summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/speculation-rules/prerender/resources/clients-matchall-service-worker.js
blob: 634b13160a43cd76e9a468153a8846a519f9dcad (plain)
1
2
3
4
5
6
7
8
9
10
11
onmessage = e => {
  // Collect all client URLs in this origin.
  const options = { includeUncontrolled: true, type: 'all' };
  const promise = self.clients.matchAll(options)
      .then(clients => {
        const client_urls = [];
        clients.forEach(client => client_urls.push(client.url));
        e.source.postMessage(client_urls);
      });
  e.waitUntil(promise);
};