Backed out changeset a3d6ad2faa3a (bug 996652) for checktest bustage.
authorRyan VanderMeulen <ryanvm@gmail.com>
Mon, 25 May 2015 12:11:07 -0400
changeset 245491 fc99c65e595678d4ba56829f4f3e6427e1d3b9e0
parent 245490 00aff9bcfd9a5dcbe36761e124107c71358fef70
child 245492 657edac53a6683765f89ebf9f1988d2129a6c50d
push id28806
push userphilringnalda@gmail.com
push dateTue, 26 May 2015 02:10:16 +0000
treeherdermozilla-central@4362d9251296 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs996652
milestone41.0a1
backs outa3d6ad2faa3a74eed953d72f003ba2b9be99d176
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out changeset a3d6ad2faa3a (bug 996652) for checktest bustage.
testing/xpcshell/head.js
--- a/testing/xpcshell/head.js
+++ b/testing/xpcshell/head.js
@@ -5,17 +5,16 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /*
  * This file contains common code that is loaded before each test file(s).
  * See http://developer.mozilla.org/en/docs/Writing_xpcshell-based_unit_tests
  * for more information.
  */
 
-(function(exports) {
 var _quit = false;
 var _passed = true;
 var _tests_pending = 0;
 var _cleanupFunctions = [];
 var _pendingTimers = [];
 var _profileInitialized = false;
 
 // Register the testing-common resource protocol early, to have access to its
@@ -191,35 +190,35 @@ function _Timer(func, delay) {
     // Timer undershot, retry with a little overshoot to try to avoid more
     // undershoots.
     var newDelay = this._delay - elapsed;
     do_timeout(newDelay, this._func);
   }
 };
 
 function _do_main() {
-  if (exports._quit)
+  if (_quit)
     return;
 
   _testLogger.info("running event loop");
 
   var thr = Components.classes["@mozilla.org/thread-manager;1"]
                       .getService().currentThread;
 
-  while (!exports._quit)
+  while (!_quit)
     thr.processNextEvent(true);
 
   while (thr.hasPendingEvents())
     thr.processNextEvent(true);
 }
 
 function _do_quit() {
   _testLogger.info("exiting test");
   _Promise.Debugging.flushUncaughtErrors();
-  exports._quit = true;
+  _quit = true;
 }
 
 /**
  * Overrides idleService with a mock.  Idle is commonly used for maintenance
  * tasks, thus if a test uses a service that requires the idle service, it will
  * start handling them.
  * This behaviour would cause random failures and slowdown tests execution,
  * for example by running database vacuum or cleanups for each test.
@@ -489,36 +488,42 @@ function _execute_test() {
                       });
   });
 
   // _HEAD_FILES is dynamically defined by <runxpcshelltests.py>.
   _load_files(_HEAD_FILES);
   // _TEST_FILE is dynamically defined by <runxpcshelltests.py>.
   _load_files(_TEST_FILE);
 
+  // Tack Assert.jsm methods to the current scope.
+  this.Assert = Assert;
+  for (let func in Assert) {
+    this[func] = Assert[func].bind(Assert);
+  }
+
   try {
     do_test_pending("MAIN run_test");
     // Check if run_test() is defined. If defined, run it.
     // Else, call run_next_test() directly to invoke tests
     // added by add_test() and add_task().  
     if (typeof run_test === "function") {
       run_test();
     } else {
       run_next_test();
     }
     do_test_finished("MAIN run_test");
     _do_main();
   } catch (e) {
     _passed = false;
-    // do_check failures are already logged and set exports._quit to true and throw
+    // do_check failures are already logged and set _quit to true and throw
     // NS_ERROR_ABORT. If both of those are true it is likely this exception
     // has already been logged so there is no need to log it again. It's
     // possible that this will mask an NS_ERROR_ABORT that happens after a
     // do_check failure though.
-    if (!exports._quit || e != Components.results.NS_ERROR_ABORT) {
+    if (!_quit || e != Components.results.NS_ERROR_ABORT) {
       let extra = {};
       if (e.fileName) {
         extra.source_file = e.fileName;
         if (e.lineNumber) {
           extra.line_number = e.lineNumber;
         }
       } else {
         extra.source_file = "xpcshell/head.js";
@@ -642,22 +647,22 @@ function do_execute_soon(callback, aName
   var tm = Components.classes["@mozilla.org/thread-manager;1"]
                      .getService(Components.interfaces.nsIThreadManager);
 
   tm.mainThread.dispatch({
     run: function() {
       try {
         callback();
       } catch (e) {
-        // do_check failures are already logged and set exports._quit to true and throw
+        // do_check failures are already logged and set _quit to true and throw
         // NS_ERROR_ABORT. If both of those are true it is likely this exception
         // has already been logged so there is no need to log it again. It's
         // possible that this will mask an NS_ERROR_ABORT that happens after a
         // do_check failure though.
-        if (!exports._quit || e != Components.results.NS_ERROR_ABORT) {
+        if (!_quit || e != Components.results.NS_ERROR_ABORT) {
           let stack = e.stack ? _format_stack(e.stack) : null;
           _testLogger.testStatus(_TEST_NAME,
                                  funcName,
                                  'FAIL',
                                  'PASS',
                                  _exception_message(e),
                                  stack);
           _do_quit();
@@ -1488,63 +1493,8 @@ try {
   if (runningInParent) {
     let prefs = Components.classes["@mozilla.org/preferences-service;1"]
       .getService(Components.interfaces.nsIPrefBranch);
 
     prefs.deleteBranch("lightweightThemes.selectedThemeID");
     prefs.deleteBranch("browser.devedition.theme.enabled");
   }
 } catch (e) { }
-
-exports._execute_test = _execute_test;
-exports._setupDebuggerServer = _setupDebuggerServer;
-exports._quit = _quit;
-exports._testLogger = _testLogger;
-exports._wrap_with_quotes_if_necessary = _wrap_with_quotes_if_necessary;
-exports.Assert = Assert;
-exports.add_task = add_task;
-exports.add_test = add_test;
-exports.do_await_remote_message = do_await_remote_message;
-exports.do_check_eq = do_check_eq;
-exports.do_check_false = do_check_false;
-exports.do_check_instanceof = do_check_instanceof;
-exports.do_check_matches = do_check_matches;
-exports.do_check_neq = do_check_neq;
-exports.do_check_null = do_check_null;
-exports.do_check_throws_nsIException = do_check_throws_nsIException;
-exports.do_check_true = do_check_true;
-exports.do_execute_soon = do_execute_soon;
-exports.do_get_cwd = do_get_cwd;
-exports.do_get_file = do_get_file;
-exports.do_get_idle = do_get_idle;
-exports.do_get_minidumpdir = do_get_minidumpdir;
-exports.do_get_profile = do_get_profile;
-exports.do_get_tempdir = do_get_tempdir;
-exports.do_load_child_test_harness = do_load_child_test_harness;
-exports.do_load_manifest = do_load_manifest;
-exports.do_note_exception = do_note_exception;
-exports.do_parse_document = do_parse_document;
-exports.do_print = do_print;
-exports.do_register_cleanup = do_register_cleanup;
-exports.do_report_result = do_report_result;
-exports.do_report_unexpected_exception = do_report_unexpected_exception;
-exports.do_send_remote_message = do_send_remote_message;
-exports.do_test_finished = do_test_finished;
-exports.do_test_pending = do_test_pending;
-exports.do_throw = do_throw;
-exports.do_timeout = do_timeout;
-exports.legible_exception = legible_exception;
-exports.run_next_test = run_next_test;
-exports.run_test_in_child = run_test_in_child;
-exports.runningInParent = runningInParent;
-exports.todo_check_eq = todo_check_eq;
-exports.todo_check_false = todo_check_false;
-exports.todo_check_instanceof = todo_check_instanceof;
-exports.todo_check_neq = todo_check_neq;
-exports.todo_check_null = todo_check_null;
-exports.todo_check_true = todo_check_true;
-
-// Tack Assert.jsm methods to the current scope.
-exports.Assert = Assert;
-for (let func in Assert) {
-  exports[func] = Assert[func].bind(Assert);
-}
-}