image/test/mochitest/test_bug552605-1.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 <!--
     4 https://bugzilla.mozilla.org/show_bug.cgi?id=552605
     5 -->
     6 <head>
     7   <title>Test for Bug 552605</title>
     8   <script type="application/javascript" src="/MochiKit/MochiKit.js"></script>
     9   <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    10   <script type="application/javascript" src="/tests/SimpleTest/WindowSnapshot.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=552605">Mozilla Bug 552605</a>
    15 <p id="display"></p>
    16 <pre id="test">
    17 <script type="application/javascript">
    19 var first, second;
    21 SimpleTest.waitForExplicitFinish();
    23 function checkFirst()
    24 {
    25   var testimage = document.getElementById('test-image');
    26   first = document.createElement('canvas')
    27   var ctx = first.getContext('2d');
    28   ctx.drawImage(testimage, 0, 0);
    30   var newimg = new Image();
    31   newimg.onload = checkSecond;
    32   newimg.src = "bug552605.sjs";
    33   document.body.appendChild(newimg);
    34 }
    36 function checkSecond()
    37 {
    38   var testimage = document.getElementById('test-image');
    39   second = document.createElement('canvas')
    40   var ctx = second.getContext('2d');
    41   ctx.drawImage(testimage, 0, 0);
    43   // Check that the images are the same, since they're in the same document.
    44   [correct, val1, val2] = compareSnapshots(first, second, true);
    45   ok(correct, "Image should be the same for all loads.");
    47   SimpleTest.finish();
    48 }
    50 </script>
    51 </pre>
    52 <div id="content"> <!-- style="display: none" -->
    53 <img src="bug552605.sjs" onload="checkFirst()" id="test-image"></iframe>
    54 </div>
    55 </body>
    56 </html>

mercurial