mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 17:55:07 +02:00
If we conform with the HTML specification by processing the iframe synchronously as part of the iframe post connection steps, this test will time out as the load event is fired in the appendChild call. Create the promise for the load event before performing the load event to handle this situation, which also allows the test to pass in chromium.
28 lines
867 B
HTML
28 lines
867 B
HTML
<!DOCTYPE html>
|
|
<script src="../include.js"></script>
|
|
<script>
|
|
promiseTest(async () => {
|
|
const iframe = document.createElement('iframe');
|
|
const iframeLoaded = new Promise(resolve => { iframe.onload = resolve; });
|
|
document.body.appendChild(iframe);
|
|
|
|
await iframeLoaded;
|
|
|
|
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>
|