summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/webmessaging/broadcastchannel/resources/cross-origin.html
blob: 5078b6fc8e46f556fe1b86c7e1aa5a141c132be1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<body></body>
<script>
  window.onload = function() {
    bc1 = new BroadcastChannel('no-cross-origin-messages');
    bc2 = new BroadcastChannel('no-cross-origin-messages');
    bc2.onmessage = e => {
      parent.postMessage('done', "*");
    };
    // Post a message on bc1 and once we receive it in bc2, we know that the
    // message should have been sent to bc0 if messages were being passed
    // across origin (assuming compliance with the spec regarding message
    // delivery in port creation order).
    bc1.postMessage('ignition');
  }
</script>