Skip to content

fix(firefox): treat navigationCommitted events without navigationId as same-document URL updates#41224

Merged
dcrousso merged 1 commit into
microsoft:mainfrom
dcrousso:fix-41216
Jun 10, 2026
Merged

fix(firefox): treat navigationCommitted events without navigationId as same-document URL updates#41224
dcrousso merged 1 commit into
microsoft:mainfrom
dcrousso:fix-41216

Conversation

@dcrousso

@dcrousso dcrousso commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Firefox juggler replays the current frame state by emitting Page.navigationCommitted with no navigationId after a process swap (e.g. while restoring a persistent profile)

in Windows these replayed events can arrive after Page.ready, racing with a user goto and causing Frame.gotoImpl to throw "interrupted by another navigation"

treat these as same-document URL updates so they don't interrupt any in-flight new-document navigation in Frame.gotoImpl

fixes #41216

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

await context1.pages()[0].goto('about:blank');
await context1.close();

// On the second launch with an existing profile, Firefox session restore would race with the user's goto and cause "interrupted by another navigation".

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

won't goto throw in case of interrupted navigation? I'd try to run this test with --repeat-each 100 or something to check

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm yeah this does fail if i run this test repeatedly in firefox 🤔

lemme dig a bit deeper

@dcrousso dcrousso changed the title fix(firefox): ignore replayed navigationCommitted events without navigationId fix(firefox): treat navigationCommitted events without navigationId as a same-document URL update Jun 10, 2026
@dcrousso dcrousso changed the title fix(firefox): treat navigationCommitted events without navigationId as a same-document URL update fix(firefox): treat navigationCommitted events without navigationId as same-document URL updates Jun 10, 2026
await server.waitForRequest(route);

// Simulate a process swap where the new PageAgent is re-initialized using an existing frame and dispatches navigationCommitted without a navigationId.
delegate._onNavigationCommitted({

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is too much, we should make the browser trigger this call if it may happen in practice.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

…d` as same-document URL updates

Firefox juggler replays the current frame state by emitting `Page.navigationCommitted` with no `navigationId` after a process swap (e.g. while restoring a persistent profile)

in Windows these replayed events can arrive after `Page.ready`, racing with a user `goto` and causing `Frame.gotoImpl` to throw `"interrupted by another navigation"`

treat these as same-document URL updates so they don't interrupt any in-flight new-document navigation in `Frame.gotoImpl`
@github-actions

Copy link
Copy Markdown
Contributor

Test results for "MCP"

7279 passed, 1119 skipped


Merge workflow run.

@github-actions

Copy link
Copy Markdown
Contributor

Test results for "tests 1"

2 flaky ⚠️ [chromium-library] › library/video.spec.ts:717 › screencast › should work with video+trace `@chromium-ubuntu-22.04-node20`
⚠️ [chromium-library] › library/video.spec.ts:717 › screencast › should work with video+trace `@chromium-ubuntu-22.04-node22`

39507 passed, 771 skipped


Merge workflow run.

@dcrousso dcrousso merged commit 81881e2 into microsoft:main Jun 10, 2026
46 checks passed
@dcrousso dcrousso deleted the fix-41216 branch June 10, 2026 18:12
@yury-s

yury-s commented Jun 15, 2026

Copy link
Copy Markdown
Member

Heads up: this PR regressed the macos-15-large (firefox) job, which has been red on these tests ever since it merged:

  • tests/library/defaultbrowsercontext-2.spec.ts:111 › should restore state from userDataDir
  • tests/library/defaultbrowsercontext-2.spec.ts:145 › should goto about:blank on relaunched persistent context
  • tests/library/defaultbrowsercontext-2.spec.ts:176 › should have passed URL when launching with ignoreDefaultArgs: true
  • tests/library/proxy.spec.ts:235 › should exclude patterns

Bisection (tests 2 workflow on main)

Run (Jun 10) macos-15-large (firefox)
17:09 (before this PR) ✅ success
15:52 (before this PR) ✅ success
18:12 (this PR's merge) ❌ failure
every run since ❌ failure

#41309 only added it.slow(), which doesn't help — should restore state still times out at the full 90s, so it's a genuine hang, not slowness.

Mechanism

From the blob report, the hung steps are launchPersistentContext (3 tests) and a goto-through-proxy (1 test) — all waiting on a navigation that never resolves.

gotoImpl waits for a new-document navigation event whose documentId matches the navigationId returned by navigate. On macOS-15, Firefox sometimes commits the navigation with no navigationId (the id is lost across the process swap during persistent-profile restore / proxied loads).

So the change traded the rare "interrupted by another navigation" fast-fail for a hard hang that blankets the macOS-15 Firefox suite.

Note

The macOS-15 Firefox job isn't in the standard PR matrix (it runs in tests 2), which is why this slipped through.

The clean fix is juggler-side (preserve navigationId across the process swap). For an immediate unblock, reverting the ffPage.ts change here restores green and reverts #41216 to its rarer fast-fail form.

dcrousso added a commit to dcrousso/playwright that referenced this pull request Jun 17, 2026
limit when `Page.navigationCommitted` should be treated as a `Page.sameDocumentNavigation` to only if the `url` and `frameId` match a known active navigation

without these, we end up rerouting more than intended to handle the original process-swap scenario
dcrousso added a commit to dcrousso/playwright that referenced this pull request Jun 17, 2026
…igationId` as same-document URL updates (microsoft#41224)"

This is a partial revert for commits 81881e2 and c2ac911.

Keep the test added as that's still a valuable scenario to check, though it's skipped for Firefox due to the known issue.
dcrousso added a commit that referenced this pull request Jun 17, 2026
…igationId` as same-document URL updates (#41224)" (#41349)

this is a partial revert for commits 81881e2 <#41224> and c2ac911 <#41309>

leep the test added as that's still a valuable scenario to check, though it's skipped for Firefox due to the known issue

fixes <#41347>
yury-s pushed a commit that referenced this pull request Jun 18, 2026
…ommitted` events without `navigationId` as same-document URL updates (#41224)" (#41350)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Navigation interrupted by another navigation when launching from persistent context for second time

2 participants