|
1 <!DOCTYPE html> |
|
2 <html> |
|
3 <!-- |
|
4 https://bugzilla.mozilla.org/show_bug.cgi?id=postMessage |
|
5 --> |
|
6 <head> |
|
7 <title>postMessage with a thrown exception</title> |
|
8 <script type="text/javascript" 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://mochi.test:8888/tests/dom/tests/mochitest/whatwg/postMessage_throw_helper.html" |
|
17 name="sameDomain"></iframe> |
|
18 <iframe src="http://example.org:8000/tests/dom/tests/mochitest/whatwg/postMessage_throw_helper.html" |
|
19 name="crossDomain"></iframe> |
|
20 |
|
21 |
|
22 <pre id="test"> |
|
23 <script class="testbody" type="application/javascript"> |
|
24 /** Test for Bug 387706 **/ |
|
25 |
|
26 SimpleTest.waitForExplicitFinish(); |
|
27 |
|
28 function atLoad() |
|
29 { |
|
30 try |
|
31 { |
|
32 sameDomain.postMessage("foo", "http://mochi.test:8888"); |
|
33 ok(true, "should not have thrown for same-domain exception"); |
|
34 } |
|
35 catch (e) |
|
36 { |
|
37 ok(false, "uh-oh, threw a same-domain exception: " + e); |
|
38 } |
|
39 |
|
40 setTimeout(next, 0); |
|
41 } |
|
42 |
|
43 function next() |
|
44 { |
|
45 ok(true, "no pending-exception wackiness for same-domain"); |
|
46 setTimeout(next2, 0); |
|
47 } |
|
48 |
|
49 function next2() |
|
50 { |
|
51 try |
|
52 { |
|
53 crossDomain.postMessage("foo", "http://example.org:8000"); |
|
54 ok(true, "should not have thrown for cross-domain exception"); |
|
55 } |
|
56 catch (e) |
|
57 { |
|
58 ok(false, "uh-oh, threw a cross-domain exception: " + e); |
|
59 } |
|
60 |
|
61 setTimeout(next3, 0); |
|
62 } |
|
63 |
|
64 function next3() |
|
65 { |
|
66 ok(true, "no pending-exception wackiness for cross-domain"); |
|
67 SimpleTest.finish(); |
|
68 } |
|
69 |
|
70 addLoadEvent(atLoad); |
|
71 </script> |
|
72 </pre> |
|
73 </body> |
|
74 </html> |