Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / dom / gc-image-element-2.html
blobb1fd2ae7e1b7f167e3dda4b041d41b7484582f88
1 <p>Tests for image elements firing their load events even when they're not in the document. Should say "onload fired" ten times, and then "PASS".</p>
2 <pre id="console"></pre>
4 <script src="../../resources/js-test.js"></script>
5 <script>
6 if (window.testRunner) {
7 testRunner.dumpAsText();
8 testRunner.waitUntilDone();
11 function $(id)
13 return document.getElementById(id);
16 function log(s)
18 $("console").appendChild(document.createTextNode(s + "\n"));
21 var imageCount = 0;
23 function createImage()
25 ++imageCount;
26 var image = new Image;
27 image.src = "resources/apple.gif";
28 image.onload = function () {
29 log("onload fired...");
30 gc();
32 --imageCount;
33 if (!imageCount) {
34 log("PASS");
35 if (window.testRunner)
36 testRunner.notifyDone();
39 image = null;
42 for (var i = 0; i < 10; ++i)
43 createImage();
45 </script>