summaryrefslogtreecommitdiffstats
path: root/toolkit/components/url-classifier/tests/mochitest/sw_worker.js
diff options
context:
space:
mode:
Diffstat (limited to 'toolkit/components/url-classifier/tests/mochitest/sw_worker.js')
-rw-r--r--toolkit/components/url-classifier/tests/mochitest/sw_worker.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/toolkit/components/url-classifier/tests/mochitest/sw_worker.js b/toolkit/components/url-classifier/tests/mochitest/sw_worker.js
new file mode 100644
index 0000000000..bad16608b4
--- /dev/null
+++ b/toolkit/components/url-classifier/tests/mochitest/sw_worker.js
@@ -0,0 +1,10 @@
+self.addEventListener("fetch", function (event) {
+ let sep = "synth.html?";
+ let idx = event.request.url.indexOf(sep);
+ if (idx > 0) {
+ let url = event.request.url.substring(idx + sep.length);
+ event.respondWith(fetch(url, { credentials: "include" }));
+ } else {
+ event.respondWith(fetch(event.request));
+ }
+});