<!DOCTYPE html>
<html>
<body>
<p>Tests that setting the src attribute of an img element inside a detached document does not crash.</p>
<iframe id="testFrame" src="resources/top.html"></iframe>
<script>
if (window.testRunner) {
    testRunner.dumpAsText();
    testRunner.waitUntilDone();
}

onload = () => {
    image = testFrame.contentDocument.getElementById("img");
    testFrame.remove();
    setTimeout(() => {
        image.src = "resources/mozilla.gif";
        setTimeout(() => {
            if (window.testRunner)
                testRunner.notifyDone();
        }, 0);
    }, 0);
}

</script>
</body>
</html>

