Skip to content

fix(chromium): use resource type when deciding if evicted body can be re-fetched - #42201

Merged
Yury Semikhatsky (yury-s) merged 2 commits into
microsoft:mainfrom
yury-s:fix-android-response-body
Aug 11, 2026
Merged

Yury Semikhatsky (yury-s) merged 2 commits into
microsoft:mainfrom
yury-s:fix-android-response-body

Conversation

@yury-s

Copy link
Copy Markdown
Member

Summary

  • The re-fetch gate from fix(chromium): only re-fetch replay-safe requests when reading response body #42124 relied on Sec-Fetch-Dest, which Chromium only sends to potentially trustworthy origins; Android tests reach the server via plain-http 10.0.2.2, so response.body() always returned an empty body there.
  • Accept requests whose CDP resource type is a static subresource, falling back to the header checks otherwise.
  • Skip the prefetch test on Chromium < 138: Sec-Purpose on <link rel=prefetch> only shipped in Chrome 138 and the Android emulator's Chrome is older.

… re-fetched

Sec-Fetch-Dest is only sent to potentially trustworthy origins, so the
re-fetch gate from microsoft#42124 always returned an empty body on Android where
tests reach the server via http://10.0.2.2. Accept requests whose CDP
resource type is a static subresource, falling back to the header checks
otherwise.

Skip the prefetch test on Chromium < 138: Sec-Purpose on <link rel=prefetch>
only shipped in Chrome 138 and the Android emulator's Chrome is older.

Fixes "should return body for prefetch script" and "should return body for
image with evicted body" under android, broken by microsoft#42124.
@github-actions

This comment has been minimized.

const secFetchDest = rawHeaderValue('sec-fetch-dest');
if (!isPrefetch && (!secFetchDest || !kRefetchSafeDestinations.has(secFetchDest)))
return Buffer.from('');
if (!kRefetchSafeResourceTypes.has(request.resourceType())) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Perhaps using just the resourceType() is enough here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Dropped the Sec-Fetch-Dest check — every destination in that list maps to a resource type already in the safe set (workers report 'script', audio/video 'media', track 'texttrack'). Kept the Sec-Purpose check: link prefetch reports resource type 'other', so the header is the only signal.

@github-actions

This comment has been minimized.

…etch

Drop the Sec-Fetch-Dest check: every safe destination maps to a resource
type already in the safe set. Keep the Sec-Purpose check as link prefetch
requests report resource type 'other'.
@yury-s
Yury Semikhatsky (yury-s) merged commit 62e4f5e into microsoft:main Aug 11, 2026
43 checks passed
@yury-s
Yury Semikhatsky (yury-s) deleted the fix-android-response-body branch August 11, 2026 21:46
@github-actions

Copy link
Copy Markdown
Contributor

Test results for "tests 1"

6 flaky ⚠️ [chromium-library] › library/video.spec.ts:736 › screencast › should work with video+trace `@frozen-time-library-chromium-linux`
⚠️ [chromium-library] › library/browsercontext-page-event.spec.ts:160 › should work with Shift-clicking `@chromium-ubuntu-22.04-arm-node20`
⚠️ [chromium-library] › library/beforeunload.spec.ts:130 › should support dismissing the dialog multiple times `@realtime-time-library-chromium-linux`
⚠️ [chromium-library] › library/trace-viewer.spec.ts:1630 › should highlight locator in iframe while typing `@chromium-ubuntu-22.04-node20`
⚠️ [chromium-library] › library/video.spec.ts:699 › screencast › should capture full viewport on hidpi `@chromium-ubuntu-22.04-node22`
⚠️ [firefox-page] › page/page-goto.spec.ts:90 › should work with Cross-Origin-Opener-Policy `@firefox-ubuntu-22.04-node20`

51080 passed, 1208 skipped


Merge workflow run.

@github-actions

Copy link
Copy Markdown
Contributor

Test results for "MCP"

8089 passed, 1284 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.

2 participants