summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/presentation-api/receiving-ua/serviceworker.js
blob: ae50ad649866e926fbd206ab7038548edd12af0c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
self.addEventListener('install', () => {
    // activate this service worker immediately
    self.skipWaiting();
});

self.addEventListener('activate', event => {
    // let this service worker control window clients immediately
    event.waitUntil(self.clients.claim());
});

self.addEventListener('message', event => {
    event.waitUntil(clients.matchAll().then(windows => {
        event.ports[0].postMessage(windows.map(w => { return w.url; }).sort());
    }));
});