diff --git a/browser/base/content/test/general/browser_e10s_about_process.js b/browser/base/content/test/general/browser_e10s_about_process.js index 3983d3c4be13..ff6b969fa69b 100644 --- a/browser/base/content/test/general/browser_e10s_about_process.js +++ b/browser/base/content/test/general/browser_e10s_about_process.js @@ -1,6 +1,7 @@ const CHROME_PROCESS = E10SUtils.NOT_REMOTE; const WEB_CONTENT_PROCESS = E10SUtils.WEB_REMOTE_TYPE; const PRIVILEGED_CONTENT_PROCESS = E10SUtils.PRIVILEGED_REMOTE_TYPE; +const EXTENSION_PROCESS = E10SUtils.EXTENSION_REMOTE_TYPE; const CHROME = { id: "cb34538a-d9da-40f3-b61a-069f0b2cb9fb", @@ -23,12 +24,19 @@ const CANPRIVILEGEDREMOTE = { flags: Ci.nsIAboutModule.URI_MUST_LOAD_IN_CHILD | Ci.nsIAboutModule.URI_CAN_LOAD_IN_PRIVILEGED_CHILD, }; +const MUSTEXTENSION = { + id: "f7a1798f-965b-49e9-be83-ec6ee4d7d675", + path: "test-mustextension", + flags: Ci.nsIAboutModule.URI_MUST_LOAD_IN_EXTENSION_PROCESS, +}; + const TEST_MODULES = [ CHROME, CANREMOTE, MUSTREMOTE, CANPRIVILEGEDREMOTE, + MUSTEXTENSION, ]; function AboutModule() { @@ -87,13 +95,15 @@ registerCleanupFunction(() => { } }); -function test_url(url, chromeResult, webContentResult, privilegedContentResult) { +function test_url(url, chromeResult, webContentResult, privilegedContentResult, extensionProcessResult) { is(E10SUtils.canLoadURIInRemoteType(url, CHROME_PROCESS), chromeResult, "Check URL in chrome process."); is(E10SUtils.canLoadURIInRemoteType(url, WEB_CONTENT_PROCESS), webContentResult, "Check URL in web content process."); is(E10SUtils.canLoadURIInRemoteType(url, PRIVILEGED_CONTENT_PROCESS), privilegedContentResult, "Check URL in privileged content process."); + is(E10SUtils.canLoadURIInRemoteType(url, EXTENSION_PROCESS), + extensionProcessResult, "Check URL in extension process."); is(E10SUtils.canLoadURIInRemoteType(url + "#foo", CHROME_PROCESS), chromeResult, "Check URL with ref in chrome process."); @@ -101,6 +111,8 @@ function test_url(url, chromeResult, webContentResult, privilegedContentResult) webContentResult, "Check URL with ref in web content process."); is(E10SUtils.canLoadURIInRemoteType(url + "#foo", PRIVILEGED_CONTENT_PROCESS), privilegedContentResult, "Check URL with ref in privileged content process."); + is(E10SUtils.canLoadURIInRemoteType(url + "#foo", EXTENSION_PROCESS), + extensionProcessResult, "Check URL with ref in extension process."); is(E10SUtils.canLoadURIInRemoteType(url + "?foo", CHROME_PROCESS), chromeResult, "Check URL with query in chrome process."); @@ -108,6 +120,8 @@ function test_url(url, chromeResult, webContentResult, privilegedContentResult) webContentResult, "Check URL with query in web content process."); is(E10SUtils.canLoadURIInRemoteType(url + "?foo", PRIVILEGED_CONTENT_PROCESS), privilegedContentResult, "Check URL with query in privileged content process."); + is(E10SUtils.canLoadURIInRemoteType(url + "?foo", EXTENSION_PROCESS), + extensionProcessResult, "Check URL with query in extension process."); is(E10SUtils.canLoadURIInRemoteType(url + "?foo#bar", CHROME_PROCESS), chromeResult, "Check URL with query and ref in chrome process."); @@ -115,18 +129,20 @@ function test_url(url, chromeResult, webContentResult, privilegedContentResult) webContentResult, "Check URL with query and ref in web content process."); is(E10SUtils.canLoadURIInRemoteType(url + "?foo#bar", PRIVILEGED_CONTENT_PROCESS), privilegedContentResult, "Check URL with query and ref in privileged content process."); + is(E10SUtils.canLoadURIInRemoteType(url + "?foo#bar", EXTENSION_PROCESS), + extensionProcessResult, "Check URL with query and ref in extension process."); } add_task(async function test_chrome() { - test_url("about:" + CHROME.path, true, false, false); + test_url("about:" + CHROME.path, true, false, false, false); }); add_task(async function test_any() { - test_url("about:" + CANREMOTE.path, true, true, false); + test_url("about:" + CANREMOTE.path, true, true, false, false); }); add_task(async function test_remote() { - test_url("about:" + MUSTREMOTE.path, false, true, false); + test_url("about:" + MUSTREMOTE.path, false, true, false, false); }); add_task(async function test_privileged_remote_true() { @@ -139,7 +155,7 @@ add_task(async function test_privileged_remote_true() { // This shouldn't be taken literally. We will always use the privileged // content type if the URI_CAN_LOAD_IN_PRIVILEGED_CHILD flag is enabled and // the pref is turned on. - test_url("about:" + CANPRIVILEGEDREMOTE.path, false, false, true); + test_url("about:" + CANPRIVILEGEDREMOTE.path, false, false, true, false); }); add_task(async function test_privileged_remote_false() { @@ -152,5 +168,9 @@ add_task(async function test_privileged_remote_false() { // This shouldn't be taken literally. We will always use the privileged // content type if the URI_CAN_LOAD_IN_PRIVILEGED_CHILD flag is enabled and // the pref is turned on. - test_url("about:" + CANPRIVILEGEDREMOTE.path, false, true, false); + test_url("about:" + CANPRIVILEGEDREMOTE.path, false, true, false, false); +}); + +add_task(async function test_extension() { + test_url("about:" + MUSTEXTENSION.path, false, false, false, true); }); diff --git a/netwerk/protocol/about/nsIAboutModule.idl b/netwerk/protocol/about/nsIAboutModule.idl index 08e8d74dcfd6..1c994e01c138 100644 --- a/netwerk/protocol/about/nsIAboutModule.idl +++ b/netwerk/protocol/about/nsIAboutModule.idl @@ -78,6 +78,11 @@ interface nsIAboutModule : nsISupports */ const unsigned long URI_CAN_LOAD_IN_PRIVILEGED_CHILD = (1 << 8); + /** + * A flag that indicates that this URI must be loaded in an extension process (if available). + */ + const unsigned long URI_MUST_LOAD_IN_EXTENSION_PROCESS = (1 << 9); + /** * A method to get the flags that apply to a given about: URI. The URI * passed in is guaranteed to be one of the URIs that this module diff --git a/toolkit/modules/E10SUtils.jsm b/toolkit/modules/E10SUtils.jsm index 6e8841c93e97..9518f7802f48 100644 --- a/toolkit/modules/E10SUtils.jsm +++ b/toolkit/modules/E10SUtils.jsm @@ -222,6 +222,10 @@ var E10SUtils = { } let flags = module.getURIFlags(aURI); + if (flags & Ci.nsIAboutModule.URI_MUST_LOAD_IN_EXTENSION_PROCESS) { + return WebExtensionPolicy.useRemoteWebExtensions ? EXTENSION_REMOTE_TYPE : NOT_REMOTE; + } + if (flags & Ci.nsIAboutModule.URI_MUST_LOAD_IN_CHILD) { if ((flags & Ci.nsIAboutModule.URI_CAN_LOAD_IN_PRIVILEGED_CHILD) && useSeparatePrivilegedContentProcess) {