summaryrefslogtreecommitdiffstats
path: root/dom/push/test/frame.html
blob: 50036db15e24315fc565db0c082f0e4fd11aad02 (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
<!DOCTYPE HTML>
<html>
<head>
  <meta http-equiv="Content-type" content="text/html;charset=UTF-8">
  <script>

    function waitOnWorkerMessage(type) {
      return new Promise(function(res, rej) {
        function onMessage(e) {
          if (e.data.type == type) {
            navigator.serviceWorker.removeEventListener("message", onMessage);
            (e.data.okay == "yes" ? res : rej)(e.data);
          }
        }
        navigator.serviceWorker.addEventListener("message", onMessage);
      });
    }

  </script>
</head>
<body>

</body>
</html>