Bug 1273920 P4 Fix bugs in dom/push/test_serviceworker_lifetime.html test. r=kitcambridge

This commit is contained in:
Ben Kelly 2016-05-24 14:08:20 -07:00
Родитель df95996482
Коммит 0304c38349
2 изменённых файлов: 11 добавлений и 7 удалений

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

@ -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)
}