Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / http / tests / misc / embed-image-load-outlives-gc-without-crashing.html
blob0c77d3fa5e0ca8cb0a1a8a369ecbef4149419c73
1 <script src="/js-test-resources/js-test.js"></script>
2 <script>
4 if (window.testRunner) {
5 testRunner.waitUntilDone();
6 testRunner.dumpAsText();
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.
11 alert("FAIL: The load event fired");
13 if (window.testRunner)
14 testRunner.notifyDone();
17 </script>
18 <body onload="loaded();">
20 This has an embed element representing an image. That embed element is wrapped in a div. It removes the div, forces garbage collection, and makes sure that the window load event does not fire. It also makes sure there is no crash.<br>
21 <div id="thediv">
22 <embed type="image/gif" src="resources/slowimage.php">
23 </embed>
24 </div>
25 </body>
26 <script>
28 function finished() {
29 window.stop()
30 if (window.testRunner)
31 testRunner.notifyDone();
34 function forceGC() {
35 gc();
36 setTimeout("finished();", 0);
39 function removeTheDiv() {
40 var element = window.document.getElementById("thediv");
41 element.parentNode.removeChild(element);
42 element = null;
43 setTimeout("forceGC();", 0);
46 setTimeout("removeTheDiv();", 0);
48 </script>