summaryrefslogtreecommitdiffstats
path: root/dom/messagechannel/tests/iframe_messageChannel_cloning.html
blob: de03cead9606d6f58d6bc591fcff955c402334a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<!DOCTYPE HTML>
<html>
<body>
  <script type="application/javascript">

  function ok(a, msg) {
    window.parent.postMessage({ status: a ? "OK" : "KO", message: msg }, "*");
  }

  window.addEventListener('message', receiveMessage, false);
  function receiveMessage(evt) {
    ok (evt.data, "Data received");
    ok (evt.data.port instanceof MessagePort, "Data contains a MessagePort");

    var a = new MessageChannel();
    window.parent.postMessage({ status: "FINISH", port: a.port2 }, '*', [a.port2]);
  }

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