Skip to content

Truly independent web browser

Tests/LibWeb: Stop racing navigation tests against their own timers

Tim Ledbetter501a54a0d06b
diff --git a/Tests/LibWeb/Text/input/navigation/link-click-after-replace-state-in-click-handler.html b/Tests/LibWeb/Text/input/navigation/link-click-after-replace-state-in-click-handler.html
index 6aacd3a3482..16e90d610ca 100644
--- a/Tests/LibWeb/Text/input/navigation/link-click-after-replace-state-in-click-handler.html
+++ b/Tests/LibWeb/Text/input/navigation/link-click-after-replace-state-in-click-handler.html
@@ -39,10 +39,8 @@
const result = await new Promise(resolve => {
const iframe = document.createElement("iframe");
- const timer = setTimeout(() => resolve("FAIL (timed out)"), 5000);
window.addEventListener("message", e => {
if (e.source === iframe.contentWindow && e.data === "loaded-page2") {
- clearTimeout(timer);
iframe.remove();
resolve("PASS");
}
diff --git a/Tests/LibWeb/Text/input/navigation/location-replace-after-nested-iframe-navigated.html b/Tests/LibWeb/Text/input/navigation/location-replace-after-nested-iframe-navigated.html
index d5bf2d51a4c..aac7c69bf32 100644
--- a/Tests/LibWeb/Text/input/navigation/location-replace-after-nested-iframe-navigated.html
+++ b/Tests/LibWeb/Text/input/navigation/location-replace-after-nested-iframe-navigated.html
@@ -26,7 +26,7 @@
}
frameA.contentWindow.location.replace("data:text/html,<script>parent.postMessage('replaced', '*')<\/script>");
- const timedOut = new Promise(resolve => setTimeout(() => resolve("not replaced"), 2000));
- println(await Promise.race([replaced.then(() => "replaced"), timedOut]));
+ await replaced;
+ println("replaced");
});
</script>