Bug 1747261: enable ServiceWorker process-isolation for all domains r=jdescottes

Differential Revision: https://phabricator.services.mozilla.com/D134505
This commit is contained in:
Randell Jesup 2022-01-24 19:38:01 +00:00
Родитель e27a6d1ff0
Коммит acfbcd62fe
5 изменённых файлов: 11 добавлений и 44 удалений

Просмотреть файл

@ -121,9 +121,14 @@ add_task(async function() {
await removeTab(gBrowser.selectedTab);
});
// Test setting breakpoints while the service worker is starting up.
add_task(async function() {
info("Subtest #4");
if (Services.appinfo.fissionAutostart) {
// Disabled when serviceworker isolation is used due to bug 1749341
return;
}
const toolbox = await openNewTabAndToolbox(
EXAMPLE_URL + "doc-service-workers.html",

Просмотреть файл

@ -322,28 +322,9 @@ add_task(async function test() {
// ## Fission Isolation
if (Services.appinfo.fissionAutostart) {
const fissionUrl = "example.com";
const fissionRemoteType = `webIsolated=https://example.com`;
await do_test_sw(fissionUrl, fissionRemoteType, "synthetic", null);
await do_test_sw(fissionUrl, fissionRemoteType, "synthetic", fileBlob);
// ## ServiceWorker isolation via allow-list
// ## ServiceWorker isolation
const isolateUrl = "example.com";
const isolateRemoteType = `webServiceWorker=https://` + isolateUrl;
await SpecialPowers.pushPrefEnv({
set: [
[
"browser.tabs.remote.serviceWorkerIsolationList",
"https://" + isolateUrl,
],
[
"browser.tabs.remote.separatePrivilegedMozillaWebContentProcess",
false,
],
["browser.tabs.remote.separatedMozillaDomains", ""],
],
});
await do_test_sw(isolateUrl, isolateRemoteType, "synthetic", null);
await do_test_sw(isolateUrl, isolateRemoteType, "synthetic", fileBlob);
}

Просмотреть файл

@ -1432,14 +1432,6 @@
value: true
mirror: always
# Temporary pref which makes certain ServiceWorkers be isolated in special
# processes instead of within a the normal web/webIsolated process based on
# the URI. Entries are separated by commas
- name: browser.tabs.remote.serviceWorkerIsolationList
type: String
value: ""
mirror: never
# When this pref is enabled, opaque response is only allowed to enter the
# content process if it's a response for media (audio, image, video), CSS, or
# JavaScript.

Просмотреть файл

@ -44,16 +44,6 @@ XPCOMUtils.defineLazyPreferenceGetter(
"browser.tabs.remote.useCrossOriginOpenerPolicy",
false
);
// Preference containing the list (comma separated) of origins that will
// have ServiceWorkers isolated in special processes
XPCOMUtils.defineLazyPreferenceGetter(
this,
"serviceWorkerIsolationList",
"browser.tabs.remote.serviceWorkerIsolationList",
"",
false,
val => val.split(",")
);
XPCOMUtils.defineLazyServiceGetter(
this,
"serializationHelper",
@ -250,10 +240,7 @@ function validatedWebRemoteType(
if (
aIsWorker &&
aWorkerType === Ci.nsIE10SUtils.REMOTE_WORKER_TYPE_SERVICE &&
serviceWorkerIsolationList.some(function(val) {
return targetPrincipal.siteOriginNoSuffix == val;
})
aWorkerType === Ci.nsIE10SUtils.REMOTE_WORKER_TYPE_SERVICE
) {
return `${SERVICEWORKER_REMOTE_TYPE}=${targetPrincipal.siteOrigin}`;
}
@ -289,6 +276,7 @@ var E10SUtils = {
PRIVILEGEDMOZILLA_REMOTE_TYPE,
LARGE_ALLOCATION_REMOTE_TYPE,
FISSION_WEB_REMOTE_TYPE,
SERVICEWORKER_REMOTE_TYPE,
/**
* @param aURI The URI of the about page

Просмотреть файл

@ -44,6 +44,7 @@ const {
NOT_REMOTE,
PRIVILEGEDABOUT_REMOTE_TYPE,
PRIVILEGEDMOZILLA_REMOTE_TYPE,
SERVICEWORKER_REMOTE_TYPE,
WEB_REMOTE_COOP_COEP_TYPE_PREFIX,
WEB_REMOTE_TYPE,
} = E10SUtils;
@ -77,7 +78,7 @@ add_task(function test_get_remote_type_for_service_worker() {
// - content principal + any preferred remote type => web remote type
// - fission enabled:
// - extension principal + any preferred remote type => extension remote type
// - content principal + any preferred remote type => webIsolated=siteOrigin remote type
// - content principal + any preferred remote type => webServiceWorker=siteOrigin remote type
function* getTestCase(fission = false) {
const TEST_PRINCIPALS = [
principalSecureCom,
@ -129,7 +130,7 @@ add_task(function test_get_remote_type_for_service_worker() {
// Test cases for e10s mode + fission enabled.
for (const testCase of getTestCase(true)) {
const [msg, principal, ...args] = testCase;
let expected = `${FISSION_WEB_REMOTE_TYPE}=${principal.siteOrigin}`;
let expected = `${SERVICEWORKER_REMOTE_TYPE}=${principal.siteOrigin}`;
if (principal == principalExtension) {
expected = WebExtensionPolicy.useRemoteWebExtensions