dom/tests/mochitest/whatwg/test_postMessage_onOther.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 called through a different same-origin page</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://example.com/tests/dom/tests/mochitest/whatwg/postMessage_onOther.html"
    17         name="topDomainFrame"></iframe>
    18 <iframe src="http://test1.example.com/tests/dom/tests/mochitest/whatwg/postMessage_onOther.html"
    19         name="subDomainFrame"></iframe>
    22 <pre id="test">
    23 <script class="testbody" type="application/javascript">
    24 /** Test for Bug 387706 **/
    26 SimpleTest.waitForExplicitFinish();
    28 /** Receives MessageEvents to this window. */
    29 function messageReceiver(evt)
    30 {
    31   ok(evt instanceof MessageEvent, "wrong event type");
    32   is(evt.origin, "http://test1.example.com", "unexpected origin");
    33   is(evt.lastEventId, "", "postMessage creates events with empty lastEventId");
    34   is(evt.data, "test-finished",
    35      "unexpected data in message");
    37   SimpleTest.finish();
    38 }
    40 function run()
    41 {
    42   window.frames.subDomainFrame.postMessage("start-test",
    43                                            "http://test1.example.com");
    44 }
    46 window.addEventListener("message", messageReceiver, false);
    47 window.addEventListener("load", run, false);
    48 </script>
    49 </pre>
    50 </body>
    51 </html>

mercurial