chromium/third_party/blink/web_tests/http/tests/misc/embed-image-load-outlives-gc-without-crashing.html

<!DOCTYPE html>
<script src = "../resources/testharness.js"></script>
<script src = "../resources/testharnessreport.js"></script>

<p>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.</p><br>
<div id="thediv">
  <embed type="image/gif" src="resources/slowimage.php"></embed>
</div>

<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.
	assert_unreached('FAIL: The load event fired');
	if (window.testRunner)
		testRunner.notifyDone();
}
window.onload = () => loaded();

setTimeout(() => {
  // Remove the div from the document.
	window.document.getElementById("thediv").remove();
	setTimeout(() => {
    gc();
    setTimeout(() => {
      window.stop();
      if (window.testRunner)
        testRunner.notifyDone();
    }, 0);
  }, 0);
}, 1);
</script>