|
1 <!DOCTYPE html> |
|
2 <html> |
|
3 <head> |
|
4 <title>postMessage's interaction with hash URIs</title> |
|
5 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
|
6 <script type="text/javascript" src="browserFu.js"></script> |
|
7 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> |
|
8 <base href="http://example.com/" /> |
|
9 </head> |
|
10 <body> |
|
11 <p>(no bug; this is a preemptive test)</p> |
|
12 <p id="display"></p> |
|
13 <div id="content" style="display: none"></div> |
|
14 |
|
15 <iframe src="http://mochi.test:8888/tests/dom/tests/mochitest/whatwg/postMessage_hash.html#hash" |
|
16 name="kid"></iframe> |
|
17 |
|
18 <pre id="test"> |
|
19 <script class="testbody" type="application/javascript"> |
|
20 |
|
21 SimpleTest.waitForExplicitFinish(); |
|
22 |
|
23 function receiveMessage(evt) |
|
24 { |
|
25 is(evt.origin, "http://mochi.test:8888", "wrong origin"); |
|
26 ok(evt.source === window.frames.kid, "wrong source"); |
|
27 is(evt.lastEventId, "", "postMessage creates events with empty lastEventId"); |
|
28 |
|
29 is(evt.data, "response-message", "wrong data"); |
|
30 |
|
31 SimpleTest.finish(); |
|
32 } |
|
33 |
|
34 window.addEventListener("message", receiveMessage, false); |
|
35 |
|
36 function run() |
|
37 { |
|
38 window.frames.kid.postMessage("from-parent", "http://mochi.test:8888"); |
|
39 } |
|
40 |
|
41 window.addEventListener("load", run, false); |
|
42 </script> |
|
43 </pre> |
|
44 </body> |
|
45 </html> |