diff options
Diffstat (limited to 'testing/web-platform/tests/fetch/api/resources/sw-intercept.js')
-rw-r--r-- | testing/web-platform/tests/fetch/api/resources/sw-intercept.js | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/testing/web-platform/tests/fetch/api/resources/sw-intercept.js b/testing/web-platform/tests/fetch/api/resources/sw-intercept.js new file mode 100644 index 0000000000..b8166b62a5 --- /dev/null +++ b/testing/web-platform/tests/fetch/api/resources/sw-intercept.js @@ -0,0 +1,10 @@ +async function broadcast(msg) { + for (const client of await clients.matchAll()) { + client.postMessage(msg); + } +} + +addEventListener('fetch', event => { + event.waitUntil(broadcast(event.request.url)); + event.respondWith(fetch(event.request)); +}); |