summaryrefslogtreecommitdiffstats
path: root/dom/serviceworkers/test/unresolved_fetch_worker.js
blob: fae74f34b8f629ab7409d1c4fb7bef8d07f37450 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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) {})));
};

addEventListener("activate", function (event) {
  event.waitUntil(clients.claim());
});