summaryrefslogtreecommitdiffstats
path: root/dom/workers/test/serviceworkers/claim_fetch_worker.js
blob: ea62c37b88c8449bfbd8ce42e835294a78e0b440 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
onfetch = function(e) {
  if (e.request.url.indexOf("service_worker_controlled") >= 0) {
    // pass through
    e.respondWith(fetch(e.request));
  } else {
    e.respondWith(new Response("Fetch was intercepted"));
  }
}

onmessage = function(e) {
  clients.claim();
}