зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1557170 - Add isParentInterceptEnabled trait to ServiceWorkerRegistration actor r=daisuke
Differential Revision: https://phabricator.services.mozilla.com/D43598 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
451bc0629c
Коммит
8a65fc4677
|
@ -143,13 +143,6 @@ function installTemporaryExtension() {
|
||||||
function pushServiceWorker(id, registrationFront) {
|
function pushServiceWorker(id, registrationFront) {
|
||||||
return async (_, getState) => {
|
return async (_, getState) => {
|
||||||
try {
|
try {
|
||||||
const clientWrapper = getCurrentClient(getState().runtimes);
|
|
||||||
const deviceFront = await clientWrapper.getFront("device");
|
|
||||||
|
|
||||||
// TODO: device description should already have been received, so this
|
|
||||||
// call should be able to be avoided (bug 1557250).
|
|
||||||
const { isParentInterceptEnabled } = await deviceFront.getDescription();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Older servers will not define `ServiceWorkerRegistrationFront.push`,
|
* Older servers will not define `ServiceWorkerRegistrationFront.push`,
|
||||||
* and `ServiceWorkerRegistrationFront.push` will only work if the
|
* and `ServiceWorkerRegistrationFront.push` will only work if the
|
||||||
|
@ -160,9 +153,11 @@ function pushServiceWorker(id, registrationFront) {
|
||||||
* _and_ parent-intercept is stable (which definitely won't happen when
|
* _and_ parent-intercept is stable (which definitely won't happen when
|
||||||
* the release channel is < FF69).
|
* the release channel is < FF69).
|
||||||
*/
|
*/
|
||||||
|
const { isParentInterceptEnabled } = registrationFront.traits;
|
||||||
if (registrationFront.push && isParentInterceptEnabled) {
|
if (registrationFront.push && isParentInterceptEnabled) {
|
||||||
await registrationFront.push();
|
await registrationFront.push();
|
||||||
} else {
|
} else {
|
||||||
|
const clientWrapper = getCurrentClient(getState().runtimes);
|
||||||
const workerActor = await clientWrapper.getServiceWorkerFront({ id });
|
const workerActor = await clientWrapper.getServiceWorkerFront({ id });
|
||||||
await workerActor.push();
|
await workerActor.push();
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,9 +72,10 @@ const ServiceWorkerRegistrationActor = protocol.ActorClassWithSpec(
|
||||||
|
|
||||||
const newestWorker = activeWorker || waitingWorker || installingWorker;
|
const newestWorker = activeWorker || waitingWorker || installingWorker;
|
||||||
|
|
||||||
const isNewE10sImplementation = swm.isParentInterceptEnabled();
|
const isParentInterceptEnabled = swm.isParentInterceptEnabled();
|
||||||
const isMultiE10sWithOldImplementation =
|
const isMultiE10sWithOldImplementation =
|
||||||
Services.appinfo.browserTabsRemoteAutostart && !isNewE10sImplementation;
|
Services.appinfo.browserTabsRemoteAutostart &&
|
||||||
|
!isParentInterceptEnabled;
|
||||||
return {
|
return {
|
||||||
actor: this.actorID,
|
actor: this.actorID,
|
||||||
scope: registration.scope,
|
scope: registration.scope,
|
||||||
|
@ -87,6 +88,9 @@ const ServiceWorkerRegistrationActor = protocol.ActorClassWithSpec(
|
||||||
// - In non-e10s or new implementaion: check if we have an active worker
|
// - In non-e10s or new implementaion: check if we have an active worker
|
||||||
active: isMultiE10sWithOldImplementation ? true : !!activeWorker,
|
active: isMultiE10sWithOldImplementation ? true : !!activeWorker,
|
||||||
lastUpdateTime: registration.lastUpdateTime,
|
lastUpdateTime: registration.lastUpdateTime,
|
||||||
|
traits: {
|
||||||
|
isParentInterceptEnabled,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,6 @@ const {
|
||||||
FrontClassWithSpec,
|
FrontClassWithSpec,
|
||||||
registerFront,
|
registerFront,
|
||||||
} = require("devtools/shared/protocol");
|
} = require("devtools/shared/protocol");
|
||||||
const { XPCOMUtils } = require("resource://gre/modules/XPCOMUtils.jsm");
|
|
||||||
|
|
||||||
loader.lazyRequireGetter(this, "getFront", "devtools/shared/protocol", true);
|
loader.lazyRequireGetter(this, "getFront", "devtools/shared/protocol", true);
|
||||||
loader.lazyRequireGetter(
|
loader.lazyRequireGetter(
|
||||||
|
@ -31,13 +30,6 @@ loader.lazyRequireGetter(
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
|
||||||
XPCOMUtils.defineLazyServiceGetter(
|
|
||||||
this,
|
|
||||||
"swm",
|
|
||||||
"@mozilla.org/serviceworkers/manager;1",
|
|
||||||
"nsIServiceWorkerManager"
|
|
||||||
);
|
|
||||||
|
|
||||||
class RootFront extends FrontClassWithSpec(rootSpec) {
|
class RootFront extends FrontClassWithSpec(rootSpec) {
|
||||||
constructor(client, form) {
|
constructor(client, form) {
|
||||||
super(client);
|
super(client);
|
||||||
|
@ -135,16 +127,6 @@ class RootFront extends FrontClassWithSpec(rootSpec) {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
|
||||||
* FIXME (bug 1557170): Make this compatible with remote debugging.
|
|
||||||
*
|
|
||||||
* Getting the value from `ServiceWorkerManager.isParentInterceptEnabled`
|
|
||||||
* may not return the same value as what exists on a remote server.
|
|
||||||
* Unfortunately, calling `DeviceFront.getDescription()` here to read the
|
|
||||||
* dom.serviceWorkers.parent_intercept pref causes test failures.
|
|
||||||
*/
|
|
||||||
const isParentInterceptEnabled = swm.isParentInterceptEnabled();
|
|
||||||
|
|
||||||
workers.forEach(front => {
|
workers.forEach(front => {
|
||||||
const worker = {
|
const worker = {
|
||||||
id: front.id,
|
id: front.id,
|
||||||
|
@ -165,6 +147,7 @@ class RootFront extends FrontClassWithSpec(rootSpec) {
|
||||||
* >= FF69 _and_ parent-intercept is stable (which definitely won't
|
* >= FF69 _and_ parent-intercept is stable (which definitely won't
|
||||||
* happen when the release channel is < FF69).
|
* happen when the release channel is < FF69).
|
||||||
*/
|
*/
|
||||||
|
const { isParentInterceptEnabled } = r.registrationFront.traits;
|
||||||
if (!r.newestWorkerId || !isParentInterceptEnabled) {
|
if (!r.newestWorkerId || !isParentInterceptEnabled) {
|
||||||
return r.scope === front.scope;
|
return r.scope === front.scope;
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,6 +66,8 @@ class ServiceWorkerRegistrationFront extends FrontClassWithSpec(
|
||||||
form(form) {
|
form(form) {
|
||||||
this.actorID = form.actor;
|
this.actorID = form.actor;
|
||||||
this._form = form;
|
this._form = form;
|
||||||
|
// FF70+ ServiceWorkerRegistration actor starts exposing traits object
|
||||||
|
this.traits = form.traits || {};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче