diff options
Diffstat (limited to 'devtools/client/application/test/browser/resources/service-workers/debug-sw.js')
-rw-r--r-- | devtools/client/application/test/browser/resources/service-workers/debug-sw.js | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/devtools/client/application/test/browser/resources/service-workers/debug-sw.js b/devtools/client/application/test/browser/resources/service-workers/debug-sw.js new file mode 100644 index 0000000000..31f0b1bdd2 --- /dev/null +++ b/devtools/client/application/test/browser/resources/service-workers/debug-sw.js @@ -0,0 +1,18 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +self.addEventListener("activate", event => { + event.waitUntil(self.clients.claim()); +}); + +self.onfetch = function (event) { + const url = event.request.url; + + const response = url.endsWith("test") + ? new Response("lorem ipsum", { statusText: "OK" }) + : fetch(event.request); + + event.respondWith(response); +}; |