summaryrefslogtreecommitdiffstats
path: root/dom/serviceworkers/test/sw_file_upload.js
diff options
context:
space:
mode:
Diffstat (limited to 'dom/serviceworkers/test/sw_file_upload.js')
-rw-r--r--dom/serviceworkers/test/sw_file_upload.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/dom/serviceworkers/test/sw_file_upload.js b/dom/serviceworkers/test/sw_file_upload.js
new file mode 100644
index 0000000000..20c695614b
--- /dev/null
+++ b/dom/serviceworkers/test/sw_file_upload.js
@@ -0,0 +1,16 @@
+self.skipWaiting();
+
+addEventListener("fetch", event => {
+ const url = new URL(event.request.url);
+ const params = new URLSearchParams(url.search);
+
+ if (params.get("clone") === "1") {
+ event.respondWith(fetch(event.request.clone()));
+ } else {
+ event.respondWith(fetch(event.request));
+ }
+});
+
+addEventListener("activate", function (event) {
+ event.waitUntil(clients.claim());
+});