dom/tests/mochitest/whatwg/test_postMessage_throw.html

Thu, 15 Jan 2015 15:55:04 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 15:55:04 +0100
branch
TOR_BUG_9701
changeset 9
a63d609f5ebe
permissions
-rw-r--r--

Back out 97036ab72558 which inappropriately compared turds to third parties.

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

mercurial