mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 09:45:06 +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.
38 lines
1.3 KiB
HTML
38 lines
1.3 KiB
HTML
<!DOCTYPE html>
|
|
<!-- Test: Rapidly create and destroy iframes containing images.
|
|
This exercises many concurrent image loading operations across
|
|
multiple documents that become inactive at different times.
|
|
The batching dispatcher may accumulate callbacks from many
|
|
different inactive documents. -->
|
|
<html class="test-wait">
|
|
<body>
|
|
<script>
|
|
const imageUrl = new URL("../../Assets/120.png", document.baseURI).href;
|
|
|
|
function createAndDestroyIframe(index) {
|
|
const iframe = document.createElement("iframe");
|
|
iframe.src = "../../Assets/blank.html";
|
|
iframe.onload = () => {
|
|
const doc = iframe.contentDocument;
|
|
for (let i = 0; i < 5; i++) {
|
|
const img = doc.createElement("img");
|
|
img.src = imageUrl + "?frame=" + index + "&img=" + i;
|
|
doc.body.appendChild(img);
|
|
}
|
|
// Remove after a variable delay to create different timing conditions.
|
|
setTimeout(() => { iframe.remove(); }, index * 2);
|
|
};
|
|
document.body.appendChild(iframe);
|
|
}
|
|
|
|
for (let i = 0; i < 10; i++) {
|
|
createAndDestroyIframe(i);
|
|
}
|
|
|
|
setTimeout(() => {
|
|
document.documentElement.classList.remove("test-wait");
|
|
}, 2000);
|
|
</script>
|
|
</body>
|
|
</html>
|