Bug 1496997 - Remove dom.serviceWorkers.parent_intercept pref r=asuth,dom-workers-and-storage-reviewers,perftest-reviewers,jgraham,sparky,webdriver-reviewers,whimboo

Differential Revision: https://phabricator.services.mozilla.com/D101788
This commit is contained in:
Yaron Tausky 2021-06-15 08:52:39 +00:00
parent 5ca749b2ba
commit 768366d7b8
22 changed files with 20 additions and 110 deletions

View File

@ -123,8 +123,7 @@ function installTemporaryExtension() {
function pushServiceWorker(id, registrationFront) {
return async ({ dispatch, getState }) => {
try {
// The push button is only available if canDebugServiceWorkers is true,
// which is only true if dom.serviceWorkers.parent_intercept is true.
// The push button is only available if canDebugServiceWorkers is true.
// With this configuration, `push` should always be called on the
// registration front, and not on the (service) WorkerTargetActor.
await registrationFront.push();

View File

@ -114,9 +114,8 @@ static const RedirEntry kRedirMap[] = {
{"processes", "chrome://global/content/aboutProcesses.html",
nsIAboutModule::ALLOW_SCRIPT},
// about:serviceworkers always wants to load in the parent process because
// when dom.serviceWorkers.parent_intercept is set to true (the new default)
// then the only place nsIServiceWorkerManager has any data is in the
// parent process.
// the only place nsIServiceWorkerManager has any data is in the parent
// process.
//
// There is overlap without about:debugging, but about:debugging is not
// available on mobile at this time, and it's useful to be able to know if

View File

@ -176,10 +176,7 @@
};
}
let shutdownTopic =
SpecialPowers.getBoolPref("dom.serviceWorkers.parent_intercept", false) ?
"specialpowers-service-worker-shutdown" :
"service-worker-shutdown";
let shutdownTopic = "specialpowers-service-worker-shutdown";
SpecialPowers.registerObservers("service-worker-shutdown");
function setShutdownObserver(expectingEvent) {

View File

@ -76,8 +76,7 @@ class ServiceWorkerUpdateFinishCallback {
* installation, querying and event dispatch of ServiceWorkers for all the
* origins in the process.
*
* NOTE: the following documentation is a WIP and only applies with
* dom.serviceWorkers.parent_intercept=true:
* NOTE: the following documentation is a WIP:
*
* The ServiceWorkerManager (SWM) is a main-thread, parent-process singleton
* that encapsulates the browser-global state of service workers. This state

View File

@ -23,10 +23,7 @@ let registration = null;
async function startAndStopServiceWorker() {
SpecialPowers.registerObservers("service-worker-shutdown");
const spTopic =
SpecialPowers.getBoolPref("dom.serviceWorkers.parent_intercept") ?
"specialpowers-service-worker-shutdown" :
"service-worker-shutdown";
const spTopic = "specialpowers-service-worker-shutdown";
const origIdleTimeout =
SpecialPowers.getIntPref("dom.serviceWorkers.idle_timeout");

View File

@ -80,23 +80,15 @@
});
}
let getScope;
let parent_intercept_enabled =
SpecialPowers.getBoolPref("dom.serviceWorkers.parent_intercept");
let chromeScript = SpecialPowers.loadChromeScript(chromeScriptSource);
let docPrincipal = SpecialPowers.wrap(document).nodePrincipal.spec;
if (parent_intercept_enabled) {
let chromeScript = SpecialPowers.loadChromeScript(chromeScriptSource);
let docPrincipal = SpecialPowers.wrap(document).nodePrincipal.spec;
getScope = async (path) => {
let rv = await chromeScript.sendQuery("getScope", { principal: docPrincipal, path });
if (rv.exception)
throw rv.exception;
return rv.scope;
};
} else {
getScope = navigator.serviceWorker.getScopeForUrl.bind(navigator.serviceWorker);
}
getScope = async (path) => {
let rv = await chromeScript.sendQuery("getScope", { principal: docPrincipal, path });
if (rv.exception)
throw rv.exception;
return rv.scope;
};
var base = new URL(".", document.baseURI);

View File

@ -7,7 +7,6 @@ add_task(async function setup() {
["dom.ipc.processCount.privilegedmozilla", 1],
["dom.serviceWorkers.enabled", true],
["dom.serviceWorkers.testing.enabled", true],
["dom.serviceworkers.parent_intercept", true],
],
});
});

