mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 17:55:07 +02:00
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.
28 lines
937 B
HTML
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>
|