dom/tests/mochitest/whatwg/test_postMessage_joined.html

branch
TOR_BUG_9701
changeset 9
a63d609f5ebe
equal deleted inserted replaced
-1:000000000000 0:a58a1f6de5fe
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 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 </head>
12 <body>
13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=postMessage">Mozilla Bug 387706</a>
14 <p id="display"></p>
15 <div id="content" style="display: none"></div>
16
17 <iframe src="http://sub1.test1.example.org/tests/dom/tests/mochitest/whatwg/postMessage_joined_helper.html"
18 name="container"></iframe>
19
20
21 <pre id="test">
22 <script class="testbody" type="application/javascript">
23 /** Test for Bug 387706 **/
24
25 SimpleTest.waitForExplicitFinish();
26
27 function receiveTestResult(evt)
28 {
29 ok(evt instanceof MessageEvent, "umm, how did we get this?");
30 is(evt.type, "message", "expected events of type 'message'");
31
32 if (isMozilla)
33 {
34 ok(evt.isTrusted === false, "shouldn't have been a trusted event");
35 }
36
37 is(evt.lastEventId, "", "postMessage creates events with empty lastEventId");
38
39 // Either we passed the test or we failed it. The message's
40 // contents should help to diagnose the failure. Either way,
41 // consider this the end of the test.
42 is(evt.data, "test-passed", "unexpected test result");
43 SimpleTest.finish();
44 }
45
46 function setup()
47 {
48 window.addEventListener("message", receiveTestResult, false);
49 window.frames.container.postMessage("start-test",
50 "http://sub1.test1.example.org");
51 }
52
53 addLoadEvent(setup);
54
55 </script>
56 </pre>
57 </body>
58 </html>

mercurial