Bug 1585777 - Part 2: Fix test_url_for_process_types and its callers to be more readable, r=nika
authorAnny Gakhokidze <agakhokidze@mozilla.com>
Wed, 30 Oct 2019 21:44:17 +0000
changeset 499895 55724db5349e429c044d3493eb13bfc94c620ecf
parent 499894 8db87421134d4dfa51d81291438203495b5d75d1
child 499896 9f7f0e4c65dab04b3d6b974290669db827016a60
push id114163
push useraiakab@mozilla.com
push dateThu, 31 Oct 2019 10:03:38 +0000
treeherdermozilla-inbound@5fe1e03dbfbc [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnika
bugs1585777
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 1585777 - Part 2: Fix test_url_for_process_types and its callers to be more readable, r=nika Depends on D50370 Differential Revision: https://phabricator.services.mozilla.com/D50528
browser/base/content/test/tabs/browser_e10s_about_process.js
browser/base/content/test/tabs/browser_e10s_chrome_process.js
browser/base/content/test/tabs/browser_e10s_mozillaweb_process.js
browser/base/content/test/tabs/head.js
--- a/browser/base/content/test/tabs/browser_e10s_about_process.js
+++ b/browser/base/content/test/tabs/browser_e10s_about_process.js
@@ -96,86 +96,86 @@ registerCleanupFunction(() => {
   );
   let registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
   for (let module of TEST_MODULES) {
     registrar.unregisterFactory(Components.ID(module.id), AboutModuleFactory);
   }
 });
 
 add_task(async function test_chrome() {
-  test_url_for_process_types(
-    "about:" + CHROME.path,
-    true,
-    false,
-    false,
-    false,
-    false
-  );
+  test_url_for_process_types({
+    url: "about:" + CHROME.path,
+    chromeResult: true,
+    webContentResult: false,
+    privilegedAboutContentResult: false,
+    privilegedMozillaContentResult: false,
+    extensionProcessResult: false,
+  });
 });
 
 add_task(async function test_any() {
-  test_url_for_process_types(
-    "about:" + CANREMOTE.path,
-    true,
-    true,
-    true,
-    true,
-    true
-  );
+  test_url_for_process_types({
+    url: "about:" + CANREMOTE.path,
+    chromeResult: true,
+    webContentResult: true,
+    privilegedAboutContentResult: true,
+    privilegedMozillaContentResult: true,
+    extensionProcessResult: true,
+  });
 });
 
 add_task(async function test_remote() {
-  test_url_for_process_types(
-    "about:" + MUSTREMOTE.path,
-    false,
-    true,
-    false,
-    false,
-    false
-  );
+  test_url_for_process_types({
+    url: "about:" + MUSTREMOTE.path,
+    chromeResult: false,
+    webContentResult: true,
+    privilegedAboutContentResult: false,
+    privilegedMozillaContentResult: false,
+    extensionProcessResult: false,
+  });
 });
 
 add_task(async function test_privileged_remote_true() {
   await SpecialPowers.pushPrefEnv({
     set: [["browser.tabs.remote.separatePrivilegedContentProcess", true]],
   });
 
   // This shouldn't be taken literally. We will always use the privleged about
   // content type if the URI_CAN_LOAD_IN_PRIVILEGEDABOUT_PROCESS flag is enabled and
   // the pref is turned on.
-  test_url_for_process_types(
-    "about:" + CANPRIVILEGEDREMOTE.path,
-    false,
-    false,
-    true,
-    false,
-    false
-  );
+  test_url_for_process_types({
+    url: "about:" + CANPRIVILEGEDREMOTE.path,
+    chromeResult: false,
+    webContentResult: false,
+    privilegedAboutContentResult: true,
+    privilegedMozillaContentResult: false,
+    extensionProcessResult: false,
+  });
 });
 
 add_task(async function test_privileged_remote_false() {
   await SpecialPowers.pushPrefEnv({
     set: [["browser.tabs.remote.separatePrivilegedContentProcess", false]],
   });
 
   // This shouldn't be taken literally. We will always use the privleged about
   // content type if the URI_CAN_LOAD_IN_PRIVILEGEDABOUT_PROCESS flag is enabled and
   // the pref is turned on.
-  test_url_for_process_types(
-    "about:" + CANPRIVILEGEDREMOTE.path,
-    false,
-    true,
-    false,
-    false,
-    false
-  );
+  test_url_for_process_types({
+    url: "about:" + CANPRIVILEGEDREMOTE.path,
+    chromeResult: false,
+    webContentResult: true,
+    privilegedAboutContentResult: false,
+    privilegedMozillaContentResult: false,
+    extensionProcessResult: false,
+  });
 });
 
 add_task(async function test_extension() {
-  test_url_for_process_types(
-    "about:" + MUSTEXTENSION.path,
-    false,
-    false,
-    false,
-    false,
-    true
-  );
+  test_url_for_process_types({
+    url: "about:" + MUSTEXTENSION.path,
+    chromeResult: false,
+    webContentResult: false,
+    privilegedAboutContentResult: false,
+    privilegedMozillaContentResult: false,
+    extensionProcessResult: true,
+  });
 });
