dom/tests/mochitest/whatwg/test_postMessage_joined.html

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

     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>
    17 <iframe src="http://sub1.test1.example.org/tests/dom/tests/mochitest/whatwg/postMessage_joined_helper.html"
    18         name="container"></iframe>
    21 <pre id="test">
    22 <script class="testbody" type="application/javascript">
    23 /** Test for Bug 387706 **/
    25 SimpleTest.waitForExplicitFinish();
    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'");
    32   if (isMozilla)
    33   {
    34     ok(evt.isTrusted === false, "shouldn't have been a trusted event");
    35   }
    37   is(evt.lastEventId, "", "postMessage creates events with empty lastEventId");
    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 }
    46 function setup()
    47 {
    48   window.addEventListener("message", receiveTestResult, false);
    49   window.frames.container.postMessage("start-test",
    50                                       "http://sub1.test1.example.org");
    51 }
    53 addLoadEvent(setup);
    55 </script>
    56 </pre>
    57 </body>
    58 </html>

mercurial