image/test/reftest/apng/delaytest.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 class="reftest-wait">
     3 <head>
     4 <title>Delayed image reftest wrapper</title>
     5 </head>
     6 <body>
     7 <img id="image1">
     8 <script>
     9 // This loads a externally specified image, forces a draw (in case of
    10 // decode-on-draw), waits 100ms, and then triggers the reftest snapshot.
    11 // This allows the animation on the page to complete.
    12 //
    13 // Use as "delaytest.html?animation.png"
    14 //
    16 // Get the image URL from our URL
    17 var imgURL = document.location.search.substr(1);
    19 // Load the image
    20 var img = document.images[0];
    21 img.src = imgURL;
    22 img.onload = forceDecode;
    24 function forceDecode() {
    26   // We need to force drawing of the image in an invisible context
    27   var canvas = document.createElement("canvas");
    28   var ctx = canvas.getContext("2d");
    29   ctx.drawImage(img, 0, 0);
    31   // We've force the decode. start the timer to trigger the reftest
    32   startTimer();
    33 }
    35 function startTimer() {
    36   const delay = 100;
    37   setTimeout("document.documentElement.className = '';", delay);
    38 }
    39 </script>
    40 </body>
    41 </html>

mercurial