Bug 1593439 - always use document channel to test coop for beta simulation, r=valentin
authorJunior Hsu <juhsu@mozilla.com>
Sat, 09 Nov 2019 10:52:44 +0000
changeset 501416 453108aa1e96fe97b264ba921740aec0a7ef4884
parent 501415 a1901e1e614fc9773275cbc683cb77ea53ea1c7a
child 501417 32ee3bf157f4e0fa2fdce214b54c257c5c4a8dab
push id36791
push usercsabou@mozilla.com
push dateSun, 10 Nov 2019 09:53:30 +0000
treeherdermozilla-central@72c52c0101cf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvalentin
bugs1593439
milestone72.0a1
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
Bug 1593439 - always use document channel to test coop for beta simulation, r=valentin Differential Revision: https://phabricator.services.mozilla.com/D52388
toolkit/components/remotebrowserutils/tests/browser/browser_httpCrossOriginOpenerPolicy.js
--- a/toolkit/components/remotebrowserutils/tests/browser/browser_httpCrossOriginOpenerPolicy.js
+++ b/toolkit/components/remotebrowserutils/tests/browser/browser_httpCrossOriginOpenerPolicy.js
@@ -1,16 +1,29 @@
 /* eslint-disable mozilla/no-arbitrary-setTimeout */
 "use strict";
 
 const { E10SUtils } = ChromeUtils.import(
   "resource://gre/modules/E10SUtils.jsm"
 );
 
-const PREF_NAME = "browser.tabs.remote.useCrossOriginOpenerPolicy";
+const COOP_PREF = "browser.tabs.remote.useCrossOriginOpenerPolicy";
+const DOCUMENT_CHANNEL_PREF = "browser.tabs.documentchannel";
+
+async function setPref() {
+  await SpecialPowers.pushPrefEnv({
+    set: [[COOP_PREF, true], [DOCUMENT_CHANNEL_PREF, true]],
+  });
+}
+
+async function unsetPref() {
+  await SpecialPowers.pushPrefEnv({
+    set: [[COOP_PREF, false], [DOCUMENT_CHANNEL_PREF, false]],
+  });
+}
 
 function httpURL(filename, host = "https://example.com") {
   let root = getRootDirectory(gTestPath).replace(
     "chrome://mochitests/content",
     host
   );
   return root + filename;
 }
@@ -173,17 +186,17 @@ async function test_download_from(initCo
 
     await BrowserTestUtils.closeWindow(win);
   });
 }
 
 // Check that multiple navigations of the same tab will only switch processes
 // when it's expected.
 add_task(async function test_multiple_nav_process_switches() {
-  await SpecialPowers.pushPrefEnv({ set: [[PREF_NAME, true]] });
+  await setPref();
   await BrowserTestUtils.withNewTab(
     {
       gBrowser,
       url: httpURL("coop_header.sjs", "https://example.org"),
       waitForStateStop: true,
     },
     async function(browser) {
       await new Promise(resolve => setTimeout(resolve, 20));
@@ -286,17 +299,17 @@ add_task(async function test_multiple_na
 
       Assert.equal(prevPID, currentPID);
       prevPID = currentPID;
     }
   );
 });
 
 add_task(async function test_disabled() {
-  await SpecialPowers.pushPrefEnv({ set: [[PREF_NAME, false]] });
+  await unsetPref();
   await test_coop(
     httpURL("coop_header.sjs", "https://example.com"),
     httpURL("coop_header.sjs", "https://example.com"),
     false
   );
   await test_coop(
     httpURL("coop_header.sjs?coop=same-origin", "http://example.com"),
     httpURL("coop_header.sjs", "http://example.com"),
@@ -310,17 +323,17 @@ add_task(async function test_disabled() 
   await test_coop(
     httpURL("coop_header.sjs?coop=same-origin", "http://example.com"),
     httpURL("coop_header.sjs?coop=same-site", "http://example.com"),
     false
   ); // assuming we don't have fission yet :)
 });
 
 add_task(async function test_enabled() {
-  await SpecialPowers.pushPrefEnv({ set: [[PREF_NAME, true]] });
+  await setPref();
 
   function checkIsCoopRemoteType(remoteType) {
     Assert.ok(
       remoteType.startsWith(E10SUtils.WEB_REMOTE_COOP_COEP_TYPE_PREFIX),
       `${remoteType} expected to be coop`
     );
   }
 
@@ -412,17 +425,17 @@ add_task(async function test_enabled() {
     true,
     checkIsCoopRemoteType,
     checkIsCoopRemoteType
   );
 });
 
 add_task(async function test_download() {
   requestLongerTimeout(4);
-  await SpecialPowers.pushPrefEnv({ set: [[PREF_NAME, true]] });
+  await setPref();
 
   let initCoopArray = ["", "same-site", "same-origin"];
 
   let downloadCoopArray = [
     "no-coop",
     "same-site",
     "same-origin",
     "same-site%20unsafe-allow-outgoing",