summaryrefslogtreecommitdiffstats
path: root/dom/serviceworkers/test/sw_clients/service_worker_controlled.html
blob: e0d7bce573601a0ce518ffd49330342040201559 (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
28
29
30
31
32
33
34
35
36
37
38
<!--
  Any copyright is dedicated to the Public Domain.
  http://creativecommons.org/publicdomain/zero/1.0/
-->
<!DOCTYPE HTML>
<html>
<head>
  <title>controlled page</title>
  <!--
    Paged controlled by a service worker for testing matchAll().
    See bug 982726, 1058311.
  -->
<script class="testbody" type="text/javascript">
  function fail(msg) {
    info("service_worker_controlled.html: " + msg);
    opener.postMessage("FAIL", "*");
  }

  if (!parent) {
      info("service_worker_controlled.html should not be launched directly!");
  }

  window.onload = function() {
    navigator.serviceWorker.ready.then(function(swr) {
      parent.postMessage("READY", "*");
    });
  }

  navigator.serviceWorker.onmessage = function(msg) {
    // forward message to the test page.
    parent.postMessage(msg.data, "*");
  };
</script>

</head>
<body>
</body>
</html>