Bug 503662 - Stop using tail_ files in xpcshell: use do_register_cleanup() instead. r=aceman
authorMark Banner <standard8@mozilla.com>
Sat, 14 Jan 2017 09:34:35 +0000
changeset 27321 0b4789cf7743bd1e3319eca637b649f9f9491fc9
parent 27320 1e9544045f0986802a8701bf0a6ae8effd5cf1dd
child 27322 6422b8ba5878180fe451303d89e6661897833fc7
push id1878
push userclokep@gmail.com
push dateTue, 07 Mar 2017 14:18:40 +0000
treeherdercomm-beta@ab59ffd05575 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaceman
bugs503662
Bug 503662 - Stop using tail_ files in xpcshell: use do_register_cleanup() instead. r=aceman
mail/base/test/unit/head_mailbase.js
mail/base/test/unit/tail_base.js
mail/base/test/unit/xpcshell.ini
mail/base/test/unit/xpcshell_maildir.ini
mail/components/test/unit/head_mailcomponents.js
mail/components/test/unit/tail_mailcomponents.js
mail/components/test/unit/xpcshell.ini
mailnews/addrbook/test/unit/head_addrbook.js
mailnews/addrbook/test/unit/tail_addrbook.js
mailnews/addrbook/test/unit/xpcshell.ini
mailnews/base/test/unit/head_mailbase.js
mailnews/base/test/unit/tail_base.js
mailnews/base/test/unit/xpcshell.ini
mailnews/compose/test/unit/head_compose.js
mailnews/compose/test/unit/tail_compose.js
mailnews/compose/test/unit/xpcshell.ini
mailnews/db/gloda/test/unit/head_gloda.js
mailnews/db/gloda/test/unit/tail_gloda.js
mailnews/db/gloda/test/unit/xpcshell.ini
mailnews/db/msgdb/test/unit/head_maildb.js
mailnews/db/msgdb/test/unit/tail_msgdb.js
mailnews/db/msgdb/test/unit/xpcshell.ini
mailnews/extensions/bayesian-spam-filter/test/unit/head_bayes.js
mailnews/extensions/bayesian-spam-filter/test/unit/tail_bayesian.js
mailnews/extensions/bayesian-spam-filter/test/unit/xpcshell.ini
mailnews/extensions/mdn/test/unit/head_mdn.js
mailnews/extensions/mdn/test/unit/tail_mdn.js
mailnews/extensions/mdn/test/unit/xpcshell.ini
mailnews/imap/test/unit/head_server.js
mailnews/imap/test/unit/tail_imap.js
mailnews/imap/test/unit/xpcshell.ini
mailnews/imap/test/unit/xpcshell_maildir.ini
mailnews/import/test/unit/head_import.js
mailnews/import/test/unit/tail_import.js
mailnews/import/test/unit/xpcshell.ini
mailnews/jsaccount/test/unit/head_jsaccount.js
mailnews/jsaccount/test/unit/tail_jsaccount.js
mailnews/jsaccount/test/unit/xpcshell.ini
mailnews/local/test/unit/head_maillocal.js
mailnews/local/test/unit/tail_local.js
mailnews/local/test/unit/xpcshell.ini
mailnews/mime/test/unit/head_mime.js
mailnews/mime/test/unit/tail_mime.js
mailnews/mime/test/unit/xpcshell.ini
mailnews/news/test/unit/head_server_setup.js
mailnews/news/test/unit/tail_news.js
mailnews/news/test/unit/xpcshell.ini
--- a/mail/base/test/unit/head_mailbase.js
+++ b/mail/base/test/unit/head_mailbase.js
@@ -7,8 +7,12 @@ var Cc = Components.classes;
 var Ci = Components.interfaces;
 var Cr = Components.results;
 var CC = Components.Constructor;
 
 // Ensure the profile directory is set up
 do_get_profile();
 
 var gDEPTH = "../../../../";