--- a/browser/base/content/test/tabs/browser_e10s_chrome_process.js
+++ b/browser/base/content/test/tabs/browser_e10s_chrome_process.js
@@ -69,25 +69,46 @@ add_task(async function init() {
   });
 });
 
 registerCleanupFunction(() => {
   gBrowser.removeCurrentTab();
 });
 
 add_task(async function test_chrome() {
-  test_url_for_process_types(CHROME, true, false, false, false, false);
+  test_url_for_process_types({
+    url: CHROME,
+    chromeResult: true,
+    webContentResult: false,
+    privilegedAboutContentResult: false,
+    privilegedMozillaContentResult: false,
+    extensionProcessResult: false,
+  });
 });
 
 add_task(async function test_any() {
-  test_url_for_process_types(CANREMOTE, true, true, false, false, false);
+  test_url_for_process_types({
+    url: CANREMOTE,
+    chromeResult: true,
+    webContentResult: true,
+    privilegedAboutContentResult: false,
+    privilegedMozillaContentResult: false,
+    extensionProcessResult: false,
+  });
 });
 
 add_task(async function test_remote() {
-  test_url_for_process_types(MUSTREMOTE, false, true, false, false, false);
+  test_url_for_process_types({
+    url: MUSTREMOTE,
+    chromeResult: false,
+    webContentResult: true,
+    privilegedAboutContentResult: false,
+    privilegedMozillaContentResult: false,
+    extensionProcessResult: false,
+  });
 });
 
 // The set of page transitions
 var TESTS = [
   ["chrome -> chrome", CHROME, false, CHROME, false],
   ["chrome -> canremote", CHROME, false, CANREMOTE, false],
   ["chrome -> mustremote", CHROME, false, MUSTREMOTE, true],
   ["remote -> chrome", MUSTREMOTE, true, CHROME, false],
--- a/browser/base/content/test/tabs/browser_e10s_mozillaweb_process.js
+++ b/browser/base/content/test/tabs/browser_e10s_mozillaweb_process.js
@@ -2,51 +2,51 @@ add_task(async function test_privileged_
   await SpecialPowers.pushPrefEnv({
     set: [
       ["browser.tabs.remote.separatePrivilegedContentProcess", true],
       ["browser.tabs.remote.separatePrivilegedMozillaWebContentProcess", true],
       ["browser.tabs.remote.separatedMozillaDomains", "example.org"],
     ],
   });
 
-  test_url_for_process_types(
-    "https://example.com",
-    false,
-    true,
-    false,
-    false,
-    false
-  );
-  test_url_for_process_types(
-    "https://example.org",
-    false,
-    false,
-    false,
-    true,
-    false
-  );
+  test_url_for_process_types({
+    url: "https://example.com",
+    chromeResult: false,
+    webContentResult: true,
+    privilegedAboutContentResult: false,
+    privilegedMozillaContentResult: false,
+    extensionProcessResult: false,
+  });
+  test_url_for_process_types({
+    url: "https://example.org",
+    chromeResult: false,
+    webContentResult: false,
+    privilegedAboutContentResult: false,
+    privilegedMozillaContentResult: true,
+    extensionProcessResult: false,
+  });
 });
 
 add_task(async function test_privileged_remote_false() {
   await SpecialPowers.pushPrefEnv({
     set: [
       ["browser.tabs.remote.separatePrivilegedContentProcess", true],
       ["browser.tabs.remote.separatePrivilegedMozillaWebContentProcess", false],
     ],
   });
 
-  test_url_for_process_types(
-    "https://example.com",
-    false,
-    true,
-    false,
-    false,
-    false
-  );
-  test_url_for_process_types(
-    "https://example.org",
-    false,
-    true,
-    false,
-    false,
-    false
-  );
+  test_url_for_process_types({
+    url: "https://example.com",
+    chromeResult: false,
+    webContentResult: true,
+    privilegedAboutContentResult: false,
+    privilegedMozillaContentResult: false,
+    extensionProcessResult: false,
+  });
+  test_url_for_process_types({
+    url: "https://example.org",
+    chromeResult: false,
+    webContentResult: true,
+    privilegedAboutContentResult: false,
+    privilegedMozillaContentResult: false,
+    extensionProcessResult: false,
+  });
 });
--- a/browser/base/content/test/tabs/head.js
+++ b/browser/base/content/test/tabs/head.js
@@ -288,24 +288,24 @@ function checkBrowserRemoteType(
     is(
       browser.messageManager.remoteType,
       expectedRemoteType,
       "Parent and child process should agree on the remote type."
     );
   }
 }
 
-function test_url_for_process_types(
+function test_url_for_process_types({
   url,
   chromeResult,
   webContentResult,
   privilegedAboutContentResult,
   privilegedMozillaContentResult,
-  extensionProcessResult
-) {
+  extensionProcessResult,
+}) {
   const CHROME_PROCESS = E10SUtils.NOT_REMOTE;
   const WEB_CONTENT_PROCESS = E10SUtils.WEB_REMOTE_TYPE;
   const PRIVILEGEDABOUT_CONTENT_PROCESS = E10SUtils.PRIVILEGEDABOUT_REMOTE_TYPE;
   const PRIVILEGEDMOZILLA_CONTENT_PROCESS =
     E10SUtils.PRIVILEGEDMOZILLA_REMOTE_TYPE;
   const EXTENSION_PROCESS = E10SUtils.EXTENSION_REMOTE_TYPE;
 
   is(