summaryrefslogtreecommitdiffstats
path: root/dom/serviceworkers/test/fetch/plugin/worker.js
blob: da3c1ba54a9004d6d8e075fa1dbf92377c91e70d (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,
          });
        }
      });
    })
  );
});