Bug 1400391 fix e10s xpcshell-test for remote webextensions, r?kmag
MozReview-Commit-ID: AgdmUNWLGaq
--- a/toolkit/components/extensions/test/xpcshell/head.js
+++ b/toolkit/components/extensions/test/xpcshell/head.js
@@ -1,13 +1,13 @@
"use strict";
const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
-/* exported createHttpServer, promiseConsoleOutput, cleanupDir */
+/* exported createHttpServer, promiseConsoleOutput, cleanupDir, testEnv */
Components.utils.import("resource://gre/modules/AppConstants.jsm");
Components.utils.import("resource://gre/modules/Services.jsm");
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
Components.utils.import("resource://gre/modules/Timer.jsm");
Components.utils.import("resource://testing-common/AddonTestUtils.jsm");
XPCOMUtils.defineLazyModuleGetters(this, {
@@ -17,17 +17,27 @@ XPCOMUtils.defineLazyModuleGetters(this,
ExtensionParent: "resource://gre/modules/ExtensionParent.jsm",
ExtensionTestUtils: "resource://testing-common/ExtensionXPCShellUtils.jsm",
FileUtils: "resource://gre/modules/FileUtils.jsm",
HttpServer: "resource://testing-common/httpd.js",
NetUtil: "resource://gre/modules/NetUtil.jsm",
Schemas: "resource://gre/modules/Schemas.jsm",
});
+// These values may be changed in later head files and tested in check_remote
+// below.
Services.prefs.setBoolPref("extensions.webextensions.remote", false);
+const testEnv = {
+ expectRemote: false,
+};
+
+add_task(function check_remote() {
+ Assert.equal(WebExtensionPolicy.useRemoteWebExtensions, testEnv.expectRemote, "useRemoteWebExtensions matches");
+ Assert.equal(WebExtensionPolicy.isExtensionProcess, !testEnv.expectRemote, "testing from extension process");
+});
ExtensionTestUtils.init(this);
/**
* Creates a new HttpServer for testing, and begins listening on the
* specified port. Automatically shuts down the server when the test
* unit ends.
*
--- a/toolkit/components/extensions/test/xpcshell/head_e10s.js
+++ b/toolkit/components/extensions/test/xpcshell/head_e10s.js
@@ -1,5 +1,10 @@
"use strict";
/* globals ExtensionTestUtils */
+// We want to force enable e10s so we can test remote extensions
+Services.prefs.setBoolPref("browser.tabs.remote.force-enable", true);
+// This causes nsIXULRuntime.browserTabsRemoteAutostart to reset and force e10s
+Services.prefs.setStringPref("e10s.rollout.cohort", "xpcshell-test");
+
ExtensionTestUtils.remoteContentScripts = true;
--- a/toolkit/components/extensions/test/xpcshell/head_remote.js
+++ b/toolkit/components/extensions/test/xpcshell/head_remote.js
@@ -1,4 +1,7 @@
"use strict";
Services.prefs.setBoolPref("extensions.webextensions.remote", true);
Services.prefs.setIntPref("dom.ipc.keepProcessesAlive.extension", 1);
+
+/* globals testEnv */
+testEnv.expectRemote = true; // tested in head_test.js
--- a/toolkit/components/extensions/test/xpcshell/test_ext_proxy_auth.js
+++ b/toolkit/components/extensions/test/xpcshell/test_ext_proxy_auth.js
@@ -69,9 +69,9 @@ add_task(async function test_webRequest_
await handlingExt.startup();
await handlingExt.awaitMessage("pac-ready");
let contentPage = await ExtensionTestUtils.loadContentPage(`http://mozilla.org/`);
await handlingExt.awaitMessage("done");
await contentPage.close();
await handlingExt.unload();
-}).only();
+});