summaryrefslogtreecommitdiffstats
path: root/dom/workers/test/serviceworkers/worker_unregister.js
blob: 7a3e764f4e15ada2c032c92c8fabf1c61c4aa5a4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
onmessage = function(e) {
  clients.matchAll().then(function(c) {
    if (c.length === 0) {
      // We cannot proceed.
      return;
    }

    registration.unregister().then(function() {
      c[0].postMessage('DONE');
    }, function() {
      c[0].postMessage('ERROR');
    }).then(function() {
      c[0].postMessage('FINISH');
    });
  });
}