dom/tests/mochitest/whatwg/postMessage_idn_helper.html

branch
TOR_BUG_9701
changeset 15
b8a032363ba2
equal deleted inserted replaced
-1:000000000000 0:d2ee4e849c9d
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <title>postMessage IDN test page</title>
5 <script type="application/javascript">
6 function receiveMessage(evt)
7 {
8 var response = "idn-response";
9
10 if (!(evt instanceof MessageEvent))
11 response += " not-a-MessageEvent";
12 if (evt.origin !== "http://mochi.test:8888")
13 response += " wrong-sender-origin(" + evt.origin + ")";
14 if (evt.data !== "idn-message")
15 response += " wrong-data(" + evt.data + ")";
16 if (evt.lastEventId !== "")
17 response += " wrong-lastEventId(" + evt.lastEventId + ")";
18 if (evt.source !== window.parent)
19 response += " wrong-source";
20 if (evt.target !== window)
21 response += " wrong-target";
22 if (evt.type !== "message")
23 response += " wrong-type(" + evt.type + ")";
24
25 evt.source.postMessage(response, evt.origin);
26 }
27 window.addEventListener("message", receiveMessage, false);
28
29 function setup()
30 {
31 var target = document.getElementById("location");
32 target.textContent = location.hostname + ":" + (location.port || 80);
33 }
34
35 window.addEventListener("load", setup, false);
36 </script>
37 </head>
38 <body>
39 <h1 id="location">No location!</h1>
40 </body>
41 </html>

mercurial