Skip to content

fix(firefox): commit navigation before init scripts#40133

Open
JustasMonkev wants to merge 1 commit intomicrosoft:mainfrom
JustasMonkev:fix/firefox-navigation-commit-order
Open

fix(firefox): commit navigation before init scripts#40133
JustasMonkev wants to merge 1 commit intomicrosoft:mainfrom
JustasMonkev:fix/firefox-navigation-commit-order

Conversation

@JustasMonkev
Copy link
Copy Markdown
Contributor

Summary

This fixes the Firefox/Juggler ordering issue from #39624.

Before this change, Firefox could create the new document execution context and run init scripts before Page.navigationCommitted was reported. Because of that, MCP could observe init script console messages before the navigation commit.

This change updates the Firefox Juggler frame lifecycle so new-document init scripts run after the navigation commit is reported. It also avoids committing the initial synthetic about:blank while a real navigation is still pending.

The tests were updated to check the new behavior directly:

  • removed the Firefox workaround from the MCP init-script test
  • tightened the Firefox iframe init-script expectation to match the committed frame URL

Testing

Tested against a patched Firefox app copy with the updated FrameTree.js in omni.ja.

  • PLAYWRIGHT_MCP_EXECUTABLE_PATH=/tmp/pwff39624.YQBUwG/Nightly.app/Contents/MacOS/firefox npm run test-mcp -- --project=firefox tests/mcp/init-script.spec.ts
  • CI=1 FFPATH=/tmp/pwff39624.YQBUwG/Nightly.app/Contents/MacOS/firefox npm run test -- --project=firefox-page tests/page/page-add-init-script.spec.ts

@pavelfeldman
Copy link
Copy Markdown
Member

// CC @aslushnikov

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.

2 participants