Skip to content

fix(chromium): connect to a page that activated a prerender - #43854

Open
Dmitry Gozman (dgozman) wants to merge 3 commits into
microsoft:mainfrom
dgozman:fix-43842
Open

Dmitry Gozman (dgozman) wants to merge 3 commits into
microsoft:mainfrom
dgozman:fix-43842

Conversation

@dgozman

Copy link
Copy Markdown
Collaborator

Summary

  • After a prerender activation, the tab keeps its target id but the main frame gets a new id, so connectOverCDP reported the page with a dummy main frame and title()/evaluate() never resolved.
  • Add CRPage.isMainFrame(), CRPage.isLocalRoot(), CRPage.localRootSession() and FrameSession.localRoot(), and use them instead of comparing frame ids with target ids.
  • Log page initialization errors instead of swallowing them.

Fixes #43842

When a prerendered page is activated, the tab keeps its target id, but
the main frame gets a new id. Looking up the main frame session by
frame id then fails, so the page is reported with a dummy main frame
and never becomes usable.

Introduce CRPage.isMainFrame(), CRPage.isLocalRoot(),
CRPage.localRootSession() and FrameSession.localRoot(), and use them
instead of comparing frame ids with target ids. Also log page
initialization errors instead of swallowing them.

Fixes: microsoft#43842
@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.

@microsoft-playwright-automation

Copy link
Copy Markdown
Contributor

🟢 All three failures predate this PR

Hi, I'm the Playwright bot. I checked the failed MCP run; the same three Chrome tests fail on main with identical errors.

Details

Covers MCP run 43856794190 at a56d7049394dd61b3847ebec98e01a42021f6fda, published in the merged report.

Pre-existing flake / infra

All three failures in [chrome] › mcp/crash.spec.ts › crash recovery also occur in the Chrome job on main, at b4d016aadc5cbd2b898a284307975fe73e05483d, which does not contain this PR:

Test Matching failure on this PR and main
:31 › reports the navigation error, then resets and logs the crash 30-second timeout in the recovery check at line 48.
:58 › lists only one tab 30-second timeout and Not connected from browser_tabs at line 71.
:79 › marks non-current crashed tab in the tab list 30-second timeout and Not connected from browser_tabs at line 93.

These are frequent pre-existing failures, not isolated retry failures: since November 9, each test failed in 63 of 64 recorded Chrome runs outside this PR, including 24 runs on main. The PR changes Chromium frame/session selection, but leaves the crash-event handler and MCP crash-recovery code unchanged. No failure points to a new regression here.

Checked the failures on Linux by the Playwright bot - agent run

@microsoft-playwright-automation

Copy link
Copy Markdown
Contributor

🟢 Both failures predate this PR

Hi, I'm the Playwright bot. Both JUnit failures also occur on main with identical errors. They are Windows test errors, not regressions from this PR.

Details

Covers tests 1 run 43856794313 for head a56d7049394dd61b3847ebec98e01a42021f6fda.

Pre-existing flake / infra — existing test defect

[playwright-test] › reporter-junit.spec.ts:350 › should add file attribute relative to fileRoot fails in both created and merged on Windows. The assertion at line 374 expects classname to be auth/a.test.js, but receives auth\a.test.js.

Both tests fail identically in the Windows job on main, at b4d016aadc5cbd2b898a284307975fe73e05483d, which does not contain this PR. The JUnit reporter, test and test loader are unchanged between that commit and this PR's tested merge.

This is a path-separator mismatch, not an intermittent failure: classname uses the platform-native suite path. The test was added in #44107. The small fix is to expect path.join('auth', 'a.test.js') for classname; the separate file assertions should keep forward slashes.

The MCP failures already have a separate verdict. The WebKit test that passed on retry is not counted as a failure.

Checked the failures on Linux by the Playwright bot - agent run

@github-actions

Copy link
Copy Markdown
Contributor

Test results for "tests 1"

2 failed
❌ [playwright-test] › reporter-junit.spec.ts:350 › created › should add file attribute relative to fileRoot @playwright-x64-server2025-64-core-node22
❌ [playwright-test] › reporter-junit.spec.ts:350 › merged › should add file attribute relative to fileRoot @playwright-x64-server2025-64-core-node22

23646 passed, 716 skipped


Merge workflow run.

@microsoft-playwright-automation

Copy link
Copy Markdown
Contributor

🟢 Both failures predate this PR

Hi, I'm the Playwright bot. I checked the new run: both failures are existing Windows test errors, not regressions from this PR.

Details

Covers tests 1 run 43874427859 for head d359ffcc2521c9680246d14696a39fc15e73fc2e, reported here.

Pre-existing flake / infra — existing test defect

[playwright-test] › reporter-junit.spec.ts:350 › should add file attribute relative to fileRoot fails in both created and merged. The PR's Windows job expects classname to be auth/a.test.js at line 374, but receives auth\a.test.js.

Both tests fail with that exact assertion in the Windows job on main, at b4d016aadc5cbd2b898a284307975fe73e05483d. The JUnit reporter, test and test loader are identical between that commit and this PR's merge commit f62abd1872ea1d70666feeeaac4271b258adec0e. The PR changes Chromium frame handling, not these paths.

The small fix is to use path.join('auth', 'a.test.js') in the classname expectation. Keep the separate file expectations with forward slashes. This is a repeatable path-separator mismatch, not a flake.

Checked the failures on Linux by the Playwright bot - agent run

@github-actions

Copy link
Copy Markdown
Contributor

Test results for "MCP"

3 failed
❌ [chrome] › mcp/crash.spec.ts:31 › crash recovery › reports the navigation error, then resets and logs the crash @mcp-ubuntu-latest-chrome
❌ [chrome] › mcp/crash.spec.ts:58 › crash recovery › lists only one tab @mcp-ubuntu-latest-chrome
❌ [chrome] › mcp/crash.spec.ts:79 › crash recovery › marks non-current crashed tab in the tab list @mcp-ubuntu-latest-chrome

5232 passed, 631 skipped


Merge workflow run.

@microsoft-playwright-automation

Copy link
Copy Markdown
Contributor

🟢 All three failures predate this PR

Hi, I'm the Playwright bot. I checked the new MCP run: the same three Chrome crash-recovery tests fail on main with identical errors.

Details

Covers MCP run 43874427934 for head d359ffcc2521c9680246d14696a39fc15e73fc2e, reported here.

Pre-existing flake / infra

All three failures in [chrome] › mcp/crash.spec.ts › crash recovery match the Chrome job on main, at b4d016aadc5cbd2b898a284307975fe73e05483d, which does not contain this PR:

Test Matching error on this PR and main
:31 › reports the navigation error, then resets and logs the crash 30-second timeout in the recovery check at line 48.
:58 › lists only one tab 30-second timeout and Not connected from browser_tabs at line 71.
:79 › marks non-current crashed tab in the tab list 30-second timeout and Not connected from browser_tabs at line 93.

I compared both jobs' logs directly. The PR's Chrome job introduces no new failure in this group. The PR changes Chromium frame/session selection, but leaves the crash-event handler and MCP crash-recovery code unchanged. These are confirmed pre-existing failures; the timeouts alone are not the basis for the verdict.

The separate Windows JUnit failures for this head already have a verdict.

Checked the failures on Linux by the Playwright bot - agent run

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants