Files
ladybird/Tests/LibWeb/Crash/HTML/image-load-after-iframe-navigated.html
Andreas Kling d0fd5dd731 Tests/LibWeb: Add crash tests for image loading in removed iframes
Add 18 crash tests covering various scenarios where image loading
callbacks fire after an iframe has been removed from the DOM,
making its document inactive. These tests cover microtasks,
element tasks, batching dispatcher callbacks, decode promises,
lazy loading, srcset, picture elements, nested iframes, document
adoption, and iframe reattach/remove cycles.
2026-02-10 21:19:35 +01:00

33 lines
1023 B
HTML

<!DOCTYPE html>
<!-- Test: Image starts loading in iframe, then the iframe is navigated to a
different page. The old document becomes inactive, but the image fetch
callbacks may still fire on it. -->
<html class="test-wait">
<body>
<script>
const iframe = document.createElement("iframe");
iframe.src = "../../Assets/blank.html";
let navigated = false;
iframe.onload = () => {
if (navigated) {
setTimeout(() => {
document.documentElement.classList.remove("test-wait");
}, 500);
return;
}
navigated = true;
const doc = iframe.contentDocument;
const img = doc.createElement("img");
doc.body.appendChild(img);
img.src = "120.png";
// Navigate the iframe, making the old document inactive.
// Image loading callbacks from the old document may still fire.
iframe.src = "../../Assets/blank.html";
};
document.body.appendChild(iframe);
</script>
</body>
</html>