summaryrefslogtreecommitdiffstats
path: root/dom/serviceworkers/test/unresolved_fetch_worker.js
blob: 80d39b037a867828fa0294625a0c4c9fb36a90fb (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());
});