From 08a3c562f31fa7bc33dcde2005a80401909f184b Mon Sep 17 00:00:00 2001 From: Andrew Kaster Date: Thu, 25 Jan 2024 10:29:02 -0700 Subject: [PATCH] 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. --- Tests/LibWeb/TestConfig.ini | 1 - .../LibWeb/Text/input/HTML/Window-postMessage.html | 14 ++++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Tests/LibWeb/TestConfig.ini b/Tests/LibWeb/TestConfig.ini index ad8863712a..24bea23b45 100644 --- a/Tests/LibWeb/TestConfig.ini +++ b/Tests/LibWeb/TestConfig.ini @@ -1,4 +1,3 @@ [Skipped] -Text/input/HTML/Window-postMessage.html Text/input/Worker/Worker-echo.html Text/input/window-scrollTo.html diff --git a/Tests/LibWeb/Text/input/HTML/Window-postMessage.html b/Tests/LibWeb/Text/input/HTML/Window-postMessage.html index ec8f9608d6..153eaa0952 100644 --- a/Tests/LibWeb/Text/input/HTML/Window-postMessage.html +++ b/Tests/LibWeb/Text/input/HTML/Window-postMessage.html @@ -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(() => {