<script src="/js-test-resources/js-test-pre.js"></script>
<script>

if (window.testRunner) {
	testRunner.waitUntilDone();
	testRunner.dumpAsText();
}

function loaded() {
	// If the garbage collection causes the image load to stop and therefore causes the load event to fire on the main frame, we failed.
	alert("FAIL: The load event fired");
	
	if (window.testRunner)
		testRunner.notifyDone();
}

</script>
<body onload="loaded();">

This has an svg element that contains an svg image element.  That svg 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>
<div id="thediv">
<svg>
<image xlink:href="resources/slowimage.py" />
</svg>
</div>
</body>
<script>

function finished() {
	window.stop()
	if (window.testRunner)
		testRunner.notifyDone();
}

function forceGC() {
	gc();
	setTimeout("finished();", 0);
}

function removeTheDiv() {
	var element = window.document.getElementById("thediv");
	element.parentNode.removeChild(element);
	element = null;
	setTimeout("forceGC();", 0);
}

setTimeout("removeTheDiv();", 0);

</script>
