ladybird/Tests/LibWeb/Text/input/HTML/WindowProxy-Get-after-detaching-from-browsing-context.html
Andreas Kling ad843b6e4a LibWeb: Don't crash when accessing property in detached Window object
After removing an iframe from the DOM, its contentWindow will be
detached from its browsing context, per spec.

Because the contentWindow is still accessible, we cannot assume that
Window objects always have an associated browsing context.

This needs to be fixed in the spec, but let's add a sensible null check
in the meantime.
2024-03-11 18:29:10 +01:00

11 lines
325 B
HTML

<script src="../include.js"></script>
<script>
test(() => {
let iframe = document.querySelector("iframe")
let w = iframe.contentWindow;
println(w.getSelection());
iframe.remove();
println(w.getSelection());
println("PASS (didn't crash)");
})
</script><iframe></iframe>