Skip to content

Commit

Permalink
BroadcastChannel: origin of events
Browse files Browse the repository at this point in the history
  • Loading branch information
annevk committed May 17, 2017
1 parent d9e8cd5 commit 4c79b9e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
10 changes: 10 additions & 0 deletions webmessaging/broadcastchannel/origin.window.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
async_test(t => {
const crossOriginURL = new URL("resources/origin.html", self.location.href).href.replace("://", "://天気の良い日."),
frame = document.createElement("iframe");
frame.src = crossOriginURL;
document.body.appendChild(frame);
t.add_cleanup(() => frame.remove());
self.onmessage = t.step_func_done(e => {
assert_equals(e.data, self.origin.replace("://", "://xn--n8j6ds53lwwkrqhv28a."));
});
}, "Serialization of BroadcastChannel origin");
8 changes: 8 additions & 0 deletions webmessaging/broadcastchannel/resources/origin.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<script>
const bc1 = new BroadcastChannel("ladila"),
bc2 = new BroadcastChannel("ladila");
bc2.onmessage = e => {
parent.postMessage(e.origin, "*");
}
bc1.postMessage("does not matter");
</script>

0 comments on commit 4c79b9e

Please sign in to comment.