Files
ladybird/Tests/LibWeb/Crash/HTML/image-src-during-parse-iframe-removed.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

28 lines
937 B
HTML

<!DOCTYPE html>
<!-- Test: Use document.write() to inject image elements into an iframe document,
then immediately remove the iframe. The HTML parser triggers image loading
as it processes img elements, and the iframe removal races with the
parser-initiated image loads. -->
<html class="test-wait">
<body>
<script>
const imageUrl = new URL("../../Assets/120.png", document.baseURI).href;
const iframe = document.createElement("iframe");
document.body.appendChild(iframe);
// The initial about:blank document should be fully active.
const doc = iframe.contentDocument;
doc.open();
doc.write(`<img src="${imageUrl}"><img src="${imageUrl}?2"><img src="${imageUrl}?3">`);
doc.close();
// Remove iframe immediately after parsing completes.
iframe.remove();
setTimeout(() => {
document.documentElement.classList.remove("test-wait");
}, 500);
</script>
</body>
</html>