summaryrefslogtreecommitdiffstats
path: root/dom/serviceworkers/test/bug1151916_worker.js
blob: 2688b786688536fa21aa0a434fce712704dd6484 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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);
  }
};