content/html/content/test/test_bug332246.html

Thu, 15 Jan 2015 15:59:08 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 15:59:08 +0100
branch
TOR_BUG_9701
changeset 10
ac0c01689b40
permissions
-rw-r--r--

Implement a real Private Browsing Mode condition by changing the API/ABI;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

     1 <html>
     2 <!--
     3 https://bugzilla.mozilla.org/show_bug.cgi?id=332246
     4 -->
     5 <head>
     6   <title>Test for Bug 332246 - scrollIntoView(false) doesn't work correctly for inline elements that wrap at multiple lines</title>
     7   <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
     8   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
     9 </head>
    10 <body>
    11 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=332246">Mozilla Bug 332246</a>
    12 <p id="display"></p>
    13 <div id="content">
    15 <div id="a1" style="height: 100px; width: 100px; overflow: hidden; outline:1px dotted black;">
    16 <div style="height: 100px"></div>
    17 <a id="a2" href="#" style="display:block; background:yellow; height:200px;">Top</a>
    18 <div style="height: 100px"></div>
    19 </div>
    21 <div id="b1" style="height: 100px; width: 100px; overflow: hidden; outline:1px dotted black;">
    22 <div style="height: 100px"></div>
    23 <div id="b2" href="#" style="border:10px solid black; background:yellow; height:200px;"></div>
    24 <div style="height: 100px"></div>
    25 </div>
    27 <br>
    29 <div id="c1" style="height: 100px; width: 100px; overflow: hidden; position: relative; outline:1px dotted black;">
    30 <div id="c2" style="border: 10px solid black; height: 200px; width: 50px; position: absolute; top: 100px;"></div>
    31 <div style="height: 100px"></div>
    32 </div>
    34 </div>
    35 <pre id="test">
    36 <script class="testbody" type="text/javascript">
    38 /** Test for Bug 332246 **/
    40 var a1 = document.getElementById('a1');
    41 var a2 = document.getElementById('a2');
    42 is(a1.scrollHeight, 400, "Wrong a1.scrollHeight");
    43 is(a1.offsetHeight, 100, "Wrong a1.offsetHeight");
    44 a2.scrollIntoView(true);
    45 is(a1.scrollTop, 100, "Wrong scrollTop value after a2.scrollIntoView(true)");
    46 a2.scrollIntoView(false);
    47 is(a1.scrollTop, 200, "Wrong scrollTop value after a2.scrollIntoView(false)");
    49 var b1 = document.getElementById('b1');
    50 var b2 = document.getElementById('b2');
    51 is(b1.scrollHeight, 420, "Wrong b1.scrollHeight");
    52 is(b1.offsetHeight, 100, "Wrong b1.offsetHeight");
    53 b2.scrollIntoView(true);
    54 is(b1.scrollTop, 100, "Wrong scrollTop value after b2.scrollIntoView(true)");
    55 b2.scrollIntoView(false);
    56 is(b1.scrollTop, 220, "Wrong scrollTop value after b2.scrollIntoView(false)");
    58 var c1 = document.getElementById('c1');
    59 var c2 = document.getElementById('c2');
    60 is(c1.scrollHeight, 320, "Wrong c1.scrollHeight");
    61 is(c1.offsetHeight, 100, "Wrong c1.offsetHeight");
    62 c2.scrollIntoView(true);
    63 is(c1.scrollTop, 100, "Wrong scrollTop value after c2.scrollIntoView(true)");
    64 c2.scrollIntoView(false);
    65 is(c1.scrollTop, 220, "Wrong scrollTop value after c2.scrollIntoView(false)");
    67 </script>
    68 </pre>
    69 </body>
    70 </html>

mercurial