Backed out changeset 1bcc96832309 (bug 1747261) for causing mochitest-devtools failures on browser_dbg-windowless-service-workers.js. CLOSED TREE

This commit is contained in:
Iulian Moraru 2022-01-08 21:32:24 +02:00
Родитель 64a4726936
Коммит 7f6a59432d
4 изменённых файлов: 44 добавлений и 6 удалений

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

@ -322,9 +322,28 @@ add_task(async function test() {
// ## Fission Isolation
if (Services.appinfo.fissionAutostart) {
// ## ServiceWorker isolation
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
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);
}

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

@ -1427,6 +1427,14 @@
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,6 +44,16 @@ 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",
@ -237,7 +247,10 @@ function validatedWebRemoteType(
if (
aIsWorker &&
aWorkerType === Ci.nsIE10SUtils.REMOTE_WORKER_TYPE_SERVICE
aWorkerType === Ci.nsIE10SUtils.REMOTE_WORKER_TYPE_SERVICE &&
serviceWorkerIsolationList.some(function(val) {
return targetPrincipal.siteOriginNoSuffix == val;
})
) {
return `${SERVICEWORKER_REMOTE_TYPE}=${targetPrincipal.siteOrigin}`;
}
@ -273,7 +286,6 @@ 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,7 +44,6 @@ const {
NOT_REMOTE,
PRIVILEGEDABOUT_REMOTE_TYPE,
PRIVILEGEDMOZILLA_REMOTE_TYPE,
SERVICEWORKER_REMOTE_TYPE,
WEB_REMOTE_COOP_COEP_TYPE_PREFIX,
WEB_REMOTE_TYPE,
} = E10SUtils;
@ -78,7 +77,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 => webServiceWorker=siteOrigin remote type
// - content principal + any preferred remote type => webIsolated=siteOrigin remote type
function* getTestCase(fission = false) {
const TEST_PRINCIPALS = [
principalSecureCom,
@ -130,7 +129,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 = `${SERVICEWORKER_REMOTE_TYPE}=${principal.siteOrigin}`;
let expected = `${FISSION_WEB_REMOTE_TYPE}=${principal.siteOrigin}`;
if (principal == principalExtension) {
expected = WebExtensionPolicy.useRemoteWebExtensions