mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-25 19:56:30 +00:00
LibWeb: Fix CloseWatcher constructor for detached iframes
This fixes the last subtest in /close-watcher/frame-removal.html :)
This commit is contained in:
parent
14b2e5849d
commit
63d9ed9d8c
Notes:
github-actions[bot]
2024-10-15 12:42:46 +00:00
Author: https://github.com/beuss-git 🔰
Commit: 63d9ed9d8c
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1814
3 changed files with 34 additions and 2 deletions
|
@ -0,0 +1,25 @@
|
|||
<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>
|
Loading…
Add table
Add a link
Reference in a new issue