tor-browser

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

test_bug466586.html (1551B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <!--
      4 https://bugzilla.mozilla.org/show_bug.cgi?id=466586
      5 -->
      6 <head>
      7  <title>Test for Bug 466586</title>
      8  <script src="/tests/SimpleTest/SimpleTest.js"></script>
      9  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
     10 </head>
     11 
     12 <body onload="loadSmall();">
     13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=89419">Mozilla Bug 466586</a>
     14 <p id="display"></p>
     15 <div id="content" style="display: none">
     16  <img id="big" src="big.png"/>
     17 </div>
     18 <pre id="test">
     19 <script type="application/javascript">
     20 
     21 SimpleTest.waitForExplicitFinish();
     22 
     23 var jsBig = new Image();
     24 
     25 // We have loaded the large png with id "big". We want to test if it will be
     26 // kicked out of the cache and thus have to be reloaded, but to ensure that, we
     27 // need to get the cache to look at what is there. So we load another image,
     28 // this one small.
     29 function loadSmall()
     30 {
     31  // Trivial check, for reference.
     32  is(document.getElementById("big").width, 3000,
     33     "HTML 'big' image width after page onload()");
     34 
     35  var small = new Image();
     36  small.onload = smallLoaded;
     37  small.src = "red.png";
     38 }
     39 
     40 function smallLoaded()
     41 {
     42  jsBig.src = document.getElementById("big").src;
     43  // Check that it is not needed to wait for onload().
     44  is(jsBig.width, 3000, "JS 'big' image width before its onload()");
     45  // Check again after onload(), for reference.
     46  jsBig.onload = jsBigLoaded;
     47 }
     48 
     49 function jsBigLoaded()
     50 {
     51  is(jsBig.width, 3000, "JS 'big' image width after its onload()");
     52 
     53  SimpleTest.finish();
     54 }
     55 </script>
     56 </pre>
     57 </body>
     58 </html>