test_postMessage_joined.html (1604B)
1 <!DOCTYPE html> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=postMessage 5 --> 6 <head> 7 <title>postMessage with document.domain setting to join origins</title> 8 <script src="/tests/SimpleTest/SimpleTest.js"></script> 9 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> 10 </head> 11 <body> 12 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=postMessage">Mozilla Bug 387706</a> 13 <p id="display"></p> 14 <div id="content" style="display: none"></div> 15 16 <iframe src="http://sub1.test1.example.org/tests/dom/tests/mochitest/whatwg/postMessage_joined_helper.html" 17 name="container"></iframe> 18 19 20 <pre id="test"> 21 <script class="testbody" type="application/javascript"> 22 /** Test for Bug 387706 */ 23 24 SimpleTest.waitForExplicitFinish(); 25 26 function receiveTestResult(evt) 27 { 28 ok(evt instanceof MessageEvent, "umm, how did we get this?"); 29 is(evt.type, "message", "expected events of type 'message'"); 30 ok(evt.isTrusted === true, "should have been a trusted event"); 31 32 is(evt.lastEventId, "", "postMessage creates events with empty lastEventId"); 33 34 // Either we passed the test or we failed it. The message's 35 // contents should help to diagnose the failure. Either way, 36 // consider this the end of the test. 37 is(evt.data, "test-passed", "unexpected test result"); 38 SimpleTest.finish(); 39 } 40 41 function setup() 42 { 43 window.addEventListener("message", receiveTestResult); 44 window.frames.container.postMessage("start-test", 45 "http://sub1.test1.example.org"); 46 } 47 48 addLoadEvent(setup); 49 50 </script> 51 </pre> 52 </body> 53 </html>