dom/tests/mochitest/whatwg/postMessage_origin_helper.xhtml

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:0d86151061fa
1 <!DOCTYPE html>
2 <html xmlns="http://www.w3.org/1999/xhtml">
3 <head>
4 <title>postMessage origin-testing helper page</title>
5 <script type="application/javascript"><![CDATA[
6 function receiveMessage(evt)
7 {
8 var response = "PASS";
9
10 if (evt.origin !== "http://mochi.test:8888")
11 response += " wrong-origin(" + evt.origin + ")";
12 if (evt.source !== window.parent)
13 response += " wrong-source";
14 if (evt.data !== "PASS")
15 response += " wrong-data(" + evt.data + ")";
16
17 window.parent.postMessage(response, "http://mochi.test:8888");
18 }
19
20 window.addEventListener("message", receiveMessage, false);
21
22
23 // Aids for identifying origins
24
25 function setup()
26 {
27 var target = document.getElementById("location");
28 target.textContent = location.hostname + ":" + (location.port || 80);
29 }
30
31 window.addEventListener("load", setup, false);
32 ]]></script>
33 </head>
34 <body>
35 <h1 id="location">No location!</h1>
36 </body>
37 </html>

mercurial