Backed out changeset 96a5b2854978 (bug 527444) for android xpcshell bustage on a CLOSED TREE
authorWes Kocher <wkocher@mozilla.com>
Fri, 12 Dec 2014 12:57:14 -0800
changeset 219587 4c12f753a0049ceac0dbc8f2e72fa892e2b1e150
parent 219586 93ede5de8bd31bd3316ade72b0731fe11bd4e660
child 219588 2dcb3e8f88d33a9a4299fcdd5d715bbdd3037164
push idunknown
push userunknown
push dateunknown
bugs527444
milestone37.0a1
backs out96a5b2854978515965575601ef9df04a30ad5564
Backed out changeset 96a5b2854978 (bug 527444) for android xpcshell bustage on a CLOSED TREE
modules/libjar/zipwriter/test/unit/head_zipwriter.js
modules/libjar/zipwriter/test/unit/tail_zipwriter.js
modules/libjar/zipwriter/test/unit/xpcshell.ini
toolkit/components/contentprefs/tests/unit/head_contentPrefs.js
toolkit/components/contentprefs/tests/unit/tail_contentPrefs.js
toolkit/components/contentprefs/tests/unit/xpcshell.ini
toolkit/components/downloads/test/unit/head_download_manager.js
toolkit/components/downloads/test/unit/tail_download_manager.js
toolkit/components/downloads/test/unit/xpcshell.ini
toolkit/components/url-classifier/tests/unit/head_urlclassifier.js
toolkit/components/url-classifier/tests/unit/tail_urlclassifier.js
toolkit/components/url-classifier/tests/unit/xpcshell.ini
toolkit/devtools/apps/tests/unit/head_apps.js
toolkit/devtools/apps/tests/unit/tail_apps.js
toolkit/devtools/apps/tests/unit/xpcshell.ini
toolkit/identity/tests/unit/head_identity.js
toolkit/identity/tests/unit/tail_identity.js
toolkit/identity/tests/unit/xpcshell.ini
uriloader/exthandler/tests/unit/head_handlerService.js
uriloader/exthandler/tests/unit/tail_handlerService.js
uriloader/exthandler/tests/unit/xpcshell.ini
--- a/modules/libjar/zipwriter/test/unit/head_zipwriter.js
+++ b/modules/libjar/zipwriter/test/unit/head_zipwriter.js
@@ -39,18 +39,8 @@ var ZipReader = Components.Constructor("
 
 var tmpDir = do_get_profile();
 var tmpFile = tmpDir.clone();
 tmpFile.append("zipwriter-test.zip");
 if (tmpFile.exists())
   tmpFile.remove(true);
 
 var zipW = new ZipWriter();
-
-do_register_cleanup(function tail_zipwriter() {
-  try {
-    zipW.close();
-  } catch (e) {
-    // Just ignore a failure here and attempt to delete the file anyway.
-  }
-  if (tmpFile.exists())
-    tmpFile.remove(true);
-});
new file mode 100644
--- /dev/null
+++ b/modules/libjar/zipwriter/test/unit/tail_zipwriter.js
@@ -0,0 +1,14 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+try {
+  zipW.close();
+}
+catch (e) {
+  // Just ignore a failure here and attempt to delete the file anyway.
+}
+
+if (tmpFile.exists())
+  tmpFile.remove(true);
--- a/modules/libjar/zipwriter/test/unit/xpcshell.ini
+++ b/modules/libjar/zipwriter/test/unit/xpcshell.ini
@@ -1,10 +1,11 @@
 [DEFAULT]
 head = head_zipwriter.js
+tail = tail_zipwriter.js
 skip-if = toolkit == 'gonk'
 support-files =
   data/test_bug446708/thumbs/st14-1.tiff
   data/emptyfile.txt
   data/smallfile.txt
   data/test.png
   data/test.txt
   data/test.zip
--- a/toolkit/components/contentprefs/tests/unit/head_contentPrefs.js
+++ b/toolkit/components/contentprefs/tests/unit/head_contentPrefs.js
@@ -159,12 +159,8 @@ function inChildProcess() {
 // problems with the tests. Note that we cannot do this in a child process
 // without crashing (but we don't need it anyhow)
 if (!inChildProcess()) {
   var prefBranch = Cc["@mozilla.org/preferences-service;1"].
                    getService(Ci.nsIPrefBranch);
   prefBranch.setBoolPref("browser.preferences.content.log", true);
 }
 
-do_register_cleanup(function tail_contentPrefs() {
-  ContentPrefTest.deleteDatabase();
-  ContentPrefTest.__dirSvc = null;
-});
new file mode 100644
--- /dev/null
+++ b/toolkit/components/contentprefs/tests/unit/tail_contentPrefs.js
@@ -0,0 +1,6 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+ContentPrefTest.deleteDatabase();
+ContentPrefTest.__dirSvc = null;
--- a/toolkit/components/contentprefs/tests/unit/xpcshell.ini
+++ b/toolkit/components/contentprefs/tests/unit/xpcshell.ini
@@ -1,10 +1,11 @@
 [DEFAULT]
 head = head_contentPrefs.js
+tail = tail_contentPrefs.js
 skip-if = toolkit == 'gonk'
 
 [test_bug248970.js]
 [test_bug503971.js]
 [test_bug679784.js]
 [test_contentPrefs.js]
 [test_contentPrefsCache.js]
 [test_getPrefAsync.js]
--- a/toolkit/components/downloads/test/unit/head_download_manager.js
+++ b/toolkit/components/downloads/test/unit/head_download_manager.js
@@ -226,18 +226,8 @@ function oldDownloadManagerDisabled() {
   try {
     // This method throws an exception if the old Download Manager is disabled.
     Services.downloads.activeDownloadCount;
   } catch (ex) {
     return true;
   }
   return false;
 }
-
-do_register_cleanup(function tail_download_manager() {
-  add_task(function test_common_terminate() {
-    // Stop the HTTP server.  We must do this inside a task in "tail.js" until the
-    // xpcshell testing framework supports asynchronous termination functions.
-    let deferred = Promise.defer();
-    gHttpServer.stop(deferred.resolve);
-    yield deferred.promise;
-  });
-});
new file mode 100644
--- /dev/null
+++ b/toolkit/components/downloads/test/unit/tail_download_manager.js
@@ -0,0 +1,24 @@
+/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
+/* vim: set ts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+/**
+ * Provides infrastructure for automated download components tests.
+ */
+
+"use strict";
+
+////////////////////////////////////////////////////////////////////////////////
+//// Termination functions common to all tests
+
+add_task(function test_common_terminate()
+{
+  // Stop the HTTP server.  We must do this inside a task in "tail.js" until the
+  // xpcshell testing framework supports asynchronous termination functions.
+  let deferred = Promise.defer();
+  gHttpServer.stop(deferred.resolve);
+  yield deferred.promise;
+});
+
--- a/toolkit/components/downloads/test/unit/xpcshell.ini
+++ b/toolkit/components/downloads/test/unit/xpcshell.ini
@@ -1,10 +1,11 @@
 [DEFAULT]
 head = head_download_manager.js
+tail = tail_download_manager.js
 firefox-appdir = browser
 skip-if = toolkit == 'android' || toolkit == 'gonk'
 support-files =
   downloads_manifest.js
   test_downloads.manifest
   data/digest.chunk
   data/block_digest.chunk
   data/signed_win.exe
--- a/toolkit/components/url-classifier/tests/unit/head_urlclassifier.js
+++ b/toolkit/components/url-classifier/tests/unit/head_urlclassifier.js
@@ -362,12 +362,8 @@ LFSRgenerator.prototype = {
     val = (val >>> 1) | (bit << 31);
     this._value = val;
 
     return (val >>> (32 - bits));
   },
 };
 
 cleanUp();
-
-do_register_cleanup(function tail_ulrclassifier() {
-  cleanUp();
-});
new file mode 100644
--- /dev/null
+++ b/toolkit/components/url-classifier/tests/unit/tail_urlclassifier.js
@@ -0,0 +1,1 @@
+cleanUp();
--- a/toolkit/components/url-classifier/tests/unit/xpcshell.ini
+++ b/toolkit/components/url-classifier/tests/unit/xpcshell.ini
@@ -1,10 +1,11 @@
 [DEFAULT]
 head = head_urlclassifier.js
+tail = tail_urlclassifier.js
 skip-if = toolkit == 'android' || toolkit == 'gonk'
 support-files =
   data/digest1.chunk
   data/digest2.chunk
 
 [test_addsub.js]
 [test_backoff.js]
 [test_dbservice.js]
--- a/toolkit/devtools/apps/tests/unit/head_apps.js
+++ b/toolkit/devtools/apps/tests/unit/head_apps.js
@@ -124,16 +124,9 @@ function do_get_webappsdir() {
         return this;
       }
       throw Cr.NS_ERROR_NO_INTERFACE;
     }
   };
   Services.dirsvc.QueryInterface(Ci.nsIDirectoryService).registerProvider(provider);
 }
 
