Skip to content

Truly independent web browser

Tests/LibWeb: Wait for the load before holding a frame-in-flight layout

sideshowbarker8b8cdac89c65
diff --git a/Tests/LibWeb/Text/input/HTML/frame-in-flight/element-removed-beside-a-layout-taken-in-after-a-publication.html b/Tests/LibWeb/Text/input/HTML/frame-in-flight/element-removed-beside-a-layout-taken-in-after-a-publication.html
index 9b97b8074ba..103f1b61a23 100644
--- a/Tests/LibWeb/Text/input/HTML/frame-in-flight/element-removed-beside-a-layout-taken-in-after-a-publication.html
+++ b/Tests/LibWeb/Text/input/HTML/frame-in-flight/element-removed-beside-a-layout-taken-in-after-a-publication.html
@@ -16,6 +16,9 @@
// reads the layout's size containers: the rows of the later publication hold the earlier one's, which has to go
// ahead of it for the removal to stand.
asyncTest(async done => {
+ // The load lays the document out when it finishes, which would leave no layout for the hold to park.
+ if (document.readyState !== "complete")
+ await new Promise(resolve => window.addEventListener("load", resolve, { once: true }));
await twoFramesLanded();
internals.setManualRenderingOpportunities(true);
const slot = document.createElement("slot");
diff --git a/Tests/LibWeb/Text/input/HTML/frame-in-flight/element-removed-beside-the-layout-that-builds-its-box.html b/Tests/LibWeb/Text/input/HTML/frame-in-flight/element-removed-beside-the-layout-that-builds-its-box.html
index afc08f8a14a..57154e1e680 100644
--- a/Tests/LibWeb/Text/input/HTML/frame-in-flight/element-removed-beside-the-layout-that-builds-its-box.html
+++ b/Tests/LibWeb/Text/input/HTML/frame-in-flight/element-removed-beside-the-layout-that-builds-its-box.html
@@ -6,6 +6,9 @@
// An element removed beside the layout that builds its box leaves nothing of that box behind.
asyncTest(async done => {
const built = document.createElement("table");
+ // The load lays the document out when it finishes, which would leave no layout for the hold to park.
+ if (document.readyState !== "complete")
+ await new Promise(resolve => window.addEventListener("load", resolve, { once: true }));
await twoFramesLanded();
internals.setManualRenderingOpportunities(true);
requestAnimationFrame(() => {