+
+do_register_cleanup(function() {
+  load(gDEPTH + "mailnews/resources/mailShutdown.js");
+});
deleted file mode 100644
--- a/mail/base/test/unit/tail_base.js
+++ /dev/null
@@ -1,1 +0,0 @@
-load("../../../../mailnews/resources/mailShutdown.js");
--- a/mail/base/test/unit/xpcshell.ini
+++ b/mail/base/test/unit/xpcshell.ini
@@ -1,11 +1,11 @@
 [DEFAULT]
 head = head_mailbase.js
-tail = tail_base.js
+tail =
 support-files = distribution.ini resources/*
 
 [test_alertHook.js]
 [test_attachmentChecker.js]
 [test_emptyTrash_dbViewWrapper.js]
 run-sequentially = Avoid bustage.
 [test_viewWrapper_imapFolder.js]
 run-sequentially = Avoid bustage.
--- a/mail/base/test/unit/xpcshell_maildir.ini
+++ b/mail/base/test/unit/xpcshell_maildir.ini
@@ -1,6 +1,6 @@
 [DEFAULT]
 head = head_mailbase_maildir.js
-tail = tail_base.js
+tail =
 support-files = distribution.ini resources/*
 
 [test_viewWrapper_virtualFolder.js]
--- a/mail/components/test/unit/head_mailcomponents.js
+++ b/mail/components/test/unit/head_mailcomponents.js
@@ -7,8 +7,12 @@ var Cc = Components.classes;
 var Ci = Components.interfaces;
 var Cr = Components.results;
 var CC = Components.Constructor;
 
 // Ensure the profile directory is set up
 do_get_profile();
 
 var gDEPTH = "../../../../";
+
+do_register_cleanup(function() {
+  load(gDEPTH + "mailnews/resources/mailShutdown.js");
+});
deleted file mode 100644
--- a/mail/components/test/unit/tail_mailcomponents.js
+++ /dev/null
@@ -1,1 +0,0 @@
-load("../../../../mailnews/resources/mailShutdown.js");
--- a/mail/components/test/unit/xpcshell.ini
+++ b/mail/components/test/unit/xpcshell.ini
@@ -1,5 +1,5 @@
 [DEFAULT]
 head = head_mailcomponents.js
-tail = tail_mailcomponents.js
+tail =
 
 [test_about_support.js]
--- a/mailnews/addrbook/test/unit/head_addrbook.js
+++ b/mailnews/addrbook/test/unit/head_addrbook.js
@@ -7,8 +7,12 @@ var Ci = Components.interfaces;
 var Cr = Components.results;
 var CC = Components.Constructor;
 
 // Ensure the profile directory is set up
 do_get_profile();
 
 // Import the required setup scripts.
 load("../../../resources/abSetup.js");
+
+do_register_cleanup(function() {
+  load("../../../resources/mailShutdown.js");
+});
deleted file mode 100644
--- a/mailnews/addrbook/test/unit/tail_addrbook.js
+++ /dev/null
@@ -1,1 +0,0 @@
-load("../../../resources/mailShutdown.js");
--- a/mailnews/addrbook/test/unit/xpcshell.ini
+++ b/mailnews/addrbook/test/unit/xpcshell.ini
@@ -1,11 +1,11 @@
 [DEFAULT]
 head = head_addrbook.js
-tail = tail_addrbook.js
+tail =
 support-files = data/*
 
 [test_basic_nsIAbCard.js]
 [test_basic_nsIAbDirectory.js]
 [test_bug387403.js]
 [test_bug534822.js]
 [test_bug_448165.js]
 [test_cardForEmail.js]
--- a/mailnews/base/test/unit/head_mailbase.js
+++ b/mailnews/base/test/unit/head_mailbase.js
@@ -8,8 +8,12 @@ var Cc = Components.classes;
 var Ci = Components.interfaces;
 var Cr = Components.results;
 var CC = Components.Constructor;
 
 // Ensure the profile directory is set up
 do_get_profile();
 
 var gDEPTH = "../../../../";
+
+do_register_cleanup(function() {
+  load(gDEPTH + "mailnews/resources/mailShutdown.js");
+});
deleted file mode 100644
--- a/mailnews/base/test/unit/tail_base.js
+++ /dev/null
@@ -1,1 +0,0 @@
-load("../../../resources/mailShutdown.js");
--- a/mailnews/base/test/unit/xpcshell.ini
+++ b/mailnews/base/test/unit/xpcshell.ini
@@ -1,11 +1,11 @@
 [DEFAULT]
 head = head_mailbase.js
-tail = tail_base.js
+tail =
 support-files = nodelist_test.xml data/*
 
 [test_accountMgr.js]
 [test_accountMgrCustomTypes.js]
 [test_accountMigration.js]
 [test_acctRepair.js]
 [test_autoconfigFetchDisk.js]
 [test_autoconfigUtils.js]
--- a/mailnews/compose/test/unit/head_compose.js
+++ b/mailnews/compose/test/unit/head_compose.js
@@ -207,8 +207,11 @@ function getAttachmentFromContent(aConte
                          "([\\s\\S]*?)\\r\\n" +
                          "--" + boundary + "--", "m");
   let attachments = aContent.match(regex);
   do_check_neq(attachments, null);
   do_check_eq(attachments.length, 2);
   return attachments[1];
 }
 
+do_register_cleanup(function() {
+  load(gDEPTH + "mailnews/resources/mailShutdown.js");
+});
deleted file mode 100644
--- a/mailnews/compose/test/unit/tail_compose.js
+++ /dev/null
@@ -1,1 +0,0 @@
-load("../../../resources/mailShutdown.js");
--- a/mailnews/compose/test/unit/xpcshell.ini
+++ b/mailnews/compose/test/unit/xpcshell.ini
@@ -1,11 +1,11 @@
 [DEFAULT]
 head = head_compose.js
-tail = tail_compose.js
+tail =
 support-files = data/*
 
 [test_attachment.js]
 [test_attachment_intl.js]
 [test_autoReply.js]
 skip-if = os == 'mac'
 [test_bug155172.js]
 [test_bug235432.js]
--- a/mailnews/db/gloda/test/unit/head_gloda.js
+++ b/mailnews/db/gloda/test/unit/head_gloda.js
@@ -9,8 +9,12 @@ var Cr = Components.results;
 var CC = Components.Constructor;
 
 // Ensure the profile directory is set up
 do_get_profile();
 
 var gDEPTH = "../../../../../";
 
 // glodaTestHelper.js does all the rest of the imports
+
+do_register_cleanup(function() {
+  load(gDEPTH + "mailnews/resources/mailShutdown.js");
+});
deleted file mode 100644
--- a/mailnews/db/gloda/test/unit/tail_gloda.js
+++ /dev/null
@@ -1,1 +0,0 @@
-load("../../../../resources/mailShutdown.js");
--- a/mailnews/db/gloda/test/unit/xpcshell.ini
+++ b/mailnews/db/gloda/test/unit/xpcshell.ini
@@ -1,11 +1,11 @@
 [DEFAULT]
 head = head_gloda.js
-tail = tail_gloda.js
+tail =
 support-files = base_*.js resources/*
 
 [test_cleanup_msf_databases.js]
 [test_corrupt_database.js]
 [test_folder_logic.js]
 [test_fts3_tokenizer.js]
 [test_gloda_content_imap_offline.js]
 [test_gloda_content_local.js]
--- a/mailnews/db/msgdb/test/unit/head_maildb.js
+++ b/mailnews/db/msgdb/test/unit/head_maildb.js
@@ -6,8 +6,12 @@ Components.utils.import("resource://test
 
 var Cc = Components.classes;
 var Ci = Components.interfaces;
 var Cr = Components.results;
 var CC = Components.Constructor;
 
 // Ensure the profile directory is set up
 do_get_profile();
+
+do_register_cleanup(function() {
+  load("../../../../../mailnews/resources/mailShutdown.js");
+});
deleted file mode 100644
--- a/mailnews/db/msgdb/test/unit/tail_msgdb.js
+++ /dev/null
@@ -1,1 +0,0 @@
-load("../../../../resources/mailShutdown.js");
--- a/mailnews/db/msgdb/test/unit/xpcshell.ini
+++ b/mailnews/db/msgdb/test/unit/xpcshell.ini
@@ -1,9 +1,9 @@
 [DEFAULT]
 head = head_maildb.js
-tail = tail_msgdb.js
+tail =
 
 [test_enumerator_cleanup.js]
 [test_filter_enumerator.js]
 [test_maildb.js]
 [test_propertyEnumerator.js]
 [test_references_parsing.js]
--- a/mailnews/extensions/bayesian-spam-filter/test/unit/head_bayes.js
+++ b/mailnews/extensions/bayesian-spam-filter/test/unit/head_bayes.js
@@ -16,8 +16,12 @@ Components.utils.import("resource://gre/
 
 function getSpec(aFileName)
 {
   var file = do_get_file("resources/" + aFileName);
   var uri = Services.io.newFileURI(file).QueryInterface(Ci.nsIURL);
   uri.query = "type=application/x-message-display";
   return uri.spec;
 }
+
+do_register_cleanup(function() {
+  load("../../../../resources/mailShutdown.js");
+});
deleted file mode 100644
--- a/mailnews/extensions/bayesian-spam-filter/test/unit/tail_bayesian.js
+++ /dev/null
@@ -1,1 +0,0 @@
-load("../../../../resources/mailShutdown.js");
--- a/mailnews/extensions/bayesian-spam-filter/test/unit/xpcshell.ini
+++ b/mailnews/extensions/bayesian-spam-filter/test/unit/xpcshell.ini
@@ -1,11 +1,11 @@
 [DEFAULT]
 head = head_bayes.js
-tail = tail_bayesian.js
+tail =
 support-files = resources/*
 
 [test_bug228675.js]
 [test_customTokenization.js]
 [test_junkAsTraits.js]
 [test_msgCorpus.js]
 [test_traitAliases.js]
 [test_traits.js]
--- a/mailnews/extensions/mdn/test/unit/head_mdn.js
+++ b/mailnews/extensions/mdn/test/unit/head_mdn.js
@@ -5,8 +5,13 @@ Components.utils.import("resource://test
 
 var Cc = Components.classes;
 var Ci = Components.interfaces;
 var Cr = Components.results;
 var CC = Components.Constructor;
 
 // Ensure the profile directory is set up
 do_get_profile();
+
+
+do_register_cleanup(function() {
+  load("../../../../../mailnews/resources/mailShutdown.js");
+});
deleted file mode 100644
--- a/mailnews/extensions/mdn/test/unit/tail_mdn.js
+++ /dev/null
@@ -1,1 +0,0 @@
-load("../../../../resources/mailShutdown.js");
--- a/mailnews/extensions/mdn/test/unit/xpcshell.ini
+++ b/mailnews/extensions/mdn/test/unit/xpcshell.ini
@@ -1,6 +1,6 @@
 [DEFAULT]
 head = head_mdn.js
-tail = tail_mdn.js
+tail =
 
 [test_askuser.js]
 [test_mdnFlags.js]
--- a/mailnews/imap/test/unit/head_server.js
+++ b/mailnews/imap/test/unit/head_server.js
@@ -103,8 +103,11 @@ function addImapMessage()
   let messageGenerator = new MessageGenerator();
   messages = messages.concat(messageGenerator.makeMessage());
   let dataUri = Services.io.newURI("data:text/plain;base64," +
                   btoa(messages[0].toMessageString()));
   let imapMsg = new imapMessage(dataUri.spec, IMAPPump.mailbox.uidnext++, []);
   IMAPPump.mailbox.addMessage(imapMsg);
 }
 
+do_register_cleanup(function() {
+  load(gDEPTH + "mailnews/resources/mailShutdown.js");
+});
deleted file mode 100644
--- a/mailnews/imap/test/unit/tail_imap.js
+++ /dev/null
@@ -1,1 +0,0 @@
-load("../../../resources/mailShutdown.js");
--- a/mailnews/imap/test/unit/xpcshell.ini
+++ b/mailnews/imap/test/unit/xpcshell.ini
@@ -1,11 +1,11 @@
 [DEFAULT]
 head = head_server.js
-tail = tail_imap.js
+tail =
 
 [test_autosync_date_constraints.js]
 [test_bccProperty.js]
 [test_bug460636.js]
 [test_chunkLastLF.js]
 [test_compactOfflineStore.js]
 [test_copyThenMove.js]
 [test_customCommandReturnsFetchResponse.js]
--- a/mailnews/imap/test/unit/xpcshell_maildir.ini
+++ b/mailnews/imap/test/unit/xpcshell_maildir.ini
@@ -1,11 +1,11 @@
 [DEFAULT]
 head = head_imap_maildir.js
-tail = tail_imap.js
+tail =
 
 [test_autosync_date_constraints.js]
 [test_bccProperty.js]
 [test_bug460636.js]
 [test_compactOfflineStore.js]
 # Disabled until bug 870864 is resolved
 skip-if = true
 [test_copyThenMove.js]
--- a/mailnews/import/test/unit/head_import.js
+++ b/mailnews/import/test/unit/head_import.js
@@ -10,8 +10,12 @@ var CC = Components.Constructor;
 // Ensure the profile directory is set up
 do_get_profile();
 
 // Import the required setup scripts.
 load("../../../resources/abSetup.js");
 
 // Import the script with basic import functions
 load("resources/import_helper.js");
+
+do_register_cleanup(function() {
+  load("../../../resources/mailShutdown.js");
+});
deleted file mode 100644
--- a/mailnews/import/test/unit/tail_import.js
+++ /dev/null
@@ -1,1 +0,0 @@
-load("../../../resources/mailShutdown.js");
--- a/mailnews/import/test/unit/xpcshell.ini
+++ b/mailnews/import/test/unit/xpcshell.ini
@@ -1,11 +1,11 @@
 [DEFAULT]
 head = head_import.js
-tail = tail_import.js
+tail =
 support-files = resources/*
 
 [test_bug_263304.js]
 [test_bug_437556.js]
 [test_csv_GetSample.js]
 [test_becky_addressbook.js]
 run-if = os == 'win'
 [test_becky_filters.js]
--- a/mailnews/jsaccount/test/unit/head_jsaccount.js
+++ b/mailnews/jsaccount/test/unit/head_jsaccount.js
@@ -14,8 +14,12 @@ Cu.import("resource:///modules/mailServi
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 Cu.import("resource://testing-common/mailnews/mailTestUtils.js");
 Cu.import("resource://testing-common/mailnews/localAccountUtils.js");
 
 // Load the test components.
 do_load_manifest("resources/testComponents.manifest")
 // Ensure the profile directory is set up.
 do_get_profile();
+
+do_register_cleanup(function() {
+  load("../../../../mailnews/resources/mailShutdown.js");
+});
deleted file mode 100644
--- a/mailnews/jsaccount/test/unit/tail_jsaccount.js
+++ /dev/null
@@ -1,6 +0,0 @@
-/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
-/* vim: set ts=2 et sw=2 tw=80 filetype=javascript: */
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-load("../../../resources/mailShutdown.js");
--- a/mailnews/jsaccount/test/unit/xpcshell.ini
+++ b/mailnews/jsaccount/test/unit/xpcshell.ini
@@ -1,10 +1,10 @@
 # Any copyright is dedicated to the Public Domain.
 # http://creativecommons.org/publicdomain/zero/1.0/
 
 [DEFAULT]
 head = head_jsaccount.js
-tail = tail_jsaccount.js
+tail =
 support-files = resources/*
 [test_componentsExist.js]
 [test_fooUrl.js]
 [test_jaMsgFolder.js]
--- a/mailnews/local/test/unit/head_maillocal.js
+++ b/mailnews/local/test/unit/head_maillocal.js
@@ -162,8 +162,11 @@ function setup_mailbox(type, mailboxPath
                .generateUUID().toString();
   let incomingServer =
     MailServices.accounts.createIncomingServer(user, "Local Folder", type);
   incomingServer.localPath = mailboxPath;
 
   return incomingServer.rootFolder;
 }
 
+do_register_cleanup(function() {
+  load(gDEPTH + "mailnews/resources/mailShutdown.js");
+});
deleted file mode 100644
--- a/mailnews/local/test/unit/tail_local.js
+++ /dev/null
@@ -1,1 +0,0 @@
-load("../../../resources/mailShutdown.js");
--- a/mailnews/local/test/unit/xpcshell.ini
+++ b/mailnews/local/test/unit/xpcshell.ini
@@ -1,11 +1,11 @@
 [DEFAULT]
 head = head_maillocal.js
-tail = tail_local.js
+tail =
 support-files = data/*
 
 [test_bug457168.js]
 [test_duplicateKey.js]
 [test_fileName.js]
 [test_folderLoaded.js]
 [test_localFolder.js]
 [test_mailboxContentLength.js]
--- a/mailnews/mime/test/unit/head_mime.js
+++ b/mailnews/mime/test/unit/head_mime.js
@@ -7,8 +7,12 @@ var Cc = Components.classes;
 var Ci = Components.interfaces;
 var Cr = Components.results;
 var CC = Components.Constructor;
 
 // Ensure the profile directory is set up
 do_get_profile();
 
 var gDEPTH = "../../../../";
+
+do_register_cleanup(function() {
+  load(gDEPTH + "mailnews/resources/mailShutdown.js");
+});
deleted file mode 100644
--- a/mailnews/mime/test/unit/tail_mime.js
+++ /dev/null
@@ -1,1 +0,0 @@
-load("../../../resources/mailShutdown.js");
--- a/mailnews/mime/test/unit/xpcshell.ini
+++ b/mailnews/mime/test/unit/xpcshell.ini
@@ -1,11 +1,11 @@
 [DEFAULT]
 head = head_mime.js
-tail = tail_mime.js
+tail =
 support-files = custom_header.js
 
 [test_EncodeMimePartIIStr_UTF8.js]
 [test_alternate_p7m_handling.js]
 [test_attachment_size.js]
 [test_badContentType.js]
 [test_bug493544.js]
 [test_hidden_attachments.js]
--- a/mailnews/news/test/unit/head_server_setup.js
+++ b/mailnews/news/test/unit/head_server_setup.js
@@ -244,8 +244,13 @@ var articleTextListener = {
     let scriptStream = Cc["@mozilla.org/scriptableinputstream;1"]
                          .createInstance(Ci.nsIScriptableInputStream);
 
     scriptStream.init(aInputStream);
 
     this.data += scriptStream.read(aCount);
   }
 };
+
+do_register_cleanup(function() {
+  load("../../../resources/mailShutdown.js");
+});
+
deleted file mode 100644
--- a/mailnews/news/test/unit/tail_news.js
+++ /dev/null
@@ -1,5 +0,0 @@
-load("../../../resources/mailShutdown.js");
-
-if (_server)
-  _server.QueryInterface(Components.interfaces.nsISubscribableServer)
-         .subscribeCleanup();
--- a/mailnews/news/test/unit/xpcshell.ini
+++ b/mailnews/news/test/unit/xpcshell.ini
@@ -1,11 +1,11 @@
 [DEFAULT]
 head = head_server_setup.js
-tail = tail_news.js
+tail =
 support-files = postings/*
 
 [test_biff.js]
 [test_bug37465.js]
 [test_bug403242.js]
 [test_bug540288.js]
 [test_bug695309.js]
 run-sequentially = Restarts server twice--may work but dangerous