summaryrefslogtreecommitdiffstats
path: root/dom/workers/test/serviceworkers/unresolved_fetch_worker.js
blob: 71fbad7813b4ae67a684191d51f22111aa9d66af (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
var keepPromiseAlive;
onfetch = function(event) {
  event.waitUntil(
    clients.matchAll()
           .then(clients => {
             clients.forEach(client => {
               client.postMessage("continue");
             });
           })
  );

  // Never resolve, and keep it alive on our global so it can't get GC'ed and
  // make this test weird and intermittent.
  event.respondWith((keepPromiseAlive = new Promise(function(res, rej) {})));
}

onactivate = function(event) {
  event.waitUntil(clients.claim());
}