summaryrefslogtreecommitdiffstats
path: root/dom/workers/test/serviceworkers/thirdparty/sw.js
blob: ca45698c837485bb8ab7d17c0a0258d2f3a11eeb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
self.addEventListener("fetch", function(event) {
  dump("fetch " + event.request.url + "\n");
  if (event.request.url.indexOf("iframe2.html") >= 0) {
    var body =
      "<script>" +
        "window.parent.postMessage({" +
          "source: 'iframe', status: 'swresponse'" +
        "}, '*');" +
      "</script>";
    event.respondWith(new Response(body, {
      headers: {'Content-Type': 'text/html'}
    }));
  }
});