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