tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

test_bug89419-2.html (2083B)


      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 src="/tests/SimpleTest/SimpleTest.js"></script>
      9  <script src="/tests/SimpleTest/WindowSnapshot.js"></script>
     10  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
     11 </head>
     12 <body>
     13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=89419">Mozilla Bug 89419</a>
     14 <p id="display"></p>
     15 <pre id="test">
     16 <script type="application/javascript">
     17 
     18 var first, second, third;
     19 var correct, val1, val2;
     20 
     21 SimpleTest.waitForExplicitFinish();
     22 
     23 function checkFirst()
     24 {
     25  var iframeelem = document.getElementById('test-iframe');
     26  first = snapshotWindow(iframeelem.contentWindow, false);
     27 
     28  iframeelem.onload = checkSecond;
     29  // eslint-disable-next-line no-self-assign
     30  iframeelem.contentWindow.location.href = iframeelem.contentWindow.location.href;
     31 }
     32 
     33 function checkSecond()
     34 {
     35  var iframeelem = document.getElementById('test-iframe');
     36  second = snapshotWindow(iframeelem.contentWindow, false);
     37 
     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.");
     41 
     42  iframeelem.onload = checkThird;
     43  // eslint-disable-next-line no-self-assign
     44  iframeelem.contentWindow.location.href = iframeelem.contentWindow.location.href;
     45 }
     46 
     47 function checkThird()
     48 {
     49  var iframeelem = document.getElementById('test-iframe');
     50  third = snapshotWindow(iframeelem.contentWindow, false);
     51 
     52  // Check that we actually reloaded.
     53  [correct, val1, val2] = compareSnapshots(second, third, false);
     54  ok(correct, "Image should have changed after the second reload.");
     55 
     56  // Make sure we looped back to the first image.
     57  [correct, val1, val2] = compareSnapshots(first, third, true);
     58  ok(correct, "Third image should match first image.");
     59 
     60  SimpleTest.finish();
     61 }
     62 
     63 </script>
     64 </pre>
     65 <div id="content"> <!-- style="display: none" -->
     66 <iframe id="test-iframe" src="bug89419-iframe.html" onload="checkFirst()"></iframe>
     67 </div>
     68 </body>
     69 </html>