Update web-platform-tests to revision 2d68590d46a990bf28a08d6384a59962d2e56bf6

This commit is contained in:
WPT Sync Bot 2019-03-14 21:30:32 -04:00
parent bc03d32142
commit ad4cc3691e
135 changed files with 1613 additions and 341 deletions

View file

@ -72,3 +72,16 @@ function addPrefetch(url) {
link.href = url;
document.body.appendChild(link);
}
async function registerServiceWorkerAndWaitUntilActivated(script, scope) {
const reg = await navigator.serviceWorker.register(script, {scope: scope});
if (reg.active)
return;
const worker = reg.installing || reg.waiting;
await new Promise((resolve) => {
worker.addEventListener('statechange', (event) => {
if (event.target.state == 'activated')
resolve();
});
});
}