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.
31 lines
938 B
HTML
31 lines
938 B
HTML
<!DOCTYPE html>
|
|
<!-- Test: Image with invalid URL starts loading in iframe. Iframe is removed.
|
|
The fetch failure callback fires on an inactive document and tries to
|
|
dispatch an error event. -->
|
|
<html class="test-wait">
|
|
<body>
|
|
<script>
|
|
const iframe = document.createElement("iframe");
|
|
iframe.src = "../../Assets/blank.html";
|
|
iframe.onload = () => {
|
|
const doc = iframe.contentDocument;
|
|
const img = doc.createElement("img");
|
|
doc.body.appendChild(img);
|
|
|
|
// Use a URL that will fail to decode as an image.
|
|
img.src = "data:text/plain,not-an-image";
|
|
|
|
// Remove iframe. The error callback fires on an inactive document.
|
|
setTimeout(() => {
|
|
iframe.remove();
|
|
}, 5);
|
|
|
|
setTimeout(() => {
|
|
document.documentElement.classList.remove("test-wait");
|
|
}, 500);
|
|
};
|
|
document.body.appendChild(iframe);
|
|
</script>
|
|
</body>
|
|
</html>
|