image/test/mochitest/test_bug466586.html

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     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 type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
     9   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    10 </head>
    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">
    21 SimpleTest.waitForExplicitFinish();
    23 var jsBig = new Image();
    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()");
    35   var small = new Image();
    36   small.onload = smallLoaded;
    37   small.src = "red.png";
    38 }
    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 }
    49 function jsBigLoaded()
    50 {
    51   is(jsBig.width, 3000, "JS 'big' image width after its onload()");
    53   SimpleTest.finish();
    54 }
    55 </script>
    56 </pre>
    57 </body>
    58 </html>

mercurial