dom/tests/mochitest/whatwg/test_postMessage_userpass.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=417075
     5 -->
     6 <head>
     7   <title>postMessage from a page with username/password in its URI</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=417075">Mozilla Bug 417075</a>
    13 <p id="display"></p>
    14 <div id="content" style="display: none"></div>
    16 <iframe src="http://bobhope:password@example.org/tests/dom/tests/mochitest/whatwg/postMessage_userpass_helper.html"
    17         name="userPassKid"></iframe>
    20 <pre id="test">
    21 <script class="testbody" type="application/javascript">
    22 /** Test for Bug 417075 **/
    24 SimpleTest.waitForExplicitFinish();
    26 function receiveMessage(evt)
    27 {
    28   is(evt.origin, "http://example.org", "wrong origin");
    29   is(evt.data, "child-message", "wrong data");
    30   is(evt.lastEventId, "", "postMessage creates events with empty lastEventId");
    31   ok(evt.source === window.frames.userPassKid, "wrong source");
    32   SimpleTest.finish();
    33 }
    35 window.addEventListener("message", receiveMessage, false);
    37 function sendMessage(evt)
    38 {
    39   window.frames.userPassKid.postMessage("parent-message", "http://example.org");
    40 }
    42 window.addEventListener("load", sendMessage, false);
    43 </script>
    44 </pre>
    45 </body>
    46 </html>

mercurial