OLD | NEW |
| (Empty) |
1 <script src="resources/print.js"></script> | |
2 <script> | |
3 if (window.testRunner) { | |
4 testRunner.dumpAsText(); | |
5 testRunner.waitUntilDone(); | |
6 } | |
7 | |
8 window._beforeloadfired = false; | |
9 | |
10 function runTest() | |
11 { | |
12 document.addEventListener("beforeload", function(event) { | |
13 window._beforeloadfired = true; | |
14 }, true); | |
15 | |
16 cachedImage = new Image(); | |
17 document.body.appendChild(cachedImage); | |
18 cachedImage.onload = function(event) { | |
19 if (window._beforeloadfired) | |
20 print("PASS: load fired after beforeload for a cached image.", "
green"); | |
21 else | |
22 print("FAIL: load fired before beforeload for a cached image.",
"red"); | |
23 | |
24 if (this.width == 16) | |
25 print("PASS: image is 16px wide.", "green"); | |
26 else | |
27 print("FAIL: image claims not to be 16px wide.", "red"); | |
28 | |
29 if (window.testRunner) | |
30 testRunner.notifyDone(); | |
31 } | |
32 cachedImage.src = document.getElementById("originalImage").src; | |
33 cachedImage.style.visibility = "hidden"; | |
34 } | |
35 </script> | |
36 <p>This is a regression test for <a href="http://webkit.org/b/45586">http://webk
it.org/b/45586</a>. It verifies that the beforeload event fires before the load
event when loading a cached image, and that the image's style attributes can be
queried in the load event handler. On success, you should see two lines of green
text starting with the word 'PASS'.</p> | |
37 <div id="console"></div> | |
38 <img id="originalImage" style="visibility:hidden" onload="runTest()" src="../../
images/resources/test-load.jpg"> | |
OLD | NEW |