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