Bug 1318604: Don't add task for OOP preference initialization. r?aswan draft
authorKris Maglione <maglione.k@gmail.com>
Fri, 18 Nov 2016 09:27:06 -0800
changeset 441279 cfa7dad8dcaee65bb07447b80c87c94a470b520a
parent 441278 5ff6465aee720453bff02829ff5e73360e5d0c70
child 537522 e44303d2470e70bfaa7284adee9b109883bdbf6c
push id36387
push usermaglione.k@gmail.com
push dateFri, 18 Nov 2016 17:27:35 +0000
reviewersaswan
bugs1318604
milestone53.0a1
Bug 1318604: Don't add task for OOP preference initialization. r?aswan Adding mochitest tasks from head scripts turns out to cause unpredictable timing issues, where the initial add_task() call sometimes causes tests to begin running before the main test script has loaded, and had a chance to add its tasks. While I'd still prefer to do this initialization in a task, it's not worth the intermittent failures it causes. MozReview-Commit-ID: 3CDL82NyrzC
browser/components/extensions/test/browser/head.js
toolkit/components/extensions/test/mochitest/head.js
--- a/browser/components/extensions/test/browser/head.js
+++ b/browser/components/extensions/test/browser/head.js
@@ -18,22 +18,20 @@
 var {AppConstants} = Cu.import("resource://gre/modules/AppConstants.jsm");
 var {CustomizableUI} = Cu.import("resource:///modules/CustomizableUI.jsm");
 
 // We run tests under two different configurations, from browser.ini and
 // browser-remote.ini. When running from browser-remote.ini, the tests are
 // copied to the sub-directory "test-oop-extensions", which we detect here, and
 // use to select our configuration.
 if (gTestPath.includes("test-oop-extensions")) {
-  add_task(() => {
-    return SpecialPowers.pushPrefEnv({set: [
-      ["dom.ipc.processCount", 1],
-      ["extensions.webextensions.remote", true],
-    ]});
-  });
+  SpecialPowers.pushPrefEnv({set: [
+    ["dom.ipc.processCount", 1],
+    ["extensions.webextensions.remote", true],
+  ]});
 }
 
 // Bug 1239884: Our tests occasionally hit a long GC pause at unpredictable
 // times in debug builds, which results in intermittent timeouts. Until we have
 // a better solution, we force a GC after certain strategic tests, which tend to
 // accumulate a high number of unreaped windows.
 function forceGC() {
   if (AppConstants.DEBUG) {
--- a/toolkit/components/extensions/test/mochitest/head.js
+++ b/toolkit/components/extensions/test/mochitest/head.js
@@ -1,21 +1,19 @@
 "use strict";
 
 // We run tests under two different configurations, from mochitest.ini and
 // mochitest-remote.ini. When running from mochitest-remote.ini, the tests are
 // copied to the sub-directory "test-oop-extensions", which we detect here, and
 // use to select our configuration.
 if (location.pathname.includes("test-oop-extensions")) {
-  add_task(() => {
-    return SpecialPowers.pushPrefEnv({set: [
-      ["dom.ipc.processCount", 1],
-      ["extensions.webextensions.remote", true],
-    ]});
-  });
+  SpecialPowers.pushPrefEnv({set: [
+    ["dom.ipc.processCount", 1],
+    ["extensions.webextensions.remote", true],
+  ]});
 }
 
 /* exported waitForLoad */
 
 function waitForLoad(win) {
   return new Promise(resolve => {
     win.addEventListener("load", function listener() {
       win.removeEventListener("load", listener, true);