diff options
Diffstat (limited to 'dom/serviceworkers/test/bug1151916_worker.js')
-rw-r--r-- | dom/serviceworkers/test/bug1151916_worker.js | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/dom/serviceworkers/test/bug1151916_worker.js b/dom/serviceworkers/test/bug1151916_worker.js new file mode 100644 index 0000000000..2688b78668 --- /dev/null +++ b/dom/serviceworkers/test/bug1151916_worker.js @@ -0,0 +1,15 @@ +onactivate = function(e) { + e.waitUntil( + self.caches.open("default-cache").then(function(cache) { + var response = new Response("Hi there"); + return cache.put("madeup.txt", response); + }) + ); +}; + +onfetch = function(e) { + if (e.request.url.match(/madeup.txt$/)) { + var p = self.caches.match("madeup.txt", { cacheName: "default-cache" }); + e.respondWith(p); + } +}; |