Files
ladybird/Tests/LibWeb/Crash/HTML/intersection-observer-implicit-root-target-in-navigated-iframe.html
Andreas Kling 0f4575e7d0 LibWeb: Clear stale layout state for inactive documents
IntersectionObserver can keep elements from a navigated iframe's old
document alive until a later rendering update. Once that document tears
down its layout tree, descendant nodes and pseudo-elements can still
retain stale layout and paintable pointers, and destruction can bypass
the usual inactive-document teardown entirely.

Clear per-node layout and paintable pointers across the inactive
document subtree before tearing down the layout tree, and do the same
from destroy() for documents that never go through
did_stop_being_active_document_in_navigable().

Add a crash test that observes an iframe target, navigates the iframe,
and waits for rendering updates without touching stale layout state.

Fixes #8670
2026-04-11 16:03:26 +02:00

24 lines
711 B
HTML

<!DOCTYPE html>
<html class="test-wait">
<iframe></iframe>
<script>
const iframe = document.querySelector("iframe");
iframe.srcdoc = "<div id='target' style='width: 10px; height: 10px'></div>";
iframe.onload = () => {
const observer = new IntersectionObserver(() => {});
observer.observe(iframe.contentDocument.getElementById("target"));
iframe.onload = () => {
requestAnimationFrame(() => {
requestAnimationFrame(() => {
document.documentElement.classList.remove("test-wait");
});
});
};
iframe.srcdoc = "<p>replacement document</p>";
};
</script>
</html>
</content>
</invoke>