Bug 1434599 - Enable test_workerupdatefoundevent.html. r=bkelly

--HG--
extra : rebase_source : 3e5e40dec9190a3f359c2dd51c0634ab93b9a757
This commit is contained in:
Catalin Badea 2018-02-02 06:12:00 +02:00
parent 974faf875d
commit fb0b064981
3 changed files with 14 additions and 7 deletions

View File

@ -341,7 +341,6 @@ tags = openwindow
[test_workerUnregister.html]
[test_workerUpdate.html]
[test_workerupdatefoundevent.html]
skip-if = !e10s # Bug 1433276
[test_xslt.html]
[test_async_waituntil.html]
[test_worker_reference_gc_timeout.html]

View File

@ -22,6 +22,17 @@
registration = await navigator.serviceWorker.register("worker_updatefoundevent.js",
{ scope: "./updatefoundevent.html" })
await waitForState(registration.installing, 'activated');
content = document.getElementById("content");
iframe = document.createElement("iframe");
content.appendChild(iframe);
iframe.setAttribute("src", "./updatefoundevent.html");
await new Promise(function(resolve) { iframe.onload = resolve; });
ok(iframe.contentWindow.navigator.serviceWorker.controller, "Controlled client.");
return Promise.resolve();
}
function startWaitForUpdateFound() {
@ -38,11 +49,6 @@
}
});
content = document.getElementById("content");
iframe = document.createElement("iframe");
content.appendChild(iframe);
iframe.setAttribute("src", "./updatefoundevent.html");
return Promise.resolve();
}

View File

@ -6,7 +6,9 @@
registration.onupdatefound = function(e) {
clients.matchAll().then(function(clients) {
if (!clients.length) {
reject("No clients found");
// We don't control any clients when the first update event is fired
// because we haven't reached the 'activated' state.
return;
}
if (registration.scope.match(/updatefoundevent\.html$/)) {