dom/tests/mochitest/bugs/test_bug850517.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=850517
     5 -->
     6 <head>
     7   <meta charset="utf-8">
     8   <title>Test for Bug 850517</title>
     9   <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    10   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    11   <script type="application/javascript">
    13   /** Test for live updating of named child resolution. **/
    14   SimpleTest.waitForExplicitFinish();
    16   function go() {
    17     var ifrA = $('a');
    18     var ifrB = $('b');
    19     var sb = new SpecialPowers.Cu.Sandbox('http://www.example.com');
    20     sb.win = window;
    21     sb.childA = ifrA.contentWindow;
    22     sb.childB = ifrB.contentWindow;
    23     sb.is = SpecialPowers.wrap(is);
    24     sb.ok = SpecialPowers.wrap(ok);
    25     is(window.theoneandonly.frameElement, ifrA, "Named child resolution works");
    26     SpecialPowers.Cu.evalInSandbox('is(win.theoneandonly, childA, "Named child resolution works via Xray");', sb);
    27     ifrA.removeAttribute('name');
    28     is(typeof window.theoneandonly, 'undefined', "Revocation works");
    29     SpecialPowers.Cu.evalInSandbox('try { win.theoneandonly; ok(false, "Should have thrown"); } ' +
    30                                    'catch (e) {ok(!!/denied/.exec(e) && !!/theoneandonly/.exec(e), "Revocation works via Xray");};', sb);
    31     ifrB.setAttribute('name', 'theoneandonly');
    32     is(window.theoneandonly.frameElement, ifrB, "Another mule kicking in the same old stall");
    33     SpecialPowers.Cu.evalInSandbox('is(win.theoneandonly, childB, "Another mule via Xray");', sb);
    34     SimpleTest.finish();
    35   }
    37   </script>
    38 </head>
    39 <body onload="go();">
    40 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=850517">Mozilla Bug 850517</a>
    41 <p id="display"></p>
    42 <iframe id="a" name="theoneandonly"></iframe>
    43 <iframe id="b"></iframe>
    44 <pre id="test">
    45 </pre>
    46 </body>
    47 </html>

mercurial