Tests/LibWeb: Handle synchronous iframe processing in CloseWatcher test

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.
This commit is contained in:
Shannon Booth
2026-03-24 20:42:35 +01:00
committed by Jelle Raaijmakers
parent d330171be3
commit 633b684d76
Notes: github-actions[bot] 2026-03-25 13:50:40 +00:00

View File

@@ -3,9 +3,10 @@
<script>
promiseTest(async () => {
const iframe = document.createElement('iframe');
const iframeLoaded = new Promise(resolve => { iframe.onload = resolve; });
document.body.appendChild(iframe);
await new Promise(resolve => iframe.onload = resolve);
await iframeLoaded;
const iframeCloseWatcher = iframe.contentWindow.CloseWatcher;
const iframeDOMException = iframe.contentWindow.DOMException;