View File

@ -637,7 +637,7 @@ function BuildConditionSandbox(aURL) {
// Running with a variant enabled?
sandbox.fission = Services.appinfo.fissionAutostart;
sandbox.serviceWorkerE10s = prefs.getBoolPref("dom.serviceWorkers.parent_intercept", false);
sandbox.serviceWorkerE10s = true;
if (!g.dumpedConditionSandbox) {
g.logger.info("Dumping JSON representation of sandbox");

View File

@ -3087,13 +3087,6 @@
value: false
mirror: always
# If true. then the service worker interception and the ServiceWorkerManager
# will live in the parent process. This only takes effect on browser start.
- name: dom.serviceWorkers.parent_intercept
type: bool
value: true
mirror: never
- name: dom.serviceWorkers.testing.enabled
type: RelaxedAtomicBool
value: false

View File

@ -639,9 +639,7 @@ class PuppeteerTest(MachCommandBase):
options[kv[0]] = kv[1].strip()
if enable_fission:
prefs.update(
{"fission.autostart": True, "dom.serviceWorkers.parent_intercept": True}
)
prefs.update({"fission.autostart": True})
if verbosity == 1:
prefs["remote.log.level"] = "Debug"

View File

@ -242,7 +242,6 @@ TEST_VARIANTS = {
"mozharness": {
"extra-options": [
"--setpref=fission.autostart=true",
"--setpref=dom.serviceWorkers.parent_intercept=true",
],
},
},
@ -258,7 +257,6 @@ TEST_VARIANTS = {
"mozharness": {
"extra-options": [
"--setpref=fission.autostart=true",
"--setpref=dom.serviceWorkers.parent_intercept=true",
"--enable-xorigin-tests",
],
},

View File

@ -1166,7 +1166,6 @@ class MochitestArguments(ArgumentContainer):
if options.enable_fission:
options.extraPrefs.append("fission.autostart=true")
options.extraPrefs.append("dom.serviceWorkers.parent_intercept=true")
options.leakThresholds = {
"default": options.defaultLeakThreshold,

View File

@ -2868,9 +2868,7 @@ toolbar#nav-bar {
#
# Currently for automation, the pref defaults to true (but can be
# overridden with --setpref).
"serviceworker_e10s": self.extraPrefs.get(
"dom.serviceWorkers.parent_intercept", True
),
"serviceworker_e10s": True,
"sessionHistoryInParent": self.extraPrefs.get(
"fission.sessionHistoryInParent", False
)

View File

@ -51,7 +51,6 @@ def main(args=sys.argv[1:]):
args.extra_prefs.update(
{
"fission.autostart": True,
"dom.serviceWorkers.parent_intercept": True,
}
)

View File

@ -519,30 +519,6 @@ class SpecialPowersChild extends JSWindowActorChild {
}
async registeredServiceWorkers() {
// For the time being, if parent_intercept is false, we can assume that
// ServiceWorkers registered by the current test are all known to the SWM in
// this process.
if (
!Services.prefs.getBoolPref("dom.serviceWorkers.parent_intercept", false)
) {
let swm = Cc["@mozilla.org/serviceworkers/manager;1"].getService(
Ci.nsIServiceWorkerManager
);
let regs = swm.getAllRegistrations();
// XXX This is shared with SpecialPowersAPIParent.jsm
let workers = new Array(regs.length);
for (let i = 0; i < workers.length; ++i) {
let { scope, scriptSpec } = regs.queryElementAt(
i,
Ci.nsIServiceWorkerRegistrationInfo
);
workers[i] = { scope, scriptSpec };
}
return workers;
}
// Please see the comment in SpecialPowersObserver.jsm above
// this._serviceWorkerListener's assignment for what this returns.
if (this._serviceWorkerRegistered) {

View File

@ -165,7 +165,6 @@ def run_tests(config, browser_config):
if browser_config.get("enable_fission", False):
browser_config["preferences"]["fission.autostart"] = True
browser_config["preferences"]["dom.serviceWorkers.parent_intercept"] = True
browser_config["preferences"]["network.proxy.type"] = 2
browser_config["preferences"]["network.proxy.autoconfig_url"] = (

View File

@ -58,7 +58,6 @@ run_infos = {
"wasm": True,
"e10s": True,
"headless": False,
"sw-e10s": True,
"fission": True,
"sessionHistoryInParent": True,
"swgl": False,
@ -110,7 +109,6 @@ run_infos = {
"wasm": True,
"e10s": True,
"headless": False,
"sw-e10s": True,
"fission": False,
"sessionHistoryInParent": False,
"swgl": False,
@ -162,7 +160,6 @@ run_infos = {
"wasm": True,
"e10s": True,
"headless": False,
"sw-e10s": True,
"fission": False,
"sessionHistoryInParent": False,
"swgl": False,

View File

@ -1,7 +0,0 @@
[inside-service-worker.https.html]
expected:
if (os == "android") and e10s and not sw-e10s: TIMEOUT
[SecurityPolicyViolation event fired on global with the correct blockedURI.]
expected:
if (os == "android") and e10s and not sw-e10s: TIMEOUT

View File

@ -3,6 +3,5 @@ prefs: [privacy.reduceTimerPrecision:false]
disabled: true
[Resource Timing]
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1432758
expected:
if sw-e10s: FAIL
expected: FAIL

View File

@ -1,3 +0,0 @@
[update_completes_in_disconnected_global.https.html]
disabled:
if not sw-e10s: https://bugzilla.mozilla.org/show_bug.cgi?id=1589699

View File

@ -237,21 +237,12 @@ def run_info_extras(**kwargs):
"wasm": kwargs.get("wasm", True),
"verify": kwargs["verify"],
"headless": kwargs.get("headless", False) or "MOZ_HEADLESS" in os.environ,
"sw-e10s": True,
"fission": kwargs.get("enable_fission") or get_bool_pref("fission.autostart"),
"sessionHistoryInParent": (kwargs.get("enable_fission") or
get_bool_pref("fission.autostart") or
get_bool_pref("fission.sessionHistoryInParent")),
"swgl": get_bool_pref("gfx.webrender.software")}
# The value of `sw-e10s` defaults to whether the "parent_intercept"
# implementation is enabled for the current build. This value, however,
# can be overridden by explicitly setting the pref with the `--setpref` CLI
# flag, which is checked here.
sw_e10s_override = get_bool_pref_if_exists("dom.serviceWorkers.parent_intercept")
if sw_e10s_override is not None:
rv["sw-e10s"] = sw_e10s_override
rv.update(run_info_browser_version(**kwargs))
return rv
@ -272,7 +263,7 @@ def run_info_browser_version(**kwargs):
def update_properties():
return (["os", "debug", "webrender", "fission", "e10s", "sw-e10s", "processor", "swgl"],
return (["os", "debug", "webrender", "fission", "e10s", "processor", "swgl"],
{"os": ["version"], "processor": ["bits"]})

View File

@ -1536,16 +1536,7 @@ class XPCShellTests(object):
self.mozInfo["fission"] = prefs.get("fission.autostart", False)
# Until the test harness can understand default pref values,
# (https://bugzilla.mozilla.org/show_bug.cgi?id=1577912) this value
# should by synchronized with the default pref value indicated in
# StaticPrefList.yaml.
#
# Currently for automation, the pref defaults to true (but can be
# overridden with --setpref).
self.mozInfo["serviceworker_e10s"] = prefs.get(
"dom.serviceWorkers.parent_intercept", True
)
self.mozInfo["serviceworker_e10s"] = True
self.mozInfo["verify"] = options.get("verify", False)
self.mozInfo["webrender"] = self.enable_webrender