ladybird/Tests/LibWeb/Text/input/HTML/CloseWatcher-detached-iframe.html
Benjamin Bjerken 63d9ed9d8c LibWeb: Fix CloseWatcher constructor for detached iframes
This fixes the last subtest in /close-watcher/frame-removal.html :)
2024-10-15 08:41:54 -04:00

25 lines
803 B
HTML

<script src="../include.js"></script>
<script>
promiseTest(async () => {
const iframe = document.createElement('iframe');
document.body.appendChild(iframe);
await new Promise(resolve => iframe.onload = resolve);
const iframeCloseWatcher = iframe.contentWindow.CloseWatcher;
const iframeDOMException = iframe.contentWindow.DOMException;
iframe.remove();
try {
new iframeCloseWatcher();
println("FAIL");
} catch (error) {
if (error instanceof iframeDOMException && error.name === "InvalidStateError") {
println("PASS");
} else {
println(`FAIL: CloseWatcher construction threw unexpected error: ${error.name}`);
}
}
});
</script>