summaryrefslogtreecommitdiffstats
path: root/dom/serviceworkers/test/eventsource/eventsource_register_worker.html
blob: 59e8e92ab646e8d3ef62da5780fd03b8c436a396 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<!--
  Any copyright is dedicated to the Public Domain.
  http://creativecommons.org/publicdomain/zero/1.0/
-->
<!DOCTYPE HTML>
<html>
<head>
  <title>Bug 1182103 - Test EventSource scenarios with fetch interception</title>
  <script type="text/javascript">

  function getURLParam (aTarget, aValue) {
    return decodeURI(aTarget.search.replace(new RegExp("^(?:.*[&\\?]" + encodeURI(aValue).replace(/[\.\+\*]/g, "\\$&") + "(?:\\=([^&]*))?)?.*$", "i"), "$1"));
  }

  function onLoad() {
    navigator.serviceWorker.ready.then(function() {
      parent.postMessage({status: "callback", data: "done"}, "*");
    });

    navigator.serviceWorker.register(getURLParam(document.location, "script"), {scope: "."});
  }

  </script>
</head>
<body onload="onLoad()">
</body>
</html>