Backed out 6 changesets (bug 1595964, bug 1596939) for causing failures in browser_application_panel_list-domain-workers.js

Backed out changeset 65c870147654 (bug 1595964)
Backed out changeset 74a982a9144a (bug 1596939)
Backed out changeset c21c15689e77 (bug 1596939)
Backed out changeset a6848f4d219d (bug 1596939)
Backed out changeset 4f538e6c6dcc (bug 1595964)
Backed out changeset d1c93f700b8c (bug 1595964)
This commit is contained in:
Noemi Erli 2019-12-07 20:13:22 +02:00
Родитель cbb1fe8008
Коммит 7c520af3a9
20 изменённых файлов: 122 добавлений и 325 удалений

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

@ -50,12 +50,14 @@ function setupEvents(dependencies: Dependencies) {
sourceQueue.initialize(actions);
addThreadEventListeners(threadFront);
tabTarget.on("workerListChanged", () => threadListChanged());
debuggerClient.mainRoot.on("processListChanged", () => threadListChanged());
tabTarget.on("workerListChanged", () => threadListChanged("worker"));
debuggerClient.mainRoot.on("processListChanged", () =>
threadListChanged("contentProcess")
);
if (features.windowlessServiceWorkers || attachAllTargets(tabTarget)) {
const workersListener = new WorkersListener(debuggerClient.mainRoot);
workersListener.addListener(() => threadListChanged());
workersListener.addListener(() => threadListChanged("worker"));
}
}
@ -112,8 +114,8 @@ function newSource(threadFront: ThreadFront, { source }: SourcePacket) {
});
}
function threadListChanged() {
actions.updateThreads();
function threadListChanged(type) {
actions.updateThreads(type);
}
function replayFramePositions(

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

@ -90,7 +90,6 @@ async function listWorkerTargets(args: Args) {
} else {
workers = (await currentTarget.listWorkers()).workers;
if (currentTarget.url && features.windowlessServiceWorkers) {
allWorkers = await debuggerClient.mainRoot.listAllWorkerTargets();
const {
registrations,
} = await debuggerClient.mainRoot.listServiceWorkerRegistrations();
@ -101,16 +100,10 @@ async function listWorkerTargets(args: Args) {
}
for (const front of serviceWorkerRegistrations) {
const {
activeWorker,
waitingWorker,
installingWorker,
evaluatingWorker,
} = front;
const { activeWorker, waitingWorker, installingWorker } = front;
await maybeMarkServiceWorker(activeWorker, "active");
await maybeMarkServiceWorker(waitingWorker, "waiting");
await maybeMarkServiceWorker(installingWorker, "installing");
await maybeMarkServiceWorker(evaluatingWorker, "evaluating");
}
async function maybeMarkServiceWorker(info, status) {
@ -118,6 +111,9 @@ async function listWorkerTargets(args: Args) {
return;
}
if (!allWorkers) {
allWorkers = await debuggerClient.mainRoot.listAllWorkerTargets();
}
const worker = allWorkers.find(front => front && front.id == info.id);
if (!worker) {
return;
@ -132,37 +128,20 @@ async function listWorkerTargets(args: Args) {
return workers;
}
async function getAllProcessTargets(args) {
const { debuggerClient } = args;
async function listProcessTargets(args: Args) {
const { currentTarget, debuggerClient } = args;
if (!attachAllTargets(currentTarget)) {
return [];
}
const { processes } = await debuggerClient.mainRoot.listProcesses();
return Promise.all(
const targets = await Promise.all(
processes
.filter(descriptor => !descriptor.isParent)
.map(descriptor => descriptor.getTarget())
);
}
async function listProcessTargets(args: Args) {
const { currentTarget } = args;
if (!attachAllTargets(currentTarget)) {
if (currentTarget.url && features.windowlessServiceWorkers) {
// Service workers associated with our target's origin need to pause until
// we attach, regardless of which process they are running in.
const origin = new URL(currentTarget.url).origin;
const targets = await getAllProcessTargets(args);
try {
await Promise.all(
targets.map(t => t.pauseMatchingServiceWorkers({ origin }))
);
} catch (e) {
// Old servers without pauseMatchingServiceWorkers will throw.
// @backward-compatibility: remove in Firefox 75
}
}
return [];
}
return getAllProcessTargets(args);
return targets;
}
export async function updateTargets(args: Args) {

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

@ -7,14 +7,6 @@ async function checkWorkerThreads(dbg, count) {
ok(true, `Have ${count} threads`);
}
async function checkWorkerStatus(dbg, status) {
await waitUntil(() => {
const threads = dbg.selectors.getThreads();
return threads.some(t => t.serviceWorkerStatus == status);
});
ok(true, `Have thread with status ${status}`);
}
// Test that we can detect a new service worker and hit breakpoints that we've
// set in it.
add_task(async function() {
@ -39,9 +31,8 @@ add_task(async function() {
await waitForPaused(dbg);
assertPausedAtSourceAndLine(dbg, workerSource.id, 13);
// Leave the breakpoint and worker in place for the next subtest.
// Leave the breakpoint in place for the next subtest.
await resume(dbg);
await waitForRequestsToSettle(dbg);
await removeTab(gBrowser.selectedTab);
});
@ -70,7 +61,6 @@ add_task(async function() {
invokeInTab("unregisterWorker");
await checkWorkerThreads(dbg, 0);
await waitForRequestsToSettle(dbg);
await removeTab(gBrowser.selectedTab);
});
@ -83,7 +73,6 @@ add_task(async function() {
invokeInTab("registerWorker");
await checkWorkerThreads(dbg, 1);
await checkWorkerStatus(dbg, "active");
const firstTab = gBrowser.selectedTab;
@ -112,13 +101,9 @@ add_task(async function() {
ok(content0.value.includes("newServiceWorker") != content1.value.includes("newServiceWorker"),
"Got two different sources for service worker");
// Add a breakpoint for the next subtest.
await addBreakpoint(dbg, "service-worker.sjs", 2);
invokeInTab("unregisterWorker");
await checkWorkerThreads(dbg, 0);
await waitForRequestsToSettle(dbg);
await removeTab(firstTab);
await removeTab(secondTab);
@ -126,41 +111,3 @@ add_task(async function() {
await addTab(EXAMPLE_URL + "service-worker.sjs?setStatus=");
await removeTab(gBrowser.selectedTab);
});
// Test setting breakpoints while the service worker is starting up.
add_task(async function() {
info("Subtest #4");
const toolbox = await openNewTabAndToolbox(EXAMPLE_URL + "doc-service-workers.html", "jsdebugger");
const dbg = createDebuggerContext(toolbox);
invokeInTab("registerWorker");
await checkWorkerThreads(dbg, 1);
await waitForSource(dbg, "service-worker.sjs");
const workerSource = findSource(dbg, "service-worker.sjs");
await waitForBreakpointCount(dbg, 1);
await waitForPaused(dbg);
assertPausedAtSourceAndLine(dbg, workerSource.id, 2);
await checkWorkerStatus(dbg, "evaluating");
await addBreakpoint(dbg, "service-worker.sjs", 19);
await resume(dbg);
await waitForPaused(dbg);
assertPausedAtSourceAndLine(dbg, workerSource.id, 19);
await checkWorkerStatus(dbg, "installing");
await addBreakpoint(dbg, "service-worker.sjs", 5);
await resume(dbg);
await waitForPaused(dbg);
assertPausedAtSourceAndLine(dbg, workerSource.id, 5);
await checkWorkerStatus(dbg, "active");
await resume(dbg);
invokeInTab("unregisterWorker");
await checkWorkerThreads(dbg, 0);
await waitForRequestsToSettle(dbg);
await removeTab(gBrowser.selectedTab);
});

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

@ -19,10 +19,6 @@ self.addEventListener("fetch", event => {
event.respondWith(response);
}
});
self.addEventListener("install", event => {
dump("Install\\n");
});
`;
function handleRequest(request, response) {
@ -34,5 +30,17 @@ function handleRequest(request, response) {
}
const status = getState("status");
response.write(body.replace("STATUS", status));
let newBody = body.replace("STATUS", status);
if (status == "stuckInstall") {
newBody += `
self.addEventListener("install", event => {
dump("Install\\n");
event.waitUntil(new Promise(resolve => {}));
});
`;
}
response.write(newBody);
}

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

@ -194,7 +194,7 @@ RootActor.prototype = {
this._parameters.addonList.onListChanged = null;
}
if (this._parameters.workerList) {
this._parameters.workerList.destroy();
this._parameters.workerList.onListChanged = null;
}
if (this._parameters.serviceWorkerRegistrationList) {
this._parameters.serviceWorkerRegistrationList.onListChanged = null;

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

@ -684,9 +684,7 @@ const browsingContextTargetPrototype = {
},
pauseWorkersUntilAttach(shouldPause) {
this.ensureWorkerTargetActorList().workerPauser.setPauseMatching(
shouldPause
);
this.ensureWorkerTargetActorList().setPauseMatchingWorkers(shouldPause);
},
listWorkers(request) {
@ -962,7 +960,8 @@ const browsingContextTargetPrototype = {
// Make sure that no more workerListChanged notifications are sent.
if (this._workerTargetActorList !== null) {
this._workerTargetActorList.destroy();
this._workerTargetActorList.onListChanged = null;
this._workerTargetActorList.setPauseMatchingWorkers(false);
this._workerTargetActorList = null;
}

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

@ -139,36 +139,30 @@ const ContentProcessTargetActor = ActorClassWithSpec(contentProcessTargetSpec, {
};
},
ensureWorkerList() {
listWorkers: function() {
if (!this._workerList) {
this._workerList = new WorkerTargetActorList(this.conn, {});
}
return this._workerList;
},
return this._workerList.getList().then(actors => {
const pool = new Pool(this.conn);
for (const actor of actors) {
pool.manage(actor);
}
listWorkers: function() {
return this.ensureWorkerList()
.getList()
.then(actors => {
const pool = new Pool(this.conn);
for (const actor of actors) {
pool.manage(actor);
}
// Do not destroy the pool before transfering ownership to the newly created
// pool, so that we do not accidentally destroy actors that are still in use.
if (this._workerTargetActorPool) {
this._workerTargetActorPool.destroy();
}
// Do not destroy the pool before transfering ownership to the newly created
// pool, so that we do not accidentally destroy actors that are still in use.
if (this._workerTargetActorPool) {
this._workerTargetActorPool.destroy();
}
this._workerTargetActorPool = pool;
this._workerList.onListChanged = this._onWorkerListChanged;
this._workerTargetActorPool = pool;
this._workerList.onListChanged = this._onWorkerListChanged;
return {
from: this.actorID,
workers: actors,
};
});
return {
from: this.actorID,
workers: actors,
};
});
},
_onWorkerListChanged: function() {
@ -176,17 +170,12 @@ const ContentProcessTargetActor = ActorClassWithSpec(contentProcessTargetSpec, {
this._workerList.onListChanged = null;
},
pauseMatchingServiceWorkers(request) {
this.ensureWorkerList().workerPauser.setPauseServiceWorkers(request.origin);
},
destroy: function() {
Actor.prototype.destroy.call(this);
// Tell the live lists we aren't watching any more.
if (this._workerList) {
this._workerList.destroy();
this._workerList = null;
this._workerList.onListChanged = null;
}
if (this._sources) {

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

@ -71,13 +71,11 @@ const ServiceWorkerRegistrationActor = protocol.ActorClassWithSpec(
form() {
const registration = this._registration;
const evaluatingWorker = this._evaluatingWorker.form();
const installingWorker = this._installingWorker.form();
const waitingWorker = this._waitingWorker.form();
const activeWorker = this._activeWorker.form();
const newestWorker =
activeWorker || waitingWorker || installingWorker || evaluatingWorker;
const newestWorker = activeWorker || waitingWorker || installingWorker;
const isParentInterceptEnabled = swm.isParentInterceptEnabled();
const isMultiE10sWithOldImplementation =
@ -87,7 +85,6 @@ const ServiceWorkerRegistrationActor = protocol.ActorClassWithSpec(
actor: this.actorID,
scope: registration.scope,
url: registration.scriptSpec,
evaluatingWorker,
installingWorker,
waitingWorker,
activeWorker,
@ -124,7 +121,6 @@ const ServiceWorkerRegistrationActor = protocol.ActorClassWithSpec(
this._destroyServiceWorkerActors();
this._evaluatingWorker = null;
this._installingWorker = null;
this._waitingWorker = null;
this._activeWorker = null;
@ -301,7 +297,6 @@ const ServiceWorkerRegistrationActor = protocol.ActorClassWithSpec(
},
_destroyServiceWorkerActors() {
this._evaluatingWorker.destroy();
this._installingWorker.destroy();
this._waitingWorker.destroy();
this._activeWorker.destroy();
@ -309,16 +304,11 @@ const ServiceWorkerRegistrationActor = protocol.ActorClassWithSpec(
_createServiceWorkerActors() {
const {
evaluatingWorker,
installingWorker,
waitingWorker,
activeWorker,
} = this._registration;
this._evaluatingWorker = new ServiceWorkerActor(
this._conn,
evaluatingWorker
);
this._installingWorker = new ServiceWorkerActor(
this._conn,
installingWorker
@ -328,7 +318,6 @@ const ServiceWorkerRegistrationActor = protocol.ActorClassWithSpec(
// Add the ServiceWorker actors as children of this ServiceWorkerRegistration actor,
// assigning them valid actorIDs.
this.manage(this._evaluatingWorker);
this.manage(this._installingWorker);
this.manage(this._waitingWorker);
this.manage(this._activeWorker);

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

@ -4,7 +4,6 @@
"use strict";
const { Ci } = require("chrome");
const protocol = require("devtools/shared/protocol");
const {
serviceWorkerSpec,
@ -21,17 +20,11 @@ const ServiceWorkerActor = protocol.ActorClassWithSpec(serviceWorkerSpec, {
return null;
}
// handlesFetchEvents is not available if the worker's main script is in the
// evaluating state.
const isEvaluating =
this._worker.state == Ci.nsIServiceWorkerInfo.STATE_PARSED;
const fetch = isEvaluating ? undefined : this._worker.handlesFetchEvents;
return {
actor: this.actorID,
url: this._worker.scriptSpec,
state: this._worker.state,
fetch,
fetch: this._worker.handlesFetchEvents,
id: this._worker.id,
};
},

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

@ -4,7 +4,6 @@
"use strict";
const { Ci } = require("chrome");
const { XPCOMUtils } = require("resource://gre/modules/XPCOMUtils.jsm");
loader.lazyRequireGetter(
this,
@ -38,65 +37,32 @@ function matchWorkerDebugger(dbg, options) {
return true;
}
function matchServiceWorker(dbg, origin) {
return (
dbg.type == Ci.nsIWorkerDebugger.TYPE_SERVICE &&
new URL(dbg.url).origin == origin
);
}
// When a new worker appears, in some cases (i.e. the debugger is running) we
// want it to pause during registration until a later time (i.e. the debugger
// finishes attaching to the worker). This is an optional WorkderDebuggerManager
// listener that can be installed in addition to the WorkerTargetActorList
// listener. It always listens to new workers and pauses any matching filters
// which have been set on it.
//
// Two kinds of filters are supported:
//
// setPauseMatching(true) will pause all workers which match the options strcut
// passed in on creation.
//
// setPauseServiceWorkers(origin) will pause all service workers which have the
// specified origin.
//
// FIXME Bug 1601279 separate WorkerPauser from WorkerTargetActorList and give
// it a more consistent interface.
function WorkerPauser(options) {
// listener. It always listens to new workers and pauses any which are matched
// by the WorkerTargetActorList.
function PauseMatchingWorkers(options) {
this._options = options;
this._pauseMatching = null;
this._pauseServiceWorkerOrigin = null;
this.onRegister = this._onRegister.bind(this);
this.onUnregister = () => {};
wdm.addListener(this);
}
WorkerPauser.prototype = {
PauseMatchingWorkers.prototype = {
destroy() {
wdm.removeListener(this);
},
_onRegister(dbg) {
if (
(this._pauseMatching && matchWorkerDebugger(dbg, this._options)) ||
(this._pauseServiceWorkerOrigin &&
matchServiceWorker(dbg, this._pauseServiceWorkerOrigin))
) {
if (matchWorkerDebugger(dbg, this._options)) {
// Prevent the debuggee from executing in this worker until the debugger
// has finished attaching to it.
dbg.setDebuggerReady(false);
}
},
setPauseMatching(shouldPause) {
this._pauseMatching = shouldPause;
},
setPauseServiceWorkers(origin) {
this._pauseServiceWorkerOrigin = origin;
},
};
function WorkerTargetActorList(conn, options) {
@ -104,21 +70,13 @@ function WorkerTargetActorList(conn, options) {
this._options = options;
this._actors = new Map();
this._onListChanged = null;
this._workerPauser = null;
this._pauseMatchingWorkers = null;
this._mustNotify = false;
this.onRegister = this.onRegister.bind(this);
this.onUnregister = this.onUnregister.bind(this);
}
WorkerTargetActorList.prototype = {
destroy() {
this.onListChanged = null;
if (this._workerPauser) {
this._workerPauser.destroy();
this._workerPauser = null;
}
},
getList() {
// Create a set of debuggers.
const dbgs = new Set();
@ -201,11 +159,15 @@ WorkerTargetActorList.prototype = {
}
},
get workerPauser() {
if (!this._workerPauser) {
this._workerPauser = new WorkerPauser(this._options);
setPauseMatchingWorkers(shouldPause) {
if (shouldPause != !!this._pauseMatchingWorkers) {
if (shouldPause) {
this._pauseMatchingWorkers = new PauseMatchingWorkers(this._options);
} else {
this._pauseMatchingWorkers.destroy();
this._pauseMatchingWorkers = null;
}
}
return this._workerPauser;
},
};

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

@ -106,14 +106,8 @@ class RootFront extends FrontClassWithSpec(rootSpec) {
};
registrations.forEach(front => {
const {
activeWorker,
waitingWorker,
installingWorker,
evaluatingWorker,
} = front;
const newestWorker =
activeWorker || waitingWorker || installingWorker || evaluatingWorker;
const { activeWorker, waitingWorker, installingWorker } = front;
const newestWorker = activeWorker || waitingWorker || installingWorker;
// All the information is simply mirrored from the registration front.
// However since registering workers will fetch similar information from the worker
@ -171,10 +165,8 @@ class RootFront extends FrontClassWithSpec(rootSpec) {
});
if (registration) {
// Before bug 1595964, URLs were not available for registrations
// whose worker's main script is being evaluated. Now, URLs are
// always available, and this test deals with older servers.
// @backward-compatibility: remove in Firefox 75
// XXX: Race, sometimes a ServiceWorkerRegistrationInfo doesn't
// have a scriptSpec, but its associated WorkerDebugger does.
if (!registration.url) {
registration.name = registration.url = front.url;
}

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

@ -43,10 +43,6 @@ class ServiceWorkerRegistrationFront extends FrontClassWithSpec(
return this._form.url;
}
get evaluatingWorker() {
return this._getServiceWorker("evaluatingWorker");
}
get activeWorker() {
return this._getServiceWorker("activeWorker");
}

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

@ -23,13 +23,6 @@ const contentProcessTargetSpec = generateActorSpec({
request: {},
response: RetVal("contentProcessTarget.workers"),
},
pauseMatchingServiceWorkers: {
request: {
origin: Option(0, "string"),
},
response: {},
},
},
events: {

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

@ -58,9 +58,6 @@ interface nsIServiceWorkerInfo : nsISupports
readonly attribute nsIWorkerDebugger debugger;
// Return whether the ServiceWorker has a "fetch" event listener. Throws if
// this is unknown because the worker's main script hasn't finished executing
// (when exposed as evaluatingWorker).
readonly attribute bool handlesFetchEvents;
readonly attribute PRTime installedTime;
@ -94,7 +91,6 @@ interface nsIServiceWorkerRegistrationInfo : nsISupports
readonly attribute PRTime lastUpdateTime;
readonly attribute nsIServiceWorkerInfo evaluatingWorker;
readonly attribute nsIServiceWorkerInfo installingWorker;
readonly attribute nsIServiceWorkerInfo waitingWorker;
readonly attribute nsIServiceWorkerInfo activeWorker;

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

@ -91,11 +91,6 @@ NS_IMETHODIMP
ServiceWorkerInfo::GetHandlesFetchEvents(bool* aValue) {
MOZ_ASSERT(aValue);
MOZ_ASSERT(NS_IsMainThread());
if (mHandlesFetch == Unknown) {
return NS_ERROR_FAILURE;
}
*aValue = HandlesFetch();
return NS_OK;
}

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

@ -252,14 +252,13 @@ bool DispatchFailed(nsresult aStatus) {
} // anonymous namespace
class ServiceWorkerOp::ServiceWorkerOpRunnable : public WorkerDebuggeeRunnable {
class ServiceWorkerOp::ServiceWorkerOpRunnable : public WorkerRunnable {
public:
NS_DECL_ISUPPORTS_INHERITED
ServiceWorkerOpRunnable(RefPtr<ServiceWorkerOp> aOwner,
WorkerPrivate* aWorkerPrivate)
: WorkerDebuggeeRunnable(aWorkerPrivate, WorkerThreadModifyBusyCount),
mOwner(std::move(aOwner)) {
: WorkerRunnable(aWorkerPrivate), mOwner(std::move(aOwner)) {
AssertIsOnMainThread();
MOZ_ASSERT(mOwner);
MOZ_ASSERT(aWorkerPrivate);

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

@ -170,7 +170,7 @@ ServiceWorkerRegistrationInfo::GetScope(nsAString& aScope) {
NS_IMETHODIMP
ServiceWorkerRegistrationInfo::GetScriptSpec(nsAString& aScriptSpec) {
MOZ_ASSERT(NS_IsMainThread());
RefPtr<ServiceWorkerInfo> newest = NewestIncludingEvaluating();
RefPtr<ServiceWorkerInfo> newest = Newest();
if (newest) {
CopyUTF8toUTF16(newest->ScriptSpec(), aScriptSpec);
}
@ -191,15 +191,6 @@ ServiceWorkerRegistrationInfo::GetLastUpdateTime(PRTime* _retval) {
return NS_OK;
}
NS_IMETHODIMP
ServiceWorkerRegistrationInfo::GetEvaluatingWorker(
nsIServiceWorkerInfo** aResult) {
MOZ_ASSERT(NS_IsMainThread());
RefPtr<ServiceWorkerInfo> info = mEvaluatingWorker;
info.forget(aResult);
return NS_OK;
}
NS_IMETHODIMP
ServiceWorkerRegistrationInfo::GetInstallingWorker(
nsIServiceWorkerInfo** aResult) {
@ -539,11 +530,6 @@ void ServiceWorkerRegistrationInfo::SetEvaluating(
MOZ_ASSERT(mActiveWorker != aServiceWorker);
mEvaluatingWorker = aServiceWorker;
// We don't call UpdateRegistrationState() here because the evaluating worker
// is currently not exposed to content on the registration, so calling it here
// would produce redundant IPC traffic.
NotifyChromeRegistrationListeners();
}
void ServiceWorkerRegistrationInfo::ClearEvaluating() {
@ -557,9 +543,6 @@ void ServiceWorkerRegistrationInfo::ClearEvaluating() {
// We don't update the redundant time for the sw here, since we've not expose
// evalutingWorker yet.
mEvaluatingWorker = nullptr;
// As for SetEvaluating, UpdateRegistrationState() does not need to be called.
NotifyChromeRegistrationListeners();
}
void ServiceWorkerRegistrationInfo::ClearInstalling() {

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

@ -104,14 +104,6 @@ class ServiceWorkerRegistrationInfo final
return newest.forget();
}
already_AddRefed<ServiceWorkerInfo> NewestIncludingEvaluating() const {
if (mEvaluatingWorker) {
RefPtr<ServiceWorkerInfo> newest = mEvaluatingWorker;
return newest.forget();
}
return Newest();
}
already_AddRefed<ServiceWorkerInfo> GetServiceWorkerInfoById(uint64_t aId);
void StartControllingClient() {

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

@ -11,7 +11,6 @@
const State = {
BYTECHECK: -1,
PARSED: Ci.nsIServiceWorkerInfo.STATE_PARSED,
INSTALLING: Ci.nsIServiceWorkerInfo.STATE_INSTALLING,
INSTALLED: Ci.nsIServiceWorkerInfo.STATE_INSTALLED,
ACTIVATING: Ci.nsIServiceWorkerInfo.STATE_ACTIVATING,
@ -36,10 +35,6 @@ let expectedResults = [
state: State.BYTECHECK, installedTimeRecorded: false,
activatedTimeRecorded: false, redundantTimeRecorded: false
},
{
state: State.PARSED, installedTimeRecorded: false,
activatedTimeRecorded: false, redundantTimeRecorded: false
},
{
state: State.INSTALLING, installedTimeRecorded: false,
activatedTimeRecorded: false, redundantTimeRecorded: false
@ -118,8 +113,7 @@ function verifyServiceWorkTime(aSWRInfo, resolve) {
info("Check the ServiceWorker time in its state is " + expectedResult.state);
// Get serviceWorkerInfo from swrInfo or get the astray one which we hold.
let swInfo = aSWRInfo.evaluatingWorker ||
aSWRInfo.installingWorker ||
let swInfo = aSWRInfo.installingWorker ||
aSWRInfo.waitingWorker ||
aSWRInfo.activeWorker ||
astrayServiceWorkerInfo;

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

@ -52,65 +52,15 @@
return waitForServiceWorkerRegistrationChange(registration, function () {
is(registration.scriptSpec, EXAMPLE_URL + "worker.js");
ok(registration.evaluatingWorker !== null);
ok(registration.installingWorker === null);
ok(registration.installingWorker !== null);
is(registration.installingWorker.scriptSpec, EXAMPLE_URL + "worker.js");
ok(registration.waitingWorker === null);
ok(registration.activeWorker === null);
return waitForServiceWorkerRegistrationChange(registration, function () {
ok(registration.installingWorker !== null);
is(registration.installingWorker.scriptSpec, EXAMPLE_URL + "worker.js");
ok(registration.waitingWorker === null);
ok(registration.activeWorker === null);
return waitForServiceWorkerRegistrationChange(registration, function () {
ok(registration.installingWorker === null);
ok(registration.waitingWorker !== null);
ok(registration.activeWorker === null);
return waitForServiceWorkerRegistrationChange(registration, function () {
// Activating
ok(registration.installingWorker === null);
ok(registration.waitingWorker === null);
ok(registration.activeWorker !== null);
return waitForServiceWorkerRegistrationChange(registration, function () {
// Activated
ok(registration.installingWorker === null);
ok(registration.waitingWorker === null);
ok(registration.activeWorker !== null);
return registration;
});
});
});
});
});
});
});
iframe.contentWindow.postMessage("register", "*");
let registration = await promise;
promise = waitForServiceWorkerRegistrationChange(registration, function () {
// Got change event for updating (byte-check)
ok(registration.installingWorker === null);
ok(registration.waitingWorker === null);
ok(registration.activeWorker !== null);
return waitForServiceWorkerRegistrationChange(registration, function () {
is(registration.scriptSpec, EXAMPLE_URL + "worker2.js");
ok(registration.evaluatingWorker !== null);
return waitForServiceWorkerRegistrationChange(registration, function () {
ok(registration.installingWorker !== null);
is(registration.installingWorker.scriptSpec, EXAMPLE_URL + "worker2.js");
ok(registration.waitingWorker === null);
ok(registration.activeWorker !== null);
return waitForServiceWorkerRegistrationChange(registration, function () {
ok(registration.installingWorker === null);
ok(registration.waitingWorker !== null);
ok(registration.activeWorker !== null);
ok(registration.activeWorker === null);
return waitForServiceWorkerRegistrationChange(registration, function () {
// Activating
@ -132,6 +82,45 @@
});
});
iframe.contentWindow.postMessage("register", "*");
let registration = await promise;
promise = waitForServiceWorkerRegistrationChange(registration, function () {
// Got change event for updating (byte-check)
ok(registration.installingWorker === null);
ok(registration.waitingWorker === null);
ok(registration.activeWorker !== null);
return waitForServiceWorkerRegistrationChange(registration, function () {
is(registration.scriptSpec, EXAMPLE_URL + "worker2.js");
ok(registration.installingWorker !== null);
is(registration.installingWorker.scriptSpec, EXAMPLE_URL + "worker2.js");
ok(registration.waitingWorker === null);
ok(registration.activeWorker !== null);
return waitForServiceWorkerRegistrationChange(registration, function () {
ok(registration.installingWorker === null);
ok(registration.waitingWorker !== null);
ok(registration.activeWorker !== null);
return waitForServiceWorkerRegistrationChange(registration, function () {
// Activating
ok(registration.installingWorker === null);
ok(registration.waitingWorker === null);
ok(registration.activeWorker !== null);
return waitForServiceWorkerRegistrationChange(registration, function () {
// Activated
ok(registration.installingWorker === null);
ok(registration.waitingWorker === null);
ok(registration.activeWorker !== null);
return registration;
});
});
});
});
});
iframe.contentWindow.postMessage("register", "*");
await promise;
iframe.contentWindow.postMessage("unregister", "*");