layout/reftests/scrolling/fixed-opacity-2.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 <!DOCTYPE HTML>
     2 <html>
     3 <body style="height:2000px; margin:0; overflow:hidden">
     4 <div style="height:1000px; background:url(repeatable-diagonal-gradient.png) fixed repeat-x; opacity:0.5"></div>
     5 <script type="application/javascript">
     6 var topElements = document.getElementsByClassName("scrollTop");
     7 if (!topElements.length) {
     8   topElements = [document.documentElement];
     9 }
    11 var failed = false;
    13 function doScroll(d)
    14 {
    15   if (failed)
    16     return;
    17   for (var i = 0; i < topElements.length; ++i) {
    18     var e = topElements[i];
    19     e.scrollTop = d;
    20     if (e.scrollTop != d) {
    21       document.documentElement.textContent =
    22           "Scrolling failed on " + e.tagName + " element, " +
    23           "tried to scroll to " + d + ", got " + e.scrollTop +
    24           " (Random number: " + Math.random() + ")";
    25       failed = true;
    26     }
    27   }
    28 }
    30 if (document.location.search == '?ref') {
    31   doScroll(700);
    32 } else {
    33   doScroll(800);
    34   document.documentElement.setAttribute("class", "reftest-wait");
    35   window.addEventListener("MozReftestInvalidate", function() {
    36     document.documentElement.removeAttribute("class");
    37     doScroll(700);
    38   }, false);
    39 }
    40 </script>
    41 </body>
    42 </html>

mercurial