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.

     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>
    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>
    22 <pre id="test">
    23 <script class="testbody" type="application/javascript">
    24 /** Test for Bug 387706 **/
    26 SimpleTest.waitForExplicitFinish();
    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   }
    40   setTimeout(next, 0);
    41 }
    43 function next()
    44 {
    45   ok(true, "no pending-exception wackiness for same-domain");
    46   setTimeout(next2, 0);
    47 }
    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   }
    61   setTimeout(next3, 0);
    62 }
    64 function next3()
    65 {
    66   ok(true, "no pending-exception wackiness for cross-domain");
    67   SimpleTest.finish();
    68 }
    70 addLoadEvent(atLoad);
    71 </script>
    72 </pre>
    73 </body>
    74 </html>

mercurial