-do_register_cleanup(function tail_apps() {
-  if (gClient) {
-    // Close the test remote connection before leaving this test.
-    gClient.close(function tail_apps_close() {
-      run_next_test();
-    });
-  }
-});
+
new file mode 100644
--- /dev/null
+++ b/toolkit/devtools/apps/tests/unit/tail_apps.js
@@ -0,0 +1,6 @@
+if (gClient) {
+  // Close the test remote connection before leaving this test
+  gClient.close(function () {
+    run_next_test();
+  });
+}
--- a/toolkit/devtools/apps/tests/unit/xpcshell.ini
+++ b/toolkit/devtools/apps/tests/unit/xpcshell.ini
@@ -1,9 +1,10 @@
 [DEFAULT]
 head = head_apps.js
+tail = tail_apps.js
 skip-if = toolkit == 'android'
 support-files =
   data/app.zip
   data/app-engineering.zip
 
 [test_webappsActor.js]
 skip-if = buildapp == "b2g"
--- a/toolkit/identity/tests/unit/head_identity.js
+++ b/toolkit/identity/tests/unit/head_identity.js
@@ -248,16 +248,9 @@ Services.prefs.setBoolPref("identity.fxa
 
 // after execution, restore prefs
 do_register_cleanup(function() {
   log("restoring prefs to their initial values");
   Services.prefs.setBoolPref("toolkit.identity.debug", initialPrefDebugValue);
   Services.prefs.setBoolPref("identity.fxaccounts.enabled", initialPrefFXAValue);
 });
 
-do_register_cleanup(function tail_identity() {
-  // Pre-emptively shut down to clear resources.
-  if (typeof IdentityService !== "undefined") {
-    IdentityService.shutdown();
-  } else if (typeof IDService !== "undefined") {
-    IDService.shutdown();
-  }
-});
+
new file mode 100644
--- /dev/null
+++ b/toolkit/identity/tests/unit/tail_identity.js
@@ -0,0 +1,8 @@
+
+// pre-emptively shut down to clear resources
+if (typeof IdentityService !== "undefined") {
+  IdentityService.shutdown();
+} else if (typeof IDService !== "undefined") {
+  IDService.shutdown();
+}
+
--- a/toolkit/identity/tests/unit/xpcshell.ini
+++ b/toolkit/identity/tests/unit/xpcshell.ini
@@ -1,10 +1,11 @@
 [DEFAULT]
 head = head_identity.js
+tail = tail_identity.js
 skip-if = toolkit == 'gonk'
 support-files =
   data/idp_1/.well-known/browserid
   data/idp_invalid_1/.well-known/browserid
 
 # Test load modules first so syntax failures are caught early.
 [test_load_modules.js]
 [test_minimalidentity.js]
--- a/uriloader/exthandler/tests/unit/head_handlerService.js
+++ b/uriloader/exthandler/tests/unit/head_handlerService.js
@@ -156,12 +156,8 @@ var HandlerServiceTest = {
     message = "*** HandlerServiceTest: " + message;
     this._consoleSvc.logStringMessage(message);
     print(message);
   }
 
 };
 
 HandlerServiceTest.init();
-
-do_register_cleanup(function tail_handleService() {
-  HandlerServiceTest.destroy();
-});
new file mode 100644
--- /dev/null
+++ b/uriloader/exthandler/tests/unit/tail_handlerService.js
@@ -0,0 +1,5 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+HandlerServiceTest.destroy();
--- a/uriloader/exthandler/tests/unit/xpcshell.ini
+++ b/uriloader/exthandler/tests/unit/xpcshell.ini
@@ -1,10 +1,11 @@
 [DEFAULT]
 head = head_handlerService.js
+tail = tail_handlerService.js
 skip-if = toolkit == 'gonk'
 run-sequentially = Bug 912235 - Intermittent failures
 
 [test_getTypeFromExtension_ext_to_type_mapping.js]
 [test_getTypeFromExtension_with_empty_Content_Type.js]
 [test_handlerService.js]
 support-files = mailcap
 # Bug 676997: test consistently fails on Android