[Release] Webkit-EFL Ver. 2.0_beta_118996_0.6.22
[framework/web/webkit-efl.git] / LayoutTests / fast / images / destroyed-image-load-event.html
1 <body onload="test()">
2 <p>Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=34490">bug 34490<a/>:
3 WebCore::ImageEventSender::dispatchPendingEvents() crashes in certain conditions.</p>
4 <div id="testRun"></div>
5 <div id="container"></div>
6 <script>
7 if (window.layoutTestController) {
8     layoutTestController.waitUntilDone();
9     layoutTestController.dumpAsText();
10 }
11
12 function gc()
13 {
14     if (window.GCController)
15         return GCController.collect();
16
17     for (var i = 0; i < 10000; i++) { // > force garbage collection (FF requires about 9K allocations before a collect)
18         var s = new String("abc");
19     }
20 }
21
22 var container = document.getElementById("container");
23 var testRunDiv = document.getElementById("testRun");
24 var remainingTestRuns = 30;
25
26 function test()
27 {
28     testRunDiv.innerHTML = remainingTestRuns;
29
30     if (--remainingTestRuns < 0) {
31         testRunDiv.innerHTML = "PASS";
32         if (window.layoutTestController)
33             layoutTestController.notifyDone();
34         return;
35     }
36
37     container.innerHTML = '<img src="resources/boston.gif" onload="loaded1()">' +
38         '<img src="resources/boston.gif" onload="loaded2()">';
39 }
40
41 function loaded1()
42 {
43     var img2 = document.getElementsByTagName("img")[1];
44     img2.src = "";
45     container.removeChild(img2);
46     img2 = null;
47     gc();
48     setTimeout(test, 0);
49 }
50
51 function loaded2()
52 {
53 }
54 </script>
55 </body>