Skip to content

fix(evaluate): await page-overridden Promise in evaluateHandle and waitForFunction - #43436

Merged
Yury Semikhatsky (yury-s) merged 2 commits into
microsoft:mainfrom
yury-s:fix-43415
Oct 15, 2026
Merged

Yury Semikhatsky (yury-s) merged 2 commits into
microsoft:mainfrom
yury-s:fix-43415

Conversation

@yury-s

Copy link
Copy Markdown
Member

Summary

  • The handle path in UtilityScript.evaluate returned the page's thenable as is. Firefox and WebKit only await native promises, so a zone.js-style Promise wrapper came back unresolved from evaluateHandle and made waitForFunction resolve right away.
  • Wrap a thenable result in a native promise on the handle path, same as the by-value path already does.

Fixes #43415

@github-actions

This comment has been minimized.

@github-actions

Copy link
Copy Markdown
Contributor

Test results for "MCP"

2 failed
❌ [chromium] › mcp/webmcp-dynamic.spec.ts:189 › a tool registered in an iframe can be called after the page is reloaded @mcp-ubuntu-latest-chromium
❌ [msedge] › mcp/http.spec.ts:132 › http transport browser sigint @mcp-windows-latest-msedge

5152 passed, 614 skipped


Merge workflow run.

@github-actions

Copy link
Copy Markdown
Contributor

Test results for "tests 1"

3 flaky ⚠️ [chromium-library] › library/chromium/chromium.spec.ts:179 › serviceWorker(), and fromServiceWorker() work `@chromium-playwright-x64-ubuntu24-64-core-node22`
⚠️ [firefox-library] › library/browsercontext-cookies-third-party.spec.ts:257 › third party 'Partitioned;' cookies `@firefox-playwright-x64-ubuntu24-64-core-node22`
⚠️ [firefox-library] › library/browsercontext-cookies-third-party.spec.ts:470 › top level 'Partitioned;' cookie and same origin iframe `@firefox-playwright-x64-ubuntu24-64-core-node22`

23553 passed, 710 skipped


Merge workflow run.

@github-actions

Copy link
Copy Markdown
Contributor

Hi, I'm the Playwright bot and I took a first look at the CI failures.

🟢 Both failures are confirmed pre-existing flakes

At PR head 308b8a3, neither failure looks caused by this PR. The exact tests also fail on unrelated PRs and main-branch pushes, and both usually pass.

Details

Overall assessment

This PR changes thenable handling in UtilityScript.evaluate and adds coverage in page-evaluate.spec.ts. The two MCP failures have established cross-run flake histories on the same projects and CI bots.

Pre-existing flakes

Triaged by the Playwright bot - agent run

@yury-s
Yury Semikhatsky (yury-s) merged commit 10bf92f into microsoft:main Oct 15, 2026
24 of 26 checks passed
@yury-s
Yury Semikhatsky (yury-s) deleted the fix-43415 branch October 15, 2026 20:35
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]: evaluateHandle and waitForFunction don't wait for a page-overridden Promise in Firefox and WebKit

2 participants