LibWeb: Resolve postMessage test promises if iframes already loaded

For some reason on macOS with ASAN enabled, the test promises in
HTML/Window-postMessage do not resolve. These promises wait for both
the in-document and the blob url iframes to load. It's not clear why
this works fine in Linux nor why the onload handler doesn't fire
when the iframe has already loaded.
This commit is contained in:
Andrew Kaster 2024-01-25 10:29:02 -07:00 committed by Andreas Kling
parent e025bcc4f9
commit 08a3c562f3
Notes: sideshowbarker 2024-07-16 22:22:13 +09:00
2 changed files with 12 additions and 3 deletions

View file

@ -1,4 +1,3 @@
[Skipped]
Text/input/HTML/Window-postMessage.html
Text/input/Worker/Worker-echo.html
Text/input/window-scrollTo.html

View file

@ -127,11 +127,21 @@
globalThis.doneCallback = done;
const blobIframeLoadPromise = new Promise(resolve => {
blobIframe.onload = () => resolve();
if (blobIframe.contentDocument.readyState === "complete") {
resolve();
}
else {
blobIframe.onload = () => resolve();
}
});
const srcdocIframeLoadPromise = new Promise(resolve => {
iframe.onload = () => resolve();
if (iframe.contentDocument.readyState === "complete") {
resolve()
}
else {
iframe.onload = () => resolve();
}
});
Promise.all([blobIframeLoadPromise, srcdocIframeLoadPromise]).then(() => {