summaryrefslogtreecommitdiffstats
path: root/dom/serviceworkers/test/fetch/plugin/worker.js
blob: 9849c9e0d52576216f2669c17fb85b152358c17d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
self.addEventListener("fetch", function (event) {
  var resource = event.request.url.split("/").pop();
  event.waitUntil(
    clients.matchAll().then(clients => {
      clients.forEach(client => {
        if (client.url.includes("plugins.html")) {
          client.postMessage({
            destination: event.request.destination,
            resource,
          });
        }
      });
    })
  );
});