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
--- 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);