зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1273920 P4 Fix bugs in dom/push/test_serviceworker_lifetime.html test. r=kitcambridge
This commit is contained in:
Родитель
df95996482
Коммит
0304c38349
|
@ -55,6 +55,11 @@ onmessage = function(event) {
|
|||
}
|
||||
|
||||
onpush = function(event) {
|
||||
var pushResolve;
|
||||
event.waitUntil(new Promise(function(resolve) {
|
||||
pushResolve = resolve;
|
||||
}));
|
||||
|
||||
// FIXME(catalinb): push message carry no data. So we assume the only
|
||||
// push message we get is "wait"
|
||||
clients.matchAll().then(function(client) {
|
||||
|
@ -65,11 +70,10 @@ onpush = function(event) {
|
|||
client[0].postMessage({type: "push", state: state});
|
||||
|
||||
state = "wait";
|
||||
event.waitUntil(new Promise(function(res, rej) {
|
||||
if (resolvePromiseCallback) {
|
||||
dump("ERROR: service worker was already waiting on a promise.\n");
|
||||
}
|
||||
resolvePromiseCallback = res;
|
||||
}));
|
||||
if (resolvePromiseCallback) {
|
||||
dump("ERROR: service worker was already waiting on a promise.\n");
|
||||
} else {
|
||||
resolvePromiseCallback = pushResolve;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -257,7 +257,7 @@
|
|||
.then(setShutdownObserver(false))
|
||||
.then(checkStateAndUpdate(pushEvent, "from_scope", "wait"))
|
||||
.then(setShutdownObserver(true))
|
||||
.then(checkStateAndUpdate(messageEventIframe, "wait", "update"))
|
||||
.then(checkStateAndUpdate(messageEventIframe, "wait", "release"))
|
||||
.then(waitOnShutdownObserver)
|
||||
.then(closeIframe)
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче