summaryrefslogtreecommitdiffstats
path: root/dom/messagechannel/tests/iframe_messageChannel_post.html
blob: e551dd61ca9bc758627e10d0de232eecd8e0ab3a (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>
<body>
  <script type="application/javascript">

  var port;

  window.addEventListener('message', receiveMessage, false);
  function receiveMessage(evt) {
    port = evt.data.port;

    port.addEventListener('message', receivePostMessage, false);
    function receivePostMessage(evt) {
      port.postMessage(evt.data);
    }
    port.start();

    window.parent.postMessage({ status: "READY" }, '*');
  }

  </script>
</body>
</html>