mirror of
https://github.com/servo/servo.git
synced 2025-08-12 08:55:32 +01:00
Update web-platform-tests to revision 2d68590d46a990bf28a08d6384a59962d2e56bf6
This commit is contained in:
parent
bc03d32142
commit
ad4cc3691e
135 changed files with 1613 additions and 341 deletions
|
@ -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();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue