Truly independent web browser
Tests/LibWeb: Arm frame-in-flight holds once earlier frames have landed
Jelle Raaijmakersa5c3c2e792cd
diff --git a/Tests/LibWeb/Text/input/HTML/frame-in-flight/animation-frame-runs-beside-previous-layout.html b/Tests/LibWeb/Text/input/HTML/frame-in-flight/animation-frame-runs-beside-previous-layout.htmlindex 6aff88917ad..a1e75c24a7f 100644--- a/Tests/LibWeb/Text/input/HTML/frame-in-flight/animation-frame-runs-beside-previous-layout.html+++ b/Tests/LibWeb/Text/input/HTML/frame-in-flight/animation-frame-runs-beside-previous-layout.html@@ -11,7 +11,7 @@// beside the event loop, where nothing script sees waits for that layout: the update takes it in, and paints it,// once its callbacks have run.asyncTest(async done => {- await twoFrames();+ await twoFramesLanded();internals.setManualRenderingOpportunities(true);const order = [];requestAnimationFrame(() => {diff --git a/Tests/LibWeb/Text/input/HTML/frame-in-flight/frame-in-flight.js b/Tests/LibWeb/Text/input/HTML/frame-in-flight/frame-in-flight.jsindex 6032b577e38..0183bb08c12 100644--- a/Tests/LibWeb/Text/input/HTML/frame-in-flight/frame-in-flight.js+++ b/Tests/LibWeb/Text/input/HTML/frame-in-flight/frame-in-flight.js@@ -7,7 +7,7 @@async function whileRecordingInFlight(mutate, during) {if (document.readyState !== "complete")await new Promise(resolve => window.addEventListener("load", resolve, { once: true }));- await twoFrames();+ await twoFramesLanded();return new Promise((resolve, reject) => {requestAnimationFrame(() => {internals.holdNextFrame();@@ -44,6 +44,14 @@ async function twoFrames() {await nextFrame();}+// Resolves in the first task after two rendering updates once nothing of theirs is in flight. A frame that is still in+// flight spends a hold that a test arms next, which is then not the hold of the rendering update the test means.+async function twoFramesLanded() {+ await twoFrames();+ do await nextTask();+ while (internals.frameSchedulerState() !== "idle");+}+// Has the clock lane of the document's presented frame sample its animations beside a task.//// whileLaneAnimates(animate, during) injects rendering opportunities until the animation `animate` starts is running anddiff --git a/Tests/LibWeb/Text/input/HTML/frame-in-flight/layout-flight-held-beside-collected-document.html b/Tests/LibWeb/Text/input/HTML/frame-in-flight/layout-flight-held-beside-collected-document.htmlindex 619001edf33..c8265ca936a 100644--- a/Tests/LibWeb/Text/input/HTML/frame-in-flight/layout-flight-held-beside-collected-document.html+++ b/Tests/LibWeb/Text/input/HTML/frame-in-flight/layout-flight-held-beside-collected-document.html@@ -20,7 +20,7 @@};document.body.appendChild(frame);});- await twoFrames();+ await twoFramesLanded();requestAnimationFrame(() => {internals.holdNextFrame("layout");internals.setManualRenderingOpportunities(true);diff --git a/Tests/LibWeb/Text/input/HTML/frame-in-flight/layout-flight-renumbers-list-items.html b/Tests/LibWeb/Text/input/HTML/frame-in-flight/layout-flight-renumbers-list-items.htmlindex da9277f87e2..05904c9c359 100644--- a/Tests/LibWeb/Text/input/HTML/frame-in-flight/layout-flight-renumbers-list-items.html+++ b/Tests/LibWeb/Text/input/HTML/frame-in-flight/layout-flight-renumbers-list-items.html@@ -6,7 +6,7 @@// A rendering update whose style is already up to date lays out beside the event loop even where list items wait// to be renumbered: the round renumbers them first, as the layout update's first round would.asyncTest(async done => {- await twoFrames();+ await twoFramesLanded();requestAnimationFrame(() => {internals.holdNextFrame("layout");internals.setManualRenderingOpportunities(true);diff --git a/Tests/LibWeb/Text/input/HTML/frame-in-flight/layout-runs-beside-tasks-after-style-change.html b/Tests/LibWeb/Text/input/HTML/frame-in-flight/layout-runs-beside-tasks-after-style-change.htmlindex 3f65e30654d..01f1c3e9832 100644--- a/Tests/LibWeb/Text/input/HTML/frame-in-flight/layout-runs-beside-tasks-after-style-change.html+++ b/Tests/LibWeb/Text/input/HTML/frame-in-flight/layout-runs-beside-tasks-after-style-change.html@@ -11,7 +11,7 @@// loop has taken the style in: the tasks after that run while the layout does. Nothing here reads the style or the// layout until the layout is taken in, which a read would wait for, and no rendering update runs to take it in.asyncTest(async done => {- await twoFrames();+ await twoFramesLanded();requestAnimationFrame(() => {internals.holdNextFrame("layout");internals.setManualRenderingOpportunities(true);diff --git a/Tests/LibWeb/Text/input/HTML/frame-in-flight/layout-runs-beside-tasks-without-style-change.html b/Tests/LibWeb/Text/input/HTML/frame-in-flight/layout-runs-beside-tasks-without-style-change.htmlindex 5e8bcb3afcf..2ed005a2aeb 100644--- a/Tests/LibWeb/Text/input/HTML/frame-in-flight/layout-runs-beside-tasks-without-style-change.html+++ b/Tests/LibWeb/Text/input/HTML/frame-in-flight/layout-runs-beside-tasks-without-style-change.html@@ -7,7 +7,7 @@// loop right away: the tasks after the update run while the layout does. Nothing here reads the layout until it is// taken in, which a read would wait for, and no rendering update runs to take it in.asyncTest(async done => {- await twoFrames();+ await twoFramesLanded();requestAnimationFrame(() => {internals.holdNextFrame("layout");internals.setManualRenderingOpportunities(true);