image/test/mochitest/test_bug89419-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=89419
     5 -->
     6 <head>
     7   <title>Test for Bug 89419</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=89419">Mozilla Bug 89419</a>
    15 <p id="display"></p>
    16 <pre id="test">
    17 <script type="application/javascript">
    19 var first, second, third;
    20 var correct, val1, val2;
    22 SimpleTest.waitForExplicitFinish();
    24 function checkFirst()
    25 {
    26   var iframeelem = document.getElementById('test-iframe');
    27   first = snapshotWindow(iframeelem.contentWindow, false);
    29   iframeelem.onload = checkSecond;
    30   iframeelem.contentWindow.location.reload(false);
    31 }
    33 function checkSecond()
    34 {
    35   var iframeelem = document.getElementById('test-iframe');
    36   second = snapshotWindow(iframeelem.contentWindow, false);
    38   // Check that we actually reloaded.
    39   [correct, val1, val2] = compareSnapshots(first, second, false);
    40   ok(correct, "Image should have changed after the first reload.");
    42   iframeelem.onload = checkThird;
    43   iframeelem.contentWindow.location.reload(false);
    44 }
    46 function checkThird()
    47 {
    48   var iframeelem = document.getElementById('test-iframe');
    49   third = snapshotWindow(iframeelem.contentWindow, false);
    51   // Check that we actually reloaded.
    52   [correct, val1, val2] = compareSnapshots(second, third, false);
    53   ok(correct, "Image should have changed after the second reload.");
    55   // Make sure we looped back to the first image.
    56   [correct, val1, val2] = compareSnapshots(first, third, true);
    57   ok(correct, "Third image should match first image.");
    59   SimpleTest.finish();
    60 }
    62 </script>
    63 </pre>
    64 <div id="content"> <!-- style="display: none" -->
    65 <iframe id="test-iframe" src="bug89419-iframe.html" onload="checkFirst()"></iframe>
    66 </div>
    67 </body>
    68 </html>

mercurial