Skip to content

browser: fix frame document ordering#5676

Draft
inancgumus wants to merge 8 commits intomasterfrom
fix/frame-document-race
Draft

browser: fix frame document ordering#5676
inancgumus wants to merge 8 commits intomasterfrom
fix/frame-document-race

Conversation

@inancgumus
Copy link
Contributor

@inancgumus inancgumus commented Feb 18, 2026

What?

This PR fixes how navigation responses are resolved during Goto and WaitForNavigation.

Instead of reading the response directly from the navigation event (before network handling has caught up), it now waits for lifecycle events to complete, then looks up the response by document ID. It also fixes request binding during redirects, where a request could end up associated with the wrong document.

Why?

Improves stability, reduces the flaky behavior, and should reduce other flaky behavior in CI.

Before this, there was a timing window where the response was read as nil even though the request had completed. This caused flaky results and was the reason WebVital tests had to be skipped on Windows.

Note

This PR requires #5656 to be merged. Otherwise, it will fail.

Related PR(s)/Issue(s)

Depends on #5656
Closes #4371

This lock protects both current and pending document state.

The old name suggested it only covered pending state.
There were repeated nil checks around document comparisons.

A small matcher keeps those checks consistent.
Request lookup by document ID was scattered and easy to get wrong.

Putting it behind one helper keeps that logic in one place.
Response lookup should follow the same path as request lookup.

A dedicated helper keeps request/response access aligned.
The response could be read before network handling caught up.

Waiting for lifecycle first removes that timing window.
WaitForNavigation had the same ordering problem as Goto.

Applying the same ordering keeps both paths consistent.
During redirects, requests can land on current or pending documents.

Rebinding by document ID keeps the association correct.
@inancgumus inancgumus added the bug label Feb 18, 2026
@inancgumus inancgumus self-assigned this Feb 18, 2026
@inancgumus inancgumus added the browser Browser module changes label Feb 18, 2026
@inancgumus inancgumus temporarily deployed to azure-trusted-signing February 18, 2026 04:16 — with GitHub Actions Inactive
@inancgumus inancgumus temporarily deployed to azure-trusted-signing February 18, 2026 04:22 — with GitHub Actions Inactive
@inancgumus inancgumus temporarily deployed to azure-trusted-signing February 18, 2026 04:23 — with GitHub Actions Inactive
@inancgumus inancgumus changed the title browser: fix frame document sync race browser: fix frame document ordering Feb 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

browser Browser module changes bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TestWebVitalMetric might be flaky

1 participant