dom/tests/mochitest/bugs/test_bug377539.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=377539
     5 -->
     6 <head>
     7     <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
     8     <title>Testcase for bug 377539</title>
    10   <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    11   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
    12 </head>
    13 <body>
    14 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=377539">Mozilla Bug 377539</a>
    16 <p id="display"></p>
    17 <div id="content" style="display: none">
    19 </div>
    21 <script type="text/javascript">
    22 var sw;
    23 var child_sw = -1;
    25 function test(){
    26         var t = '<div style="display: none;"><iframe onload="doChecks()" src="data:text/html,<body><scr'+'ipt>try {parent.child_sw=screen.width}catch(e){}</scr'+'ipt>"></iframe></div>';
    27         var div = document.createElement('div');
    28         div.innerHTML = t;
    29         document.getElementsByTagName('body')[0].appendChild(div);
    30 }
    32 try {
    33   sw = screen.width;
    34 } catch (e) {
    35   sw = -1;
    36 }
    38 </script>
    40 <pre id="test">
    41 <script class="testbody" type="text/javascript">
    42 function doChecks() {
    43   isnot(sw, -1, "screen.width threw an exception");
    44   is(child_sw, sw, "iframe got wrong screen.width");
    45   SimpleTest.finish();
    46 }
    48 SimpleTest.waitForExplicitFinish();
    50 test();
    52 </script>
    53 </pre>
    54 </body>
    55 </html>

mercurial