Skip to content

feat(network): add request.waitForPostBody() for asynchronously reported bodies#41888

Draft
yury-s wants to merge 2 commits into
microsoft:mainfrom
yury-s:fix-6479
Draft

feat(network): add request.waitForPostBody() for asynchronously reported bodies#41888
yury-s wants to merge 2 commits into
microsoft:mainfrom
yury-s:fix-6479

Conversation

@yury-s

@yury-s yury-s commented Jul 21, 2026

Copy link
Copy Markdown
Member

Summary

  • Chromium only reports hasPostData for Blob/File request bodies in Network.requestWillBeSent; fetch the body via Network.getRequestPostData and push it to the client asynchronously
  • New request.waitForPostBody() resolves once the body has been reported; sync postData()/postDataBuffer() also return it after that point

Fixes #6479

yury-s added 2 commits July 20, 2026 16:38
Network.requestWillBeSent does not include post data entries when the
request body is not available synchronously (e.g. a Blob or File body),
only hasPostData is set. Retrieve the body via Network.getRequestPostData
in that case, deferring the request events until the body is fetched.

Fixes: microsoft#6479
…ted bodies

Instead of deferring request dispatch while the body is fetched via
Network.getRequestPostData, dispatch the request right away and push the
body to the client once it is available. New request.waitForPostBody()
resolves when the body has been reported by the browser.

Fixes: microsoft#6479
@yury-s
yury-s requested a review from dgozman July 21, 2026 02:06
@github-actions

Copy link
Copy Markdown
Contributor

Test results for "MCP"

1 failed
❌ [chrome] › mcp/annotate.spec.ts:173 › user-initiated annotate downloads zip with feedback.md @mcp-macos-latest-chrome

7759 passed, 1249 skipped


Merge workflow run.

@github-actions

Copy link
Copy Markdown
Contributor

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

🟢 The one failure is a pre-existing flake — this PR is clear

[chrome] › mcp/annotate.spec.ts:173 › user-initiated annotate downloads zip with feedback.md is the only failure, and it flakes on its own across many unrelated runs. This PR only touches Chromium network post-data handling, which the MCP annotate flow doesn't exercise.

Details

Overall: 1 failed, 7759 passed. The single failure is unrelated to the diff and has a long flake history, so I don't see any CI signal attributable to this PR.

Pre-existing flake / infra

  • [chrome] › mcp/annotate.spec.ts:173 › user-initiated annotate downloads zip with feedback.md — flake. In the aggregated test-results DB this test flips verdict across runs on unrelated SHAs: chrome failed 3 of 326 runs, passed the other 323, and it's bimodal on every engine too (firefox 12/320 failed, webkit 10/327 failed, chromium 4/324 failed). This PR changes crNetworkManager.ts / network.ts post-data reporting for Blob/File bodies and adds request.waitForPostBody() — none of which the MCP annotate download path touches.

Triaged by the Playwright bot - agent run

@github-actions

Copy link
Copy Markdown
Contributor

Test results for "tests 1"

3 flaky ⚠️ [chromium-library] › library/chromium/oopif.spec.ts:282 › should click `@chromium-ubuntu-22.04-node24`
⚠️ [firefox-library] › library/inspector/cli-codegen-3.spec.ts:255 › cli codegen › should generate frame locators (4) `@firefox-ubuntu-22.04-node20`
⚠️ [playwright-test] › ui-mode-trace.spec.ts:827 › should update state on subsequent run `@windows-latest-node22`

50025 passed, 1193 skipped


Merge workflow run.

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] [Chromium/WebKit] Request object does not contain postData for file/blob

1 participant