Fix build break
[chromium-blink-merge.git] / content / test / data / post_message.html
blobaa76653e1793a1d4937f65fe9f552900a9b7e260
1 <html>
3 <head><title>Post message tests</title>
4 <script>
5 // Send a message to our opener, and it will reply.
6 function postToOpener(msg, origin) {
7 window.opener.postMessage(msg, origin);
8 return true;
11 // Send a message to a window named "foo".
12 function postToFoo(msg) {
13 var w = window.open("", "foo");
14 w.postMessage(msg, "*");
15 return true;
18 // Send a message to a subframe of window named "foo".
19 function postToFooFrame(msg) {
20 var w = window.open("", "foo");
21 w.frames[0][0].postMessage(msg, "*");
22 return true;
25 // Listen to incoming messages.
26 var receivedMessages = 0;
27 window.addEventListener("message", messageReceived, false);
28 function messageReceived(event) {
29 receivedMessages++;
30 if (event.data === "2-1-reply") {
31 event.source.postMessage("msg4", "*");
33 // Change the title to generate a notification.
34 document.title = event.data;
36 </script>
37 </head>
39 </html>