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.
33 lines
1023 B
HTML
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>
|