mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-03 18:47:53 +00:00
Backed out 4 changesets (bug 1539595) for build bustage in nsAboutRedirector.cpp. CLOSED TREE
Backed out changeset 2b0bb889b087 (bug 1539595) Backed out changeset 95f0b82ec253 (bug 1539595) Backed out changeset 6310e6dabceb (bug 1539595) Backed out changeset ba3e353c6957 (bug 1539595) --HG-- rename : browser/base/content/test/tabs/browser_e10s_about_page_triggeringprincipal.js => browser/base/content/test/general/browser_e10s_about_page_triggeringprincipal.js rename : browser/base/content/test/tabs/browser_e10s_about_process.js => browser/base/content/test/general/browser_e10s_about_process.js rename : browser/base/content/test/tabs/browser_e10s_chrome_process.js => browser/base/content/test/general/browser_e10s_chrome_process.js rename : browser/base/content/test/tabs/browser_e10s_javascript.js => browser/base/content/test/general/browser_e10s_javascript.js rename : browser/base/content/test/tabs/browser_e10s_switchbrowser.js => browser/base/content/test/general/browser_e10s_switchbrowser.js rename : browser/base/content/test/tabs/file_about_child.html => browser/base/content/test/general/file_about_child.html rename : browser/base/content/test/tabs/file_about_parent.html => browser/base/content/test/general/file_about_parent.html rename : browser/base/content/test/tabs/test_process_flags_chrome.html => browser/base/content/test/general/test_process_flags_chrome.html rename : browser/base/content/test/tabs/browser_new_tab_in_privilegedabout_process_pref.js => browser/base/content/test/tabs/browser_new_tab_in_privileged_process_pref.js
This commit is contained in:
parent
eb5865bd87
commit
fba75a919c
@ -498,16 +498,9 @@ pref("browser.tabs.showAudioPlayingIcon", true);
|
||||
// This should match Chromium's audio indicator delay.
|
||||
pref("browser.tabs.delayHidingAudioPlayingIconMS", 3000);
|
||||
|
||||
// Pref to control whether we use separate privileged content processes.
|
||||
#if defined(NIGHTLY_BUILD) && !defined(MOZ_ASAN)
|
||||
// Pref to control whether we use a separate privileged content process
|
||||
// for about: pages. This pref name did not age well: we will have multiple
|
||||
// types of privileged content processes, each with different privileges.
|
||||
// types of privleged content processes, each with different privleges.
|
||||
pref("browser.tabs.remote.separatePrivilegedContentProcess", true);
|
||||
// Pref to control whether we use a separate privileged content process
|
||||
// for certain mozilla webpages (which are listed in the pref
|
||||
// browser.tabs.remote.separatedMozillaDomains).
|
||||
pref("browser.tabs.remote.separatePrivilegedMozillaWebContentProcess", true);
|
||||
#endif
|
||||
|
||||
#ifdef NIGHTLY_BUILD
|
||||
|
@ -47,6 +47,7 @@ support-files =
|
||||
test_bug462673.html
|
||||
test_bug628179.html
|
||||
test_bug839103.html
|
||||
test_process_flags_chrome.html
|
||||
title_test.svg
|
||||
unknownContentType_file.pif
|
||||
unknownContentType_file.pif^headers^
|
||||
@ -413,6 +414,21 @@ skip-if = e10s || debug # Bug 1094240 - has findbar-related failures
|
||||
# DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD.
|
||||
[browser_addCertException.js]
|
||||
# DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD.
|
||||
[browser_e10s_about_page_triggeringprincipal.js]
|
||||
skip-if = verify
|
||||
support-files =
|
||||
file_about_child.html
|
||||
file_about_parent.html
|
||||
# DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD.
|
||||
[browser_e10s_switchbrowser.js]
|
||||
# DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD.
|
||||
[browser_e10s_about_process.js]
|
||||
# DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD.
|
||||
[browser_e10s_chrome_process.js]
|
||||
skip-if = debug # Bug 1444565, Bug 1457887
|
||||
# DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD.
|
||||
[browser_e10s_javascript.js]
|
||||
# DO NOT ADD MORE TESTS HERE. USE A TOPICAL DIRECTORY INSTEAD.
|
||||
[browser_blockHPKP.js]
|
||||
skip-if = verify && !debug
|
||||
uses-unsafe-cpows = true
|
||||
|
176
browser/base/content/test/general/browser_e10s_about_process.js
Normal file
176
browser/base/content/test/general/browser_e10s_about_process.js
Normal file
@ -0,0 +1,176 @@
|
||||
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",
|
||||
path: "test-chrome",
|
||||
flags: 0,
|
||||
};
|
||||
const CANREMOTE = {
|
||||
id: "2480d3e1-9ce4-4b84-8ae3-910b9a95cbb3",
|
||||
path: "test-allowremote",
|
||||
flags: Ci.nsIAboutModule.URI_CAN_LOAD_IN_CHILD,
|
||||
};
|
||||
const MUSTREMOTE = {
|
||||
id: "f849cee5-e13e-44d2-981d-0fb3884aaead",
|
||||
path: "test-mustremote",
|
||||
flags: Ci.nsIAboutModule.URI_MUST_LOAD_IN_CHILD,
|
||||
};
|
||||
const CANPRIVILEGEDREMOTE = {
|
||||
id: "a04ffafe-6c63-4266-acae-0f4b093165aa",
|
||||
path: "test-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() {
|
||||
}
|
||||
|
||||
AboutModule.prototype = {
|
||||
newChannel(aURI, aLoadInfo) {
|
||||
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
|
||||
},
|
||||
|
||||
getURIFlags(aURI) {
|
||||
for (let module of TEST_MODULES) {
|
||||
if (aURI.pathQueryRef.startsWith(module.path)) {
|
||||
return module.flags;
|
||||
}
|
||||
}
|
||||
|
||||
ok(false, "Called getURIFlags for an unknown page " + aURI.spec);
|
||||
return 0;
|
||||
},
|
||||
|
||||
getIndexedDBOriginPostfix(aURI) {
|
||||
return null;
|
||||
},
|
||||
|
||||
QueryInterface: ChromeUtils.generateQI([Ci.nsIAboutModule]),
|
||||
};
|
||||
|
||||
var AboutModuleFactory = {
|
||||
createInstance(aOuter, aIID) {
|
||||
if (aOuter)
|
||||
throw Cr.NS_ERROR_NO_AGGREGATION;
|
||||
return new AboutModule().QueryInterface(aIID);
|
||||
},
|
||||
|
||||
lockFactory(aLock) {
|
||||
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
|
||||
},
|
||||
|
||||
QueryInterface: ChromeUtils.generateQI([Ci.nsIFactory]),
|
||||
};
|
||||
|
||||
add_task(async function init() {
|
||||
let registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
|
||||
for (let module of TEST_MODULES) {
|
||||
registrar.registerFactory(Components.ID(module.id), "",
|
||||
"@mozilla.org/network/protocol/about;1?what=" + module.path,
|
||||
AboutModuleFactory);
|
||||
}
|
||||
});
|
||||
|
||||
registerCleanupFunction(() => {
|
||||
let registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
|
||||
for (let module of TEST_MODULES) {
|
||||
registrar.unregisterFactory(Components.ID(module.id), AboutModuleFactory);
|
||||
}
|
||||
});
|
||||
|
||||
function test_url(url, chromeResult, webContentResult, privilegedContentResult, extensionProcessResult) {
|
||||
is(E10SUtils.canLoadURIInRemoteType(url, /* fission */ false, CHROME_PROCESS),
|
||||
chromeResult, "Check URL in chrome process.");
|
||||
is(E10SUtils.canLoadURIInRemoteType(url, /* fission */ false, WEB_CONTENT_PROCESS),
|
||||
webContentResult, "Check URL in web content process.");
|
||||
is(E10SUtils.canLoadURIInRemoteType(url, /* fission */ false, PRIVILEGED_CONTENT_PROCESS),
|
||||
privilegedContentResult, "Check URL in privileged content process.");
|
||||
is(E10SUtils.canLoadURIInRemoteType(url, /* fission */ false, EXTENSION_PROCESS),
|
||||
extensionProcessResult, "Check URL in extension process.");
|
||||
|
||||
is(E10SUtils.canLoadURIInRemoteType(url + "#foo", /* fission */ false, CHROME_PROCESS),
|
||||
chromeResult, "Check URL with ref in chrome process.");
|
||||
is(E10SUtils.canLoadURIInRemoteType(url + "#foo", /* fission */ false, WEB_CONTENT_PROCESS),
|
||||
webContentResult, "Check URL with ref in web content process.");
|
||||
is(E10SUtils.canLoadURIInRemoteType(url + "#foo", /* fission */ false, PRIVILEGED_CONTENT_PROCESS),
|
||||
privilegedContentResult, "Check URL with ref in privileged content process.");
|
||||
is(E10SUtils.canLoadURIInRemoteType(url + "#foo", /* fission */ false, EXTENSION_PROCESS),
|
||||
extensionProcessResult, "Check URL with ref in extension process.");
|
||||
|
||||
is(E10SUtils.canLoadURIInRemoteType(url + "?foo", /* fission */ false, CHROME_PROCESS),
|
||||
chromeResult, "Check URL with query in chrome process.");
|
||||
is(E10SUtils.canLoadURIInRemoteType(url + "?foo", /* fission */ false, WEB_CONTENT_PROCESS),
|
||||
webContentResult, "Check URL with query in web content process.");
|
||||
is(E10SUtils.canLoadURIInRemoteType(url + "?foo", /* fission */ false, PRIVILEGED_CONTENT_PROCESS),
|
||||
privilegedContentResult, "Check URL with query in privileged content process.");
|
||||
is(E10SUtils.canLoadURIInRemoteType(url + "?foo", /* fission */ false, EXTENSION_PROCESS),
|
||||
extensionProcessResult, "Check URL with query in extension process.");
|
||||
|
||||
is(E10SUtils.canLoadURIInRemoteType(url + "?foo#bar", /* fission */ false, CHROME_PROCESS),
|
||||
chromeResult, "Check URL with query and ref in chrome process.");
|
||||
is(E10SUtils.canLoadURIInRemoteType(url + "?foo#bar", /* fission */ false, WEB_CONTENT_PROCESS),
|
||||
webContentResult, "Check URL with query and ref in web content process.");
|
||||
is(E10SUtils.canLoadURIInRemoteType(url + "?foo#bar", /* fission */ false, PRIVILEGED_CONTENT_PROCESS),
|
||||
privilegedContentResult, "Check URL with query and ref in privileged content process.");
|
||||
is(E10SUtils.canLoadURIInRemoteType(url + "?foo#bar", /* fission */ false, 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, false);
|
||||
});
|
||||
|
||||
add_task(async function test_any() {
|
||||
test_url("about:" + CANREMOTE.path, true, true, false, false);
|
||||
});
|
||||
|
||||
add_task(async function test_remote() {
|
||||
test_url("about:" + MUSTREMOTE.path, false, true, false, 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 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, 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 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, false);
|
||||
});
|
||||
|
||||
add_task(async function test_extension() {
|
||||
test_url("about:" + MUSTEXTENSION.path, false, false, false, true);
|
||||
});
|
@ -32,6 +32,8 @@ function makeTest(name, startURL, startProcessIsRemote, endURL, endProcessIsRemo
|
||||
};
|
||||
}
|
||||
|
||||
const CHROME_PROCESS = E10SUtils.NOT_REMOTE;
|
||||
const WEB_CONTENT_PROCESS = E10SUtils.WEB_REMOTE_TYPE;
|
||||
const PATH = (getRootDirectory(gTestPath) + "test_process_flags_chrome.html").replace("chrome://mochitests", "");
|
||||
|
||||
const CHROME = "chrome://mochitests" + PATH;
|
||||
@ -46,16 +48,38 @@ registerCleanupFunction(() => {
|
||||
gBrowser.removeCurrentTab();
|
||||
});
|
||||
|
||||
function test_url(url, chromeResult, contentResult) {
|
||||
is(E10SUtils.canLoadURIInRemoteType(url, /* fission */ false, CHROME_PROCESS),
|
||||
chromeResult, "Check URL in chrome process.");
|
||||
is(E10SUtils.canLoadURIInRemoteType(url, /* fission */ false, WEB_CONTENT_PROCESS),
|
||||
contentResult, "Check URL in web content process.");
|
||||
|
||||
is(E10SUtils.canLoadURIInRemoteType(url + "#foo", /* fission */ false, CHROME_PROCESS),
|
||||
chromeResult, "Check URL with ref in chrome process.");
|
||||
is(E10SUtils.canLoadURIInRemoteType(url + "#foo", /* fission */ false, WEB_CONTENT_PROCESS),
|
||||
contentResult, "Check URL with ref in web content process.");
|
||||
|
||||
is(E10SUtils.canLoadURIInRemoteType(url + "?foo", /* fission */ false, CHROME_PROCESS),
|
||||
chromeResult, "Check URL with query in chrome process.");
|
||||
is(E10SUtils.canLoadURIInRemoteType(url + "?foo", /* fission */ false, WEB_CONTENT_PROCESS),
|
||||
contentResult, "Check URL with query in web content process.");
|
||||
|
||||
is(E10SUtils.canLoadURIInRemoteType(url + "?foo#bar", /* fission */ false, CHROME_PROCESS),
|
||||
chromeResult, "Check URL with query and ref in chrome process.");
|
||||
is(E10SUtils.canLoadURIInRemoteType(url + "?foo#bar", /* fission */ false, WEB_CONTENT_PROCESS),
|
||||
contentResult, "Check URL with query and ref in web content process.");
|
||||
}
|
||||
|
||||
add_task(async function test_chrome() {
|
||||
test_url_for_process_types(CHROME, true, false, false, false, false);
|
||||
test_url(CHROME, true, false);
|
||||
});
|
||||
|
||||
add_task(async function test_any() {
|
||||
test_url_for_process_types(CANREMOTE, true, true, false, false, false);
|
||||
test_url(CANREMOTE, true, true);
|
||||
});
|
||||
|
||||
add_task(async function test_remote() {
|
||||
test_url_for_process_types(MUSTREMOTE, false, true, false, false, false);
|
||||
test_url(MUSTREMOTE, false, true);
|
||||
});
|
||||
|
||||
// The set of page transitions
|
@ -3,8 +3,8 @@
|
||||
<html>
|
||||
<body>
|
||||
<p>chrome: test page</p>
|
||||
<p><a href="chrome://mochitests/content/browser/browser/base/content/test/tabs/test_process_flags_chrome.html">chrome</a></p>
|
||||
<p><a href="chrome://mochitests-any/content/browser/browser/base/content/test/tabs/test_process_flags_chrome.html">canremote</a></p>
|
||||
<p><a href="chrome://mochitests-content/content/browser/browser/base/content/test/tabs/test_process_flags_chrome.html">mustremote</a></p>
|
||||
<p><a href="chrome://mochitests/content/browser/browser/base/content/test/general/test_process_flags_chrome.html">chrome</a></p>
|
||||
<p><a href="chrome://mochitests-any/content/browser/browser/base/content/test/general/test_process_flags_chrome.html">canremote</a></p>
|
||||
<p><a href="chrome://mochitests-content/content/browser/browser/base/content/test/general/test_process_flags_chrome.html">mustremote</a></p>
|
||||
</body>
|
||||
</html>
|
@ -191,14 +191,8 @@ function makeObserver(aObserveTopic, aObserveFunc) {
|
||||
return removeMe;
|
||||
}
|
||||
|
||||
registerCleanupFunction(function() {
|
||||
Services.prefs.clearUserPref("browser.tabs.remote.separatePrivilegedMozillaWebContentProcess");
|
||||
});
|
||||
|
||||
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
Services.prefs.setBoolPref("browser.tabs.remote.separatePrivilegedMozillaWebContentProcess", false);
|
||||
|
||||
(async function() {
|
||||
for (let testCase of gTests) {
|
||||
|
@ -4,7 +4,6 @@ support-files =
|
||||
dummy_page.html
|
||||
../general/audio.ogg
|
||||
file_mediaPlayback.html
|
||||
test_process_flags_chrome.html
|
||||
|
||||
[browser_accessibility_indicator.js]
|
||||
skip-if = (verify && debug && (os == 'linux')) || (os == 'win' && processor == 'aarch64')
|
||||
@ -20,17 +19,6 @@ skip-if = (verify && debug && (os == 'linux'))
|
||||
support-files =
|
||||
test_bug1358314.html
|
||||
[browser_isLocalAboutURI.js]
|
||||
[browser_e10s_about_page_triggeringprincipal.js]
|
||||
skip-if = verify
|
||||
support-files =
|
||||
file_about_child.html
|
||||
file_about_parent.html
|
||||
[browser_e10s_switchbrowser.js]
|
||||
[browser_e10s_about_process.js]
|
||||
[browser_e10s_mozillaweb_process.js]
|
||||
[browser_e10s_chrome_process.js]
|
||||
skip-if = debug # Bug 1444565, Bug 1457887
|
||||
[browser_e10s_javascript.js]
|
||||
[browser_multiselect_tabs_active_tab_selected_by_default.js]
|
||||
[browser_multiselect_tabs_bookmark.js]
|
||||
[browser_multiselect_tabs_clear_selection_when_tab_switch.js]
|
||||
@ -64,9 +52,7 @@ skip-if = !e10s # Test only relevant for e10s.
|
||||
[browser_new_tab_insert_position.js]
|
||||
skip-if = (debug && os == 'linux' && bits == 32) #Bug 1455882, disabled on Linux32 for almost permafailing
|
||||
support-files = file_new_tab_page.html
|
||||
[browser_new_tab_in_privilegedabout_process_pref.js]
|
||||
skip-if = !e10s # Pref and test only relevant for e10s.
|
||||
[browser_privilegedmozilla_process_pref.js]
|
||||
[browser_new_tab_in_privileged_process_pref.js]
|
||||
skip-if = !e10s # Pref and test only relevant for e10s.
|
||||
[browser_new_web_tab_in_file_process_pref.js]
|
||||
skip-if = !e10s # Pref and test only relevant for e10s.
|
||||
|
@ -1,135 +0,0 @@
|
||||
const CHROME = {
|
||||
id: "cb34538a-d9da-40f3-b61a-069f0b2cb9fb",
|
||||
path: "test-chrome",
|
||||
flags: 0,
|
||||
};
|
||||
const CANREMOTE = {
|
||||
id: "2480d3e1-9ce4-4b84-8ae3-910b9a95cbb3",
|
||||
path: "test-allowremote",
|
||||
flags: Ci.nsIAboutModule.URI_CAN_LOAD_IN_CHILD,
|
||||
};
|
||||
const MUSTREMOTE = {
|
||||
id: "f849cee5-e13e-44d2-981d-0fb3884aaead",
|
||||
path: "test-mustremote",
|
||||
flags: Ci.nsIAboutModule.URI_MUST_LOAD_IN_CHILD,
|
||||
};
|
||||
const CANPRIVILEGEDREMOTE = {
|
||||
id: "a04ffafe-6c63-4266-acae-0f4b093165aa",
|
||||
path: "test-canprivilegedremote",
|
||||
flags: Ci.nsIAboutModule.URI_MUST_LOAD_IN_CHILD |
|
||||
Ci.nsIAboutModule.URI_CAN_LOAD_IN_PRIVILEGEDABOUT_PROCESS,
|
||||
};
|
||||
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() {
|
||||
}
|
||||
|
||||
AboutModule.prototype = {
|
||||
newChannel(aURI, aLoadInfo) {
|
||||
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
|
||||
},
|
||||
|
||||
getURIFlags(aURI) {
|
||||
for (let module of TEST_MODULES) {
|
||||
if (aURI.pathQueryRef.startsWith(module.path)) {
|
||||
return module.flags;
|
||||
}
|
||||
}
|
||||
|
||||
ok(false, "Called getURIFlags for an unknown page " + aURI.spec);
|
||||
return 0;
|
||||
},
|
||||
|
||||
getIndexedDBOriginPostfix(aURI) {
|
||||
return null;
|
||||
},
|
||||
|
||||
QueryInterface: ChromeUtils.generateQI([Ci.nsIAboutModule]),
|
||||
};
|
||||
|
||||
var AboutModuleFactory = {
|
||||
createInstance(aOuter, aIID) {
|
||||
if (aOuter)
|
||||
throw Cr.NS_ERROR_NO_AGGREGATION;
|
||||
return new AboutModule().QueryInterface(aIID);
|
||||
},
|
||||
|
||||
lockFactory(aLock) {
|
||||
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
|
||||
},
|
||||
|
||||
QueryInterface: ChromeUtils.generateQI([Ci.nsIFactory]),
|
||||
};
|
||||
|
||||
add_task(async function init() {
|
||||
SpecialPowers.setBoolPref("browser.tabs.remote.separatePrivilegedMozillaWebContentProcess", true);
|
||||
let registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
|
||||
for (let module of TEST_MODULES) {
|
||||
registrar.registerFactory(Components.ID(module.id), "",
|
||||
"@mozilla.org/network/protocol/about;1?what=" + module.path,
|
||||
AboutModuleFactory);
|
||||
}
|
||||
});
|
||||
|
||||
registerCleanupFunction(() => {
|
||||
SpecialPowers.clearUserPref("browser.tabs.remote.separatePrivilegedMozillaWebContentProcess");
|
||||
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);
|
||||
});
|
||||
|
||||
add_task(async function test_any() {
|
||||
test_url_for_process_types("about:" + CANREMOTE.path, true, true, false, false, false);
|
||||
});
|
||||
|
||||
add_task(async function test_remote() {
|
||||
test_url_for_process_types("about:" + MUSTREMOTE.path, false, true, false, false, 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);
|
||||
});
|
||||
|
||||
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);
|
||||
});
|
||||
|
||||
add_task(async function test_extension() {
|
||||
test_url_for_process_types("about:" + MUSTEXTENSION.path, false, false, false, false, true);
|
||||
});
|
@ -1,24 +0,0 @@
|
||||
add_task(async function test_privileged_remote_true() {
|
||||
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);
|
||||
});
|
||||
|
||||
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);
|
||||
});
|
@ -5,9 +5,8 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Tests to ensure that Activity Stream loads in the privileged about:
|
||||
* content process. Normal http web pages should load in the web content
|
||||
* process.
|
||||
* Tests to ensure that Activity Stream loads in the privileged content process.
|
||||
* Normal http web pages should load in the web content process.
|
||||
* Ref: Bug 1469072.
|
||||
*/
|
||||
|
||||
@ -17,29 +16,54 @@ const ABOUT_NEWTAB = "about:newtab";
|
||||
const ABOUT_WELCOME = "about:welcome";
|
||||
const TEST_HTTP = "http://example.org/";
|
||||
|
||||
/**
|
||||
* Takes a xul:browser and makes sure that the remoteTypes for the browser in
|
||||
* both the parent and the child processes are the same.
|
||||
*
|
||||
* @param {xul:browser} browser
|
||||
* A xul:browser.
|
||||
* @param {string} expectedRemoteType
|
||||
* The expected remoteType value for the browser in both the parent
|
||||
* and child processes.
|
||||
* @param {optional string} message
|
||||
* If provided, shows this string as the message when remoteType values
|
||||
* do not match. If not present, it uses the default message defined
|
||||
* in the function parameters.
|
||||
*/
|
||||
function checkBrowserRemoteType(
|
||||
browser,
|
||||
expectedRemoteType,
|
||||
message = `Ensures that tab runs in the ${expectedRemoteType} content process.`
|
||||
) {
|
||||
// Check both parent and child to ensure that they have the correct remoteType.
|
||||
is(browser.remoteType, expectedRemoteType, message);
|
||||
is(browser.messageManager.remoteType, expectedRemoteType,
|
||||
"Parent and child process should agree on the remote type.");
|
||||
}
|
||||
|
||||
add_task(async function setup() {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [
|
||||
["browser.newtab.preload", false],
|
||||
["browser.tabs.remote.separatePrivilegedContentProcess", true],
|
||||
["dom.ipc.processCount.privilegedabout", 1],
|
||||
["dom.ipc.keepProcessesAlive.privilegedabout", 1],
|
||||
["dom.ipc.processCount.privileged", 1],
|
||||
["dom.ipc.keepProcessesAlive.privileged", 1],
|
||||
],
|
||||
});
|
||||
});
|
||||
|
||||
/*
|
||||
* Test to ensure that the Activity Stream tabs open in privileged about: content
|
||||
* Test to ensure that the Activity Stream tabs open in privileged content
|
||||
* process. We will first open an about:newtab page that acts as a reference to
|
||||
* the privileged about: content process. With the reference, we can then open
|
||||
* Activity Stream links in a new tab and ensure that the new tab opens in the same
|
||||
* privileged about: content process as our reference.
|
||||
* the privileged content process. With the reference, we can then open Activity
|
||||
* Stream links in a new tab and ensure that the new tab opens in the same
|
||||
* privileged content process as our reference.
|
||||
*/
|
||||
add_task(async function activity_stream_in_privileged_content_process() {
|
||||
Services.ppmm.releaseCachedProcesses();
|
||||
|
||||
await BrowserTestUtils.withNewTab(ABOUT_NEWTAB, async function(browser1) {
|
||||
checkBrowserRemoteType(browser1, E10SUtils.PRIVILEGEDABOUT_REMOTE_TYPE);
|
||||
checkBrowserRemoteType(browser1, E10SUtils.PRIVILEGED_REMOTE_TYPE);
|
||||
|
||||
// Note the processID for about:newtab for comparison later.
|
||||
let privilegedPid = browser1.frameLoader.remoteTab.osPid;
|
||||
@ -57,7 +81,7 @@ add_task(async function activity_stream_in_privileged_content_process() {
|
||||
]) {
|
||||
await BrowserTestUtils.withNewTab(url, async function(browser2) {
|
||||
is(browser2.frameLoader.remoteTab.osPid, privilegedPid,
|
||||
"Check that about:newtab tabs are in the same privileged about: content process.");
|
||||
"Check that about:newtab tabs are in the same privileged content process.");
|
||||
});
|
||||
}
|
||||
});
|
||||
@ -76,25 +100,25 @@ add_task(async function process_switching_through_loading_in_the_same_tab() {
|
||||
checkBrowserRemoteType(browser, E10SUtils.WEB_REMOTE_TYPE);
|
||||
|
||||
for (let [url, remoteType] of [
|
||||
[ABOUT_NEWTAB, E10SUtils.PRIVILEGEDABOUT_REMOTE_TYPE],
|
||||
[ABOUT_BLANK, E10SUtils.PRIVILEGEDABOUT_REMOTE_TYPE],
|
||||
[ABOUT_NEWTAB, E10SUtils.PRIVILEGED_REMOTE_TYPE],
|
||||
[ABOUT_BLANK, E10SUtils.PRIVILEGED_REMOTE_TYPE],
|
||||
[TEST_HTTP, E10SUtils.WEB_REMOTE_TYPE],
|
||||
[ABOUT_HOME, E10SUtils.PRIVILEGEDABOUT_REMOTE_TYPE],
|
||||
[ABOUT_HOME, E10SUtils.PRIVILEGED_REMOTE_TYPE],
|
||||
[TEST_HTTP, E10SUtils.WEB_REMOTE_TYPE],
|
||||
[ABOUT_WELCOME, E10SUtils.PRIVILEGEDABOUT_REMOTE_TYPE],
|
||||
[ABOUT_WELCOME, E10SUtils.PRIVILEGED_REMOTE_TYPE],
|
||||
[TEST_HTTP, E10SUtils.WEB_REMOTE_TYPE],
|
||||
[ABOUT_BLANK, E10SUtils.WEB_REMOTE_TYPE],
|
||||
[`${ABOUT_NEWTAB}#foo`, E10SUtils.PRIVILEGEDABOUT_REMOTE_TYPE],
|
||||
[`${ABOUT_NEWTAB}#foo`, E10SUtils.PRIVILEGED_REMOTE_TYPE],
|
||||
[TEST_HTTP, E10SUtils.WEB_REMOTE_TYPE],
|
||||
[`${ABOUT_WELCOME}#bar`, E10SUtils.PRIVILEGEDABOUT_REMOTE_TYPE],
|
||||
[`${ABOUT_WELCOME}#bar`, E10SUtils.PRIVILEGED_REMOTE_TYPE],
|
||||
[TEST_HTTP, E10SUtils.WEB_REMOTE_TYPE],
|
||||
[`${ABOUT_HOME}#baz`, E10SUtils.PRIVILEGEDABOUT_REMOTE_TYPE],
|
||||
[`${ABOUT_HOME}#baz`, E10SUtils.PRIVILEGED_REMOTE_TYPE],
|
||||
[TEST_HTTP, E10SUtils.WEB_REMOTE_TYPE],
|
||||
[`${ABOUT_NEWTAB}?q=foo`, E10SUtils.PRIVILEGEDABOUT_REMOTE_TYPE],
|
||||
[`${ABOUT_NEWTAB}?q=foo`, E10SUtils.PRIVILEGED_REMOTE_TYPE],
|
||||
[TEST_HTTP, E10SUtils.WEB_REMOTE_TYPE],
|
||||
[`${ABOUT_WELCOME}?q=bar`, E10SUtils.PRIVILEGEDABOUT_REMOTE_TYPE],
|
||||
[`${ABOUT_WELCOME}?q=bar`, E10SUtils.PRIVILEGED_REMOTE_TYPE],
|
||||
[TEST_HTTP, E10SUtils.WEB_REMOTE_TYPE],
|
||||
[`${ABOUT_HOME}?q=baz`, E10SUtils.PRIVILEGEDABOUT_REMOTE_TYPE],
|
||||
[`${ABOUT_HOME}?q=baz`, E10SUtils.PRIVILEGED_REMOTE_TYPE],
|
||||
[TEST_HTTP, E10SUtils.WEB_REMOTE_TYPE],
|
||||
]) {
|
||||
BrowserTestUtils.loadURI(browser, url);
|
||||
@ -115,7 +139,7 @@ add_task(async function process_switching_through_navigation_features() {
|
||||
Services.ppmm.releaseCachedProcesses();
|
||||
|
||||
await BrowserTestUtils.withNewTab(ABOUT_NEWTAB, async function(browser) {
|
||||
checkBrowserRemoteType(browser, E10SUtils.PRIVILEGEDABOUT_REMOTE_TYPE);
|
||||
checkBrowserRemoteType(browser, E10SUtils.PRIVILEGED_REMOTE_TYPE);
|
||||
|
||||
// Note the processID for about:newtab for comparison later.
|
||||
let privilegedPid = browser.frameLoader.remoteTab.osPid;
|
||||
@ -131,20 +155,20 @@ add_task(async function process_switching_through_navigation_features() {
|
||||
});
|
||||
browser = newTab.linkedBrowser;
|
||||
is(browser.frameLoader.remoteTab.osPid, privilegedPid,
|
||||
"Check that new tab opened from about:newtab is loaded in privileged about: content process.");
|
||||
"Check that new tab opened from about:newtab is loaded in privileged content process.");
|
||||
|
||||
// Check that reload does not break the privileged about: content process affinity.
|
||||
// Check that reload does not break the privileged content process affinity.
|
||||
BrowserReload();
|
||||
await BrowserTestUtils.browserLoaded(browser, false, ABOUT_NEWTAB);
|
||||
is(browser.frameLoader.remoteTab.osPid, privilegedPid,
|
||||
"Check that about:newtab is still in privileged about: content process after reload.");
|
||||
"Check that about:newtab is still in privileged content process after reload.");
|
||||
|
||||
// Load http webpage
|
||||
BrowserTestUtils.loadURI(browser, TEST_HTTP);
|
||||
await BrowserTestUtils.browserLoaded(browser, false, TEST_HTTP);
|
||||
checkBrowserRemoteType(browser, E10SUtils.WEB_REMOTE_TYPE);
|
||||
|
||||
// Check that using the history back feature switches back to privileged about: content process.
|
||||
// Check that using the history back feature switches back to privileged content process.
|
||||
let promiseLocation = BrowserTestUtils.waitForLocationChange(gBrowser, ABOUT_NEWTAB);
|
||||
browser.goBack();
|
||||
await promiseLocation;
|
||||
@ -152,7 +176,7 @@ add_task(async function process_switching_through_navigation_features() {
|
||||
// the navigation history data will be available when we do browser.goForward();
|
||||
await BrowserTestUtils.waitForEvent(newTab, "SSTabRestored");
|
||||
is(browser.frameLoader.remoteTab.osPid, privilegedPid,
|
||||
"Check that about:newtab is still in privileged about: content process after history goBack.");
|
||||
"Check that about:newtab is still in privileged content process after history goBack.");
|
||||
|
||||
// Check that using the history forward feature switches back to the web content process.
|
||||
promiseLocation = BrowserTestUtils.waitForLocationChange(gBrowser, TEST_HTTP);
|
||||
@ -169,7 +193,7 @@ add_task(async function process_switching_through_navigation_features() {
|
||||
browser.gotoIndex(0);
|
||||
await promiseLocation;
|
||||
is(browser.frameLoader.remoteTab.osPid, privilegedPid,
|
||||
"Check that about:newtab is in privileged about: content process after history gotoIndex.");
|
||||
"Check that about:newtab is in privileged content process after history gotoIndex.");
|
||||
|
||||
BrowserTestUtils.loadURI(browser, TEST_HTTP);
|
||||
await BrowserTestUtils.browserLoaded(browser, false, TEST_HTTP);
|
||||
@ -181,7 +205,7 @@ add_task(async function process_switching_through_navigation_features() {
|
||||
});
|
||||
await BrowserTestUtils.browserLoaded(browser, false, ABOUT_NEWTAB);
|
||||
is(browser.frameLoader.remoteTab.osPid, privilegedPid,
|
||||
"Check that about:newtab is in privileged about: content process after location change.");
|
||||
"Check that about:newtab is in privileged content process after location change.");
|
||||
});
|
||||
|
||||
Services.ppmm.releaseCachedProcesses();
|
@ -1,183 +0,0 @@
|
||||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
|
||||
/**
|
||||
* Tests to ensure that Mozilla Privileged Webpages load in the privileged
|
||||
* mozilla web content process. Normal http web pages should load in the web
|
||||
* content process.
|
||||
* Ref: Bug 1539595.
|
||||
*/
|
||||
|
||||
// High and Low Privilege
|
||||
const TEST_HIGH1 = "https://example.org/";
|
||||
const TEST_HIGH2 = "https://test1.example.org/";
|
||||
const TEST_LOW1 = "http://example.org/";
|
||||
const TEST_LOW2 = "https://example.com/";
|
||||
|
||||
add_task(async function setup() {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [
|
||||
["browser.tabs.remote.separatePrivilegedMozillaWebContentProcess", true],
|
||||
["browser.tabs.remote.separatedMozillaDomains", "example.org"],
|
||||
["dom.ipc.processCount.privilegedmozilla", 1],
|
||||
],
|
||||
});
|
||||
});
|
||||
|
||||
/*
|
||||
* Test to ensure that the tabs open in privileged mozilla content process. We
|
||||
* will first open a page that acts as a reference to the privileged mozilla web
|
||||
* content process. With the reference, we can then open other links in a new tab
|
||||
* and ensure that the new tab opens in the same privileged mozilla content process
|
||||
* as our reference.
|
||||
*/
|
||||
add_task(async function webpages_in_privileged_content_process() {
|
||||
Services.ppmm.releaseCachedProcesses();
|
||||
|
||||
await BrowserTestUtils.withNewTab(TEST_HIGH1, async function(browser1) {
|
||||
checkBrowserRemoteType(browser1, E10SUtils.PRIVILEGEDMOZILLA_REMOTE_TYPE);
|
||||
|
||||
// Note the processID for about:newtab for comparison later.
|
||||
let privilegedPid = browser1.frameLoader.remoteTab.osPid;
|
||||
|
||||
for (let url of [
|
||||
TEST_HIGH1,
|
||||
`${TEST_HIGH1}#foo`,
|
||||
`${TEST_HIGH1}?q=foo`,
|
||||
TEST_HIGH2,
|
||||
`${TEST_HIGH2}#foo`,
|
||||
`${TEST_HIGH2}?q=foo`,
|
||||
]) {
|
||||
await BrowserTestUtils.withNewTab(url, async function(browser2) {
|
||||
is(browser2.frameLoader.remoteTab.osPid, privilegedPid,
|
||||
"Check that privileged pages are in the same privileged mozilla content process.");
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
Services.ppmm.releaseCachedProcesses();
|
||||
});
|
||||
|
||||
/*
|
||||
* Test to ensure that a process switch occurs when navigating between normal
|
||||
* web pages and unprivileged pages in the same tab.
|
||||
*/
|
||||
add_task(async function process_switching_through_loading_in_the_same_tab() {
|
||||
Services.ppmm.releaseCachedProcesses();
|
||||
|
||||
await BrowserTestUtils.withNewTab(TEST_LOW1, async function(browser) {
|
||||
checkBrowserRemoteType(browser, E10SUtils.WEB_REMOTE_TYPE);
|
||||
|
||||
for (let [url, remoteType] of [
|
||||
[TEST_HIGH1, E10SUtils.PRIVILEGEDMOZILLA_REMOTE_TYPE],
|
||||
[TEST_LOW1, E10SUtils.WEB_REMOTE_TYPE],
|
||||
[TEST_HIGH1, E10SUtils.PRIVILEGEDMOZILLA_REMOTE_TYPE],
|
||||
[TEST_LOW2, E10SUtils.WEB_REMOTE_TYPE],
|
||||
[TEST_HIGH1, E10SUtils.PRIVILEGEDMOZILLA_REMOTE_TYPE],
|
||||
[TEST_LOW1, E10SUtils.WEB_REMOTE_TYPE],
|
||||
[TEST_LOW2, E10SUtils.WEB_REMOTE_TYPE],
|
||||
[`${TEST_HIGH1}#foo`, E10SUtils.PRIVILEGEDMOZILLA_REMOTE_TYPE],
|
||||
[TEST_LOW1, E10SUtils.WEB_REMOTE_TYPE],
|
||||
[`${TEST_HIGH1}#bar`, E10SUtils.PRIVILEGEDMOZILLA_REMOTE_TYPE],
|
||||
[TEST_LOW2, E10SUtils.WEB_REMOTE_TYPE],
|
||||
[`${TEST_HIGH1}#baz`, E10SUtils.PRIVILEGEDMOZILLA_REMOTE_TYPE],
|
||||
[TEST_LOW1, E10SUtils.WEB_REMOTE_TYPE],
|
||||
[`${TEST_HIGH1}?q=foo`, E10SUtils.PRIVILEGEDMOZILLA_REMOTE_TYPE],
|
||||
[TEST_LOW2, E10SUtils.WEB_REMOTE_TYPE],
|
||||
[`${TEST_HIGH1}?q=bar`, E10SUtils.PRIVILEGEDMOZILLA_REMOTE_TYPE],
|
||||
[TEST_LOW1, E10SUtils.WEB_REMOTE_TYPE],
|
||||
[`${TEST_HIGH1}?q=baz`, E10SUtils.PRIVILEGEDMOZILLA_REMOTE_TYPE],
|
||||
[TEST_LOW2, E10SUtils.WEB_REMOTE_TYPE],
|
||||
]) {
|
||||
BrowserTestUtils.loadURI(browser, url);
|
||||
await BrowserTestUtils.browserLoaded(browser, false, url);
|
||||
checkBrowserRemoteType(browser, remoteType);
|
||||
}
|
||||
});
|
||||
|
||||
Services.ppmm.releaseCachedProcesses();
|
||||
});
|
||||
|
||||
/*
|
||||
* Test to ensure that a process switch occurs when navigating between normal
|
||||
* web pages and privileged pages using the browser's navigation features
|
||||
* such as history and location change.
|
||||
*/
|
||||
add_task(async function process_switching_through_navigation_features() {
|
||||
Services.ppmm.releaseCachedProcesses();
|
||||
|
||||
await BrowserTestUtils.withNewTab(TEST_HIGH1, async function(browser) {
|
||||
checkBrowserRemoteType(browser, E10SUtils.PRIVILEGEDMOZILLA_REMOTE_TYPE);
|
||||
|
||||
// Note the processID for about:newtab for comparison later.
|
||||
let privilegedPid = browser.frameLoader.remoteTab.osPid;
|
||||
|
||||
// Check that about:newtab opened from JS in about:newtab page is in the same process.
|
||||
let promiseTabOpened = BrowserTestUtils.waitForNewTab(gBrowser, TEST_HIGH1, true);
|
||||
await ContentTask.spawn(browser, TEST_HIGH1, uri => {
|
||||
content.open(uri, "_blank");
|
||||
});
|
||||
let newTab = await promiseTabOpened;
|
||||
registerCleanupFunction(async function() {
|
||||
BrowserTestUtils.removeTab(newTab);
|
||||
});
|
||||
browser = newTab.linkedBrowser;
|
||||
is(browser.frameLoader.remoteTab.osPid, privilegedPid,
|
||||
"Check that new tab opened from privileged page is loaded in privileged mozilla content process.");
|
||||
|
||||
// Check that reload does not break the privileged mozilla content process affinity.
|
||||
BrowserReload();
|
||||
await BrowserTestUtils.browserLoaded(browser, false, TEST_HIGH1);
|
||||
is(browser.frameLoader.remoteTab.osPid, privilegedPid,
|
||||
"Check that privileged page is still in privileged mozilla content process after reload.");
|
||||
|
||||
// Load http webpage
|
||||
BrowserTestUtils.loadURI(browser, TEST_LOW1);
|
||||
await BrowserTestUtils.browserLoaded(browser, false, TEST_LOW1);
|
||||
checkBrowserRemoteType(browser, E10SUtils.WEB_REMOTE_TYPE);
|
||||
|
||||
// Check that using the history back feature switches back to privileged mozilla content process.
|
||||
let promiseLocation = BrowserTestUtils.waitForLocationChange(gBrowser, TEST_HIGH1);
|
||||
browser.goBack();
|
||||
await promiseLocation;
|
||||
// We will need to ensure that the process flip has fully completed so that
|
||||
// the navigation history data will be available when we do browser.goForward();
|
||||
await BrowserTestUtils.waitForEvent(newTab, "SSTabRestored");
|
||||
is(browser.frameLoader.remoteTab.osPid, privilegedPid,
|
||||
"Check that privileged page is still in privileged mozilla content process after history goBack.");
|
||||
|
||||
// Check that using the history forward feature switches back to the web content process.
|
||||
promiseLocation = BrowserTestUtils.waitForLocationChange(gBrowser, TEST_LOW1);
|
||||
browser.goForward();
|
||||
await promiseLocation;
|
||||
// We will need to ensure that the process flip has fully completed so that
|
||||
// the navigation history data will be available when we do browser.gotoIndex(0);
|
||||
await BrowserTestUtils.waitForEvent(newTab, "SSTabRestored");
|
||||
checkBrowserRemoteType(browser, E10SUtils.WEB_REMOTE_TYPE,
|
||||
"Check that tab runs in the web content process after using history goForward.");
|
||||
|
||||
// Check that goto history index does not break the affinity.
|
||||
promiseLocation = BrowserTestUtils.waitForLocationChange(gBrowser, TEST_HIGH1);
|
||||
browser.gotoIndex(0);
|
||||
await promiseLocation;
|
||||
is(browser.frameLoader.remoteTab.osPid, privilegedPid,
|
||||
"Check that privileged page is in privileged mozilla content process after history gotoIndex.");
|
||||
|
||||
BrowserTestUtils.loadURI(browser, TEST_LOW2);
|
||||
await BrowserTestUtils.browserLoaded(browser, false, TEST_LOW2);
|
||||
checkBrowserRemoteType(browser, E10SUtils.WEB_REMOTE_TYPE);
|
||||
|
||||
// Check that location change causes a change in process type as well.
|
||||
await ContentTask.spawn(browser, TEST_HIGH1, uri => {
|
||||
content.location = uri;
|
||||
});
|
||||
await BrowserTestUtils.browserLoaded(browser, false, TEST_HIGH1);
|
||||
is(browser.frameLoader.remoteTab.osPid, privilegedPid,
|
||||
"Check that privileged page is in privileged mozilla content process after location change.");
|
||||
});
|
||||
|
||||
Services.ppmm.releaseCachedProcesses();
|
||||
});
|
@ -189,80 +189,3 @@ async function dragAndDrop(tab1, tab2, copy, destWindow = window) {
|
||||
function getUrl(tab) {
|
||||
return tab.linkedBrowser.currentURI.spec;
|
||||
}
|
||||
|
||||
/**
|
||||
* Takes a xul:browser and makes sure that the remoteTypes for the browser in
|
||||
* both the parent and the child processes are the same.
|
||||
*
|
||||
* @param {xul:browser} browser
|
||||
* A xul:browser.
|
||||
* @param {string} expectedRemoteType
|
||||
* The expected remoteType value for the browser in both the parent
|
||||
* and child processes.
|
||||
* @param {optional string} message
|
||||
* If provided, shows this string as the message when remoteType values
|
||||
* do not match. If not present, it uses the default message defined
|
||||
* in the function parameters.
|
||||
*/
|
||||
function checkBrowserRemoteType(
|
||||
browser,
|
||||
expectedRemoteType,
|
||||
message = `Ensures that tab runs in the ${expectedRemoteType} content process.`
|
||||
) {
|
||||
// Check both parent and child to ensure that they have the correct remoteType.
|
||||
is(browser.remoteType, expectedRemoteType, message);
|
||||
is(browser.messageManager.remoteType, expectedRemoteType,
|
||||
"Parent and child process should agree on the remote type.");
|
||||
}
|
||||
|
||||
function test_url_for_process_types(url, chromeResult, webContentResult, privilegedAboutContentResult, privilegedMozillaContentResult, 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(E10SUtils.canLoadURIInRemoteType(url, /* fission */ false, CHROME_PROCESS),
|
||||
chromeResult, "Check URL in chrome process.");
|
||||
is(E10SUtils.canLoadURIInRemoteType(url, /* fission */ false, WEB_CONTENT_PROCESS),
|
||||
webContentResult, "Check URL in web content process.");
|
||||
is(E10SUtils.canLoadURIInRemoteType(url, /* fission */ false, PRIVILEGEDABOUT_CONTENT_PROCESS),
|
||||
privilegedAboutContentResult, "Check URL in privileged about content process.");
|
||||
is(E10SUtils.canLoadURIInRemoteType(url, /* fission */ false, PRIVILEGEDMOZILLA_CONTENT_PROCESS),
|
||||
privilegedMozillaContentResult, "Check URL in privileged mozilla content process.");
|
||||
is(E10SUtils.canLoadURIInRemoteType(url, /* fission */ false, EXTENSION_PROCESS),
|
||||
extensionProcessResult, "Check URL in extension process.");
|
||||
|
||||
is(E10SUtils.canLoadURIInRemoteType(url + "#foo", /* fission */ false, CHROME_PROCESS),
|
||||
chromeResult, "Check URL with ref in chrome process.");
|
||||
is(E10SUtils.canLoadURIInRemoteType(url + "#foo", /* fission */ false, WEB_CONTENT_PROCESS),
|
||||
webContentResult, "Check URL with ref in web content process.");
|
||||
is(E10SUtils.canLoadURIInRemoteType(url + "#foo", /* fission */ false, PRIVILEGEDABOUT_CONTENT_PROCESS),
|
||||
privilegedAboutContentResult, "Check URL with ref in privileged about content process.");
|
||||
is(E10SUtils.canLoadURIInRemoteType(url + "#foo", /* fission */ false, PRIVILEGEDMOZILLA_CONTENT_PROCESS),
|
||||
privilegedMozillaContentResult, "Check URL with ref in privileged mozilla content process.");
|
||||
is(E10SUtils.canLoadURIInRemoteType(url + "#foo", /* fission */ false, EXTENSION_PROCESS),
|
||||
extensionProcessResult, "Check URL with ref in extension process.");
|
||||
|
||||
is(E10SUtils.canLoadURIInRemoteType(url + "?foo", /* fission */ false, CHROME_PROCESS),
|
||||
chromeResult, "Check URL with query in chrome process.");
|
||||
is(E10SUtils.canLoadURIInRemoteType(url + "?foo", /* fission */ false, WEB_CONTENT_PROCESS),
|
||||
webContentResult, "Check URL with query in web content process.");
|
||||
is(E10SUtils.canLoadURIInRemoteType(url + "?foo", /* fission */ false, PRIVILEGEDABOUT_CONTENT_PROCESS),
|
||||
privilegedAboutContentResult, "Check URL with query in privileged about content process.");
|
||||
is(E10SUtils.canLoadURIInRemoteType(url + "?foo", /* fission */ false, PRIVILEGEDMOZILLA_CONTENT_PROCESS),
|
||||
privilegedMozillaContentResult, "Check URL with query in privileged mozilla content process.");
|
||||
is(E10SUtils.canLoadURIInRemoteType(url + "?foo", /* fission */ false, EXTENSION_PROCESS),
|
||||
extensionProcessResult, "Check URL with query in extension process.");
|
||||
|
||||
is(E10SUtils.canLoadURIInRemoteType(url + "?foo#bar", /* fission */ false, CHROME_PROCESS),
|
||||
chromeResult, "Check URL with query and ref in chrome process.");
|
||||
is(E10SUtils.canLoadURIInRemoteType(url + "?foo#bar", /* fission */ false, WEB_CONTENT_PROCESS),
|
||||
webContentResult, "Check URL with query and ref in web content process.");
|
||||
is(E10SUtils.canLoadURIInRemoteType(url + "?foo#bar", /* fission */ false, PRIVILEGEDABOUT_CONTENT_PROCESS),
|
||||
privilegedAboutContentResult, "Check URL with query and ref in privileged about content process.");
|
||||
is(E10SUtils.canLoadURIInRemoteType(url + "?foo#bar", /* fission */ false, PRIVILEGEDMOZILLA_CONTENT_PROCESS),
|
||||
privilegedMozillaContentResult, "Check URL with query and ref in privileged mozilla content process.");
|
||||
is(E10SUtils.canLoadURIInRemoteType(url + "?foo#bar", /* fission */ false, EXTENSION_PROCESS),
|
||||
extensionProcessResult, "Check URL with query and ref in extension process.");
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ bool AboutRedirector::sAboutLoginsEnabled = false;
|
||||
static const uint32_t ACTIVITY_STREAM_FLAGS =
|
||||
nsIAboutModule::ALLOW_SCRIPT | nsIAboutModule::ENABLE_INDEXED_DB |
|
||||
nsIAboutModule::URI_MUST_LOAD_IN_CHILD |
|
||||
nsIAboutModule::URI_CAN_LOAD_IN_PRIVILEGEDABOUT_PROCESS |
|
||||
nsIAboutModule::URI_CAN_LOAD_IN_PRIVILEGED_CHILD |
|
||||
nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT;
|
||||
|
||||
struct RedirEntry {
|
||||
@ -59,7 +59,7 @@ static const RedirEntry kRedirMap[] = {
|
||||
nsIAboutModule::HIDE_FROM_ABOUTABOUT},
|
||||
{"logins", "chrome://browser/content/aboutlogins/aboutLogins.html",
|
||||
nsIAboutModule::ALLOW_SCRIPT | nsIAboutModule::URI_MUST_LOAD_IN_CHILD |
|
||||
nsIAboutModule::URI_CAN_LOAD_IN_PRIVILEGEDABOUT_PROCESS |
|
||||
nsIAboutModule::URI_CAN_LOAD_IN_PRIVILEGED_CHILD |
|
||||
nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT},
|
||||
{"tabcrashed", "chrome://browser/content/aboutTabCrashed.xhtml",
|
||||
nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
|
||||
@ -85,7 +85,7 @@ static const RedirEntry kRedirMap[] = {
|
||||
{"newtab", "about:blank", ACTIVITY_STREAM_FLAGS},
|
||||
{"welcome", "about:blank",
|
||||
nsIAboutModule::URI_MUST_LOAD_IN_CHILD |
|
||||
nsIAboutModule::URI_CAN_LOAD_IN_PRIVILEGEDABOUT_PROCESS |
|
||||
nsIAboutModule::URI_CAN_LOAD_IN_PRIVILEGED_CHILD |
|
||||
nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
|
||||
nsIAboutModule::ALLOW_SCRIPT},
|
||||
{"library", "chrome://browser/content/aboutLibrary.xhtml",
|
||||
|
@ -23,16 +23,16 @@ XPCOMUtils.defineLazyGetter(this, "log", () => {
|
||||
const ABOUT_LOGINS_ORIGIN = "about:logins";
|
||||
const MASTER_PASSWORD_NOTIFICATION_ID = "master-password-login-required";
|
||||
|
||||
const PRIVILEGEDABOUT_PROCESS_PREF =
|
||||
const PRIVILEGED_PROCESS_PREF =
|
||||
"browser.tabs.remote.separatePrivilegedContentProcess";
|
||||
const PRIVILEGEDABOUT_PROCESS_ENABLED =
|
||||
Services.prefs.getBoolPref(PRIVILEGEDABOUT_PROCESS_PREF, false);
|
||||
const PRIVILEGED_PROCESS_ENABLED =
|
||||
Services.prefs.getBoolPref(PRIVILEGED_PROCESS_PREF, false);
|
||||
|
||||
// When the privileged content process is enabled, we expect about:logins
|
||||
// to load in it. Otherwise, it's in a normal web content process.
|
||||
const EXPECTED_ABOUTLOGINS_REMOTE_TYPE =
|
||||
PRIVILEGEDABOUT_PROCESS_ENABLED ? E10SUtils.PRIVILEGEDABOUT_REMOTE_TYPE
|
||||
: E10SUtils.DEFAULT_REMOTE_TYPE;
|
||||
PRIVILEGED_PROCESS_ENABLED ? E10SUtils.PRIVILEGED_REMOTE_TYPE
|
||||
: E10SUtils.DEFAULT_REMOTE_TYPE;
|
||||
|
||||
const isValidLogin = login => {
|
||||
return !(login.hostname || "").startsWith("chrome://");
|
||||
|
@ -26,18 +26,18 @@ const BASE_URL = "resource://activity-stream/";
|
||||
const ACTIVITY_STREAM_PAGES = new Set(["home", "newtab", "welcome"]);
|
||||
|
||||
const IS_MAIN_PROCESS = Services.appinfo.processType === Services.appinfo.PROCESS_TYPE_DEFAULT;
|
||||
const IS_PRIVILEGED_PROCESS = Services.appinfo.remoteType === E10SUtils.PRIVILEGEDABOUT_REMOTE_TYPE;
|
||||
const IS_PRIVILEGED_PROCESS = Services.appinfo.remoteType === E10SUtils.PRIVILEGED_REMOTE_TYPE;
|
||||
|
||||
const IS_RELEASE_OR_BETA = AppConstants.RELEASE_OR_BETA;
|
||||
|
||||
const PREF_SEPARATE_PRIVILEGEDABOUT_CONTENT_PROCESS = "browser.tabs.remote.separatePrivilegedContentProcess";
|
||||
const PREF_SEPARATE_PRIVILEGED_CONTENT_PROCESS = "browser.tabs.remote.separatePrivilegedContentProcess";
|
||||
const PREF_ACTIVITY_STREAM_PRERENDER_ENABLED = "browser.newtabpage.activity-stream.prerender";
|
||||
const PREF_ACTIVITY_STREAM_DEBUG = "browser.newtabpage.activity-stream.debug";
|
||||
|
||||
function AboutNewTabService() {
|
||||
Services.obs.addObserver(this, TOPIC_APP_QUIT);
|
||||
Services.obs.addObserver(this, TOPIC_LOCALES_CHANGE);
|
||||
Services.prefs.addObserver(PREF_SEPARATE_PRIVILEGEDABOUT_CONTENT_PROCESS, this);
|
||||
Services.prefs.addObserver(PREF_SEPARATE_PRIVILEGED_CONTENT_PROCESS, this);
|
||||
Services.prefs.addObserver(PREF_ACTIVITY_STREAM_PRERENDER_ENABLED, this);
|
||||
if (!IS_RELEASE_OR_BETA) {
|
||||
Services.prefs.addObserver(PREF_ACTIVITY_STREAM_DEBUG, this);
|
||||
@ -93,7 +93,7 @@ AboutNewTabService.prototype = {
|
||||
_activityStreamPrerender: false,
|
||||
_activityStreamPath: "",
|
||||
_activityStreamDebug: false,
|
||||
_privilegedAboutContentProcess: false,
|
||||
_privilegedContentProcess: false,
|
||||
_overridden: false,
|
||||
willNotifyUser: false,
|
||||
|
||||
@ -106,8 +106,8 @@ AboutNewTabService.prototype = {
|
||||
observe(subject, topic, data) {
|
||||
switch (topic) {
|
||||
case "nsPref:changed":
|
||||
if (data === PREF_SEPARATE_PRIVILEGEDABOUT_CONTENT_PROCESS) {
|
||||
this._privilegedAboutContentProcess = Services.prefs.getBoolPref(PREF_SEPARATE_PRIVILEGEDABOUT_CONTENT_PROCESS);
|
||||
if (data === PREF_SEPARATE_PRIVILEGED_CONTENT_PROCESS) {
|
||||
this._privilegedContentProcess = Services.prefs.getBoolPref(PREF_SEPARATE_PRIVILEGED_CONTENT_PROCESS);
|
||||
this.updatePrerenderedPath();
|
||||
this.notifyChange();
|
||||
} else if (data === PREF_ACTIVITY_STREAM_PRERENDER_ENABLED) {
|
||||
@ -216,7 +216,7 @@ AboutNewTabService.prototype = {
|
||||
} else {
|
||||
this._activityStreamEnabled = false;
|
||||
}
|
||||
this._privilegedAboutContentProcess = Services.prefs.getBoolPref(PREF_SEPARATE_PRIVILEGEDABOUT_CONTENT_PROCESS);
|
||||
this._privilegedContentProcess = Services.prefs.getBoolPref(PREF_SEPARATE_PRIVILEGED_CONTENT_PROCESS);
|
||||
this._activityStreamPrerender = Services.prefs.getBoolPref(PREF_ACTIVITY_STREAM_PRERENDER_ENABLED);
|
||||
if (!IS_RELEASE_OR_BETA) {
|
||||
this._activityStreamDebug = Services.prefs.getBoolPref(PREF_ACTIVITY_STREAM_DEBUG, false);
|
||||
@ -233,7 +233,7 @@ AboutNewTabService.prototype = {
|
||||
// Debug files are specially packaged in a non-localized directory, but with
|
||||
// dynamic script loading, localized debug is supported.
|
||||
this._activityStreamPath = `${this._activityStreamDebug &&
|
||||
!this._privilegedAboutContentProcess ? "static" : this.activityStreamLocale}/`;
|
||||
!this._privilegedContentProcess ? "static" : this.activityStreamLocale}/`;
|
||||
},
|
||||
|
||||
/*
|
||||
@ -253,8 +253,8 @@ AboutNewTabService.prototype = {
|
||||
"activity-stream",
|
||||
this._activityStreamPrerender ? "-prerendered" : "",
|
||||
// Debug version loads dev scripts but noscripts separately loads scripts
|
||||
this._activityStreamDebug && !this._privilegedAboutContentProcess ? "-debug" : "",
|
||||
this._privilegedAboutContentProcess ? "-noscripts" : "",
|
||||
this._activityStreamDebug && !this._privilegedContentProcess ? "-debug" : "",
|
||||
this._privilegedContentProcess ? "-noscripts" : "",
|
||||
".html",
|
||||
].join("");
|
||||
},
|
||||
@ -351,7 +351,7 @@ AboutNewTabService.prototype = {
|
||||
}
|
||||
Services.obs.removeObserver(this, TOPIC_APP_QUIT);
|
||||
Services.obs.removeObserver(this, TOPIC_LOCALES_CHANGE);
|
||||
Services.prefs.removeObserver(PREF_SEPARATE_PRIVILEGEDABOUT_CONTENT_PROCESS, this);
|
||||
Services.prefs.removeObserver(PREF_SEPARATE_PRIVILEGED_CONTENT_PROCESS, this);
|
||||
Services.prefs.removeObserver(PREF_ACTIVITY_STREAM_PRERENDER_ENABLED, this);
|
||||
if (!IS_RELEASE_OR_BETA) {
|
||||
Services.prefs.removeObserver(PREF_ACTIVITY_STREAM_DEBUG, this);
|
||||
|
@ -9,17 +9,17 @@
|
||||
|
||||
"use strict";
|
||||
|
||||
const PRIVILEGEDABOUT_PROCESS_PREF =
|
||||
const PRIVILEGED_PROCESS_PREF =
|
||||
"browser.tabs.remote.separatePrivilegedContentProcess";
|
||||
const PRIVILEGEDABOUT_PROCESS_ENABLED =
|
||||
Services.prefs.getBoolPref(PRIVILEGEDABOUT_PROCESS_PREF);
|
||||
const PRIVILEGED_PROCESS_ENABLED =
|
||||
Services.prefs.getBoolPref(PRIVILEGED_PROCESS_PREF);
|
||||
|
||||
const REMOTE_BROWSER_SHOWN = "remote-browser-shown";
|
||||
|
||||
// When the privileged content process is enabled, we expect about:home
|
||||
// to load in it. Otherwise, it's in a normal web content process.
|
||||
const EXPECTED_ABOUTHOME_REMOTE_TYPE =
|
||||
PRIVILEGEDABOUT_PROCESS_ENABLED ? E10SUtils.PRIVILEGEDABOUT_REMOTE_TYPE
|
||||
PRIVILEGED_PROCESS_ENABLED ? E10SUtils.PRIVILEGED_REMOTE_TYPE
|
||||
: E10SUtils.DEFAULT_REMOTE_TYPE;
|
||||
|
||||
/**
|
||||
|
@ -141,7 +141,7 @@ function swapToInnerBrowser({ tab, containerURL, getInnerBrowser }) {
|
||||
// Bug 1510806 has been filed to fix this properly, by making RDM resilient
|
||||
// to process flips.
|
||||
if (mustChangeProcess &&
|
||||
tab.linkedBrowser.remoteType == "privilegedabout") {
|
||||
tab.linkedBrowser.remoteType == "privileged") {
|
||||
debug(`Tab must flip away from the privileged content process ` +
|
||||
`on navigation`);
|
||||
gBrowser.updateBrowserRemoteness(tab.linkedBrowser, {
|
||||
|
@ -710,9 +710,8 @@ already_AddRefed<Promise> ChromeUtils::RequestProcInfo(GlobalObject& aGlobal,
|
||||
type = mozilla::ProcType::File;
|
||||
} else if (processType.EqualsLiteral(EXTENSION_REMOTE_TYPE)) {
|
||||
type = mozilla::ProcType::Extension;
|
||||
} else if (processType.EqualsLiteral(
|
||||
PRIVILEGEDABOUT_REMOTE_TYPE)) {
|
||||
type = mozilla::ProcType::PrivilegedAbout;
|
||||
} else if (processType.EqualsLiteral(PRIVILEGED_REMOTE_TYPE)) {
|
||||
type = mozilla::ProcType::Privileged;
|
||||
} else if (processType.EqualsLiteral(
|
||||
LARGE_ALLOCATION_REMOTE_TYPE)) {
|
||||
type = mozilla::ProcType::WebLargeAllocation;
|
||||
|
@ -415,7 +415,7 @@ enum ProcType {
|
||||
"web",
|
||||
"file",
|
||||
"extension",
|
||||
"privilegedabout",
|
||||
"privileged",
|
||||
"webLargeAllocation",
|
||||
"gpu",
|
||||
"rdd",
|
||||
|
@ -2723,7 +2723,7 @@ mozilla::ipc::IPCResult ContentChild::RecvRemoteType(
|
||||
SetProcessName(NS_LITERAL_STRING("file:// Content"));
|
||||
} else if (aRemoteType.EqualsLiteral(EXTENSION_REMOTE_TYPE)) {
|
||||
SetProcessName(NS_LITERAL_STRING("WebExtensions"));
|
||||
} else if (aRemoteType.EqualsLiteral(PRIVILEGEDABOUT_REMOTE_TYPE)) {
|
||||
} else if (aRemoteType.EqualsLiteral(PRIVILEGED_REMOTE_TYPE)) {
|
||||
SetProcessName(NS_LITERAL_STRING("Privileged Content"));
|
||||
} else if (aRemoteType.EqualsLiteral(LARGE_ALLOCATION_REMOTE_TYPE)) {
|
||||
SetProcessName(NS_LITERAL_STRING("Large Allocation Web Content"));
|
||||
|
@ -52,8 +52,7 @@
|
||||
#define DEFAULT_REMOTE_TYPE "web"
|
||||
#define FILE_REMOTE_TYPE "file"
|
||||
#define EXTENSION_REMOTE_TYPE "extension"
|
||||
#define PRIVILEGEDABOUT_REMOTE_TYPE "privilegedabout"
|
||||
#define PRIVILEGEDMOZILLA_REMOTE_TYPE "privilegedmozilla"
|
||||
#define PRIVILEGED_REMOTE_TYPE "privileged"
|
||||
|
||||
// This must start with the DEFAULT_REMOTE_TYPE above.
|
||||
#define LARGE_ALLOCATION_REMOTE_TYPE "webLargeAllocation"
|
||||
|
@ -92,7 +92,7 @@ declTest("getActor with remoteType match", {
|
||||
});
|
||||
|
||||
declTest("getActor with remoteType mismatch", {
|
||||
remoteTypes: ["privilegedabout"],
|
||||
remoteTypes: ["privileged"],
|
||||
url: TEST_URL,
|
||||
|
||||
async test(browser) {
|
||||
|
@ -188,8 +188,8 @@ ProcessType ScriptPreloader::GetChildProcessType(const nsAString& remoteType) {
|
||||
if (remoteType.EqualsLiteral(EXTENSION_REMOTE_TYPE)) {
|
||||
return ProcessType::Extension;
|
||||
}
|
||||
if (remoteType.EqualsLiteral(PRIVILEGEDABOUT_REMOTE_TYPE)) {
|
||||
return ProcessType::PrivilegedAbout;
|
||||
if (remoteType.EqualsLiteral(PRIVILEGED_REMOTE_TYPE)) {
|
||||
return ProcessType::Privileged;
|
||||
}
|
||||
return ProcessType::Web;
|
||||
}
|
||||
@ -346,9 +346,9 @@ void ScriptPreloader::FinishContentStartup() {
|
||||
|
||||
#ifdef DEBUG
|
||||
if (mContentStartupFinishedTopic.Equals(CONTENT_DOCUMENT_LOADED_TOPIC)) {
|
||||
MOZ_ASSERT(sProcessType == ProcessType::PrivilegedAbout);
|
||||
MOZ_ASSERT(sProcessType == ProcessType::Privileged);
|
||||
} else {
|
||||
MOZ_ASSERT(sProcessType != ProcessType::PrivilegedAbout);
|
||||
MOZ_ASSERT(sProcessType != ProcessType::Privileged);
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
|
||||
@ -457,7 +457,7 @@ Result<Ok, nsresult> ScriptPreloader::InitCache(
|
||||
nsCOMPtr<nsIObserverService> obs = services::GetObserverService();
|
||||
MOZ_RELEASE_ASSERT(obs);
|
||||
|
||||
if (sProcessType == ProcessType::PrivilegedAbout) {
|
||||
if (sProcessType == ProcessType::Privileged) {
|
||||
// Since we control all of the documents loaded in the privileged
|
||||
// content process, we can increase the window of active time for the
|
||||
// ScriptPreloader to include the scripts that are loaded until the
|
||||
|
@ -46,7 +46,7 @@ enum class ProcessType : uint8_t {
|
||||
Parent,
|
||||
Web,
|
||||
Extension,
|
||||
PrivilegedAbout,
|
||||
Privileged,
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
|
@ -861,4 +861,3 @@ pref("extensions.systemAddon.update.url", "https://aus5.mozilla.org/update/3/Sys
|
||||
pref("browser.tabs.remote.separateFileUriProcess", false);
|
||||
pref("browser.tabs.remote.allowLinkedWebInFileUriProcess", true);
|
||||
pref("browser.tabs.remote.separatePrivilegedContentProcess", false);
|
||||
pref("browser.tabs.remote.separatePrivilegedMozillaWebContentProcess", false);
|
||||
|
@ -3348,17 +3348,13 @@ pref("dom.ipc.processCount.file", 1);
|
||||
// WebExtensions only support a single extension process.
|
||||
pref("dom.ipc.processCount.extension", 1);
|
||||
|
||||
// The privileged about process only supports a single content process.
|
||||
pref("dom.ipc.processCount.privilegedabout", 1);
|
||||
// Privileged content only supports a single content process.
|
||||
pref("dom.ipc.processCount.privileged", 1);
|
||||
|
||||
// Limit the privileged mozilla process to a single instance only
|
||||
// to avoid multiple of these content processes
|
||||
pref("dom.ipc.processCount.privilegedmozilla", 1);
|
||||
|
||||
// Keep a single privileged about process alive for performance reasons.
|
||||
// Keep a single privileged content process alive for performance reasons.
|
||||
// e.g. we do not want to throw content processes out every time we navigate
|
||||
// away from about:newtab.
|
||||
pref("dom.ipc.keepProcessesAlive.privilegedabout", 1);
|
||||
pref("dom.ipc.keepProcessesAlive.privileged", 1);
|
||||
|
||||
// Whether a native event loop should be used in the content process.
|
||||
#if defined(XP_WIN) || defined(XP_MACOSX)
|
||||
@ -3390,19 +3386,9 @@ pref("browser.tabs.remote.separateFileUriProcess", true);
|
||||
// content process, causes compatibility issues.
|
||||
pref("browser.tabs.remote.allowLinkedWebInFileUriProcess", true);
|
||||
|
||||
// Pref to control whether we use a separate privileged content process
|
||||
// for about: pages. This pref name did not age well: we will have multiple
|
||||
// types of privileged content processes, each with different privileges.
|
||||
// Pref to control whether we use separate privileged content processes.
|
||||
pref("browser.tabs.remote.separatePrivilegedContentProcess", false);
|
||||
|
||||
// Pref to control whether we use a separate privileged content process
|
||||
// for certain mozilla webpages (which are listed in the following pref).
|
||||
pref("browser.tabs.remote.separatePrivilegedMozillaWebContentProcess", false);
|
||||
|
||||
// The domains we will isolate into the Mozilla Content Process. Comma-separated
|
||||
// full domains: any subdomains of the domains listed will also be allowed.
|
||||
pref("browser.tabs.remote.separatedMozillaDomains", "addons.mozilla.org,accounts.firefox.com");
|
||||
|
||||
// When this pref is enabled top level loads with a mismatched
|
||||
// Cross-Origin-Opener-Policy header will be loaded in a separate process.
|
||||
pref("browser.tabs.remote.useCrossOriginOpenerPolicy", false);
|
||||
|
@ -76,10 +76,10 @@ interface nsIAboutModule : nsISupports
|
||||
|
||||
/**
|
||||
* A flag that indicates that this URI can be loaded in the privileged
|
||||
* activity stream content process if said process is enabled. Ignored unless
|
||||
* content process if privileged content process is enabled. Ignored unless
|
||||
* URI_MUST_LOAD_IN_CHILD is also specified.
|
||||
*/
|
||||
const unsigned long URI_CAN_LOAD_IN_PRIVILEGEDABOUT_PROCESS = (1 << 8);
|
||||
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).
|
||||
|
@ -33,14 +33,6 @@ ChromeUtils.defineModuleGetter(this, "FxAccountsPairingFlow",
|
||||
"resource://gre/modules/FxAccountsPairing.jsm");
|
||||
XPCOMUtils.defineLazyPreferenceGetter(this, "pairingEnabled",
|
||||
"identity.fxaccounts.pairing.enabled");
|
||||
XPCOMUtils.defineLazyPreferenceGetter(this, "separatePrivilegedMozillaWebContentProcess",
|
||||
"browser.tabs.remote.separatePrivilegedMozillaWebContentProcess", false);
|
||||
XPCOMUtils.defineLazyPreferenceGetter(this, "separatedMozillaDomains",
|
||||
"browser.tabs.remote.separatedMozillaDomains", false,
|
||||
false, val => val.split(","));
|
||||
XPCOMUtils.defineLazyPreferenceGetter(this, "accountServer",
|
||||
"identity.fxaccounts.remote.root", false, false,
|
||||
val => Services.io.newURI(val));
|
||||
|
||||
// These engines were added years after Sync had been introduced, they need
|
||||
// special handling since they are system add-ons and are un-available on
|
||||
@ -150,16 +142,6 @@ this.FxAccountsWebChannel.prototype = {
|
||||
_receiveMessage(message, sendingContext) {
|
||||
const {command, data} = message;
|
||||
|
||||
let shouldCheckRemoteType = separatePrivilegedMozillaWebContentProcess &&
|
||||
separatedMozillaDomains.some(function(val) {
|
||||
return accountServer.asciiHost == val || accountServer.asciiHost.endsWith("." + val);
|
||||
});
|
||||
if (shouldCheckRemoteType &&
|
||||
sendingContext.browser.remoteType != "privilegedmozilla") {
|
||||
log.error("Rejected FxA webchannel message from remoteType = " + sendingContext.browser.remoteType);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (command) {
|
||||
case COMMAND_PROFILE_CHANGE:
|
||||
Services.obs.notifyObservers(null, ON_PROFILE_CHANGE_NOTIFICATION, data.uid);
|
||||
|
@ -4,13 +4,9 @@
|
||||
|
||||
process-type-web = Web Content
|
||||
|
||||
# process used to run privileged about pages,
|
||||
# process used to run privileged pages,
|
||||
# such as about:home
|
||||
process-type-privilegedabout = Privileged About
|
||||
|
||||
# process used to run privileged mozilla pages,
|
||||
# such as accounts.firefox.com
|
||||
process-type-privilegedmozilla = Privileged Mozilla Content
|
||||
process-type-privileged = Privileged Content
|
||||
|
||||
process-type-extension = Extension
|
||||
|
||||
|
@ -13,13 +13,8 @@ XPCOMUtils.defineLazyPreferenceGetter(this, "useSeparateFileUriProcess",
|
||||
"browser.tabs.remote.separateFileUriProcess", false);
|
||||
XPCOMUtils.defineLazyPreferenceGetter(this, "allowLinkedWebInFileUriProcess",
|
||||
"browser.tabs.remote.allowLinkedWebInFileUriProcess", false);
|
||||
XPCOMUtils.defineLazyPreferenceGetter(this, "useSeparatePrivilegedAboutContentProcess",
|
||||
XPCOMUtils.defineLazyPreferenceGetter(this, "useSeparatePrivilegedContentProcess",
|
||||
"browser.tabs.remote.separatePrivilegedContentProcess", false);
|
||||
XPCOMUtils.defineLazyPreferenceGetter(this, "separatePrivilegedMozillaWebContentProcess",
|
||||
"browser.tabs.remote.separatePrivilegedMozillaWebContentProcess", false);
|
||||
XPCOMUtils.defineLazyPreferenceGetter(this, "separatedMozillaDomains",
|
||||
"browser.tabs.remote.separatedMozillaDomains", false,
|
||||
false, val => val.split(","));
|
||||
XPCOMUtils.defineLazyPreferenceGetter(this, "useHttpResponseProcessSelection",
|
||||
"browser.tabs.remote.useHTTPResponseProcessSelection", false);
|
||||
XPCOMUtils.defineLazyPreferenceGetter(this, "useCrossOriginOpenerPolicy",
|
||||
@ -51,24 +46,13 @@ const NOT_REMOTE = null;
|
||||
const WEB_REMOTE_TYPE = "web";
|
||||
const FILE_REMOTE_TYPE = "file";
|
||||
const EXTENSION_REMOTE_TYPE = "extension";
|
||||
const PRIVILEGEDABOUT_REMOTE_TYPE = "privilegedabout";
|
||||
const PRIVILEGEDMOZILLA_REMOTE_TYPE = "privilegedmozilla";
|
||||
const PRIVILEGED_REMOTE_TYPE = "privileged";
|
||||
|
||||
// This must start with the WEB_REMOTE_TYPE above.
|
||||
const LARGE_ALLOCATION_REMOTE_TYPE = "webLargeAllocation";
|
||||
const DEFAULT_REMOTE_TYPE = WEB_REMOTE_TYPE;
|
||||
|
||||
function validatedWebRemoteType(aPreferredRemoteType, aTargetUri, aCurrentUri, aRemoteSubframes) {
|
||||
// To load into the Privileged Mozilla Content Process you must be https,
|
||||
// and be an exact match or a subdomain of an allowlisted domain.
|
||||
if (separatePrivilegedMozillaWebContentProcess &&
|
||||
aTargetUri.asciiHost && aTargetUri.scheme == "https" &&
|
||||
separatedMozillaDomains.some(function(val) {
|
||||
return aTargetUri.asciiHost == val || aTargetUri.asciiHost.endsWith("." + val);
|
||||
})) {
|
||||
return PRIVILEGEDMOZILLA_REMOTE_TYPE;
|
||||
}
|
||||
|
||||
// If the domain is whitelisted to allow it to use file:// URIs, then we have
|
||||
// to run it in a file content process, in case it uses file:// sub-resources.
|
||||
const sm = Services.scriptSecurityManager;
|
||||
@ -119,8 +103,7 @@ var E10SUtils = {
|
||||
WEB_REMOTE_TYPE,
|
||||
FILE_REMOTE_TYPE,
|
||||
EXTENSION_REMOTE_TYPE,
|
||||
PRIVILEGEDABOUT_REMOTE_TYPE,
|
||||
PRIVILEGEDMOZILLA_REMOTE_TYPE,
|
||||
PRIVILEGED_REMOTE_TYPE,
|
||||
LARGE_ALLOCATION_REMOTE_TYPE,
|
||||
|
||||
useHttpResponseProcessSelection() {
|
||||
@ -252,9 +235,9 @@ var E10SUtils = {
|
||||
}
|
||||
|
||||
if (flags & Ci.nsIAboutModule.URI_MUST_LOAD_IN_CHILD) {
|
||||
if ((flags & Ci.nsIAboutModule.URI_CAN_LOAD_IN_PRIVILEGEDABOUT_PROCESS) &&
|
||||
useSeparatePrivilegedAboutContentProcess) {
|
||||
return PRIVILEGEDABOUT_REMOTE_TYPE;
|
||||
if ((flags & Ci.nsIAboutModule.URI_CAN_LOAD_IN_PRIVILEGED_CHILD) &&
|
||||
useSeparatePrivilegedContentProcess) {
|
||||
return PRIVILEGED_REMOTE_TYPE;
|
||||
}
|
||||
return DEFAULT_REMOTE_TYPE;
|
||||
}
|
||||
|
@ -13,12 +13,6 @@
|
||||
ChromeUtils.defineModuleGetter(this, "AppConstants",
|
||||
"resource://gre/modules/AppConstants.jsm");
|
||||
|
||||
const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
XPCOMUtils.defineLazyPreferenceGetter(this, "separatePrivilegedMozillaWebContentProcess",
|
||||
"browser.tabs.remote.separatePrivilegedMozillaWebContentProcess", false);
|
||||
XPCOMUtils.defineLazyPreferenceGetter(this, "extensionsWebAPITesting",
|
||||
"extensions.webapi.testing", false);
|
||||
|
||||
// The old XPInstall error codes
|
||||
const EXECUTION_ERROR = -203;
|
||||
const CANT_READ_ARCHIVE = -207;
|
||||
@ -222,12 +216,6 @@ amManager.prototype = {
|
||||
}
|
||||
|
||||
case MSG_PROMISE_REQUEST: {
|
||||
if (!extensionsWebAPITesting &&
|
||||
separatePrivilegedMozillaWebContentProcess && aMessage.target &&
|
||||
aMessage.target.remoteType != null && aMessage.target.remoteType !== "privilegedmozilla") {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
let mm = aMessage.target.messageManager;
|
||||
let resolve = (value) => {
|
||||
mm.sendAsyncMessage(MSG_PROMISE_RESULT, {
|
||||
@ -252,23 +240,11 @@ amManager.prototype = {
|
||||
}
|
||||
|
||||
case MSG_INSTALL_CLEANUP: {
|
||||
if (!extensionsWebAPITesting &&
|
||||
separatePrivilegedMozillaWebContentProcess && aMessage.target &&
|
||||
aMessage.target.remoteType != null && aMessage.target.remoteType !== "privilegedmozilla") {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
AddonManager.webAPI.clearInstalls(payload.ids);
|
||||
break;
|
||||
}
|
||||
|
||||
case MSG_ADDON_EVENT_REQ: {
|
||||
if (!extensionsWebAPITesting &&
|
||||
separatePrivilegedMozillaWebContentProcess && aMessage.target &&
|
||||
aMessage.target.remoteType != null && aMessage.target.remoteType !== "privilegedmozilla") {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
let target = aMessage.target.messageManager;
|
||||
if (payload.enabled) {
|
||||
this._addAddonListener(target);
|
||||
|
@ -18,7 +18,7 @@ enum class ProcType {
|
||||
Web,
|
||||
File,
|
||||
Extension,
|
||||
PrivilegedAbout,
|
||||
Privileged,
|
||||
WebLargeAllocation,
|
||||
// GPU process (only on Windows)
|
||||
Gpu,
|
||||
|
Loading…
Reference in New Issue
Block a user