| OLD | NEW |
| 1 <script src="/js-test-resources/js-test.js"></script> | 1 <script src="/js-test-resources/js-test.js"></script> |
| 2 <script> | 2 <script> |
| 3 | 3 |
| 4 if (window.testRunner) { | 4 if (window.testRunner) { |
| 5 » window.jsTestIsAsync = true; | 5 » testRunner.waitUntilDone(); |
| 6 testRunner.dumpAsText(); | 6 testRunner.dumpAsText(); |
| 7 } | 7 } |
| 8 | 8 |
| 9 function loaded() { | 9 function loaded() { |
| 10 // If the garbage collection causes the image load to stop and therefore
causes the load event to fire on the main frame, we failed. | 10 // If the garbage collection causes the image load to stop and therefore
causes the load event to fire on the main frame, we failed. |
| 11 alert("FAIL: The load event fired"); | 11 alert("FAIL: The load event fired"); |
| 12 » finishJSTest(); | 12 » |
| 13 » if (window.testRunner) |
| 14 » » testRunner.notifyDone(); |
| 13 } | 15 } |
| 14 | 16 |
| 15 </script> | 17 </script> |
| 16 <body onload="loaded();"> | 18 <body onload="loaded();"> |
| 17 | 19 |
| 18 This test has an image inside a div. It removes the div, forces garbage collect
ion, and makes sure that the window load event does not fire. It also makes sur
e there is no crash.<br> | 20 This test has an image inside a div. It removes the div, forces garbage collect
ion, and makes sure that the window load event does not fire. It also makes sur
e there is no crash.<br> |
| 19 <div id="thediv"> | 21 <div id="thediv"> |
| 20 <img src="resources/slowimage.php"> | 22 <img src="resources/slowimage.php"> |
| 21 </div> | 23 </div> |
| 22 </body> | 24 </body> |
| 23 <script> | 25 <script> |
| 24 | 26 |
| 25 function finished() { | 27 function finished() { |
| 26 window.stop() | 28 window.stop() |
| 27 » finishJSTest(); | 29 » if (window.testRunner) |
| 30 » » testRunner.notifyDone(); |
| 28 } | 31 } |
| 29 | 32 |
| 30 function forceGC() { | 33 function forceGC() { |
| 31 gc(); | 34 gc(); |
| 32 setTimeout("finished();", 0); | 35 setTimeout("finished();", 0); |
| 33 } | 36 } |
| 34 | 37 |
| 35 function removeTheDiv() { | 38 function removeTheDiv() { |
| 36 var element = window.document.getElementById("thediv"); | 39 var element = window.document.getElementById("thediv"); |
| 37 element.parentNode.removeChild(element); | 40 element.parentNode.removeChild(element); |
| 38 element = null; | 41 element = null; |
| 39 setTimeout("forceGC();", 0); | 42 setTimeout("forceGC();", 0); |
| 40 } | 43 } |
| 41 | 44 |
| 42 setTimeout("removeTheDiv();", 0); | 45 setTimeout("removeTheDiv();", 0); |
| 43 | 46 |
| 44 </script> | 47 </script> |
| OLD | NEW |