|
1 <!DOCTYPE html> |
|
2 <html> |
|
3 <!-- |
|
4 https://bugzilla.mozilla.org/show_bug.cgi?id=414815 |
|
5 --> |
|
6 <head> |
|
7 <title>postMessage's interaction with a <base> tag</title> |
|
8 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
|
9 <script type="text/javascript" src="browserFu.js"></script> |
|
10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> |
|
11 <base href="http://example.com/" /> |
|
12 </head> |
|
13 <body> |
|
14 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=414815">Mozilla Bug 414815</a> |
|
15 <p id="display"></p> |
|
16 <div id="content" style="display: none"></div> |
|
17 |
|
18 <pre id="test"> |
|
19 <script class="testbody" type="application/javascript"> |
|
20 /** Test for Bug 414815 **/ |
|
21 |
|
22 SimpleTest.waitForExplicitFinish(); |
|
23 |
|
24 function receiveMessage(evt) |
|
25 { |
|
26 is(evt.origin, "http://mochi.test:8888", "wrong sender"); |
|
27 ok(evt.source === window, "wrong source"); |
|
28 |
|
29 is(evt.data, "generate-event", "wrong data"); |
|
30 is(evt.lastEventId, "", "wrong lastEventId"); |
|
31 |
|
32 SimpleTest.finish(); |
|
33 } |
|
34 |
|
35 window.addEventListener("message", receiveMessage, false); |
|
36 |
|
37 function run() |
|
38 { |
|
39 window.postMessage("generate-event", "http://mochi.test:8888"); |
|
40 } |
|
41 |
|
42 window.addEventListener("load", run, false); |
|
43 </script> |
|
44 </pre> |
|
45 </body> |
|
46 </html> |