Allow fetch/XMLHttpRequest APIs to set a user-agent [chromium/src : main]

2 views
Skip to first unread message

Adam Rice (Gerrit)

unread,
Feb 7, 2024, 4:51:44 AM2/7/24
to Andrew Brown, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org, chromium...@chromium.org, Nate Chapin
Attention needed from Andrew Brown

Adam Rice added 1 comment

File services/network/cors/cors_url_loader_factory.cc
Line 474, Patchset 2 (Latest): header.key == "User-Agent") {
Adam Rice . unresolved

You should add "User-Agent" to NetworkContext::cors_exempt_header_list somewhere rather than special-casing it.

Open in Gerrit

Related details

Attention is currently required from:
  • Andrew Brown
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Icf56620f99f371ea2f128e6a3194d6096b0d62cd
Gerrit-Change-Number: 5273743
Gerrit-PatchSet: 2
Gerrit-Owner: Andrew Brown <m...@ajbrown.au>
Gerrit-CC: Adam Rice <ri...@chromium.org>
Gerrit-CC: Nate Chapin <jap...@chromium.org>
Gerrit-Attention: Andrew Brown <m...@ajbrown.au>
Gerrit-Comment-Date: Wed, 07 Feb 2024 09:51:33 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Andrew Brown (Gerrit)

unread,
Feb 7, 2024, 11:02:00 PM2/7/24
to blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
Attention needed from Andrew Brown

Andrew Brown uploaded new patchset

Andrew Brown uploaded patch set #3 to this change.
Open in Gerrit

Related details

Attention is currently required from:
  • Andrew Brown
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: newpatchset
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Icf56620f99f371ea2f128e6a3194d6096b0d62cd
Gerrit-Change-Number: 5273743
Gerrit-PatchSet: 3
satisfied_requirement
unsatisfied_requirement
open
diffy

Andrew Brown (Gerrit)

unread,
Feb 7, 2024, 11:05:40 PM2/7/24
to blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org, Adam Rice, chromium...@chromium.org, Nate Chapin
Attention needed from Adam Rice

Andrew Brown added 1 comment

File services/network/cors/cors_url_loader_factory.cc
Line 474, Patchset 2: header.key == "User-Agent") {
Adam Rice . unresolved

You should add "User-Agent" to NetworkContext::cors_exempt_header_list somewhere rather than special-casing it.

Andrew Brown

I wasn't sure about adding it to that list, as the headers on that list seem to be almost exclusively "variations headers" for whatever lives in components/variations.

I've added it in SystemNetworkContextManager::ConfigureDefaultNetworkContextParams.

Can't shake the feeling I should be leaving the browser user-agent till later - I noticed NetworkContext has a user_agent field, also filled out in ConfigureDefaultNetworkContextParams. I might investigate that and see if it's possible for the browser user-agent to be set from that value instead of setting it in third_party/blink/renderer/platform/loader/fetch/url_loader/request_conversion.cc.

Open in Gerrit

Related details

Attention is currently required from:
  • Adam Rice
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Icf56620f99f371ea2f128e6a3194d6096b0d62cd
Gerrit-Change-Number: 5273743
Gerrit-PatchSet: 3
Gerrit-Owner: Andrew Brown <m...@ajbrown.au>
Gerrit-CC: Adam Rice <ri...@chromium.org>
Gerrit-CC: Nate Chapin <jap...@chromium.org>
Gerrit-Attention: Adam Rice <ri...@chromium.org>
Gerrit-Comment-Date: Thu, 08 Feb 2024 04:05:28 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Adam Rice <ri...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Adam Rice (Gerrit)

unread,
Feb 8, 2024, 2:07:20 AM2/8/24
to Andrew Brown, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org, chromium...@chromium.org, Nate Chapin
Attention needed from Andrew Brown

Adam Rice added 1 comment

File services/network/cors/cors_url_loader_factory.cc
Line 474, Patchset 2: header.key == "User-Agent") {
Adam Rice . unresolved

You should add "User-Agent" to NetworkContext::cors_exempt_header_list somewhere rather than special-casing it.

Andrew Brown

I wasn't sure about adding it to that list, as the headers on that list seem to be almost exclusively "variations headers" for whatever lives in components/variations.

I've added it in SystemNetworkContextManager::ConfigureDefaultNetworkContextParams.

Can't shake the feeling I should be leaving the browser user-agent till later - I noticed NetworkContext has a user_agent field, also filled out in ConfigureDefaultNetworkContextParams. I might investigate that and see if it's possible for the browser user-agent to be set from that value instead of setting it in third_party/blink/renderer/platform/loader/fetch/url_loader/request_conversion.cc.

Adam Rice

We need to use the value from the render process, as it may have been overridden by DevTools. I don't know if there is any way to access the DevTools override from within the network service. My guess would be not.

Another method would be to add a new `default_user_agent` field to `network::ResourceRequest`, but it would require changes in quite a few places.

Open in Gerrit

Related details

Attention is currently required from:
  • Andrew Brown
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Icf56620f99f371ea2f128e6a3194d6096b0d62cd
Gerrit-Change-Number: 5273743
Gerrit-PatchSet: 3
Gerrit-Owner: Andrew Brown <m...@ajbrown.au>
Gerrit-CC: Adam Rice <ri...@chromium.org>
Gerrit-CC: Nate Chapin <jap...@chromium.org>
Gerrit-Attention: Andrew Brown <m...@ajbrown.au>
Gerrit-Comment-Date: Thu, 08 Feb 2024 07:07:12 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Adam Rice <ri...@chromium.org>
Comment-In-Reply-To: Andrew Brown <m...@ajbrown.au>
satisfied_requirement
unsatisfied_requirement
open
diffy

Adam Rice (Gerrit)

unread,
Feb 9, 2024, 5:49:51 AM2/9/24
to Andrew Brown, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin
Attention needed from Andrew Brown

Adam Rice added 1 comment

Patchset-level comments
File-level comment, Patchset 3 (Latest):
Adam Rice . resolved

Please run
```
third_party/blink/tools run_web_tests.py external/wpt/fetch --reset
```
to reset the test expectations and include any changes to *-expected.txt files in the CL.

Open in Gerrit

Related details

Attention is currently required from:
  • Andrew Brown
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Icf56620f99f371ea2f128e6a3194d6096b0d62cd
Gerrit-Change-Number: 5273743
Gerrit-PatchSet: 3
Gerrit-Owner: Andrew Brown <m...@ajbrown.au>
Gerrit-Reviewer: Adam Rice <ri...@chromium.org>
Gerrit-CC: Nate Chapin <jap...@chromium.org>
Gerrit-Attention: Andrew Brown <m...@ajbrown.au>
Gerrit-Comment-Date: Fri, 09 Feb 2024 10:49:43 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Andrew Brown (Gerrit)

unread,
Feb 17, 2024, 10:07:39 PM2/17/24
to blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
Attention needed from Andrew Brown

Andrew Brown uploaded new patchset

Andrew Brown uploaded patch set #4 to this change.
Open in Gerrit

Related details

Attention is currently required from:
  • Andrew Brown
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: newpatchset
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Icf56620f99f371ea2f128e6a3194d6096b0d62cd
Gerrit-Change-Number: 5273743
Gerrit-PatchSet: 4
satisfied_requirement
unsatisfied_requirement
open
diffy

Andrew Brown (Gerrit)

unread,
Feb 17, 2024, 10:12:51 PM2/17/24
to blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org, Chromium LUCI CQ, Adam Rice, chromium...@chromium.org, Nate Chapin
Attention needed from Adam Rice

Andrew Brown added 2 comments

Patchset-level comments
File-level comment, Patchset 3:
Adam Rice . unresolved

Please run
```
third_party/blink/tools run_web_tests.py external/wpt/fetch --reset
```
to reset the test expectations and include any changes to *-expected.txt files in the CL.

Andrew Brown

Just done this (apologies for delay again).

There's a *lot* of changes. Like, way more than expected. Is it possible that the test-running processes need an update with this change? I imagine it might be possible that a heap of blink web tests are now "failing" because the runner doesn't adequately respond with CORS headers for custom user-agents.

Maybe it is OK, I'm not sure.

File services/network/cors/cors_url_loader_factory.cc
Line 474, Patchset 2: header.key == "User-Agent") {
Adam Rice . unresolved

You should add "User-Agent" to NetworkContext::cors_exempt_header_list somewhere rather than special-casing it.

Andrew Brown

I wasn't sure about adding it to that list, as the headers on that list seem to be almost exclusively "variations headers" for whatever lives in components/variations.

I've added it in SystemNetworkContextManager::ConfigureDefaultNetworkContextParams.

Can't shake the feeling I should be leaving the browser user-agent till later - I noticed NetworkContext has a user_agent field, also filled out in ConfigureDefaultNetworkContextParams. I might investigate that and see if it's possible for the browser user-agent to be set from that value instead of setting it in third_party/blink/renderer/platform/loader/fetch/url_loader/request_conversion.cc.

Adam Rice

We need to use the value from the render process, as it may have been overridden by DevTools. I don't know if there is any way to access the DevTools override from within the network service. My guess would be not.

Another method would be to add a new `default_user_agent` field to `network::ResourceRequest`, but it would require changes in quite a few places.

Andrew Brown

Oh, true, I'd completely forgotten that DevTools lets you override your browser's default.

...Hm, should *that* value be CORS-exempt? (In this CL, it will be.) Probably a question for the whatwg peoplem, not here.

Open in Gerrit

Related details

Attention is currently required from:
  • Adam Rice
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Icf56620f99f371ea2f128e6a3194d6096b0d62cd
Gerrit-Change-Number: 5273743
Gerrit-PatchSet: 4
Gerrit-Owner: Andrew Brown <m...@ajbrown.au>
Gerrit-Reviewer: Adam Rice <ri...@chromium.org>
Gerrit-CC: Nate Chapin <jap...@chromium.org>
Gerrit-Attention: Adam Rice <ri...@chromium.org>
Gerrit-Comment-Date: Sun, 18 Feb 2024 03:12:40 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Adam Rice (Gerrit)

unread,
Feb 18, 2024, 3:35:57 PM2/18/24
to Andrew Brown, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin
Attention needed from Andrew Brown

Adam Rice added 2 comments

Patchset-level comments
Adam Rice . unresolved

Please run
```
third_party/blink/tools run_web_tests.py external/wpt/fetch --reset
```
to reset the test expectations and include any changes to *-expected.txt files in the CL.

Andrew Brown

Just done this (apologies for delay again).

There's a *lot* of changes. Like, way more than expected. Is it possible that the test-running processes need an update with this change? I imagine it might be possible that a heap of blink web tests are now "failing" because the runner doesn't adequately respond with CORS headers for custom user-agents.

Maybe it is OK, I'm not sure.

Adam Rice

It looks like that didn't work right, since the expectations for a lot of unrelated tests are being deleted. I've started a Dry Run of the bots to see what they say.

File services/network/cors/cors_url_loader_factory.cc
Line 474, Patchset 2: header.key == "User-Agent") {
Adam Rice . unresolved

You should add "User-Agent" to NetworkContext::cors_exempt_header_list somewhere rather than special-casing it.

Andrew Brown

I wasn't sure about adding it to that list, as the headers on that list seem to be almost exclusively "variations headers" for whatever lives in components/variations.

I've added it in SystemNetworkContextManager::ConfigureDefaultNetworkContextParams.

Can't shake the feeling I should be leaving the browser user-agent till later - I noticed NetworkContext has a user_agent field, also filled out in ConfigureDefaultNetworkContextParams. I might investigate that and see if it's possible for the browser user-agent to be set from that value instead of setting it in third_party/blink/renderer/platform/loader/fetch/url_loader/request_conversion.cc.

Adam Rice

We need to use the value from the render process, as it may have been overridden by DevTools. I don't know if there is any way to access the DevTools override from within the network service. My guess would be not.

Another method would be to add a new `default_user_agent` field to `network::ResourceRequest`, but it would require changes in quite a few places.

Andrew Brown

Oh, true, I'd completely forgotten that DevTools lets you override your browser's default.

...Hm, should *that* value be CORS-exempt? (In this CL, it will be.) Probably a question for the whatwg peoplem, not here.

Adam Rice

DevTools is generally considered part of the browser, so a User-Agent set by DevTools has the same authority as one set by the browser itself.

Open in Gerrit

Related details

Attention is currently required from:
  • Andrew Brown
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Icf56620f99f371ea2f128e6a3194d6096b0d62cd
Gerrit-Change-Number: 5273743
Gerrit-PatchSet: 4
Gerrit-Owner: Andrew Brown <m...@ajbrown.au>
Gerrit-Reviewer: Adam Rice <ri...@chromium.org>
Gerrit-CC: Nate Chapin <jap...@chromium.org>
Gerrit-Attention: Andrew Brown <m...@ajbrown.au>
Gerrit-Comment-Date: Sun, 18 Feb 2024 20:35:47 +0000
satisfied_requirement
unsatisfied_requirement
open
diffy

Adam Rice (Gerrit)

unread,
Feb 19, 2024, 2:45:28 AM2/19/24
to Takashi Toyoshima, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
Attention needed from Andrew Brown and Takashi Toyoshima

Andrew Brown has uploaded the change for review

Adam Rice would like Takashi Toyoshima to review this change authored by Andrew Brown.

Commit message

Allow fetch/XMLHttpRequest APIs to set a user-agent

Per spec, fetch & XMLHttpRequest should be able to set custom
user-agents. This fix has been blocked as API-set user-agents should
cause CORS preflight checks, but browser-set ones should not. We can now
preserve this behavior using cors_exempt_headers.

See discussion at https://groups.google.com/a/chromium.org/g/blink-network-dev/c/iJLX5X3r6As
Fixed: 571722
Change-Id: Icf56620f99f371ea2f128e6a3194d6096b0d62cd

Change diff


Change information

Files:
  • M AUTHORS
  • M chrome/browser/net/system_network_context_manager.cc
  • M net/http/http_util.cc
  • M third_party/blink/renderer/core/loader/frame_fetch_context.cc
  • M third_party/blink/renderer/core/loader/worker_fetch_context.cc
  • M third_party/blink/renderer/platform/loader/fetch/resource_request.h
  • M third_party/blink/renderer/platform/loader/fetch/url_loader/request_conversion.cc
  • D third_party/blink/web_tests/external/wpt/fetch/api/abort/general.any-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/api/abort/general.any.serviceworker-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/api/abort/general.any.sharedworker-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/api/abort/general.any.worker-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/api/abort/request.any-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/api/abort/request.any.serviceworker-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/api/abort/request.any.sharedworker-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/api/abort/request.any.worker-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/api/basic/header-value-combining.any.serviceworker-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/api/basic/http-response-code.any-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/api/basic/http-response-code.any.serviceworker-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/api/basic/http-response-code.any.sharedworker-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/api/basic/http-response-code.any.worker-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/api/basic/scheme-blob.sub.any-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/api/basic/scheme-blob.sub.any.worker-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/api/body/formdata.any-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/api/body/formdata.any.worker-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/api/body/mime-type.any-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/api/body/mime-type.any.worker-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/api/cors/cors-preflight-redirect.any-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/api/cors/cors-preflight-redirect.any.sharedworker-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/api/cors/cors-preflight-redirect.any.worker-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/api/cors/cors-preflight-star.any-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/api/cors/cors-preflight-star.any.worker-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/api/cors/cors-preflight.any-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/api/cors/cors-preflight.any.worker-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/api/idlharness.any-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/api/idlharness.any.serviceworker-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/api/idlharness.any.sharedworker-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/api/idlharness.any.worker-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/api/policies/referrer-origin-when-cross-origin-service-worker.https-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/api/redirect/redirect-empty-location.any-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/api/redirect/redirect-empty-location.any.serviceworker-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/api/redirect/redirect-empty-location.any.sharedworker-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/api/redirect/redirect-empty-location.any.worker-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/api/redirect/redirect-location.any-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/api/redirect/redirect-location.any.serviceworker-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/api/redirect/redirect-location.any.sharedworker-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/api/redirect/redirect-location.any.worker-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/api/redirect/redirect-origin.any-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/api/redirect/redirect-origin.any.worker-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/api/request/request-consume-empty.any-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/api/request/request-consume-empty.any.serviceworker-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/api/request/request-consume-empty.any.sharedworker-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/api/request/request-consume-empty.any.worker-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/api/request/request-disturbed.any-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/api/request/request-disturbed.any.serviceworker-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/api/request/request-disturbed.any.sharedworker-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/api/request/request-disturbed.any.worker-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/api/request/request-error.any-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/api/request/request-error.any.serviceworker-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/api/request/request-error.any.sharedworker-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/api/request/request-error.any.worker-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/api/request/request-headers.any-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/api/request/request-headers.any.serviceworker-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/api/request/request-headers.any.sharedworker-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/api/request/request-headers.any.worker-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/api/request/request-reset-attributes.https-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/api/request/request-structure.any-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/api/request/request-structure.any.serviceworker-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/api/request/request-structure.any.sharedworker-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/api/request/request-structure.any.worker-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/api/response/response-body-read-task-handling-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/api/response/response-consume-empty.any-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/api/response/response-consume-empty.any.serviceworker-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/api/response/response-consume-empty.any.sharedworker-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/api/response/response-consume-empty.any.worker-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/api/response/response-error-from-stream.any-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/api/response/response-error-from-stream.any.serviceworker-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/api/response/response-error-from-stream.any.sharedworker-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/api/response/response-error-from-stream.any.worker-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/api/response/response-stream-disturbed-by-pipe.any-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/api/response/response-stream-disturbed-by-pipe.any.serviceworker-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/api/response/response-stream-disturbed-by-pipe.any.sharedworker-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/api/response/response-stream-disturbed-by-pipe.any.worker-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/content-type/script.window-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/corb/response_block.tentative.https-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/data-urls/processing.any-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/data-urls/processing.any.serviceworker-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/data-urls/processing.any.sharedworker-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/data-urls/processing.any.worker-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/h1-parsing/lone-cr.window-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/h1-parsing/status-code.window-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/metadata/generated/appcache-manifest.https.sub-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/metadata/generated/element-a.https.sub-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/metadata/generated/element-area.https.sub-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/metadata/generated/element-audio.https.sub-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/metadata/generated/element-embed.https.sub-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/metadata/generated/element-img.https.sub-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/metadata/generated/element-input-image.https.sub-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/metadata/generated/element-link-prefetch.https.optional.sub-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/metadata/generated/element-video.https.sub-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/metadata/generated/header-link.https.sub-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/metadata/generated/header-link.https.sub.tentative-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/metadata/generated/header-link.sub-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/metadata/generated/svg-image.https.sub-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/orb/tentative/content-range.sub.any-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/orb/tentative/content-range.sub.any.worker-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/orb/tentative/img-mime-types-coverage.tentative.sub-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/orb/tentative/known-mime-type.sub.any.worker-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/orb/tentative/nosniff.sub.any-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/orb/tentative/nosniff.sub.any.worker-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/orb/tentative/status.sub.any-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/orb/tentative/status.sub.any.worker-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/origin/assorted.window-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/private-network-access/anchor.tentative.window-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/private-network-access/fenced-frame-no-preflight-required.tentative.https.window-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/private-network-access/fenced-frame.tentative.https.window-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/private-network-access/iframe.tentative.window-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/private-network-access/mixed-content-fetch.tentative.https.window-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/private-network-access/nested-worker.tentative.https.window-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/private-network-access/nested-worker.tentative.window-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/private-network-access/shared-worker-blob-fetch.tentative.https.window-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/private-network-access/shared-worker-blob-fetch.tentative.window-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/private-network-access/shared-worker-fetch.tentative.https.window-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/private-network-access/shared-worker-fetch.tentative.window-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/private-network-access/shared-worker.tentative.window-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/private-network-access/websocket.tentative.window-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/private-network-access/window-open-existing.tentative.window-expected.txt
  • M third_party/blink/web_tests/external/wpt/fetch/private-network-access/window-open.tentative.https.window-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/private-network-access/window-open.tentative.window-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/private-network-access/worker-fetch.tentative.https.window-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/private-network-access/worker-fetch.tentative.window-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/private-network-access/worker.tentative.window-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/range/blob.any-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/range/blob.any.worker-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/range/general.any.serviceworker-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/range/general.window-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/range/sw.https.window-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/redirects/subresource-fragments-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/security/1xx-response.any-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/security/1xx-response.any.worker-expected.txt
  • D third_party/blink/web_tests/external/wpt/fetch/security/dangling-markup/dangling-markup-mitigation-allowed-apis-expected.txt
  • D third_party/blink/web_tests/platform/linux/external/wpt/fetch/orb/tentative/known-mime-type.sub.any-expected.txt
Change size: XL
Delta: 141 files changed, 27 insertions(+), 1653 deletions(-)
Open in Gerrit

Related details

Attention is currently required from:
  • Andrew Brown
  • Takashi Toyoshima
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: newchange
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Icf56620f99f371ea2f128e6a3194d6096b0d62cd
Gerrit-Change-Number: 5273743
Gerrit-PatchSet: 4
Gerrit-Owner: Andrew Brown <m...@ajbrown.au>
Gerrit-Reviewer: Adam Rice <ri...@chromium.org>
Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
Gerrit-CC: Nate Chapin <jap...@chromium.org>
Gerrit-Attention: Andrew Brown <m...@ajbrown.au>
Gerrit-Attention: Takashi Toyoshima <toyo...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Adam Rice (Gerrit)

unread,
Feb 19, 2024, 2:45:32 AM2/19/24
to Andrew Brown, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org, Takashi Toyoshima, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin
Attention needed from Andrew Brown and Takashi Toyoshima

Adam Rice added 2 comments

Patchset-level comments
File-level comment, Patchset 4 (Latest):
Adam Rice . resolved

+toyoshim to get a second opinion on whether this use of cors_exempt_header_list makes sense.

File chrome/browser/net/system_network_context_manager.cc
Line 869, Patchset 4 (Latest): network_context_params->cors_exempt_header_list.push_back(
Adam Rice . unresolved

This only affects chrome, and not other users of the network service like content_shell and webview, which is why so many tests are failing.

I think despite the fact that it tells you not to do it, you should add the header in StoragePartitionImpl::InitNetworkContext().

Open in Gerrit

Related details

Attention is currently required from:
  • Andrew Brown
  • Takashi Toyoshima
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Icf56620f99f371ea2f128e6a3194d6096b0d62cd
Gerrit-Change-Number: 5273743
Gerrit-PatchSet: 4
Gerrit-Owner: Andrew Brown <m...@ajbrown.au>
Gerrit-Reviewer: Adam Rice <ri...@chromium.org>
Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
Gerrit-CC: Nate Chapin <jap...@chromium.org>
Gerrit-Attention: Andrew Brown <m...@ajbrown.au>
Gerrit-Attention: Takashi Toyoshima <toyo...@chromium.org>
Gerrit-Comment-Date: Mon, 19 Feb 2024 07:45:23 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Andrew Brown (Gerrit)

unread,
Feb 19, 2024, 5:19:59 AM2/19/24
to blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org, Takashi Toyoshima, Adam Rice, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin
Attention needed from Adam Rice and Takashi Toyoshima

Andrew Brown added 3 comments

Patchset-level comments
Adam Rice . unresolved

Please run
```
third_party/blink/tools run_web_tests.py external/wpt/fetch --reset
```
to reset the test expectations and include any changes to *-expected.txt files in the CL.

Andrew Brown

Just done this (apologies for delay again).

There's a *lot* of changes. Like, way more than expected. Is it possible that the test-running processes need an update with this change? I imagine it might be possible that a heap of blink web tests are now "failing" because the runner doesn't adequately respond with CORS headers for custom user-agents.

Maybe it is OK, I'm not sure.

Adam Rice

It looks like that didn't work right, since the expectations for a lot of unrelated tests are being deleted. I've started a Dry Run of the bots to see what they say.

Andrew Brown

Is it possible that the 4 test suites reporting important failures are outside Blink? (i.e. net_unittests and services_unittests for the iPhone, the ones that are actually reporting failure)

There's a lot of different ways to view "which tests are failing" (with different lists each time) and it's a little hard to parse which ones need my attention.

File chrome/browser/net/system_network_context_manager.cc
Line 869, Patchset 4 (Latest): network_context_params->cors_exempt_header_list.push_back(
Adam Rice . unresolved

This only affects chrome, and not other users of the network service like content_shell and webview, which is why so many tests are failing.

I think despite the fact that it tells you not to do it, you should add the header in StoragePartitionImpl::InitNetworkContext().

Andrew Brown

Ohhhhh. Right, that makes a lot more sense now. I'll look into the StoragePartition then!

File services/network/cors/cors_url_loader_factory.cc
Line 474, Patchset 2: header.key == "User-Agent") {
Adam Rice . resolved

You should add "User-Agent" to NetworkContext::cors_exempt_header_list somewhere rather than special-casing it.

Andrew Brown

I wasn't sure about adding it to that list, as the headers on that list seem to be almost exclusively "variations headers" for whatever lives in components/variations.

I've added it in SystemNetworkContextManager::ConfigureDefaultNetworkContextParams.

Can't shake the feeling I should be leaving the browser user-agent till later - I noticed NetworkContext has a user_agent field, also filled out in ConfigureDefaultNetworkContextParams. I might investigate that and see if it's possible for the browser user-agent to be set from that value instead of setting it in third_party/blink/renderer/platform/loader/fetch/url_loader/request_conversion.cc.

Adam Rice

We need to use the value from the render process, as it may have been overridden by DevTools. I don't know if there is any way to access the DevTools override from within the network service. My guess would be not.

Another method would be to add a new `default_user_agent` field to `network::ResourceRequest`, but it would require changes in quite a few places.

Andrew Brown

Oh, true, I'd completely forgotten that DevTools lets you override your browser's default.

...Hm, should *that* value be CORS-exempt? (In this CL, it will be.) Probably a question for the whatwg peoplem, not here.

Adam Rice

DevTools is generally considered part of the browser, so a User-Agent set by DevTools has the same authority as one set by the browser itself.

Andrew Brown

Sweet, sorted then.

Open in Gerrit

Related details

Attention is currently required from:
  • Adam Rice
  • Takashi Toyoshima
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Icf56620f99f371ea2f128e6a3194d6096b0d62cd
Gerrit-Change-Number: 5273743
Gerrit-PatchSet: 4
Gerrit-Owner: Andrew Brown <m...@ajbrown.au>
Gerrit-Reviewer: Adam Rice <ri...@chromium.org>
Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
Gerrit-CC: Nate Chapin <jap...@chromium.org>
Gerrit-Attention: Adam Rice <ri...@chromium.org>
Gerrit-Attention: Takashi Toyoshima <toyo...@chromium.org>
Gerrit-Comment-Date: Mon, 19 Feb 2024 10:19:49 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Adam Rice (Gerrit)

unread,
Feb 19, 2024, 8:18:44 AM2/19/24
to Andrew Brown, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org, Takashi Toyoshima, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin
Attention needed from Andrew Brown and Takashi Toyoshima

Adam Rice added 1 comment

Patchset-level comments
Adam Rice . unresolved

Please run
```
third_party/blink/tools run_web_tests.py external/wpt/fetch --reset
```
to reset the test expectations and include any changes to *-expected.txt files in the CL.

Andrew Brown

Just done this (apologies for delay again).

There's a *lot* of changes. Like, way more than expected. Is it possible that the test-running processes need an update with this change? I imagine it might be possible that a heap of blink web tests are now "failing" because the runner doesn't adequately respond with CORS headers for custom user-agents.

Maybe it is OK, I'm not sure.

Adam Rice

It looks like that didn't work right, since the expectations for a lot of unrelated tests are being deleted. I've started a Dry Run of the bots to see what they say.

Andrew Brown

Is it possible that the 4 test suites reporting important failures are outside Blink? (i.e. net_unittests and services_unittests for the iPhone, the ones that are actually reporting failure)

There's a lot of different ways to view "which tests are failing" (with different lists each time) and it's a little hard to parse which ones need my attention.

Adam Rice

I generally deal with any failures on the linux-rel bot first. It runs the largest cross-section of tests and is less prone to weird failures than some other bots.

Usually getting linux-rel passing is sufficient to clear several other bots. If mac-rel or win-rel had failures they would be my next priority. After that I'd look at whatever was still failing.

Open in Gerrit

Related details

Attention is currently required from:
  • Andrew Brown
  • Takashi Toyoshima
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Icf56620f99f371ea2f128e6a3194d6096b0d62cd
Gerrit-Change-Number: 5273743
Gerrit-PatchSet: 4
Gerrit-Owner: Andrew Brown <m...@ajbrown.au>
Gerrit-Reviewer: Adam Rice <ri...@chromium.org>
Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
Gerrit-CC: Nate Chapin <jap...@chromium.org>
Gerrit-Attention: Andrew Brown <m...@ajbrown.au>
Gerrit-Attention: Takashi Toyoshima <toyo...@chromium.org>
Gerrit-Comment-Date: Mon, 19 Feb 2024 13:18:35 +0000
satisfied_requirement
unsatisfied_requirement
open
diffy

Takashi Toyoshima (Gerrit)

unread,
Feb 20, 2024, 2:59:10 AM2/20/24
to Andrew Brown, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org, Adam Rice, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin
Attention needed from Andrew Brown

Takashi Toyoshima added 1 comment

Patchset-level comments
File-level comment, Patchset 4 (Latest):
Takashi Toyoshima . unresolved

This is a wrong use of cors_exempt_header_list. It should not be used for headers that JavaScript can set arbitrary values, but only be allowed for headers that browser internal trusted code set.

If we allow JavaScript to set it via the API with exempted from CORS checks, it should be listed in the CORS-safelitsed request-header.
https://fetch.spec.whatwg.org/#cors-safelisted-request-header

So, I think the current behavior is intentional, and if you want to change this, spec discussion is needed. But I think the current behavior is a conclusion of a security discussion.

Open in Gerrit

Related details

Attention is currently required from:
  • Andrew Brown
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Icf56620f99f371ea2f128e6a3194d6096b0d62cd
Gerrit-Change-Number: 5273743
Gerrit-PatchSet: 4
Gerrit-Owner: Andrew Brown <m...@ajbrown.au>
Gerrit-Reviewer: Adam Rice <ri...@chromium.org>
Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
Gerrit-CC: Nate Chapin <jap...@chromium.org>
Gerrit-Attention: Andrew Brown <m...@ajbrown.au>
Gerrit-Comment-Date: Tue, 20 Feb 2024 07:59:02 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Takashi Toyoshima (Gerrit)

unread,
Feb 20, 2024, 3:18:22 AM2/20/24
to Andrew Brown, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org, Adam Rice, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin
Attention needed from Andrew Brown

Takashi Toyoshima added 1 comment

Patchset-level comments
Takashi Toyoshima . unresolved

This is a wrong use of cors_exempt_header_list. It should not be used for headers that JavaScript can set arbitrary values, but only be allowed for headers that browser internal trusted code set.

If we allow JavaScript to set it via the API with exempted from CORS checks, it should be listed in the CORS-safelitsed request-header.
https://fetch.spec.whatwg.org/#cors-safelisted-request-header

So, I think the current behavior is intentional, and if you want to change this, spec discussion is needed. But I think the current behavior is a conclusion of a security discussion.

Takashi Toyoshima

Maybe I should add mode information.
So, there are 3 groups of headers from the viewpoint of CORS and the Fetch and other APIs.

1. forbidden request headers (https://fetch.spec.whatwg.org/#forbidden-request-header)
JavaScript cannot set them.

2. safelisted request headers (https://fetch.spec.whatwg.org/#cors-safelisted-request-header)
JavaScript can set, and doesn't cause CORS preflight if their use is reasonable, but there is a rule to trigger preflight even if they are in the safelist.

3. other request headers
JavaScript can set, but trigger CORS preflight.

IIUC, the User-Agent is classified into the 3 in the current spec.

Open in Gerrit

Related details

Attention is currently required from:
  • Andrew Brown
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Icf56620f99f371ea2f128e6a3194d6096b0d62cd
Gerrit-Change-Number: 5273743
Gerrit-PatchSet: 4
Gerrit-Owner: Andrew Brown <m...@ajbrown.au>
Gerrit-Reviewer: Adam Rice <ri...@chromium.org>
Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
Gerrit-CC: Nate Chapin <jap...@chromium.org>
Gerrit-Attention: Andrew Brown <m...@ajbrown.au>
Gerrit-Comment-Date: Tue, 20 Feb 2024 08:18:14 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Takashi Toyoshima <toyo...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Andrew Brown (Gerrit)

unread,
Feb 20, 2024, 6:22:56 PM2/20/24
to blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org, Takashi Toyoshima, Adam Rice, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin
Attention needed from Takashi Toyoshima

Andrew Brown added 1 comment

Patchset-level comments
Takashi Toyoshima . unresolved

This is a wrong use of cors_exempt_header_list. It should not be used for headers that JavaScript can set arbitrary values, but only be allowed for headers that browser internal trusted code set.

If we allow JavaScript to set it via the API with exempted from CORS checks, it should be listed in the CORS-safelitsed request-header.
https://fetch.spec.whatwg.org/#cors-safelisted-request-header

So, I think the current behavior is intentional, and if you want to change this, spec discussion is needed. But I think the current behavior is a conclusion of a security discussion.

Takashi Toyoshima

Maybe I should add mode information.
So, there are 3 groups of headers from the viewpoint of CORS and the Fetch and other APIs.

1. forbidden request headers (https://fetch.spec.whatwg.org/#forbidden-request-header)
JavaScript cannot set them.

2. safelisted request headers (https://fetch.spec.whatwg.org/#cors-safelisted-request-header)
JavaScript can set, and doesn't cause CORS preflight if their use is reasonable, but there is a rule to trigger preflight even if they are in the safelist.

3. other request headers
JavaScript can set, but trigger CORS preflight.

IIUC, the User-Agent is classified into the 3 in the current spec.

Andrew Brown

Hmm. You're right, Firefox treats it a bit like #2 - if JavaScript sets it, send a preflight, and if the browser sets it, don't - but the spec does appear to describe it as #3.

I wasn't aware of the real semantic meaning of cors_exempt_header_list, so it sounds like that's not what I want. Functionally, in this CL, I've treated User-Agent as if it was #2 - but there's no mechanism in NetworkContext for "sometimes exempt", so the NetworkContext just always exempts it and trusts Blink to know what it's doing (I'll admit, not an ideal approach, but one that I can understand and implement).

If User-Agent really is #3, this CL could be almost as simple as just removing it from the list in /net/http/http_util.cc, as by default it will then always trigger a preflight. I'd still need to ensure it's hidden from ServiceWorkers, but the current setup (with the browser User-Agent kept in a separate area until the NetworkRequest is constructed) should (?) do that already.

Should I open an issue/send an email/something to ask the whatwg people for clarification? Or is it OK to just forge on with a never-cors-exempt User-Agent? (I personally suspect this could break a lot of things, as websites may not realise they have to respond to an OPTIONS request to say that setting a User-Agent is OK, and treating User-Agent as #3 would result in every request triggering an OPTIONS request to ask about the browser-supplied User-Agent.)

Open in Gerrit

Related details

Attention is currently required from:
  • Takashi Toyoshima
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Icf56620f99f371ea2f128e6a3194d6096b0d62cd
Gerrit-Change-Number: 5273743
Gerrit-PatchSet: 4
Gerrit-Owner: Andrew Brown <m...@ajbrown.au>
Gerrit-Reviewer: Adam Rice <ri...@chromium.org>
Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
Gerrit-CC: Nate Chapin <jap...@chromium.org>
Gerrit-Attention: Takashi Toyoshima <toyo...@chromium.org>
Gerrit-Comment-Date: Tue, 20 Feb 2024 23:22:43 +0000
satisfied_requirement
unsatisfied_requirement
open
diffy

Takashi Toyoshima (Gerrit)

unread,
Feb 21, 2024, 1:25:37 AM2/21/24
to Andrew Brown, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org, Adam Rice, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin
Attention needed from Andrew Brown

Takashi Toyoshima added 1 comment

Patchset-level comments
Takashi Toyoshima . unresolved

This is a wrong use of cors_exempt_header_list. It should not be used for headers that JavaScript can set arbitrary values, but only be allowed for headers that browser internal trusted code set.

If we allow JavaScript to set it via the API with exempted from CORS checks, it should be listed in the CORS-safelitsed request-header.
https://fetch.spec.whatwg.org/#cors-safelisted-request-header

So, I think the current behavior is intentional, and if you want to change this, spec discussion is needed. But I think the current behavior is a conclusion of a security discussion.

Takashi Toyoshima

Maybe I should add mode information.
So, there are 3 groups of headers from the viewpoint of CORS and the Fetch and other APIs.

1. forbidden request headers (https://fetch.spec.whatwg.org/#forbidden-request-header)
JavaScript cannot set them.

2. safelisted request headers (https://fetch.spec.whatwg.org/#cors-safelisted-request-header)
JavaScript can set, and doesn't cause CORS preflight if their use is reasonable, but there is a rule to trigger preflight even if they are in the safelist.

3. other request headers
JavaScript can set, but trigger CORS preflight.

IIUC, the User-Agent is classified into the 3 in the current spec.

Andrew Brown

Hmm. You're right, Firefox treats it a bit like #2 - if JavaScript sets it, send a preflight, and if the browser sets it, don't - but the spec does appear to describe it as #3.

I wasn't aware of the real semantic meaning of cors_exempt_header_list, so it sounds like that's not what I want. Functionally, in this CL, I've treated User-Agent as if it was #2 - but there's no mechanism in NetworkContext for "sometimes exempt", so the NetworkContext just always exempts it and trusts Blink to know what it's doing (I'll admit, not an ideal approach, but one that I can understand and implement).

If User-Agent really is #3, this CL could be almost as simple as just removing it from the list in /net/http/http_util.cc, as by default it will then always trigger a preflight. I'd still need to ensure it's hidden from ServiceWorkers, but the current setup (with the browser User-Agent kept in a separate area until the NetworkRequest is constructed) should (?) do that already.

Should I open an issue/send an email/something to ask the whatwg people for clarification? Or is it OK to just forge on with a never-cors-exempt User-Agent? (I personally suspect this could break a lot of things, as websites may not realise they have to respond to an OPTIONS request to say that setting a User-Agent is OK, and treating User-Agent as #3 would result in every request triggering an OPTIONS request to ask about the browser-supplied User-Agent.)

Takashi Toyoshima

JavaScript can easily embed a risky byte sequence into the User-Agent value. So, sending preflight to cross origin requests is the right direction. If the server doesn't know OPTIONS, it means the server is NOT ready to receive a request containing arbitrary header value. So failing it is not a compatibility break but just a right safety to avoid security problem as it's so easy to cause a buffer overflow and so on against such servers.
So, I'm fine with the direction just to remove it from the forbidden list in the http_util.cc, and I think whatwg would have the same opinion as I have been involved in the CORS discussion.
As it wasn't permitted before, this would not introduce a new compatibility breakage, but just relax the existing restriction a little?

Open in Gerrit

Related details

Attention is currently required from:
  • Andrew Brown
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Icf56620f99f371ea2f128e6a3194d6096b0d62cd
Gerrit-Change-Number: 5273743
Gerrit-PatchSet: 4
Gerrit-Owner: Andrew Brown <m...@ajbrown.au>
Gerrit-Reviewer: Adam Rice <ri...@chromium.org>
Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
Gerrit-CC: Nate Chapin <jap...@chromium.org>
Gerrit-Attention: Andrew Brown <m...@ajbrown.au>
Gerrit-Comment-Date: Wed, 21 Feb 2024 06:25:25 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Andrew Brown <m...@ajbrown.au>
Comment-In-Reply-To: Takashi Toyoshima <toyo...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Adam Rice (Gerrit)

unread,
Feb 21, 2024, 3:55:42 AM2/21/24
to Andrew Brown, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org, Takashi Toyoshima, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin
Attention needed from Andrew Brown and Takashi Toyoshima

Adam Rice added 1 comment

Patchset-level comments
Adam Rice

I'm really confused, so let me try to clarify.

Current behaviour:
1. Blink C++ code sets user-agent to "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36": sent to server without preflight
2. DevTools sets user-agent to "Banana/1.0": sent to server without preflight
3. Extension sets user-agent to "Banana/1.0": sent to server without preflight
4. JavaScript sets user-agent to "Banana/1.0": ignored, not sent to server

Desired behaviour after this change:
1. Blink C++ code sets user-agent to "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36": sent to server without preflight
2. DevTools sets user-agent to "Banana/1.0": sent to server without preflight
3. Extension sets user-agent to "Banana/1.0": sent to server without preflight
4. JavaScript sets user-agent to "Banana/1.0": sent to server with a preflight

Number 4. is the only case that should change. Is that right?

Open in Gerrit

Related details

Attention is currently required from:
  • Andrew Brown
  • Takashi Toyoshima
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Icf56620f99f371ea2f128e6a3194d6096b0d62cd
Gerrit-Change-Number: 5273743
Gerrit-PatchSet: 4
Gerrit-Owner: Andrew Brown <m...@ajbrown.au>
Gerrit-Reviewer: Adam Rice <ri...@chromium.org>
Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
Gerrit-CC: Nate Chapin <jap...@chromium.org>
Gerrit-Attention: Andrew Brown <m...@ajbrown.au>
Gerrit-Attention: Takashi Toyoshima <toyo...@chromium.org>
Gerrit-Comment-Date: Wed, 21 Feb 2024 08:55:31 +0000
satisfied_requirement
unsatisfied_requirement
open
diffy

Andrew Brown (Gerrit)

unread,
Feb 21, 2024, 7:10:09 PM2/21/24
to blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org, Takashi Toyoshima, Adam Rice, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin
Attention needed from Adam Rice and Takashi Toyoshima

Andrew Brown added 3 comments

Patchset-level comments
Adam Rice . unresolved

Please run
```
third_party/blink/tools run_web_tests.py external/wpt/fetch --reset
```
to reset the test expectations and include any changes to *-expected.txt files in the CL.

Andrew Brown

Just done this (apologies for delay again).

There's a *lot* of changes. Like, way more than expected. Is it possible that the test-running processes need an update with this change? I imagine it might be possible that a heap of blink web tests are now "failing" because the runner doesn't adequately respond with CORS headers for custom user-agents.

Maybe it is OK, I'm not sure.

Adam Rice

It looks like that didn't work right, since the expectations for a lot of unrelated tests are being deleted. I've started a Dry Run of the bots to see what they say.

Andrew Brown

Is it possible that the 4 test suites reporting important failures are outside Blink? (i.e. net_unittests and services_unittests for the iPhone, the ones that are actually reporting failure)

There's a lot of different ways to view "which tests are failing" (with different lists each time) and it's a little hard to parse which ones need my attention.

Adam Rice

I generally deal with any failures on the linux-rel bot first. It runs the largest cross-section of tests and is less prone to weird failures than some other bots.

Usually getting linux-rel passing is sufficient to clear several other bots. If mac-rel or win-rel had failures they would be my next priority. After that I'd look at whatever was still failing.

Andrew Brown

Sweet. I'll also git-reset when I do the next patchset so we don't have heaps of test changes clogging up the diff, if that's alright.

Andrew Brown

I've possibly been confused by the #1/2/3 groups - what you've just described is my understanding, it's Firefox's implementation, and it's what this CL does. Takashi can correct me if that's wrong - the spec is somewhat vague, and I'm unsure if user-agent has this behaviour nicely described anywhere.

My post above was out of concern that #3 meant *always* sending a preflight, not only when JavaScript sets the user-agent.

Either way I will have to investigate where to pass it through if cors_exempt_... isn't the place for it. Possibly this will mean creating a new mechanism for passing it through that doesn't trigger preflights.

File chrome/browser/net/system_network_context_manager.cc
Line 869, Patchset 4 (Latest): network_context_params->cors_exempt_header_list.push_back(
Adam Rice . resolved

This only affects chrome, and not other users of the network service like content_shell and webview, which is why so many tests are failing.

I think despite the fact that it tells you not to do it, you should add the header in StoragePartitionImpl::InitNetworkContext().

Andrew Brown

Ohhhhh. Right, that makes a lot more sense now. I'll look into the StoragePartition then!

Andrew Brown

Done

Open in Gerrit

Related details

Attention is currently required from:
  • Adam Rice
  • Takashi Toyoshima
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Icf56620f99f371ea2f128e6a3194d6096b0d62cd
Gerrit-Change-Number: 5273743
Gerrit-PatchSet: 4
Gerrit-Owner: Andrew Brown <m...@ajbrown.au>
Gerrit-Reviewer: Adam Rice <ri...@chromium.org>
Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
Gerrit-CC: Nate Chapin <jap...@chromium.org>
Gerrit-Attention: Adam Rice <ri...@chromium.org>
Gerrit-Attention: Takashi Toyoshima <toyo...@chromium.org>
Gerrit-Comment-Date: Thu, 22 Feb 2024 00:09:58 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Adam Rice <ri...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Takashi Toyoshima (Gerrit)

unread,
Feb 22, 2024, 1:38:03 AM2/22/24
to Andrew Brown, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org, Adam Rice, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin
Attention needed from Adam Rice and Andrew Brown

Takashi Toyoshima added 7 comments

Patchset-level comments
Takashi Toyoshima . unresolved

Hi, I'm now refreshing my memory, and let me correct my previous answer.
Probably your current change is in the right direction.

I left some notes on the cors implementation for reference, and in order to transfer my knowledge to Adam.

And, also I left some implementation comments to fix and polish current implementation. Using the cors_exempt_headers are a little tricky from the security perspective, and I want to make the interface clearer so that developers don't use it for a wrong purpose.

Takashi Toyoshima

Desired behaviors Adam describes need a small fix for 4.
Preflight will be sent only when JavaScript sets it for cross-origin requests.

Regarding the behavior, the Fetch spec defines what we need for the public web platform, but behaviors for #2 and #3 are vendor specific and the spec doesn't explain well, I think.

Also, let me refresh my memory on the chromium's CORS implementation.
My previous explanation wasn't accurate. Sorry for that.
Here are notes to share my knowledge.

We have two request header lists in network::ResourceRequest.
```
net::HttpRequestHeaders headers;
net::HttpRequestHeaders cors_exempt_headers;
```
Usually, we use `headers` to hold the request headers. But if internal code needs to set CORS impacting headers, we push them into `cors_exempt_headers` instead. Headers in the list escape from the CORS checks. But even for the same request header, it should not be used for the case JavaScript set it because JavaScript setting headers always need CORS checks.

For instance, if Blink code wants to set the default User-Agent, using `cors_exempt_headers` is fine. DevTools can use it too. But when JavaScript sets it via Fetch or XHR, we push it into `headers`.

These two headers are merged here:
https://source.chromium.org/chromium/chromium/src/+/main:services/network/url_loader.cc;l=656;bpv=0;bpt=0
So, you may need to manage the header entry is exclusive in both lists to avoid unexpected merge results.

But, using `cors_exempt_headers` needs another setup. That's the `NetworkContextParams::cors_exempt_headers_list`. This is setup via the trusted code in the browser process, and only headers listed in the list works in the `ResourceRequest::cors_exempt_headers`. If there are unknown headers there, we detect it as the requester, the initiating renderer, is compromised.

Another CORS escaping path is to set the header after the CORS checks. Some Extensions API goes to this route, and /net code and their deligates also go on this path.

File chrome/browser/net/system_network_context_manager.cc
Line 869, Patchset 4 (Latest): network_context_params->cors_exempt_header_list.push_back(
Adam Rice . unresolved

This only affects chrome, and not other users of the network service like content_shell and webview, which is why so many tests are failing.

I think despite the fact that it tells you not to do it, you should add the header in StoragePartitionImpl::InitNetworkContext().

Andrew Brown

Ohhhhh. Right, that makes a lot more sense now. I'll look into the StoragePartition then!

Andrew Brown

Done

Takashi Toyoshima

Your change is not only for Google Chrome, but for all chromium based UA.
So, the right place to set it up is here:
https://source.chromium.org/chromium/chromium/src/+/main:content/browser/storage_partition_impl.cc;l=3304;drc=f4a00cc248dd2dc8ec8759fb51620d47b5114090;bpv=1;bpt=1

File third_party/blink/renderer/core/loader/frame_fetch_context.cc
Line 331, Patchset 4 (Parent):
Takashi Toyoshima . unresolved

by the way, I could not remember how this default UA header bypassed the cors checks until today. do you explore?

File third_party/blink/renderer/platform/loader/fetch/resource_request.h
Line 228, Patchset 4 (Latest): // the safe_user_agent_ is the browser-supplied user agent. It doesn't trigger
Takashi Toyoshima . unresolved

I'm a bit concern about other developers mistakenly calling this for wrong uses.
Also, "CorsExempt" is confusing.

Can we change the direction to have a FetchContext::GetDefaultUserAgent()?
See my another comment on request_conversion.cc.

File third_party/blink/renderer/platform/loader/fetch/url_loader/request_conversion.cc
Line 309, Patchset 4 (Latest): if (!user_agent_set) {
Takashi Toyoshima . unresolved

slightly prefer `headers.HasHeader(kUserAgent)` rather than managing a flag during the conversion manually.

Line 311, Patchset 4 (Latest): src.CorsExemptHTTPUserAgent().Utf8());
Takashi Toyoshima . unresolved

Can we obtain the default user-agent header via FetchContext rather than holding it in the src?

Now, ResourceLoader and FetchManager call this PopulateResourceRequest method. Both callers can access FetchContext via ResourceFetcher.

FetchContext's GetDefaultUserAgent needs to be implemented in the inherit classes for frames, and workers respectively. So, we can add a 4th argument to this method to provide the default user-agent.

Open in Gerrit

Related details

Attention is currently required from:
  • Adam Rice
  • Andrew Brown
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Icf56620f99f371ea2f128e6a3194d6096b0d62cd
Gerrit-Change-Number: 5273743
Gerrit-PatchSet: 4
Gerrit-Owner: Andrew Brown <m...@ajbrown.au>
Gerrit-Reviewer: Adam Rice <ri...@chromium.org>
Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
Gerrit-CC: Nate Chapin <jap...@chromium.org>
Gerrit-Attention: Adam Rice <ri...@chromium.org>
Gerrit-Attention: Andrew Brown <m...@ajbrown.au>
Gerrit-Comment-Date: Thu, 22 Feb 2024 06:37:49 +0000
satisfied_requirement
unsatisfied_requirement
open
diffy

Andrew Brown (Gerrit)

unread,
Feb 29, 2024, 9:26:32 PM2/29/24
to Takashi Toyoshima, Adam Rice, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
Attention needed from Adam Rice and Takashi Toyoshima

Andrew Brown added 8 comments

Patchset-level comments

Please run
```
third_party/blink/tools run_web_tests.py external/wpt/fetch --reset
```
to reset the test expectations and include any changes to *-expected.txt files in the CL.

Andrew Brown

Just done this (apologies for delay again).

There's a *lot* of changes. Like, way more than expected. Is it possible that the test-running processes need an update with this change? I imagine it might be possible that a heap of blink web tests are now "failing" because the runner doesn't adequately respond with CORS headers for custom user-agents.

Maybe it is OK, I'm not sure.

Adam Rice

It looks like that didn't work right, since the expectations for a lot of unrelated tests are being deleted. I've started a Dry Run of the bots to see what they say.

Andrew Brown

Is it possible that the 4 test suites reporting important failures are outside Blink? (i.e. net_unittests and services_unittests for the iPhone, the ones that are actually reporting failure)

There's a lot of different ways to view "which tests are failing" (with different lists each time) and it's a little hard to parse which ones need my attention.

Adam Rice

I generally deal with any failures on the linux-rel bot first. It runs the largest cross-section of tests and is less prone to weird failures than some other bots.

Usually getting linux-rel passing is sufficient to clear several other bots. If mac-rel or win-rel had failures they would be my next priority. After that I'd look at whatever was still failing.

Andrew Brown

Sweet. I'll also git-reset when I do the next patchset so we don't have heaps of test changes clogging up the diff, if that's alright.

Andrew Brown

Done

Andrew Brown

This explanation is fantastic, much appreciated.

Takashi Toyoshima . unresolved

Hi, I'm now refreshing my memory, and let me correct my previous answer.
Probably your current change is in the right direction.

I left some notes on the cors implementation for reference, and in order to transfer my knowledge to Adam.

And, also I left some implementation comments to fix and polish current implementation. Using the cors_exempt_headers are a little tricky from the security perspective, and I want to make the interface clearer so that developers don't use it for a wrong purpose.

Andrew Brown

I've gone through your comments, but - I've made a super rookie mistake, I've `git clean`'ed a bit too hard and now I can't work out how to get `git cl upload` to link back to this CL. I guess I've accidentally cleared out whatever file `git cl` stores its information in.

Any way to link back to this manually, or is the only option to submit a separate CL? Sorry about that, it'll probably be a huge pain.

File chrome/browser/net/system_network_context_manager.cc
Line 869, Patchset 4 (Latest): network_context_params->cors_exempt_header_list.push_back(
Adam Rice . resolved

This only affects chrome, and not other users of the network service like content_shell and webview, which is why so many tests are failing.

I think despite the fact that it tells you not to do it, you should add the header in StoragePartitionImpl::InitNetworkContext().

Andrew Brown

Ohhhhh. Right, that makes a lot more sense now. I'll look into the StoragePartition then!

Andrew Brown

Done

Takashi Toyoshima

Your change is not only for Google Chrome, but for all chromium based UA.
So, the right place to set it up is here:
https://source.chromium.org/chromium/chromium/src/+/main:content/browser/storage_partition_impl.cc;l=3304;drc=f4a00cc248dd2dc8ec8759fb51620d47b5114090;bpv=1;bpt=1

Andrew Brown

Done

File third_party/blink/renderer/core/loader/frame_fetch_context.cc
Takashi Toyoshima . unresolved

by the way, I could not remember how this default UA header bypassed the cors checks until today. do you explore?

Andrew Brown

I believe the browser process checks headers against the `kForbiddenHeaderList` field using `!HttpUtil::IsSafeHeader()` before CORS. Basically, if it sees the request has any "unsafe" headers, it assumes they don't need CORS checks, because it can't have come from JavaScript.

See services/network/cors/cors_util.cc for where I think that check happens - I believe that function returns a list of headers that CORS needs to ask about, and skips any headers it sees that are "unsafe".

Unfortunately we have to take it off the forbidden list for JavaScript to use it, hence passing it around through the cors_exempt_headers.

File third_party/blink/renderer/platform/loader/fetch/resource_request.h
Line 228, Patchset 4 (Latest): // the safe_user_agent_ is the browser-supplied user agent. It doesn't trigger
Takashi Toyoshima . resolved

I'm a bit concern about other developers mistakenly calling this for wrong uses.
Also, "CorsExempt" is confusing.

Can we change the direction to have a FetchContext::GetDefaultUserAgent()?
See my another comment on request_conversion.cc.

Andrew Brown

Makes sense - done!

File third_party/blink/renderer/platform/loader/fetch/url_loader/request_conversion.cc
Line 309, Patchset 4 (Latest): if (!user_agent_set) {
Takashi Toyoshima . resolved

slightly prefer `headers.HasHeader(kUserAgent)` rather than managing a flag during the conversion manually.

Andrew Brown

Done

Line 311, Patchset 4 (Latest): src.CorsExemptHTTPUserAgent().Utf8());
Takashi Toyoshima . unresolved

Can we obtain the default user-agent header via FetchContext rather than holding it in the src?

Now, ResourceLoader and FetchManager call this PopulateResourceRequest method. Both callers can access FetchContext via ResourceFetcher.

FetchContext's GetDefaultUserAgent needs to be implemented in the inherit classes for frames, and workers respectively. So, we can add a 4th argument to this method to provide the default user-agent.

Andrew Brown

The inheritance of `FetchContext` is a little funky - I've had to implement a weird default-version in `FetchContext` returning an empty string.

In return, I've stuck in a DCHECK macro to make sure it's actually been overridden by the time we want to set it in this file.

Open in Gerrit

Related details

Attention is currently required from:
  • Adam Rice
  • Takashi Toyoshima
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Icf56620f99f371ea2f128e6a3194d6096b0d62cd
Gerrit-Change-Number: 5273743
Gerrit-PatchSet: 4
Gerrit-Owner: Andrew Brown <m...@ajbrown.au>
Gerrit-Reviewer: Adam Rice <ri...@chromium.org>
Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
Gerrit-CC: Nate Chapin <jap...@chromium.org>
Gerrit-Attention: Adam Rice <ri...@chromium.org>
Gerrit-Attention: Takashi Toyoshima <toyo...@chromium.org>
Gerrit-Comment-Date: Fri, 01 Mar 2024 02:26:22 +0000
satisfied_requirement
unsatisfied_requirement
open
diffy

Takashi Toyoshima (Gerrit)

unread,
Mar 4, 2024, 1:36:34 AM3/4/24
to Andrew Brown, Adam Rice, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
Attention needed from Adam Rice and Andrew Brown

Takashi Toyoshima added 1 comment

Patchset-level comments
Takashi Toyoshima . unresolved

Hi, I'm now refreshing my memory, and let me correct my previous answer.
Probably your current change is in the right direction.

I left some notes on the cors implementation for reference, and in order to transfer my knowledge to Adam.

And, also I left some implementation comments to fix and polish current implementation. Using the cors_exempt_headers are a little tricky from the security perspective, and I want to make the interface clearer so that developers don't use it for a wrong purpose.

Andrew Brown

I've gone through your comments, but - I've made a super rookie mistake, I've `git clean`'ed a bit too hard and now I can't work out how to get `git cl upload` to link back to this CL. I guess I've accidentally cleared out whatever file `git cl` stores its information in.

Any way to link back to this manually, or is the only option to submit a separate CL? Sorry about that, it'll probably be a huge pain.

Takashi Toyoshima

You can set up your current branch with 'git cl issue 5273743`.
This is a command to bind the current branch with a specified review entry.
So, once you run it, `git cl upload` will upload your current local changes to the bound review page.

Open in Gerrit

Related details

Attention is currently required from:
  • Adam Rice
  • Andrew Brown
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Icf56620f99f371ea2f128e6a3194d6096b0d62cd
Gerrit-Change-Number: 5273743
Gerrit-PatchSet: 4
Gerrit-Owner: Andrew Brown <m...@ajbrown.au>
Gerrit-Reviewer: Adam Rice <ri...@chromium.org>
Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
Gerrit-CC: Nate Chapin <jap...@chromium.org>
Gerrit-Attention: Adam Rice <ri...@chromium.org>
Gerrit-Attention: Andrew Brown <m...@ajbrown.au>
Gerrit-Comment-Date: Mon, 04 Mar 2024 06:36:26 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Takashi Toyoshima (Gerrit)

unread,
Mar 4, 2024, 1:38:34 AM3/4/24
to Andrew Brown, Adam Rice, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
Attention needed from Adam Rice and Andrew Brown

Takashi Toyoshima added 1 comment

Patchset-level comments
Takashi Toyoshima . unresolved

Hi, I'm now refreshing my memory, and let me correct my previous answer.
Probably your current change is in the right direction.

I left some notes on the cors implementation for reference, and in order to transfer my knowledge to Adam.

And, also I left some implementation comments to fix and polish current implementation. Using the cors_exempt_headers are a little tricky from the security perspective, and I want to make the interface clearer so that developers don't use it for a wrong purpose.

Andrew Brown

I've gone through your comments, but - I've made a super rookie mistake, I've `git clean`'ed a bit too hard and now I can't work out how to get `git cl upload` to link back to this CL. I guess I've accidentally cleared out whatever file `git cl` stores its information in.

Any way to link back to this manually, or is the only option to submit a separate CL? Sorry about that, it'll probably be a huge pain.

Takashi Toyoshima

You can set up your current branch with 'git cl issue 5273743`.
This is a command to bind the current branch with a specified review entry.
So, once you run it, `git cl upload` will upload your current local changes to the bound review page.

Takashi Toyoshima

sorry, the quotation was broken...

Gerrit-Comment-Date: Mon, 04 Mar 2024 06:38:24 +0000
satisfied_requirement
unsatisfied_requirement
open
diffy

Takashi Toyoshima (Gerrit)

unread,
Mar 4, 2024, 2:32:20 AM3/4/24
to Andrew Brown, James Su, AyeAye, Adam Rice, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, alexmo...@chromium.org, yhanad...@chromium.org, tranbaod...@chromium.org, nona+...@chromium.org, creis...@chromium.org, shuche...@chromium.org, jbauma...@chromium.org, navigation...@chromium.org, keithle...@chromium.org, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
Attention needed from Adam Rice and Andrew Brown

Takashi Toyoshima added 1 comment

Patchset-level comments
File-level comment, Patchset 5 (Latest):
Takashi Toyoshima . resolved

Oops, I mistakenly uploaded my local changes here...
I forgot that I tried the operation locally for doublechecking lol
Can you override again?

Open in Gerrit

Related details

Attention is currently required from:
  • Adam Rice
  • Andrew Brown
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Icf56620f99f371ea2f128e6a3194d6096b0d62cd
Gerrit-Change-Number: 5273743
Gerrit-PatchSet: 5
Gerrit-Owner: Andrew Brown <m...@ajbrown.au>
Gerrit-Reviewer: Adam Rice <ri...@chromium.org>
Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
Gerrit-CC: James Su <su...@chromium.org>
Gerrit-CC: Nate Chapin <jap...@chromium.org>
Gerrit-Attention: Adam Rice <ri...@chromium.org>
Gerrit-Attention: Andrew Brown <m...@ajbrown.au>
Gerrit-Comment-Date: Mon, 04 Mar 2024 07:32:10 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Andrew Brown (Gerrit)

unread,
Mar 4, 2024, 3:45:17 AM3/4/24
to W. James Maclean, James Su, AyeAye, Takashi Toyoshima, Adam Rice, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, alexmo...@chromium.org, yhanad...@chromium.org, tranbaod...@chromium.org, nona+...@chromium.org, creis...@chromium.org, shuche...@chromium.org, jbauma...@chromium.org, navigation...@chromium.org, keithle...@chromium.org, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
Attention needed from Adam Rice and Takashi Toyoshima

Andrew Brown added 2 comments

Patchset-level comments
File-level comment, Patchset 4:
Takashi Toyoshima . resolved

Hi, I'm now refreshing my memory, and let me correct my previous answer.
Probably your current change is in the right direction.

I left some notes on the cors implementation for reference, and in order to transfer my knowledge to Adam.

And, also I left some implementation comments to fix and polish current implementation. Using the cors_exempt_headers are a little tricky from the security perspective, and I want to make the interface clearer so that developers don't use it for a wrong purpose.

Andrew Brown

I've gone through your comments, but - I've made a super rookie mistake, I've `git clean`'ed a bit too hard and now I can't work out how to get `git cl upload` to link back to this CL. I guess I've accidentally cleared out whatever file `git cl` stores its information in.

Any way to link back to this manually, or is the only option to submit a separate CL? Sorry about that, it'll probably be a huge pain.

Takashi Toyoshima

You can set up your current branch with 'git cl issue 5273743`.
This is a command to bind the current branch with a specified review entry.
So, once you run it, `git cl upload` will upload your current local changes to the bound review page.

Takashi Toyoshima

sorry, the quotation was broken...

You can set up your current branch with `git cl issue 5273743`.
This is a command to bind the current branch with a specified review entry.
So, once you run it, `git cl upload` will upload your current local changes to the bound review page.

Andrew Brown

You're an absolute lifesaver, cheers! Uploaded now.

Takashi Toyoshima . resolved

Oops, I mistakenly uploaded my local changes here...
I forgot that I tried the operation locally for doublechecking lol
Can you override again?

Andrew Brown

Looks like I've managed to override, so all good.

Open in Gerrit

Related details

Attention is currently required from:
  • Adam Rice
  • Takashi Toyoshima
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Icf56620f99f371ea2f128e6a3194d6096b0d62cd
Gerrit-Change-Number: 5273743
Gerrit-PatchSet: 6
Gerrit-Owner: Andrew Brown <m...@ajbrown.au>
Gerrit-Reviewer: Adam Rice <ri...@chromium.org>
Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
Gerrit-CC: James Su <su...@chromium.org>
Gerrit-CC: Nate Chapin <jap...@chromium.org>
Gerrit-CC: W. James Maclean <wjma...@chromium.org>
Gerrit-Attention: Adam Rice <ri...@chromium.org>
Gerrit-Attention: Takashi Toyoshima <toyo...@chromium.org>
Gerrit-Comment-Date: Mon, 04 Mar 2024 08:45:04 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Adam Rice (Gerrit)

unread,
Mar 4, 2024, 12:10:26 PM3/4/24
to Andrew Brown, W. James Maclean, James Su, AyeAye, Takashi Toyoshima, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, alexmo...@chromium.org, yhanad...@chromium.org, tranbaod...@chromium.org, nona+...@chromium.org, creis...@chromium.org, shuche...@chromium.org, jbauma...@chromium.org, navigation...@chromium.org, keithle...@chromium.org, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
Attention needed from Andrew Brown and Takashi Toyoshima

Adam Rice added 4 comments

File third_party/blink/renderer/core/loader/frame_fetch_context.cc
Line 203, Patchset 6 (Latest): const String& user_agent;
Adam Rice . unresolved

Why is it safe for this to be a reference? What is keeping it alive?

Line 728, Patchset 6 (Latest):const String FrameFetchContext::GetDefaultUserAgent() const {
Adam Rice . unresolved

Making the return type `const` here doesn't really do anything useful, since the caller will usually store it in a mutable variable anyway. It may defeat return value optimisation and force the copy constructor to be called.

File third_party/blink/renderer/platform/loader/fetch/fetch_context.h
Line 155, Patchset 6 (Latest): virtual const String GetDefaultUserAgent() const { return ""; }
Adam Rice . unresolved

When is this called? Can we make the body `NOTREACHED_NORETURN();` instead?

File third_party/blink/renderer/platform/loader/fetch/url_loader/request_conversion.cc
Line 307, Patchset 6 (Latest): DCHECK_NE(context_default_user_agent, "");
Adam Rice . unresolved

What happens if someone uses DevTools to set the user agent to an empty string?

Open in Gerrit

Related details

Attention is currently required from:
  • Andrew Brown
  • Takashi Toyoshima
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Icf56620f99f371ea2f128e6a3194d6096b0d62cd
Gerrit-Change-Number: 5273743
Gerrit-PatchSet: 6
Gerrit-Owner: Andrew Brown <m...@ajbrown.au>
Gerrit-Reviewer: Adam Rice <ri...@chromium.org>
Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
Gerrit-CC: James Su <su...@chromium.org>
Gerrit-CC: Nate Chapin <jap...@chromium.org>
Gerrit-CC: W. James Maclean <wjma...@chromium.org>
Gerrit-Attention: Andrew Brown <m...@ajbrown.au>
Gerrit-Attention: Takashi Toyoshima <toyo...@chromium.org>
Gerrit-Comment-Date: Mon, 04 Mar 2024 17:10:15 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Andrew Brown (Gerrit)

unread,
Mar 4, 2024, 8:26:39 PM3/4/24
to W. James Maclean, James Su, AyeAye, Takashi Toyoshima, Adam Rice, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, alexmo...@chromium.org, yhanad...@chromium.org, tranbaod...@chromium.org, nona+...@chromium.org, creis...@chromium.org, shuche...@chromium.org, jbauma...@chromium.org, navigation...@chromium.org, keithle...@chromium.org, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
Attention needed from Adam Rice and Takashi Toyoshima

Andrew Brown added 6 comments

Patchset-level comments
File-level comment, Patchset 4:
Takashi Toyoshima . resolved

This is a wrong use of cors_exempt_header_list. It should not be used for headers that JavaScript can set arbitrary values, but only be allowed for headers that browser internal trusted code set.

Andrew Brown

Done

File third_party/blink/renderer/core/loader/frame_fetch_context.cc
Line 203, Patchset 6: const String& user_agent;
Adam Rice . resolved

Why is it safe for this to be a reference? What is keeping it alive?

Andrew Brown

Uhh, it's probably not, then. My C++ is pretty rusty, especially in the &-vs-*-vs-unique_ptr department. Switched it to a regular value instead.

Line 728, Patchset 6:const String FrameFetchContext::GetDefaultUserAgent() const {
Adam Rice . unresolved

Making the return type `const` here doesn't really do anything useful, since the caller will usually store it in a mutable variable anyway. It may defeat return value optimisation and force the copy constructor to be called.

Andrew Brown

Just checking - sounds good to me, so I've changed it, but this means changing the types of all the `GetDefaultUserAgent()` versions (not just in `FrameFetchContext`), including up to the default in `fetch_context.h` and back down to the implementation in `worker_fetch_context.cc`.

File third_party/blink/renderer/platform/loader/fetch/fetch_context.h
Line 155, Patchset 6: virtual const String GetDefaultUserAgent() const { return ""; }
Adam Rice . resolved

When is this called? Can we make the body `NOTREACHED_NORETURN();` instead?

Andrew Brown

It should never be called, hence the `DCHECK` later on. Switching to `NOTREACHED_NORETURN();` lets me get rid of that, so, done. (I had no idea that macro even existed.)

File third_party/blink/renderer/platform/loader/fetch/url_loader/request_conversion.cc
Line 307, Patchset 6: DCHECK_NE(context_default_user_agent, "");
Adam Rice . resolved

What happens if someone uses DevTools to set the user agent to an empty string?

Andrew Brown

Ah, stung by DevTools again. If I switch out the body of the default impl to be `NOTREACHED_NORETURN();`, then I can just remove this DCHECK and have the same effect, without needing to error out on some sentinel value.

Line 311, Patchset 4: src.CorsExemptHTTPUserAgent().Utf8());
Takashi Toyoshima . unresolved

Can we obtain the default user-agent header via FetchContext rather than holding it in the src?

Now, ResourceLoader and FetchManager call this PopulateResourceRequest method. Both callers can access FetchContext via ResourceFetcher.

FetchContext's GetDefaultUserAgent needs to be implemented in the inherit classes for frames, and workers respectively. So, we can add a 4th argument to this method to provide the default user-agent.

Andrew Brown

The inheritance of `FetchContext` is a little funky - I've had to implement a weird default-version in `FetchContext` returning an empty string.

In return, I've stuck in a DCHECK macro to make sure it's actually been overridden by the time we want to set it in this file.

Andrew Brown

Following Adam's review comments, the inheritance thing is much nicer - `NOTREACHED_NORETURN();` in the default, no `DCHECK();` needed.

Open in Gerrit

Related details

Attention is currently required from:
  • Adam Rice
  • Takashi Toyoshima
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Icf56620f99f371ea2f128e6a3194d6096b0d62cd
Gerrit-Change-Number: 5273743
Gerrit-PatchSet: 6
Gerrit-Owner: Andrew Brown <m...@ajbrown.au>
Gerrit-Reviewer: Adam Rice <ri...@chromium.org>
Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
Gerrit-CC: James Su <su...@chromium.org>
Gerrit-CC: Nate Chapin <jap...@chromium.org>
Gerrit-CC: W. James Maclean <wjma...@chromium.org>
Gerrit-Attention: Adam Rice <ri...@chromium.org>
Gerrit-Attention: Takashi Toyoshima <toyo...@chromium.org>
Gerrit-Comment-Date: Tue, 05 Mar 2024 01:26:28 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Adam Rice <ri...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Adam Rice (Gerrit)

unread,
Mar 4, 2024, 9:18:34 PM3/4/24
to Andrew Brown, W. James Maclean, James Su, AyeAye, Takashi Toyoshima, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, alexmo...@chromium.org, yhanad...@chromium.org, tranbaod...@chromium.org, nona+...@chromium.org, creis...@chromium.org, shuche...@chromium.org, jbauma...@chromium.org, navigation...@chromium.org, keithle...@chromium.org, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
Attention needed from Andrew Brown and Takashi Toyoshima

Adam Rice added 3 comments

Patchset-level comments
File-level comment, Patchset 7 (Latest):
Adam Rice . resolved

Just one minor tweak needed.

File third_party/blink/renderer/core/loader/frame_fetch_context.cc
Line 179, Patchset 7 (Latest): const String user_agent,
Adam Rice . unresolved
You should make this non-const, and then initialise the member variable with `std::move()`, ie.
```
user_agent(std::move(user_agent)),
```
This will avoid reference-count churn on the String.
Line 728, Patchset 6:const String FrameFetchContext::GetDefaultUserAgent() const {
Adam Rice . resolved

Making the return type `const` here doesn't really do anything useful, since the caller will usually store it in a mutable variable anyway. It may defeat return value optimisation and force the copy constructor to be called.

Andrew Brown

Just checking - sounds good to me, so I've changed it, but this means changing the types of all the `GetDefaultUserAgent()` versions (not just in `FrameFetchContext`), including up to the default in `fetch_context.h` and back down to the implementation in `worker_fetch_context.cc`.

Adam Rice

Yes, this is fine, thanks.

Open in Gerrit

Related details

Attention is currently required from:
  • Andrew Brown
  • Takashi Toyoshima
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Icf56620f99f371ea2f128e6a3194d6096b0d62cd
Gerrit-Change-Number: 5273743
Gerrit-PatchSet: 7
Gerrit-Owner: Andrew Brown <m...@ajbrown.au>
Gerrit-Reviewer: Adam Rice <ri...@chromium.org>
Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
Gerrit-CC: James Su <su...@chromium.org>
Gerrit-CC: Nate Chapin <jap...@chromium.org>
Gerrit-CC: W. James Maclean <wjma...@chromium.org>
Gerrit-Attention: Andrew Brown <m...@ajbrown.au>
Gerrit-Attention: Takashi Toyoshima <toyo...@chromium.org>
Gerrit-Comment-Date: Tue, 05 Mar 2024 02:18:22 +0000
satisfied_requirement
unsatisfied_requirement
open
diffy

Andrew Brown (Gerrit)

unread,
Mar 4, 2024, 11:50:59 PM3/4/24
to W. James Maclean, James Su, AyeAye, Takashi Toyoshima, Adam Rice, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, alexmo...@chromium.org, yhanad...@chromium.org, tranbaod...@chromium.org, nona+...@chromium.org, creis...@chromium.org, shuche...@chromium.org, jbauma...@chromium.org, navigation...@chromium.org, keithle...@chromium.org, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
Attention needed from Adam Rice and Takashi Toyoshima

Andrew Brown added 1 comment

File third_party/blink/renderer/core/loader/frame_fetch_context.cc
Line 179, Patchset 7 (Latest): const String user_agent,
Adam Rice . unresolved
You should make this non-const, and then initialise the member variable with `std::move()`, ie.
```
user_agent(std::move(user_agent)),
```
This will avoid reference-count churn on the String.
Andrew Brown

Hm, actually - I just noticed the current (live) version is `const String&`, which we just changed away from, so I did a bit more digging.

At the moment, `FrozenState` stores a `const String&`. The constructor is only used by `Detach()` on line #789, where the user_agent is provided by `GetUserAgent()`. There, the backing string for the ref is provided by `GetFrame()->Loader().UserAgent()`.

In my updated implementation, that function is just renamed to `GetDefaultUserAgent()`. So we should be safe to just keep using `const String&` here, backed by the Loader, as it's just a different function name on the same code. However, continuing to switch to use a non-const non-ref String is probably also inconsequential, if you'd like to just do that.

Open in Gerrit

Related details

Attention is currently required from:
  • Adam Rice
  • Takashi Toyoshima
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Icf56620f99f371ea2f128e6a3194d6096b0d62cd
Gerrit-Change-Number: 5273743
Gerrit-PatchSet: 7
Gerrit-Owner: Andrew Brown <m...@ajbrown.au>
Gerrit-Reviewer: Adam Rice <ri...@chromium.org>
Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
Gerrit-CC: James Su <su...@chromium.org>
Gerrit-CC: Nate Chapin <jap...@chromium.org>
Gerrit-CC: W. James Maclean <wjma...@chromium.org>
Gerrit-Attention: Adam Rice <ri...@chromium.org>
Gerrit-Attention: Takashi Toyoshima <toyo...@chromium.org>
Gerrit-Comment-Date: Tue, 05 Mar 2024 04:50:49 +0000
satisfied_requirement
unsatisfied_requirement
open
diffy

Takashi Toyoshima (Gerrit)

unread,
Mar 5, 2024, 12:29:04 AM3/5/24
to Andrew Brown, W. James Maclean, James Su, AyeAye, Adam Rice, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, alexmo...@chromium.org, yhanad...@chromium.org, tranbaod...@chromium.org, nona+...@chromium.org, creis...@chromium.org, shuche...@chromium.org, jbauma...@chromium.org, navigation...@chromium.org, keithle...@chromium.org, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
Attention needed from Adam Rice and Andrew Brown

Takashi Toyoshima added 5 comments

Patchset-level comments
Takashi Toyoshima . resolved

Thank you for the update.
It looks good to me.
I left some comments on style and minor optimization nits, but they are optional.

File third_party/blink/renderer/core/loader/frame_fetch_context.cc
Line 179, Patchset 7 (Latest): const String user_agent,
Adam Rice . unresolved
You should make this non-const, and then initialise the member variable with `std::move()`, ie.
```
user_agent(std::move(user_agent)),
```
This will avoid reference-count churn on the String.
Andrew Brown

Hm, actually - I just noticed the current (live) version is `const String&`, which we just changed away from, so I did a bit more digging.

At the moment, `FrozenState` stores a `const String&`. The constructor is only used by `Detach()` on line #789, where the user_agent is provided by `GetUserAgent()`. There, the backing string for the ref is provided by `GetFrame()->Loader().UserAgent()`.

In my updated implementation, that function is just renamed to `GetDefaultUserAgent()`. So we should be safe to just keep using `const String&` here, backed by the Loader, as it's just a different function name on the same code. However, continuing to switch to use a non-const non-ref String is probably also inconsequential, if you'd like to just do that.

Takashi Toyoshima

As of the fast String's copy is not expensive as you noticed, the current code is not inefficient even if we make a copy here.
If we want to improve it a little, as Adam suggested, taking `String` and using `std::move` will be the best. Another benefit is people can know the code is effective even if they don't know the String specific copy's internal optimization.

File third_party/blink/renderer/core/loader/worker_fetch_context.cc
Line 90, Patchset 7 (Latest): DCHECK(!user_agent.IsNull());
Takashi Toyoshima . unresolved
File third_party/blink/renderer/platform/loader/fetch/fetch_context.h
Line 155, Patchset 7 (Latest): virtual String GetDefaultUserAgent() const { NOTREACHED_NORETURN(); }
Takashi Toyoshima . unresolved

For the same reason, returning `const String&`, and making a copy in a caller side might be a not-surprising interface that doesn't rely on the copy's optimization.

File third_party/blink/renderer/platform/loader/fetch/url_loader/request_conversion.h
Line 31, Patchset 7 (Latest): const String context_default_user_agent);
Takashi Toyoshima . unresolved

Let's use `const String&` until we need an actual copy.

Open in Gerrit

Related details

Attention is currently required from:
  • Adam Rice
  • Andrew Brown
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Icf56620f99f371ea2f128e6a3194d6096b0d62cd
Gerrit-Change-Number: 5273743
Gerrit-PatchSet: 7
Gerrit-Owner: Andrew Brown <m...@ajbrown.au>
Gerrit-Reviewer: Adam Rice <ri...@chromium.org>
Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
Gerrit-CC: James Su <su...@chromium.org>
Gerrit-CC: Nate Chapin <jap...@chromium.org>
Gerrit-CC: W. James Maclean <wjma...@chromium.org>
Gerrit-Attention: Adam Rice <ri...@chromium.org>
Gerrit-Attention: Andrew Brown <m...@ajbrown.au>
Gerrit-Comment-Date: Tue, 05 Mar 2024 05:28:54 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Adam Rice <ri...@chromium.org>
Comment-In-Reply-To: Andrew Brown <m...@ajbrown.au>
satisfied_requirement
unsatisfied_requirement
open
diffy

Takashi Toyoshima (Gerrit)

unread,
Mar 5, 2024, 12:34:49 AM3/5/24
to Andrew Brown, W. James Maclean, James Su, AyeAye, Adam Rice, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, alexmo...@chromium.org, yhanad...@chromium.org, tranbaod...@chromium.org, nona+...@chromium.org, creis...@chromium.org, shuche...@chromium.org, jbauma...@chromium.org, navigation...@chromium.org, keithle...@chromium.org, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
Attention needed from Adam Rice and Andrew Brown

Takashi Toyoshima added 1 comment

File AUTHORS
Line 123, Patchset 7 (Latest):Andrew Brown <m...@ajbrown.au>
Takashi Toyoshima . unresolved

just in case for Adam: I just checked the SignCLA site and ensureed the address is already recorded as we received CLAs.

Gerrit-Comment-Date: Tue, 05 Mar 2024 05:34:37 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Andrew Brown (Gerrit)

unread,
Mar 5, 2024, 2:16:44 AM3/5/24
to W. James Maclean, James Su, AyeAye, Takashi Toyoshima, Adam Rice, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, alexmo...@chromium.org, yhanad...@chromium.org, tranbaod...@chromium.org, nona+...@chromium.org, creis...@chromium.org, shuche...@chromium.org, jbauma...@chromium.org, navigation...@chromium.org, keithle...@chromium.org, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
Attention needed from Adam Rice and Takashi Toyoshima

Andrew Brown added 5 comments

File third_party/blink/renderer/core/loader/frame_fetch_context.cc
Line 179, Patchset 7 (Latest): const String user_agent,
Adam Rice . unresolved
You should make this non-const, and then initialise the member variable with `std::move()`, ie.
```
user_agent(std::move(user_agent)),
```
This will avoid reference-count churn on the String.
Andrew Brown

Hm, actually - I just noticed the current (live) version is `const String&`, which we just changed away from, so I did a bit more digging.

At the moment, `FrozenState` stores a `const String&`. The constructor is only used by `Detach()` on line #789, where the user_agent is provided by `GetUserAgent()`. There, the backing string for the ref is provided by `GetFrame()->Loader().UserAgent()`.

In my updated implementation, that function is just renamed to `GetDefaultUserAgent()`. So we should be safe to just keep using `const String&` here, backed by the Loader, as it's just a different function name on the same code. However, continuing to switch to use a non-const non-ref String is probably also inconsequential, if you'd like to just do that.

Takashi Toyoshima

As of the fast String's copy is not expensive as you noticed, the current code is not inefficient even if we make a copy here.
If we want to improve it a little, as Adam suggested, taking `String` and using `std::move` will be the best. Another benefit is people can know the code is effective even if they don't know the String specific copy's internal optimization.

Andrew Brown

Ok, hang on, it's not as simple as I thought :(.

It looks like both "sources" of user-agent give me a `String`, not a `String&`. So it's a little hard to provide

Line 179, Patchset 7 (Latest): const String user_agent,
Adam Rice . unresolved
You should make this non-const, and then initialise the member variable with `std::move()`, ie.
```
user_agent(std::move(user_agent)),
```
This will avoid reference-count churn on the String.
Andrew Brown

Hm, actually - I just noticed the current (live) version is `const String&`, which we just changed away from, so I did a bit more digging.

At the moment, `FrozenState` stores a `const String&`. The constructor is only used by `Detach()` on line #789, where the user_agent is provided by `GetUserAgent()`. There, the backing string for the ref is provided by `GetFrame()->Loader().UserAgent()`.

In my updated implementation, that function is just renamed to `GetDefaultUserAgent()`. So we should be safe to just keep using `const String&` here, backed by the Loader, as it's just a different function name on the same code. However, continuing to switch to use a non-const non-ref String is probably also inconsequential, if you'd like to just do that.

Takashi Toyoshima

As of the fast String's copy is not expensive as you noticed, the current code is not inefficient even if we make a copy here.
If we want to improve it a little, as Adam suggested, taking `String` and using `std::move` will be the best. Another benefit is people can know the code is effective even if they don't know the String specific copy's internal optimization.

Andrew Brown

`String` and `std::move` sounds like a plan to me. Just noting that I was wrong earlier about what backs the ref, in case using a `const String&` might actually be better.

File third_party/blink/renderer/core/loader/worker_fetch_context.cc
Line 90, Patchset 7 (Latest): DCHECK(!user_agent.IsNull());
Takashi Toyoshima . resolved
Andrew Brown

Done

File third_party/blink/renderer/platform/loader/fetch/fetch_context.h
Line 155, Patchset 7 (Latest): virtual String GetDefaultUserAgent() const { NOTREACHED_NORETURN(); }
Takashi Toyoshima . unresolved

For the same reason, returning `const String&`, and making a copy in a caller side might be a not-surprising interface that doesn't rely on the copy's optimization.

Andrew Brown

The trouble with making `GetDefaultUserAgent()` return a `const String&` is that both "sources" of user-agent (either `GetFrame()->Loader().UserAgent();` in `FrameFetchContext` or `global_scope_->UserAgent();` in `WorkerFetchContext`) give me `String`, so I'd need to allocate space for them somehow in both of my `GetDefaultUserAgent()` implementations.

I guess I could go into each of those spots and follow it right the way back to make it `String&` the entire way through, but that also seems like a less-than-ideal approach.

File third_party/blink/renderer/platform/loader/fetch/url_loader/request_conversion.h
Line 31, Patchset 7 (Latest): const String context_default_user_agent);
Takashi Toyoshima . resolved

Let's use `const String&` until we need an actual copy.

Andrew Brown

Done

Open in Gerrit

Related details

Attention is currently required from:
  • Adam Rice
  • Takashi Toyoshima
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Icf56620f99f371ea2f128e6a3194d6096b0d62cd
Gerrit-Change-Number: 5273743
Gerrit-PatchSet: 7
Gerrit-Owner: Andrew Brown <m...@ajbrown.au>
Gerrit-Reviewer: Adam Rice <ri...@chromium.org>
Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
Gerrit-CC: James Su <su...@chromium.org>
Gerrit-CC: Nate Chapin <jap...@chromium.org>
Gerrit-CC: W. James Maclean <wjma...@chromium.org>
Gerrit-Attention: Adam Rice <ri...@chromium.org>
Gerrit-Attention: Takashi Toyoshima <toyo...@chromium.org>
Gerrit-Comment-Date: Tue, 05 Mar 2024 07:16:33 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Adam Rice <ri...@chromium.org>
Comment-In-Reply-To: Andrew Brown <m...@ajbrown.au>
Comment-In-Reply-To: Takashi Toyoshima <toyo...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Andrew Brown (Gerrit)

unread,
Mar 5, 2024, 2:20:28 AM3/5/24
to W. James Maclean, James Su, AyeAye, Takashi Toyoshima, Adam Rice, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, alexmo...@chromium.org, yhanad...@chromium.org, tranbaod...@chromium.org, nona+...@chromium.org, creis...@chromium.org, shuche...@chromium.org, jbauma...@chromium.org, navigation...@chromium.org, keithle...@chromium.org, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
Attention needed from Adam Rice and Takashi Toyoshima

Andrew Brown added 1 comment

File third_party/blink/renderer/core/loader/frame_fetch_context.cc
Line 179, Patchset 7: const String user_agent,
Adam Rice . unresolved
You should make this non-const, and then initialise the member variable with `std::move()`, ie.
```
user_agent(std::move(user_agent)),
```
This will avoid reference-count churn on the String.
Andrew Brown

Hm, actually - I just noticed the current (live) version is `const String&`, which we just changed away from, so I did a bit more digging.

At the moment, `FrozenState` stores a `const String&`. The constructor is only used by `Detach()` on line #789, where the user_agent is provided by `GetUserAgent()`. There, the backing string for the ref is provided by `GetFrame()->Loader().UserAgent()`.

In my updated implementation, that function is just renamed to `GetDefaultUserAgent()`. So we should be safe to just keep using `const String&` here, backed by the Loader, as it's just a different function name on the same code. However, continuing to switch to use a non-const non-ref String is probably also inconsequential, if you'd like to just do that.

Takashi Toyoshima

As of the fast String's copy is not expensive as you noticed, the current code is not inefficient even if we make a copy here.
If we want to improve it a little, as Adam suggested, taking `String` and using `std::move` will be the best. Another benefit is people can know the code is effective even if they don't know the String specific copy's internal optimization.

Andrew Brown

Ok, hang on, it's not as simple as I thought :(.

It looks like both "sources" of user-agent give me a `String`, not a `String&`. So it's a little hard to provide

Andrew Brown

Oops, ignore the second message (about not being as simple as I thought). That was related to the other comments in `fetch_context.h`.

Open in Gerrit

Related details

Attention is currently required from:
  • Adam Rice
  • Takashi Toyoshima
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Icf56620f99f371ea2f128e6a3194d6096b0d62cd
Gerrit-Change-Number: 5273743
Gerrit-PatchSet: 8
Gerrit-Owner: Andrew Brown <m...@ajbrown.au>
Gerrit-Reviewer: Adam Rice <ri...@chromium.org>
Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
Gerrit-CC: James Su <su...@chromium.org>
Gerrit-CC: Nate Chapin <jap...@chromium.org>
Gerrit-CC: W. James Maclean <wjma...@chromium.org>
Gerrit-Attention: Adam Rice <ri...@chromium.org>
Gerrit-Attention: Takashi Toyoshima <toyo...@chromium.org>
Gerrit-Comment-Date: Tue, 05 Mar 2024 07:20:17 +0000
satisfied_requirement
unsatisfied_requirement
open
diffy

Takashi Toyoshima (Gerrit)

unread,
Mar 5, 2024, 3:33:42 AM3/5/24
to Andrew Brown, W. James Maclean, James Su, AyeAye, Adam Rice, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, alexmo...@chromium.org, yhanad...@chromium.org, tranbaod...@chromium.org, nona+...@chromium.org, creis...@chromium.org, shuche...@chromium.org, jbauma...@chromium.org, navigation...@chromium.org, keithle...@chromium.org, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
Attention needed from Adam Rice and Andrew Brown

Takashi Toyoshima voted and added 2 comments

Votes added by Takashi Toyoshima

Code-Review+1

2 comments

Patchset-level comments
File-level comment, Patchset 8 (Latest):
Takashi Toyoshima . resolved

thanks. lgtm, and you'll need the second lgtm from Adam to submit this.

File third_party/blink/renderer/platform/loader/fetch/fetch_context.h
Line 155, Patchset 7: virtual String GetDefaultUserAgent() const { NOTREACHED_NORETURN(); }
Takashi Toyoshima . resolved

For the same reason, returning `const String&`, and making a copy in a caller side might be a not-surprising interface that doesn't rely on the copy's optimization.

Andrew Brown

The trouble with making `GetDefaultUserAgent()` return a `const String&` is that both "sources" of user-agent (either `GetFrame()->Loader().UserAgent();` in `FrameFetchContext` or `global_scope_->UserAgent();` in `WorkerFetchContext`) give me `String`, so I'd need to allocate space for them somehow in both of my `GetDefaultUserAgent()` implementations.

I guess I could go into each of those spots and follow it right the way back to make it `String&` the entire way through, but that also seems like a less-than-ideal approach.

Takashi Toyoshima

Aha, it sounds reasonable.

Open in Gerrit

Related details

Attention is currently required from:
  • Adam Rice
  • Andrew Brown
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Icf56620f99f371ea2f128e6a3194d6096b0d62cd
Gerrit-Change-Number: 5273743
Gerrit-PatchSet: 8
Gerrit-Owner: Andrew Brown <m...@ajbrown.au>
Gerrit-Reviewer: Adam Rice <ri...@chromium.org>
Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
Gerrit-CC: James Su <su...@chromium.org>
Gerrit-CC: Nate Chapin <jap...@chromium.org>
Gerrit-CC: W. James Maclean <wjma...@chromium.org>
Gerrit-Attention: Adam Rice <ri...@chromium.org>
Gerrit-Attention: Andrew Brown <m...@ajbrown.au>
Gerrit-Comment-Date: Tue, 05 Mar 2024 08:33:29 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Adam Rice (Gerrit)

unread,
Mar 5, 2024, 3:51:12 AM3/5/24
to Andrew Brown, Takashi Toyoshima, W. James Maclean, James Su, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, alexmo...@chromium.org, yhanad...@chromium.org, tranbaod...@chromium.org, nona+...@chromium.org, creis...@chromium.org, shuche...@chromium.org, jbauma...@chromium.org, navigation...@chromium.org, keithle...@chromium.org, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
Attention needed from Andrew Brown

Adam Rice voted and added 1 comment

Votes added by Adam Rice

Code-Review+1

1 comment

Patchset-level comments
Adam Rice . resolved

lgtm, thanks.

Open in Gerrit

Related details

Attention is currently required from:
  • Andrew Brown
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement satisfiedCode-Review
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: Icf56620f99f371ea2f128e6a3194d6096b0d62cd
    Gerrit-Change-Number: 5273743
    Gerrit-PatchSet: 8
    Gerrit-Owner: Andrew Brown <m...@ajbrown.au>
    Gerrit-Reviewer: Adam Rice <ri...@chromium.org>
    Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
    Gerrit-CC: James Su <su...@chromium.org>
    Gerrit-CC: Nate Chapin <jap...@chromium.org>
    Gerrit-CC: W. James Maclean <wjma...@chromium.org>
    Gerrit-Attention: Andrew Brown <m...@ajbrown.au>
    Gerrit-Comment-Date: Tue, 05 Mar 2024 08:51:02 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Andrew Brown (Gerrit)

    unread,
    Mar 5, 2024, 7:01:06 AM3/5/24
    to Bo Liu, Adam Rice, Takashi Toyoshima, W. James Maclean, James Su, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, alexmo...@chromium.org, yhanad...@chromium.org, tranbaod...@chromium.org, nona+...@chromium.org, creis...@chromium.org, shuche...@chromium.org, jbauma...@chromium.org, navigation...@chromium.org, keithle...@chromium.org, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
    Attention needed from Bo Liu

    Andrew Brown added 4 comments

    Patchset-level comments
    Andrew Brown . unresolved

    Thanks for all the help!

    I think just need someone with dry run access to run the CQ tests for me, and I need review from an owner of `content/browser/storage_partition_impl.cc`. I've pinged Bo, who was first on the list of suggested owners :) - given the nearby comment about deprecated APIs, there may be a better way to access cors_exempt_headers.

    File third_party/blink/renderer/core/loader/frame_fetch_context.cc
    Line 179, Patchset 7: const String user_agent,
    Adam Rice . resolved
    You should make this non-const, and then initialise the member variable with `std::move()`, ie.
    ```
    user_agent(std::move(user_agent)),
    ```
    This will avoid reference-count churn on the String.
    Andrew Brown

    Hm, actually - I just noticed the current (live) version is `const String&`, which we just changed away from, so I did a bit more digging.

    At the moment, `FrozenState` stores a `const String&`. The constructor is only used by `Detach()` on line #789, where the user_agent is provided by `GetUserAgent()`. There, the backing string for the ref is provided by `GetFrame()->Loader().UserAgent()`.

    In my updated implementation, that function is just renamed to `GetDefaultUserAgent()`. So we should be safe to just keep using `const String&` here, backed by the Loader, as it's just a different function name on the same code. However, continuing to switch to use a non-const non-ref String is probably also inconsequential, if you'd like to just do that.

    Takashi Toyoshima

    As of the fast String's copy is not expensive as you noticed, the current code is not inefficient even if we make a copy here.
    If we want to improve it a little, as Adam suggested, taking `String` and using `std::move` will be the best. Another benefit is people can know the code is effective even if they don't know the String specific copy's internal optimization.

    Andrew Brown

    Ok, hang on, it's not as simple as I thought :(.

    It looks like both "sources" of user-agent give me a `String`, not a `String&`. So it's a little hard to provide

    Andrew Brown

    Oops, ignore the second message (about not being as simple as I thought). That was related to the other comments in `fetch_context.h`.

    Andrew Brown

    Done

    Takashi Toyoshima . resolved

    by the way, I could not remember how this default UA header bypassed the cors checks until today. do you explore?

    Andrew Brown

    I believe the browser process checks headers against the `kForbiddenHeaderList` field using `!HttpUtil::IsSafeHeader()` before CORS. Basically, if it sees the request has any "unsafe" headers, it assumes they don't need CORS checks, because it can't have come from JavaScript.

    See services/network/cors/cors_util.cc for where I think that check happens - I believe that function returns a list of headers that CORS needs to ask about, and skips any headers it sees that are "unsafe".

    Unfortunately we have to take it off the forbidden list for JavaScript to use it, hence passing it around through the cors_exempt_headers.

    Andrew Brown

    Done

    File third_party/blink/renderer/platform/loader/fetch/url_loader/request_conversion.cc
    Line 311, Patchset 4: src.CorsExemptHTTPUserAgent().Utf8());
    Takashi Toyoshima . resolved

    Can we obtain the default user-agent header via FetchContext rather than holding it in the src?

    Now, ResourceLoader and FetchManager call this PopulateResourceRequest method. Both callers can access FetchContext via ResourceFetcher.

    FetchContext's GetDefaultUserAgent needs to be implemented in the inherit classes for frames, and workers respectively. So, we can add a 4th argument to this method to provide the default user-agent.

    Andrew Brown

    The inheritance of `FetchContext` is a little funky - I've had to implement a weird default-version in `FetchContext` returning an empty string.

    In return, I've stuck in a DCHECK macro to make sure it's actually been overridden by the time we want to set it in this file.

    Andrew Brown

    Following Adam's review comments, the inheritance thing is much nicer - `NOTREACHED_NORETURN();` in the default, no `DCHECK();` needed.

    Andrew Brown

    Done

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Bo Liu
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement satisfiedCode-Review
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: Icf56620f99f371ea2f128e6a3194d6096b0d62cd
    Gerrit-Change-Number: 5273743
    Gerrit-PatchSet: 8
    Gerrit-Owner: Andrew Brown <m...@ajbrown.au>
    Gerrit-Reviewer: Adam Rice <ri...@chromium.org>
    Gerrit-Reviewer: Andrew Brown <m...@ajbrown.au>
    Gerrit-Reviewer: Bo Liu <bo...@chromium.org>
    Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
    Gerrit-CC: James Su <su...@chromium.org>
    Gerrit-CC: Nate Chapin <jap...@chromium.org>
    Gerrit-CC: W. James Maclean <wjma...@chromium.org>
    Gerrit-Attention: Bo Liu <bo...@chromium.org>
    Gerrit-Comment-Date: Tue, 05 Mar 2024 12:00:52 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Adam Rice <ri...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Bo Liu (Gerrit)

    unread,
    Mar 5, 2024, 9:20:27 AM3/5/24
    to Andrew Brown, Bo Liu, Adam Rice, Takashi Toyoshima, W. James Maclean, James Su, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, alexmo...@chromium.org, yhanad...@chromium.org, tranbaod...@chromium.org, nona+...@chromium.org, creis...@chromium.org, shuche...@chromium.org, jbauma...@chromium.org, navigation...@chromium.org, keithle...@chromium.org, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
    Attention needed from Andrew Brown

    Bo Liu voted and added 1 comment

    Votes added by Bo Liu

    Code-Review+1

    1 comment

    Patchset-level comments
    Bo Liu . resolved

    content stamp

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Andrew Brown
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement satisfiedCode-Owners
    • requirement satisfiedCode-Review
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: Icf56620f99f371ea2f128e6a3194d6096b0d62cd
    Gerrit-Change-Number: 5273743
    Gerrit-PatchSet: 8
    Gerrit-Owner: Andrew Brown <m...@ajbrown.au>
    Gerrit-Reviewer: Adam Rice <ri...@chromium.org>
    Gerrit-Reviewer: Andrew Brown <m...@ajbrown.au>
    Gerrit-Reviewer: Bo Liu <bo...@chromium.org>
    Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
    Gerrit-CC: James Su <su...@chromium.org>
    Gerrit-CC: Nate Chapin <jap...@chromium.org>
    Gerrit-CC: W. James Maclean <wjma...@chromium.org>
    Gerrit-Attention: Andrew Brown <m...@ajbrown.au>
    Gerrit-Comment-Date: Tue, 05 Mar 2024 14:20:14 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    satisfied_requirement
    open
    diffy

    Andrew Brown (Gerrit)

    unread,
    Mar 6, 2024, 9:36:08 PM3/6/24
    to Hiroki Nakagawa, Bo Liu, Adam Rice, Takashi Toyoshima, W. James Maclean, James Su, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, mkwst+w...@chromium.org, horo+...@chromium.org, shimazu+se...@chromium.org, kinuko+ser...@chromium.org, servicewor...@chromium.org, antoniosarto...@chromium.org, kenjibah...@chromium.org, jsbell+ser...@chromium.org, arthursonzog...@chromium.org, blink-revie...@chromium.org, alexmo...@chromium.org, yhanad...@chromium.org, tranbaod...@chromium.org, nona+...@chromium.org, creis...@chromium.org, shuche...@chromium.org, jbauma...@chromium.org, navigation...@chromium.org, keithle...@chromium.org, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
    Attention needed from Adam Rice

    Andrew Brown added 1 comment

    Patchset-level comments
    Andrew Brown . unresolved

    Thanks for all the help!

    I think just need someone with dry run access to run the CQ tests for me, and I need review from an owner of `content/browser/storage_partition_impl.cc`. I've pinged Bo, who was first on the list of suggested owners :) - given the nearby comment about deprecated APIs, there may be a better way to access cors_exempt_headers.

    Andrew Brown

    Going to ping Adam for this, as he was helping me with tests earlier :)

    This still needs to run through the CQ tests, but before we do that, I probably have to update the expectations a bit. My local testing setup is a bit wonky; the testing docs say that some tests will just fail because I'm running a newer version than Ubuntu 10. (I have 147 regressions, a few of which are completely unrelated things like `media/W3C/video/events/`). Is there a better setup doc that I should go through, or anything better than just running it through the CQ tests again?

    I've also gone through the tests manually and updated things that I *know* are needed to change (e.g. "can this header be set" type stuff). I'm wary of the `http/tests/inspector-protocol/` tests, as I'm not actually sure what they're testing for, but I think those might also need changes.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Adam Rice
    Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: Icf56620f99f371ea2f128e6a3194d6096b0d62cd
      Gerrit-Change-Number: 5273743
      Gerrit-PatchSet: 9
      Gerrit-Owner: Andrew Brown <m...@ajbrown.au>
      Gerrit-Reviewer: Adam Rice <ri...@chromium.org>
      Gerrit-Reviewer: Andrew Brown <m...@ajbrown.au>
      Gerrit-Reviewer: Bo Liu <bo...@chromium.org>
      Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
      Gerrit-CC: Hiroki Nakagawa <nhi...@chromium.org>
      Gerrit-CC: James Su <su...@chromium.org>
      Gerrit-CC: Nate Chapin <jap...@chromium.org>
      Gerrit-CC: W. James Maclean <wjma...@chromium.org>
      Gerrit-Attention: Adam Rice <ri...@chromium.org>
      Gerrit-Comment-Date: Thu, 07 Mar 2024 02:35:58 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Andrew Brown <m...@ajbrown.au>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Andrew Brown (Gerrit)

      unread,
      Mar 7, 2024, 7:17:52 AM3/7/24
      to Adam Rice, Hiroki Nakagawa, Bo Liu, Takashi Toyoshima, W. James Maclean, James Su, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, extension...@chromium.org, chromium-a...@chromium.org, mkwst+w...@chromium.org, horo+...@chromium.org, shimazu+se...@chromium.org, kinuko+ser...@chromium.org, servicewor...@chromium.org, antoniosarto...@chromium.org, kenjibah...@chromium.org, jsbell+ser...@chromium.org, arthursonzog...@chromium.org, blink-revie...@chromium.org, alexmo...@chromium.org, yhanad...@chromium.org, tranbaod...@chromium.org, nona+...@chromium.org, creis...@chromium.org, shuche...@chromium.org, jbauma...@chromium.org, navigation...@chromium.org, keithle...@chromium.org, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
      Attention needed from Adam Rice

      Andrew Brown added 1 comment

      Patchset-level comments
      Andrew Brown . unresolved

      Thanks for all the help!

      I think just need someone with dry run access to run the CQ tests for me, and I need review from an owner of `content/browser/storage_partition_impl.cc`. I've pinged Bo, who was first on the list of suggested owners :) - given the nearby comment about deprecated APIs, there may be a better way to access cors_exempt_headers.

      Andrew Brown

      Going to ping Adam for this, as he was helping me with tests earlier :)

      This still needs to run through the CQ tests, but before we do that, I probably have to update the expectations a bit. My local testing setup is a bit wonky; the testing docs say that some tests will just fail because I'm running a newer version than Ubuntu 10. (I have 147 regressions, a few of which are completely unrelated things like `media/W3C/video/events/`). Is there a better setup doc that I should go through, or anything better than just running it through the CQ tests again?

      I've also gone through the tests manually and updated things that I *know* are needed to change (e.g. "can this header be set" type stuff). I'm wary of the `http/tests/inspector-protocol/` tests, as I'm not actually sure what they're testing for, but I think those might also need changes.

      Andrew Brown

      Ah, sorry if my inability to test makes this a bit brute-forcey.

      I've fixed the issue that caused the vast majority of those test failures - found a `MockFetchContext` (and some other variants) that were missing their override for `GetDefaultUserAgent`, so they ended up calling the default version, and predictably, `NOTREACHED_NORETURN()` caused them all to explode.

      There's definitely several other necessary test updates hidden among the mess - I found a few and fixed them in this CL, but the assumption that `user-agent` is forbidden is baked into a *lot* of tests. The non-blink tests seem to be working OK for me as of this CL - except (sorry if this is a stupid question), how do I actually compile and run every test group? E.g. I can run `blink_platform_unittests` by compiling `blink_tests` and running the `blink_platform_unittests` binary, but I can't find a binary for `webkit_unit_tests`, and `webkit_tests` isn't a valid target for compilation. (Same with `net_unittests` and `services_unittests`, but there's only one failure there, and it's easy to track down.)

      Given the number of tests I've run into that expect `user-agent` to be a forbidden header, I'll endeavour to add a few more tests that expect the correct behaviour in the next patchset.

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Adam Rice
      Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: Icf56620f99f371ea2f128e6a3194d6096b0d62cd
      Gerrit-Change-Number: 5273743
      Gerrit-PatchSet: 10
      Gerrit-Owner: Andrew Brown <m...@ajbrown.au>
      Gerrit-Reviewer: Adam Rice <ri...@chromium.org>
      Gerrit-Reviewer: Andrew Brown <m...@ajbrown.au>
      Gerrit-Reviewer: Bo Liu <bo...@chromium.org>
      Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
      Gerrit-CC: Hiroki Nakagawa <nhi...@chromium.org>
      Gerrit-CC: James Su <su...@chromium.org>
      Gerrit-CC: Nate Chapin <jap...@chromium.org>
      Gerrit-CC: W. James Maclean <wjma...@chromium.org>
      Gerrit-Attention: Adam Rice <ri...@chromium.org>
      Gerrit-Comment-Date: Thu, 07 Mar 2024 12:17:40 +0000
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Adam Rice (Gerrit)

      unread,
      Mar 7, 2024, 7:35:16 AM3/7/24
      to Andrew Brown, Hiroki Nakagawa, Bo Liu, Takashi Toyoshima, W. James Maclean, James Su, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, extension...@chromium.org, chromium-a...@chromium.org, mkwst+w...@chromium.org, horo+...@chromium.org, shimazu+se...@chromium.org, kinuko+ser...@chromium.org, servicewor...@chromium.org, antoniosarto...@chromium.org, kenjibah...@chromium.org, jsbell+ser...@chromium.org, arthursonzog...@chromium.org, blink-revie...@chromium.org, alexmo...@chromium.org, yhanad...@chromium.org, tranbaod...@chromium.org, nona+...@chromium.org, creis...@chromium.org, shuche...@chromium.org, jbauma...@chromium.org, navigation...@chromium.org, keithle...@chromium.org, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
      Attention needed from Andrew Brown

      Adam Rice added 2 comments

      Patchset-level comments
      Andrew Brown . unresolved

      Thanks for all the help!

      I think just need someone with dry run access to run the CQ tests for me, and I need review from an owner of `content/browser/storage_partition_impl.cc`. I've pinged Bo, who was first on the list of suggested owners :) - given the nearby comment about deprecated APIs, there may be a better way to access cors_exempt_headers.

      Andrew Brown

      Going to ping Adam for this, as he was helping me with tests earlier :)

      This still needs to run through the CQ tests, but before we do that, I probably have to update the expectations a bit. My local testing setup is a bit wonky; the testing docs say that some tests will just fail because I'm running a newer version than Ubuntu 10. (I have 147 regressions, a few of which are completely unrelated things like `media/W3C/video/events/`). Is there a better setup doc that I should go through, or anything better than just running it through the CQ tests again?

      I've also gone through the tests manually and updated things that I *know* are needed to change (e.g. "can this header be set" type stuff). I'm wary of the `http/tests/inspector-protocol/` tests, as I'm not actually sure what they're testing for, but I think those might also need changes.

      Andrew Brown

      Ah, sorry if my inability to test makes this a bit brute-forcey.

      I've fixed the issue that caused the vast majority of those test failures - found a `MockFetchContext` (and some other variants) that were missing their override for `GetDefaultUserAgent`, so they ended up calling the default version, and predictably, `NOTREACHED_NORETURN()` caused them all to explode.

      There's definitely several other necessary test updates hidden among the mess - I found a few and fixed them in this CL, but the assumption that `user-agent` is forbidden is baked into a *lot* of tests. The non-blink tests seem to be working OK for me as of this CL - except (sorry if this is a stupid question), how do I actually compile and run every test group? E.g. I can run `blink_platform_unittests` by compiling `blink_tests` and running the `blink_platform_unittests` binary, but I can't find a binary for `webkit_unit_tests`, and `webkit_tests` isn't a valid target for compilation. (Same with `net_unittests` and `services_unittests`, but there's only one failure there, and it's easy to track down.)

      Given the number of tests I've run into that expect `user-agent` to be a forbidden header, I'll endeavour to add a few more tests that expect the correct behaviour in the next patchset.

      Adam Rice

      I think `webkit_unit_tests` actually refers to `blink_unittests`, which you should be able to compile and run normally.

      `webkit_tests` maybe refers to the web_tests? In which case you can run
      ```
      third_party/blink/tools/run_web_tests.py external/wpt/fetch
      ```
      to run all the tests under `external/wpt/fetch`. `run_web_tests.py` can also be run with the `--reset` option to automatically update expectations.

      You should be able to build `net_unittests` and `services_unittests` normally with
      ```
      autoninja net_unittests services_unittests
      ```

      File-level comment, Patchset 10 (Latest):
      Adam Rice . resolved

      Please post a quick message to the bug when you want me to do a dry run, as I don't get notified when you upload a new patchset.

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Andrew Brown
      Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: Icf56620f99f371ea2f128e6a3194d6096b0d62cd
      Gerrit-Change-Number: 5273743
      Gerrit-PatchSet: 10
      Gerrit-Owner: Andrew Brown <m...@ajbrown.au>
      Gerrit-Reviewer: Adam Rice <ri...@chromium.org>
      Gerrit-Reviewer: Andrew Brown <m...@ajbrown.au>
      Gerrit-Reviewer: Bo Liu <bo...@chromium.org>
      Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
      Gerrit-CC: Hiroki Nakagawa <nhi...@chromium.org>
      Gerrit-CC: James Su <su...@chromium.org>
      Gerrit-CC: Nate Chapin <jap...@chromium.org>
      Gerrit-CC: W. James Maclean <wjma...@chromium.org>
      Gerrit-Attention: Andrew Brown <m...@ajbrown.au>
      Gerrit-Comment-Date: Thu, 07 Mar 2024 12:35:03 +0000
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Adam Rice (Gerrit)

      unread,
      Apr 3, 2024, 6:26:33 AM4/3/24
      to Andrew Brown, Hiroki Nakagawa, Bo Liu, Takashi Toyoshima, W. James Maclean, James Su, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, extension...@chromium.org, chromium-a...@chromium.org, mkwst+w...@chromium.org, horo+...@chromium.org, shimazu+se...@chromium.org, kinuko+ser...@chromium.org, servicewor...@chromium.org, antoniosarto...@chromium.org, kenjibah...@chromium.org, jsbell+ser...@chromium.org, arthursonzog...@chromium.org, blink-revie...@chromium.org, alexmo...@chromium.org, yhanad...@chromium.org, tranbaod...@chromium.org, nona+...@chromium.org, creis...@chromium.org, shuche...@chromium.org, jbauma...@chromium.org, navigation...@chromium.org, keithle...@chromium.org, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
      Attention needed from Andrew Brown and Takashi Toyoshima

      Adam Rice added 2 comments

      Patchset-level comments
      File-level comment, Patchset 12 (Latest):
      Adam Rice . resolved

      Looks like the ability to set the User-Agent via the inspector protocol (ie. DevTools) might have been broken by this change:
      https://ci.chromium.org/ui/p/chromium/builders/try/linux-rel/1731255/test-results?sortby=&groupby=

      Can you try running the failing tests locally and see if you can reproduce?

      File AUTHORS
      Line 123, Patchset 7:Andrew Brown <m...@ajbrown.au>
      Takashi Toyoshima . resolved

      just in case for Adam: I just checked the SignCLA site and ensureed the address is already recorded as we received CLAs.

      Adam Rice

      Thank you!

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Andrew Brown
      • Takashi Toyoshima
      Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedNo-Unresolved-Comments
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: Icf56620f99f371ea2f128e6a3194d6096b0d62cd
      Gerrit-Change-Number: 5273743
      Gerrit-PatchSet: 12
      Gerrit-Owner: Andrew Brown <m...@ajbrown.au>
      Gerrit-Reviewer: Adam Rice <ri...@chromium.org>
      Gerrit-Reviewer: Andrew Brown <m...@ajbrown.au>
      Gerrit-Reviewer: Bo Liu <bo...@chromium.org>
      Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
      Gerrit-CC: Hiroki Nakagawa <nhi...@chromium.org>
      Gerrit-CC: James Su <su...@chromium.org>
      Gerrit-CC: Nate Chapin <jap...@chromium.org>
      Gerrit-CC: W. James Maclean <wjma...@chromium.org>
      Gerrit-Attention: Andrew Brown <m...@ajbrown.au>
      Gerrit-Attention: Takashi Toyoshima <toyo...@chromium.org>
      Gerrit-Comment-Date: Wed, 03 Apr 2024 10:26:07 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Takashi Toyoshima <toyo...@chromium.org>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Andrew Brown (Gerrit)

      unread,
      Apr 4, 2024, 6:53:08 PM4/4/24
      to Adam Rice, Hiroki Nakagawa, Bo Liu, Takashi Toyoshima, W. James Maclean, James Su, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, extension...@chromium.org, chromium-a...@chromium.org, mkwst+w...@chromium.org, horo+...@chromium.org, shimazu+se...@chromium.org, kinuko+ser...@chromium.org, servicewor...@chromium.org, antoniosarto...@chromium.org, kenjibah...@chromium.org, jsbell+ser...@chromium.org, arthursonzog...@chromium.org, blink-revie...@chromium.org, alexmo...@chromium.org, yhanad...@chromium.org, tranbaod...@chromium.org, nona+...@chromium.org, creis...@chromium.org, shuche...@chromium.org, jbauma...@chromium.org, navigation...@chromium.org, keithle...@chromium.org, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
      Attention needed from Adam Rice

      Andrew Brown added 1 comment

      Patchset-level comments
      Adam Rice . resolved

      Looks like the ability to set the User-Agent via the inspector protocol (ie. DevTools) might have been broken by this change:
      https://ci.chromium.org/ui/p/chromium/builders/try/linux-rel/1731255/test-results?sortby=&groupby=

      Can you try running the failing tests locally and see if you can reproduce?

      Andrew Brown

      Sorry for the radio silence! I am still definitely intending to work on this, but my university studies are taking the bulk of my time.

      In the past month or so I've fixed a lot of the easy failures - I should be down to 17 individual failing tests (but each one will be failing on several platforms). The inspector-protocol stuff is the largest group of tests still failing, so I've had it on my list to actually learn and figure out how all that works so I can debug. (I'm unfamilar with devtools' advanced usage, so it's hard to debug without experience.)

      It definitely *looks* like this CL has stuffed up the inspector protocol stuff, and I can reproduce with local tests, but I haven't been able to reproduce manually, so it may be another matter of a missing testing interface or chrome-specific code. I'm not sure when I'll be super available to get into it, but maybe later in this month - sorry again for the low activity.

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Adam Rice
      Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedNo-Unresolved-Comments
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: Icf56620f99f371ea2f128e6a3194d6096b0d62cd
      Gerrit-Change-Number: 5273743
      Gerrit-PatchSet: 12
      Gerrit-Owner: Andrew Brown <m...@ajbrown.au>
      Gerrit-Reviewer: Adam Rice <ri...@chromium.org>
      Gerrit-Reviewer: Andrew Brown <m...@ajbrown.au>
      Gerrit-Reviewer: Bo Liu <bo...@chromium.org>
      Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
      Gerrit-CC: Hiroki Nakagawa <nhi...@chromium.org>
      Gerrit-CC: James Su <su...@chromium.org>
      Gerrit-CC: Nate Chapin <jap...@chromium.org>
      Gerrit-CC: W. James Maclean <wjma...@chromium.org>
      Gerrit-Attention: Adam Rice <ri...@chromium.org>
      Gerrit-Comment-Date: Thu, 04 Apr 2024 22:52:54 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Adam Rice <ri...@chromium.org>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Adam Rice (Gerrit)

      unread,
      Apr 5, 2024, 4:13:10 AM4/5/24
      to Andrew Brown, Hiroki Nakagawa, Bo Liu, Takashi Toyoshima, W. James Maclean, James Su, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, extension...@chromium.org, chromium-a...@chromium.org, mkwst+w...@chromium.org, horo+...@chromium.org, shimazu+se...@chromium.org, kinuko+ser...@chromium.org, servicewor...@chromium.org, antoniosarto...@chromium.org, kenjibah...@chromium.org, jsbell+ser...@chromium.org, arthursonzog...@chromium.org, blink-revie...@chromium.org, alexmo...@chromium.org, yhanad...@chromium.org, tranbaod...@chromium.org, nona+...@chromium.org, creis...@chromium.org, shuche...@chromium.org, jbauma...@chromium.org, navigation...@chromium.org, keithle...@chromium.org, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
      Attention needed from Andrew Brown

      Adam Rice added 1 comment

      Patchset-level comments
      Adam Rice . resolved

      Looks like the ability to set the User-Agent via the inspector protocol (ie. DevTools) might have been broken by this change:
      https://ci.chromium.org/ui/p/chromium/builders/try/linux-rel/1731255/test-results?sortby=&groupby=

      Can you try running the failing tests locally and see if you can reproduce?

      Andrew Brown

      Sorry for the radio silence! I am still definitely intending to work on this, but my university studies are taking the bulk of my time.

      In the past month or so I've fixed a lot of the easy failures - I should be down to 17 individual failing tests (but each one will be failing on several platforms). The inspector-protocol stuff is the largest group of tests still failing, so I've had it on my list to actually learn and figure out how all that works so I can debug. (I'm unfamilar with devtools' advanced usage, so it's hard to debug without experience.)

      It definitely *looks* like this CL has stuffed up the inspector protocol stuff, and I can reproduce with local tests, but I haven't been able to reproduce manually, so it may be another matter of a missing testing interface or chrome-specific code. I'm not sure when I'll be super available to get into it, but maybe later in this month - sorry again for the low activity.

      Adam Rice

      No problem. Take all the time you need.

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Andrew Brown
      Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedNo-Unresolved-Comments
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: Icf56620f99f371ea2f128e6a3194d6096b0d62cd
      Gerrit-Change-Number: 5273743
      Gerrit-PatchSet: 12
      Gerrit-Owner: Andrew Brown <m...@ajbrown.au>
      Gerrit-Reviewer: Adam Rice <ri...@chromium.org>
      Gerrit-Reviewer: Andrew Brown <m...@ajbrown.au>
      Gerrit-Reviewer: Bo Liu <bo...@chromium.org>
      Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
      Gerrit-CC: Hiroki Nakagawa <nhi...@chromium.org>
      Gerrit-CC: James Su <su...@chromium.org>
      Gerrit-CC: Nate Chapin <jap...@chromium.org>
      Gerrit-CC: W. James Maclean <wjma...@chromium.org>
      Gerrit-Attention: Andrew Brown <m...@ajbrown.au>
      Gerrit-Comment-Date: Fri, 05 Apr 2024 08:12:57 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Adam Rice <ri...@chromium.org>
      Comment-In-Reply-To: Andrew Brown <m...@ajbrown.au>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Andrew Brown (Gerrit)

      unread,
      Jan 2, 2025, 11:56:32 PMJan 2
      to Adam Rice, Min Qin, Hiroki Nakagawa, Bo Liu, Takashi Toyoshima, James Maclean, James Su, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, extension...@chromium.org, chromium-a...@chromium.org, mkwst+w...@chromium.org, horo+...@chromium.org, shimazu+se...@chromium.org, kinuko+ser...@chromium.org, servicewor...@chromium.org, antoniosarto...@chromium.org, kenjibah...@chromium.org, jsbell+ser...@chromium.org, arthursonzog...@chromium.org, blink-revie...@chromium.org, alexmo...@chromium.org, yhanad...@chromium.org, tranbaod...@chromium.org, nona+...@chromium.org, creis...@chromium.org, shuche...@chromium.org, jbauma...@chromium.org, navigation...@chromium.org, keithle...@chromium.org, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
      Attention needed from Adam Rice and Min Qin

      Andrew Brown added 1 comment

      Patchset-level comments
      File-level comment, Patchset 14 (Latest):
      Andrew Brown . unresolved

      Happy new year everyone! Apologies for dragging this up right as everyone returns from a well-deserved break :)

      Figured I could use some of my summer free time to close this out for good. I worked out (some of, hopefully all) the failing devtools tests, which needed changes inside the preflight-summoning code - tagged Min Qin for review. I'm a little wary that I ended up needing to have weird case handling in the preflight code.

      I have two outstanding questions:

      • I've commented out the assertion in a test for frame_fetch_context. It's expecting that the User-Agent is set after calling PrepareRequest, but because this CL moves it to its own thing, that's no longer the case. Is this test checking something "deeper" that I should work out, or can it be safely removed? (I suspect this is the root cause of a few other test failures, but I never have been able to accurately run the full suite locally.)
      • Do my cases for User-Agent handling make sense: a fetch-set User-Agent overrides a devtools User-Agent overrides the default? I think we've settled this, but it may be different when you consider which User-Agent should be present on preflight OPTIONS requests. At this point, it follows the same order.
      Open in Gerrit

      Related details

      Attention is currently required from:
      • Adam Rice
      • Min Qin
      Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedNo-Unresolved-Comments
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: Icf56620f99f371ea2f128e6a3194d6096b0d62cd
      Gerrit-Change-Number: 5273743
      Gerrit-PatchSet: 14
      Gerrit-Owner: Andrew Brown <m...@ajbrown.au>
      Gerrit-Reviewer: Adam Rice <ri...@chromium.org>
      Gerrit-Reviewer: Andrew Brown <m...@ajbrown.au>
      Gerrit-Reviewer: Bo Liu <bo...@chromium.org>
      Gerrit-Reviewer: Min Qin <qin...@chromium.org>
      Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
      Gerrit-CC: Hiroki Nakagawa <nhi...@chromium.org>
      Gerrit-CC: James Maclean <wjma...@chromium.org>
      Gerrit-CC: James Su <su...@chromium.org>
      Gerrit-CC: Nate Chapin <jap...@chromium.org>
      Gerrit-Attention: Adam Rice <ri...@chromium.org>
      Gerrit-Attention: Min Qin <qin...@chromium.org>
      Gerrit-Comment-Date: Fri, 03 Jan 2025 04:56:22 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Min Qin (Gerrit)

      unread,
      Jan 9, 2025, 12:59:06 PMJan 9
      to Andrew Brown, Adam Rice, Hiroki Nakagawa, Bo Liu, Takashi Toyoshima, James Maclean, James Su, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, extension...@chromium.org, chromium-a...@chromium.org, mkwst+w...@chromium.org, horo+...@chromium.org, shimazu+se...@chromium.org, kinuko+ser...@chromium.org, servicewor...@chromium.org, antoniosarto...@chromium.org, kenjibah...@chromium.org, jsbell+ser...@chromium.org, arthursonzog...@chromium.org, blink-revie...@chromium.org, alexmo...@chromium.org, yhanad...@chromium.org, tranbaod...@chromium.org, nona+...@chromium.org, creis...@chromium.org, shuche...@chromium.org, jbauma...@chromium.org, navigation...@chromium.org, keithle...@chromium.org, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
      Attention needed from Adam Rice and Andrew Brown

      Min Qin voted Code-Review+1

      Code-Review+1
      Open in Gerrit

      Related details

      Attention is currently required from:
      • Adam Rice
      • Andrew Brown
      Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedNo-Unresolved-Comments
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: Icf56620f99f371ea2f128e6a3194d6096b0d62cd
      Gerrit-Change-Number: 5273743
      Gerrit-PatchSet: 15
      Gerrit-Owner: Andrew Brown <m...@ajbrown.au>
      Gerrit-Reviewer: Adam Rice <ri...@chromium.org>
      Gerrit-Reviewer: Andrew Brown <m...@ajbrown.au>
      Gerrit-Reviewer: Bo Liu <bo...@chromium.org>
      Gerrit-Reviewer: Min Qin <qin...@chromium.org>
      Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
      Gerrit-CC: Hiroki Nakagawa <nhi...@chromium.org>
      Gerrit-CC: James Maclean <wjma...@chromium.org>
      Gerrit-CC: James Su <su...@chromium.org>
      Gerrit-CC: Nate Chapin <jap...@chromium.org>
      Gerrit-Attention: Adam Rice <ri...@chromium.org>
      Gerrit-Attention: Andrew Brown <m...@ajbrown.au>
      Gerrit-Comment-Date: Thu, 09 Jan 2025 17:58:52 +0000
      Gerrit-HasComments: No
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Adam Rice (Gerrit)

      unread,
      Jan 10, 2025, 3:25:07 AMJan 10
      to Andrew Brown, Min Qin, Hiroki Nakagawa, Bo Liu, Takashi Toyoshima, James Maclean, James Su, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, extension...@chromium.org, chromium-a...@chromium.org, mkwst+w...@chromium.org, horo+...@chromium.org, shimazu+se...@chromium.org, kinuko+ser...@chromium.org, servicewor...@chromium.org, antoniosarto...@chromium.org, kenjibah...@chromium.org, jsbell+ser...@chromium.org, arthursonzog...@chromium.org, blink-revie...@chromium.org, alexmo...@chromium.org, yhanad...@chromium.org, tranbaod...@chromium.org, nona+...@chromium.org, creis...@chromium.org, shuche...@chromium.org, jbauma...@chromium.org, navigation...@chromium.org, keithle...@chromium.org, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
      Attention needed from Andrew Brown

      Adam Rice added 1 comment

      Commit Message
      Line 11, Patchset 15 (Latest):cors_exempt_headers. The default (browser or devtools generated) user-agent is now stored in the FetchContext, and stored into the cors_exempt_headers only if JavaScript didn't set one first.
      Adam Rice . unresolved

      Please wrap the commit message to 72 columns so it looks nice in "git log" output. One day the UI will do this right, but that day has not yet come.

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Andrew Brown
      Gerrit-Attention: Andrew Brown <m...@ajbrown.au>
      Gerrit-Comment-Date: Fri, 10 Jan 2025 08:24:54 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Adam Rice (Gerrit)

      unread,
      Jan 10, 2025, 3:50:14 AMJan 10
      to Andrew Brown, Min Qin, Hiroki Nakagawa, Bo Liu, Takashi Toyoshima, James Maclean, James Su, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, extension...@chromium.org, chromium-a...@chromium.org, mkwst+w...@chromium.org, horo+...@chromium.org, shimazu+se...@chromium.org, kinuko+ser...@chromium.org, servicewor...@chromium.org, antoniosarto...@chromium.org, kenjibah...@chromium.org, jsbell+ser...@chromium.org, arthursonzog...@chromium.org, blink-revie...@chromium.org, alexmo...@chromium.org, yhanad...@chromium.org, tranbaod...@chromium.org, nona+...@chromium.org, creis...@chromium.org, shuche...@chromium.org, jbauma...@chromium.org, navigation...@chromium.org, keithle...@chromium.org, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
      Attention needed from Andrew Brown

      Adam Rice added 1 comment

      File services/network/cors/preflight_controller.cc
      Line 210, Patchset 15 (Latest): if (user_agent) {
      preflight_request->cors_exempt_headers.SetHeader(
      net::HttpRequestHeaders::kUserAgent, *user_agent);
      } else {
      // The User-Agent is now passed through the cors_exempt_headers, but we
      // still need this fallback to handle Devtools usage.
      user_agent = request.headers.GetHeader(net::HttpRequestHeaders::kUserAgent);
      if (user_agent) {
      preflight_request->cors_exempt_headers.SetHeader(
      net::HttpRequestHeaders::kUserAgent, *user_agent);
      }
      Adam Rice . unresolved
      We can avoid repeating the SetHeader() call like this:
      ```suggestion
      if (!user_agent) {
      // The User-Agent is now passed through the cors_exempt_headers, but we
      // still need this fallback to handle Devtools usage.
      user_agent = request.headers.GetHeader(net::HttpRequestHeaders::kUserAgent);
      }
      if (user_agent) {
      preflight_request->cors_exempt_headers.SetHeader(
      net::HttpRequestHeaders::kUserAgent, *user_agent);
      }
      ```
      Gerrit-Comment-Date: Fri, 10 Jan 2025 08:49:53 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Andrew Brown (Gerrit)

      unread,
      Jan 12, 2025, 7:02:37 PMJan 12
      to Adam Rice, Hiroki Nakagawa, Takashi Toyoshima, James Maclean, James Su, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, extension...@chromium.org, chromium-a...@chromium.org, mkwst+w...@chromium.org, horo+...@chromium.org, shimazu+se...@chromium.org, kinuko+ser...@chromium.org, servicewor...@chromium.org, antoniosarto...@chromium.org, kenjibah...@chromium.org, jsbell+ser...@chromium.org, arthursonzog...@chromium.org, blink-revie...@chromium.org, alexmo...@chromium.org, yhanad...@chromium.org, tranbaod...@chromium.org, nona+...@chromium.org, creis...@chromium.org, shuche...@chromium.org, jbauma...@chromium.org, navigation...@chromium.org, keithle...@chromium.org, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
      Attention needed from Adam Rice

      Andrew Brown added 5 comments

      Patchset-level comments
      File-level comment, Patchset 8:
      Andrew Brown . resolved

      Thanks for all the help!

      I think just need someone with dry run access to run the CQ tests for me, and I need review from an owner of `content/browser/storage_partition_impl.cc`. I've pinged Bo, who was first on the list of suggested owners :) - given the nearby comment about deprecated APIs, there may be a better way to access cors_exempt_headers.

      Andrew Brown

      Going to ping Adam for this, as he was helping me with tests earlier :)

      This still needs to run through the CQ tests, but before we do that, I probably have to update the expectations a bit. My local testing setup is a bit wonky; the testing docs say that some tests will just fail because I'm running a newer version than Ubuntu 10. (I have 147 regressions, a few of which are completely unrelated things like `media/W3C/video/events/`). Is there a better setup doc that I should go through, or anything better than just running it through the CQ tests again?

      I've also gone through the tests manually and updated things that I *know* are needed to change (e.g. "can this header be set" type stuff). I'm wary of the `http/tests/inspector-protocol/` tests, as I'm not actually sure what they're testing for, but I think those might also need changes.

      Andrew Brown

      Ah, sorry if my inability to test makes this a bit brute-forcey.

      I've fixed the issue that caused the vast majority of those test failures - found a `MockFetchContext` (and some other variants) that were missing their override for `GetDefaultUserAgent`, so they ended up calling the default version, and predictably, `NOTREACHED_NORETURN()` caused them all to explode.

      There's definitely several other necessary test updates hidden among the mess - I found a few and fixed them in this CL, but the assumption that `user-agent` is forbidden is baked into a *lot* of tests. The non-blink tests seem to be working OK for me as of this CL - except (sorry if this is a stupid question), how do I actually compile and run every test group? E.g. I can run `blink_platform_unittests` by compiling `blink_tests` and running the `blink_platform_unittests` binary, but I can't find a binary for `webkit_unit_tests`, and `webkit_tests` isn't a valid target for compilation. (Same with `net_unittests` and `services_unittests`, but there's only one failure there, and it's easy to track down.)

      Given the number of tests I've run into that expect `user-agent` to be a forbidden header, I'll endeavour to add a few more tests that expect the correct behaviour in the next patchset.

      Adam Rice

      I think `webkit_unit_tests` actually refers to `blink_unittests`, which you should be able to compile and run normally.

      `webkit_tests` maybe refers to the web_tests? In which case you can run
      ```
      third_party/blink/tools/run_web_tests.py external/wpt/fetch
      ```
      to run all the tests under `external/wpt/fetch`. `run_web_tests.py` can also be run with the `--reset` option to automatically update expectations.

      You should be able to build `net_unittests` and `services_unittests` normally with
      ```
      autoninja net_unittests services_unittests
      ```

      Andrew Brown

      Much appreciated - I did finally manage to get local tests going.

      Andrew Brown . unresolved

      Happy new year everyone! Apologies for dragging this up right as everyone returns from a well-deserved break :)

      Figured I could use some of my summer free time to close this out for good. I worked out (some of, hopefully all) the failing devtools tests, which needed changes inside the preflight-summoning code - tagged Min Qin for review. I'm a little wary that I ended up needing to have weird case handling in the preflight code.

      I have two outstanding questions:

      • I've commented out the assertion in a test for frame_fetch_context. It's expecting that the User-Agent is set after calling PrepareRequest, but because this CL moves it to its own thing, that's no longer the case. Is this test checking something "deeper" that I should work out, or can it be safely removed? (I suspect this is the root cause of a few other test failures, but I never have been able to accurately run the full suite locally.)
      • Do my cases for User-Agent handling make sense: a fetch-set User-Agent overrides a devtools User-Agent overrides the default? I think we've settled this, but it may be different when you consider which User-Agent should be present on preflight OPTIONS requests. At this point, it follows the same order.
      Andrew Brown

      Ok, not quite all the failing devtools tests :(

      Some remaining failures I've traced back down to `ThrottlingURLLoader::StartNow()`, where it enters IPC/inheritance hell. I am almost willing to bet this will characterise all the remianing failures: issues in the various implementations of `URLLoaderFactory::CreateLoaderAndStart`.

      Basically, I have reason to believe there are one or more `URLLoader` implementations that don't combine the `cors_exempt_headers` in with the normal `headers` on a request - similar to the change I've already made in `preflight_controller.cc`. There are different `URLLoader`'s for different things, and I bet the one that deals with extensions will have a problem, and so will the one that deals with non-returning delayed requests for `fetchLater()`.

      Do you have any tips for tracking down which one(s) live on the path below the DevTools (and extension) code? The debug docs are fantastic for working bottom-up, where you have a crash and you need to work out where, but not so helpful for working top-down, where I have correct behaviour and I don't know where it stops.

      There are ~43 different types of `CreateLoaderAndStart` that could lead to my problem, each with their own very large stack of behaviour, and often calling into each other in hard-to-grasp ways. I can work through them eventually, but it's going to take a long time.

      Commit Message
      Line 11, Patchset 15:cors_exempt_headers. The default (browser or devtools generated) user-agent is now stored in the FetchContext, and stored into the cors_exempt_headers only if JavaScript didn't set one first.
      Adam Rice . unresolved

      Please wrap the commit message to 72 columns so it looks nice in "git log" output. One day the UI will do this right, but that day has not yet come.

      Andrew Brown

      I think this is done? Checked using `git cl description` and it looks like it wraps properly now.

      File services/network/cors/preflight_controller.cc
      Line 210, Patchset 15: if (user_agent) {

      preflight_request->cors_exempt_headers.SetHeader(
      net::HttpRequestHeaders::kUserAgent, *user_agent);
      } else {
      // The User-Agent is now passed through the cors_exempt_headers, but we
      // still need this fallback to handle Devtools usage.
      user_agent = request.headers.GetHeader(net::HttpRequestHeaders::kUserAgent);
      if (user_agent) {
      preflight_request->cors_exempt_headers.SetHeader(
      net::HttpRequestHeaders::kUserAgent, *user_agent);
      }
      Adam Rice . resolved
      We can avoid repeating the SetHeader() call like this:
      ```suggestion
      if (!user_agent) {
      // The User-Agent is now passed through the cors_exempt_headers, but we
      // still need this fallback to handle Devtools usage.
      user_agent = request.headers.GetHeader(net::HttpRequestHeaders::kUserAgent);
      }
      if (user_agent) {
      preflight_request->cors_exempt_headers.SetHeader(
      net::HttpRequestHeaders::kUserAgent, *user_agent);
      }
      ```
      Andrew Brown

      Oh, that's much smarter.

      File third_party/blink/renderer/core/loader/frame_fetch_context_test.cc
      Line 1505, Patchset 14: // EXPECT_EQ("hi", request.HttpHeaderField(http_names::kUserAgent));
      Andrew Brown . unresolved

      This test is funny - it's now always going to fail, because there's simply no need for `PrepareRequest` to put the useragent in the headers. The title of this test implies it's testing something more meaningful than just the user-agent-setting behaviour - what sort of backup should I add instead?

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Adam Rice
      Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedNo-Unresolved-Comments
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: Icf56620f99f371ea2f128e6a3194d6096b0d62cd
      Gerrit-Change-Number: 5273743
      Gerrit-PatchSet: 17
      Gerrit-Owner: Andrew Brown <m...@ajbrown.au>
      Gerrit-Reviewer: Adam Rice <ri...@chromium.org>
      Gerrit-Reviewer: Andrew Brown <m...@ajbrown.au>
      Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
      Gerrit-CC: Hiroki Nakagawa <nhi...@chromium.org>
      Gerrit-CC: James Maclean <wjma...@chromium.org>
      Gerrit-CC: James Su <su...@chromium.org>
      Gerrit-CC: Nate Chapin <jap...@chromium.org>
      Gerrit-Attention: Adam Rice <ri...@chromium.org>
      Gerrit-Comment-Date: Mon, 13 Jan 2025 00:02:27 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Andrew Brown (Gerrit)

      unread,
      Jan 12, 2025, 7:09:40 PMJan 12
      to Bo Liu, Min Qin, Adam Rice, Hiroki Nakagawa, Takashi Toyoshima, James Maclean, James Su, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, extension...@chromium.org, chromium-a...@chromium.org, mkwst+w...@chromium.org, horo+...@chromium.org, shimazu+se...@chromium.org, kinuko+ser...@chromium.org, servicewor...@chromium.org, antoniosarto...@chromium.org, kenjibah...@chromium.org, jsbell+ser...@chromium.org, arthursonzog...@chromium.org, blink-revie...@chromium.org, alexmo...@chromium.org, yhanad...@chromium.org, tranbaod...@chromium.org, nona+...@chromium.org, creis...@chromium.org, shuche...@chromium.org, jbauma...@chromium.org, navigation...@chromium.org, keithle...@chromium.org, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
      Attention needed from Adam Rice, Bo Liu and Min Qin

      Andrew Brown added 1 comment

      Patchset-level comments
      File-level comment, Patchset 17 (Latest):
      Andrew Brown . unresolved

      ...ah, I'm terribly sorry - I thought that would just avoid pinging you both again, not delete your reviews entirely :(

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Adam Rice
      • Bo Liu
      • Min Qin
      Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedNo-Unresolved-Comments
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: Icf56620f99f371ea2f128e6a3194d6096b0d62cd
      Gerrit-Change-Number: 5273743
      Gerrit-PatchSet: 17
      Gerrit-Owner: Andrew Brown <m...@ajbrown.au>
      Gerrit-Reviewer: Adam Rice <ri...@chromium.org>
      Gerrit-Reviewer: Andrew Brown <m...@ajbrown.au>
      Gerrit-Reviewer: Bo Liu <bo...@chromium.org>
      Gerrit-Reviewer: Min Qin <qin...@chromium.org>
      Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
      Gerrit-CC: Hiroki Nakagawa <nhi...@chromium.org>
      Gerrit-CC: James Maclean <wjma...@chromium.org>
      Gerrit-CC: James Su <su...@chromium.org>
      Gerrit-CC: Nate Chapin <jap...@chromium.org>
      Gerrit-Attention: Bo Liu <bo...@chromium.org>
      Gerrit-Attention: Min Qin <qin...@chromium.org>
      Gerrit-Attention: Adam Rice <ri...@chromium.org>
      Gerrit-Comment-Date: Mon, 13 Jan 2025 00:09:29 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Bo Liu (Gerrit)

      unread,
      Jan 13, 2025, 10:02:20 AMJan 13
      to Andrew Brown, Bo Liu, Min Qin, Adam Rice, Hiroki Nakagawa, Takashi Toyoshima, James Maclean, James Su, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, extension...@chromium.org, chromium-a...@chromium.org, mkwst+w...@chromium.org, horo+...@chromium.org, shimazu+se...@chromium.org, kinuko+ser...@chromium.org, servicewor...@chromium.org, antoniosarto...@chromium.org, kenjibah...@chromium.org, jsbell+ser...@chromium.org, arthursonzog...@chromium.org, blink-revie...@chromium.org, alexmo...@chromium.org, yhanad...@chromium.org, tranbaod...@chromium.org, nona+...@chromium.org, creis...@chromium.org, shuche...@chromium.org, jbauma...@chromium.org, navigation...@chromium.org, keithle...@chromium.org, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
      Attention needed from Adam Rice, Andrew Brown and Min Qin

      Bo Liu voted and added 1 comment

      Votes added by Bo Liu

      Code-Review+1

      1 comment

      Patchset-level comments
      Bo Liu . resolved

      content stamp still

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Adam Rice
      • Andrew Brown
      • Min Qin
      Gerrit-Attention: Min Qin <qin...@chromium.org>
      Gerrit-Attention: Adam Rice <ri...@chromium.org>
      Gerrit-Attention: Andrew Brown <m...@ajbrown.au>
      Gerrit-Comment-Date: Mon, 13 Jan 2025 15:02:03 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Min Qin (Gerrit)

      unread,
      Jan 14, 2025, 1:25:45 PMJan 14
      to Andrew Brown, Bo Liu, Adam Rice, Hiroki Nakagawa, Takashi Toyoshima, James Maclean, James Su, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, extension...@chromium.org, chromium-a...@chromium.org, mkwst+w...@chromium.org, horo+...@chromium.org, shimazu+se...@chromium.org, kinuko+ser...@chromium.org, servicewor...@chromium.org, antoniosarto...@chromium.org, kenjibah...@chromium.org, jsbell+ser...@chromium.org, arthursonzog...@chromium.org, blink-revie...@chromium.org, alexmo...@chromium.org, yhanad...@chromium.org, tranbaod...@chromium.org, nona+...@chromium.org, creis...@chromium.org, shuche...@chromium.org, jbauma...@chromium.org, navigation...@chromium.org, keithle...@chromium.org, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
      Attention needed from Andrew Brown

      Min Qin added 1 comment

      Patchset-level comments
      Min Qin . resolved

      chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc lgtm

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Andrew Brown
      Gerrit-Attention: Andrew Brown <m...@ajbrown.au>
      Gerrit-Comment-Date: Tue, 14 Jan 2025 18:25:29 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Min Qin (Gerrit)

      unread,
      Jan 14, 2025, 1:25:52 PMJan 14
      to Andrew Brown, Bo Liu, Adam Rice, Hiroki Nakagawa, Takashi Toyoshima, James Maclean, James Su, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, extension...@chromium.org, chromium-a...@chromium.org, mkwst+w...@chromium.org, horo+...@chromium.org, shimazu+se...@chromium.org, kinuko+ser...@chromium.org, servicewor...@chromium.org, antoniosarto...@chromium.org, kenjibah...@chromium.org, jsbell+ser...@chromium.org, arthursonzog...@chromium.org, blink-revie...@chromium.org, alexmo...@chromium.org, yhanad...@chromium.org, tranbaod...@chromium.org, nona+...@chromium.org, creis...@chromium.org, shuche...@chromium.org, jbauma...@chromium.org, navigation...@chromium.org, keithle...@chromium.org, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
      Attention needed from Andrew Brown

      Min Qin voted Code-Review+1

      Code-Review+1
      Open in Gerrit

      Related details

      Attention is currently required from:
      • Andrew Brown
      Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement satisfiedCode-Review
      • requirement is not satisfiedNo-Unresolved-Comments
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: Icf56620f99f371ea2f128e6a3194d6096b0d62cd
      Gerrit-Change-Number: 5273743
      Gerrit-PatchSet: 17
      Gerrit-Owner: Andrew Brown <m...@ajbrown.au>
      Gerrit-Reviewer: Adam Rice <ri...@chromium.org>
      Gerrit-Reviewer: Andrew Brown <m...@ajbrown.au>
      Gerrit-Reviewer: Bo Liu <bo...@chromium.org>
      Gerrit-Reviewer: Min Qin <qin...@chromium.org>
      Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
      Gerrit-CC: Hiroki Nakagawa <nhi...@chromium.org>
      Gerrit-CC: James Maclean <wjma...@chromium.org>
      Gerrit-CC: James Su <su...@chromium.org>
      Gerrit-CC: Nate Chapin <jap...@chromium.org>
      Gerrit-Attention: Andrew Brown <m...@ajbrown.au>
      Gerrit-Comment-Date: Tue, 14 Jan 2025 18:25:38 +0000
      Gerrit-HasComments: No
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Adam Rice (Gerrit)

      unread,
      Mar 7, 2025, 1:21:10 AMMar 7
      to Andrew Brown, Min Qin, Bo Liu, Hiroki Nakagawa, Takashi Toyoshima, James Maclean, James Su, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, extension...@chromium.org, chromium-a...@chromium.org, mkwst+w...@chromium.org, horo+...@chromium.org, shimazu+se...@chromium.org, kinuko+ser...@chromium.org, servicewor...@chromium.org, antoniosarto...@chromium.org, kenjibah...@chromium.org, jsbell+ser...@chromium.org, arthursonzog...@chromium.org, blink-revie...@chromium.org, alexmo...@chromium.org, yhanad...@chromium.org, tranbaod...@chromium.org, nona+...@chromium.org, creis...@chromium.org, shuche...@chromium.org, jbauma...@chromium.org, navigation...@chromium.org, keithle...@chromium.org, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
      Attention needed from Adam Rice and Andrew Brown

      Adam Rice voted and added 2 comments

      Votes added by Adam Rice

      Commit-Queue+1

      2 comments

      Patchset-level comments
      Adam Rice . resolved

      Is this waiting on me?

      AFAICT this doesn't have a chromestatus.com entry. Do you need someone to create one?

      Commit Message
      Line 11, Patchset 15:cors_exempt_headers. The default (browser or devtools generated) user-agent is now stored in the FetchContext, and stored into the cors_exempt_headers only if JavaScript didn't set one first.
      Adam Rice . resolved

      Please wrap the commit message to 72 columns so it looks nice in "git log" output. One day the UI will do this right, but that day has not yet come.

      Andrew Brown

      I think this is done? Checked using `git cl description` and it looks like it wraps properly now.

      Adam Rice

      Yep, lgtm.

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Adam Rice
      • Andrew Brown
      Gerrit-Attention: Adam Rice <ri...@chromium.org>
      Gerrit-Attention: Andrew Brown <m...@ajbrown.au>
      Gerrit-Comment-Date: Fri, 07 Mar 2025 06:20:56 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Andrew Brown (Gerrit)

      unread,
      Mar 7, 2025, 1:58:55 AMMar 7
      to Adam Rice, Min Qin, Bo Liu, Hiroki Nakagawa, Takashi Toyoshima, James Maclean, James Su, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, extension...@chromium.org, chromium-a...@chromium.org, mkwst+w...@chromium.org, horo+...@chromium.org, shimazu+se...@chromium.org, kinuko+ser...@chromium.org, servicewor...@chromium.org, antoniosarto...@chromium.org, kenjibah...@chromium.org, jsbell+ser...@chromium.org, arthursonzog...@chromium.org, blink-revie...@chromium.org, alexmo...@chromium.org, yhanad...@chromium.org, tranbaod...@chromium.org, nona+...@chromium.org, creis...@chromium.org, shuche...@chromium.org, jbauma...@chromium.org, navigation...@chromium.org, keithle...@chromium.org, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
      Attention needed from Adam Rice

      Andrew Brown added 1 comment

      Patchset-level comments
      Adam Rice . resolved

      Is this waiting on me?

      AFAICT this doesn't have a chromestatus.com entry. Do you need someone to create one?

      Andrew Brown

      It's not waiting on you, you're all good :) I don't know what chromestatus.com is, though. Maybe?

      At this point it's probably still not able to be merged, as there's still ~10-20 code paths I need to investigate to work out the last failing tests.

      My current theory for some of the remaining test fails (hopefully most of them, but idk) is that many of the `URLLoaders` (or the things that implement `CreateLoaderAndStart`) don't currently merge `cors_exempt_headers` into their actual web request, so they don't see the new User-Agent. Basically, Blink now puts the default user-agent in `cors_exempt_header` all the time, which is great, but some of the browser process backends don't know they need to look there.

      (Correct me if any of that sounds obviously incorrect.)

      I'm investigating these, but it's really slow going, as they all call into each other in weird and opaque ways. Also my real life need to work, and sleep, seems to be hampering my free time a bit :(

      Also there's a merge conflict, but I incidentally think I already fixed that last night, so I can upload a non-conflicting one shortly if you want to run it through the bots properly (I'm just compiling it locally to check nothing's regressed, but I can upload in an hour or two once it's done and I've checked it).

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Adam Rice
      Gerrit-Comment-Date: Fri, 07 Mar 2025 06:58:45 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Adam Rice <ri...@chromium.org>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Adam Rice (Gerrit)

      unread,
      Mar 7, 2025, 4:41:35 AMMar 7
      to Andrew Brown, Min Qin, Bo Liu, Hiroki Nakagawa, Takashi Toyoshima, James Maclean, James Su, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, extension...@chromium.org, chromium-a...@chromium.org, mkwst+w...@chromium.org, horo+...@chromium.org, shimazu+se...@chromium.org, kinuko+ser...@chromium.org, servicewor...@chromium.org, antoniosarto...@chromium.org, kenjibah...@chromium.org, jsbell+ser...@chromium.org, arthursonzog...@chromium.org, blink-revie...@chromium.org, alexmo...@chromium.org, yhanad...@chromium.org, tranbaod...@chromium.org, nona+...@chromium.org, creis...@chromium.org, shuche...@chromium.org, jbauma...@chromium.org, navigation...@chromium.org, keithle...@chromium.org, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
      Attention needed from Andrew Brown

      Adam Rice added 1 comment

      Patchset-level comments
      Adam Rice . resolved

      Is this waiting on me?

      AFAICT this doesn't have a chromestatus.com entry. Do you need someone to create one?

      Andrew Brown

      It's not waiting on you, you're all good :) I don't know what chromestatus.com is, though. Maybe?

      At this point it's probably still not able to be merged, as there's still ~10-20 code paths I need to investigate to work out the last failing tests.

      My current theory for some of the remaining test fails (hopefully most of them, but idk) is that many of the `URLLoaders` (or the things that implement `CreateLoaderAndStart`) don't currently merge `cors_exempt_headers` into their actual web request, so they don't see the new User-Agent. Basically, Blink now puts the default user-agent in `cors_exempt_header` all the time, which is great, but some of the browser process backends don't know they need to look there.

      (Correct me if any of that sounds obviously incorrect.)

      I'm investigating these, but it's really slow going, as they all call into each other in weird and opaque ways. Also my real life need to work, and sleep, seems to be hampering my free time a bit :(

      Also there's a merge conflict, but I incidentally think I already fixed that last night, so I can upload a non-conflicting one shortly if you want to run it through the bots properly (I'm just compiling it locally to check nothing's regressed, but I can upload in an hour or two once it's done and I've checked it).

      Adam Rice

      In short, whenever we ship a web platform feature that affects developers, we need approval from a group of people called "API owners". In long, https://www.chromium.org/blink/launching-features/.

      Because the "Implementation of existing standard" case applies here, the process is lightweight, but it is still needed.

      I wonder if we could make it simpler by only putting the header in `cors_exempt_headers` when it would make a difference? But I'm not sure whether Blink has enough information to know if it would make a difference or not.

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Andrew Brown
      Gerrit-Attention: Andrew Brown <m...@ajbrown.au>
      Gerrit-Comment-Date: Fri, 07 Mar 2025 09:41:24 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Adam Rice <ri...@chromium.org>
      Comment-In-Reply-To: Andrew Brown <m...@ajbrown.au>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Andrew Brown (Gerrit)

      unread,
      Mar 7, 2025, 10:58:20 PMMar 7
      to Adam Rice, Min Qin, Bo Liu, Hiroki Nakagawa, Takashi Toyoshima, James Maclean, James Su, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, extension...@chromium.org, chromium-a...@chromium.org, mkwst+w...@chromium.org, horo+...@chromium.org, shimazu+se...@chromium.org, kinuko+ser...@chromium.org, servicewor...@chromium.org, antoniosarto...@chromium.org, kenjibah...@chromium.org, jsbell+ser...@chromium.org, arthursonzog...@chromium.org, blink-revie...@chromium.org, alexmo...@chromium.org, yhanad...@chromium.org, tranbaod...@chromium.org, nona+...@chromium.org, creis...@chromium.org, shuche...@chromium.org, jbauma...@chromium.org, navigation...@chromium.org, keithle...@chromium.org, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
      Attention needed from Adam Rice

      Andrew Brown added 1 comment

      Patchset-level comments
      Adam Rice . resolved

      Is this waiting on me?

      AFAICT this doesn't have a chromestatus.com entry. Do you need someone to create one?

      Andrew Brown

      It's not waiting on you, you're all good :) I don't know what chromestatus.com is, though. Maybe?

      At this point it's probably still not able to be merged, as there's still ~10-20 code paths I need to investigate to work out the last failing tests.

      My current theory for some of the remaining test fails (hopefully most of them, but idk) is that many of the `URLLoaders` (or the things that implement `CreateLoaderAndStart`) don't currently merge `cors_exempt_headers` into their actual web request, so they don't see the new User-Agent. Basically, Blink now puts the default user-agent in `cors_exempt_header` all the time, which is great, but some of the browser process backends don't know they need to look there.

      (Correct me if any of that sounds obviously incorrect.)

      I'm investigating these, but it's really slow going, as they all call into each other in weird and opaque ways. Also my real life need to work, and sleep, seems to be hampering my free time a bit :(

      Also there's a merge conflict, but I incidentally think I already fixed that last night, so I can upload a non-conflicting one shortly if you want to run it through the bots properly (I'm just compiling it locally to check nothing's regressed, but I can upload in an hour or two once it's done and I've checked it).

      Adam Rice

      In short, whenever we ship a web platform feature that affects developers, we need approval from a group of people called "API owners". In long, https://www.chromium.org/blink/launching-features/.

      Because the "Implementation of existing standard" case applies here, the process is lightweight, but it is still needed.

      I wonder if we could make it simpler by only putting the header in `cors_exempt_headers` when it would make a difference? But I'm not sure whether Blink has enough information to know if it would make a difference or not.

      Andrew Brown

      Ah, ok. Just read those, think I get it now. There definitely isn't a chromestatus entry, unless someone's sneakily put one in without telling me.

      I'm on board with creating one now, but a lot of those things have like, labels and dates and planned timeframes, which scares me a little, as I don't think I'm active enough on this to commit to a timeframe (unless I take up a lot more of your time than I really should). If there's a way to post just like, "someone's working on it" in advance, then that would be good?

      The trouble is that the "core fix" for 571722 was actually just removing `User-Agent` from the list in `net/http/http_util.cc`. After that, I hit the point where users are allowed to set it (yay) but the browser version is never cors exempt (boo), and the rest of the CL is attempting to sneak browser versions around in order to miss that requirement. I don't think it's possible to only add it to `cors_exempt_headers` sometimes, because it's really a problem on every web request that the browser makes.

      Also, if I can ask - I'm getting a bunch of `Base (test name) in virtual suite "webnn-service-on-cpu" must refer to a real file or directory` errors that are preventing me from running `git cl upload` - do you know anything about that? Have I just merged something weird or got a symlink in the wrong spot or something?

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Adam Rice
      Gerrit-Attention: Adam Rice <ri...@chromium.org>
      Gerrit-Comment-Date: Sat, 08 Mar 2025 03:58:09 +0000
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Adam Rice (Gerrit)

      unread,
      Mar 24, 2025, 7:33:10 AMMar 24
      to Andrew Brown, Min Qin, Bo Liu, Hiroki Nakagawa, Takashi Toyoshima, James Maclean, James Su, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, extension...@chromium.org, chromium-a...@chromium.org, mkwst+w...@chromium.org, horo+...@chromium.org, shimazu+se...@chromium.org, kinuko+ser...@chromium.org, servicewor...@chromium.org, antoniosarto...@chromium.org, kenjibah...@chromium.org, jsbell+ser...@chromium.org, arthursonzog...@chromium.org, blink-revie...@chromium.org, alexmo...@chromium.org, yhanad...@chromium.org, tranbaod...@chromium.org, nona+...@chromium.org, creis...@chromium.org, shuche...@chromium.org, jbauma...@chromium.org, navigation...@chromium.org, keithle...@chromium.org, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
      Attention needed from Andrew Brown

      Adam Rice added 1 comment

      File third_party/blink/renderer/core/loader/frame_fetch_context_test.cc
      Line 1505, Patchset 14: // EXPECT_EQ("hi", request.HttpHeaderField(http_names::kUserAgent));
      Andrew Brown . unresolved

      This test is funny - it's now always going to fail, because there's simply no need for `PrepareRequest` to put the useragent in the headers. The title of this test implies it's testing something more meaningful than just the user-agent-setting behaviour - what sort of backup should I add instead?

      Adam Rice

      It's verifying that resetting `dummy_page_holder` results in a call to `client->UserAgent()`. It wants to verify that `"hi"` will actually be set as the User-Agent request header on the request, but I don't know how to do that here.

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Andrew Brown
      Gerrit-Attention: Andrew Brown <m...@ajbrown.au>
      Gerrit-Comment-Date: Mon, 24 Mar 2025 11:32:51 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Andrew Brown <m...@ajbrown.au>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Andrew Brown (Gerrit)

      unread,
      Jun 26, 2025, 10:54:45 PMJun 26
      to Adam Rice, Min Qin, Bo Liu, Hiroki Nakagawa, Takashi Toyoshima, James Maclean, James Su, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, devtools-re...@chromium.org, extension...@chromium.org, chromium-a...@chromium.org, mkwst+w...@chromium.org, horo+...@chromium.org, shimazu+se...@chromium.org, kinuko+ser...@chromium.org, servicewor...@chromium.org, antoniosarto...@chromium.org, kenjibah...@chromium.org, jsbell+ser...@chromium.org, arthursonzog...@chromium.org, blink-revie...@chromium.org, alexmo...@chromium.org, yhanad...@chromium.org, tranbaod...@chromium.org, nona+...@chromium.org, creis...@chromium.org, shuche...@chromium.org, jbauma...@chromium.org, navigation...@chromium.org, keithle...@chromium.org, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
      Attention needed from Adam Rice, Bo Liu and Min Qin

      Andrew Brown added 9 comments

      Patchset-level comments
      Andrew Brown . unresolved

      Happy new year everyone! Apologies for dragging this up right as everyone returns from a well-deserved break :)

      Figured I could use some of my summer free time to close this out for good. I worked out (some of, hopefully all) the failing devtools tests, which needed changes inside the preflight-summoning code - tagged Min Qin for review. I'm a little wary that I ended up needing to have weird case handling in the preflight code.

      I have two outstanding questions:

      • I've commented out the assertion in a test for frame_fetch_context. It's expecting that the User-Agent is set after calling PrepareRequest, but because this CL moves it to its own thing, that's no longer the case. Is this test checking something "deeper" that I should work out, or can it be safely removed? (I suspect this is the root cause of a few other test failures, but I never have been able to accurately run the full suite locally.)
      • Do my cases for User-Agent handling make sense: a fetch-set User-Agent overrides a devtools User-Agent overrides the default? I think we've settled this, but it may be different when you consider which User-Agent should be present on preflight OPTIONS requests. At this point, it follows the same order.
      Andrew Brown

      Ok, not quite all the failing devtools tests :(

      Some remaining failures I've traced back down to `ThrottlingURLLoader::StartNow()`, where it enters IPC/inheritance hell. I am almost willing to bet this will characterise all the remianing failures: issues in the various implementations of `URLLoaderFactory::CreateLoaderAndStart`.

      Basically, I have reason to believe there are one or more `URLLoader` implementations that don't combine the `cors_exempt_headers` in with the normal `headers` on a request - similar to the change I've already made in `preflight_controller.cc`. There are different `URLLoader`'s for different things, and I bet the one that deals with extensions will have a problem, and so will the one that deals with non-returning delayed requests for `fetchLater()`.

      Do you have any tips for tracking down which one(s) live on the path below the DevTools (and extension) code? The debug docs are fantastic for working bottom-up, where you have a crash and you need to work out where, but not so helpful for working top-down, where I have correct behaviour and I don't know where it stops.

      There are ~43 different types of `CreateLoaderAndStart` that could lead to my problem, each with their own very large stack of behaviour, and often calling into each other in hard-to-grasp ways. I can work through them eventually, but it's going to take a long time.

      Andrew Brown

      I was *almost* correct; I actually had to tell the parallel stack that the inspector protocol uses, that it still needs to go find the UA elsewhere.

      This means unfortunately all the work to keep the UA inside the FetchContext is useless, because the inspector protocol has no idea what context the request was made in, so there's just no way that the context-based approach is compatible with the behaviour inspector needs. I've gone back to the *original* way I did it, with a new field on the ResourceRequest.

      This lets us keep basically all of the original behaviour (stuff like PrepareRequest being the function call that actually sets the UA onto the blink::ResourceRequest, instead of it happening much later when populating the network::ResourceRequest). So a lot of this CL is now semi-superfluous, as there's still some remnants of the move-to-context (though these remnants are pretty ok, in my estimation. Maybe some string copying behaviour could be optimised, idk.)

      If it works as expected, there should (fingers crossed) be only a few failing tests:

      • ExtensionWebRequestApiPrerenderingTest.Load
      • ExtensionWebRequestApiPrerenderingTest.LoadIntoNewTab (next goal/s)
      • OutOfProcessPPAPITest.URLLoader3
      • PPAPINaClNewlibTest.URLLoader3 (ChromeOS only, so I can't test these locally)

      It may be time for a chromestatus.com entry? I feel like there's a lot of implementation-defined behaviour here that would be good to get more eyes on, and I'm planning to be able to work on this for the next 4-5 weeks straight.

      File-level comment, Patchset 17:
      Andrew Brown . resolved

      ...ah, I'm terribly sorry - I thought that would just avoid pinging you both again, not delete your reviews entirely :(

      Andrew Brown

      Done

      File services/network/cors/preflight_controller.cc
      Line 220, Patchset 21 (Latest): net::HttpRequestHeaders::kUserAgent, *user_agent);
      Andrew Brown . unresolved

      I think this code has a problem, which is that if the user has set a UA, we don't bother setting the context UA onto the cors_exempt_headers (see below comment in `request_conversion.cc`). So if there's a user UA, a preflight will be sent asking whether UA is an OK header, but *using* the custom UA that the user already set. Which is daft.

      I don't know if we can fix it nicely, as I think we avoided setting UA onto both sets of headers in order to avoid merging issues with them later (header lists have no guaranteed merging behaviour, I think?). So we might have to add a special UA hiding spot to the `network::ResourceRequest` too, which is not great.

      File third_party/blink/renderer/core/inspector/inspector_network_agent.cc
      Line 199, Patchset 21 (Latest): }
      Andrew Brown . unresolved

      There has to be a better way to use `getString()` here, or use another function instead, but I could not for the life of me find documentation for `DictionaryValue`, and the code I found for it was autogenerated and didn't look like it had much of a better approach available.

      Line 1015, Patchset 21 (Latest): headers, std::make_optional(request.GetContextUserAgent())))
      Andrew Brown . unresolved

      I don't think CORS preflights go through this function, as CORS preflights still appear to be UA-less in Devtools (the actual request still has the header, just the inspector's `Network.requestWillBeSent` event is wrong.)

      But also, this behaviour isn't tested ATM (I think?) - the existing tests don't appear to be checking the inspector's view of the preflight, just the network's view of it (in `http/tests/inspector-protocol/emulation/user-agent-override-cors-preflight.js`)

      So, outstanding questions (the last of which I can answer myself, given time):

      • Should there be a test for this behaviour (sending the right UA on a preflight, and making sure Devtools sees it too)?
      • Where do preflights spawn into the inspector code? Preflights are spawned in the network process, as best I can tell (code lives in services/network, not third_party/blink), so I don't know how that information gets sent back to the render process's inspector stuff.
      Line 1121, Patchset 21 (Latest): .setHeaders(BuildObjectForHeaders(headers_map, std::nullopt))
      Andrew Brown . unresolved

      I'm also not fully convinced that optionals are what we want here, but it feels better than creating a `BuildObjectForRequestHeaders` function. Maybe not. Thoughts welcome.

      File third_party/blink/renderer/core/loader/frame_fetch_context_test.cc
      Line 1505, Patchset 14: // EXPECT_EQ("hi", request.HttpHeaderField(http_names::kUserAgent));
      Andrew Brown . resolved

      This test is funny - it's now always going to fail, because there's simply no need for `PrepareRequest` to put the useragent in the headers. The title of this test implies it's testing something more meaningful than just the user-agent-setting behaviour - what sort of backup should I add instead?

      Adam Rice

      It's verifying that resetting `dummy_page_holder` results in a call to `client->UserAgent()`. It wants to verify that `"hi"` will actually be set as the User-Agent request header on the request, but I don't know how to do that here.

      Andrew Brown

      Alright, I fiddled with it in patchset 19, but ended up needing to put the UA *back* into the ResourceRequest (unfortunately) due to inspector protocol things, so the new test just checks that the UA is correctly set inside it's new hiding spot.

      Line 1554, Patchset 21 (Latest): PrepareRequestWhenWhenDetached) {
      Andrew Brown . unresolved

      Typo, will fix in next patchset.

      File third_party/blink/renderer/platform/loader/fetch/url_loader/request_conversion.cc
      Line 310, Patchset 21 (Latest): }
      Andrew Brown . unresolved

      See above comment in `preflight_controller.cc` - it's both these pieces of code together.

      The key thing is at this point, we can't put the context UA onto the cors_exempt_headers without potentially accepting dodgy merge behaviour later when they get combined. So we have a `network::ResourceRequest` that has a user UA on the normal headers and *no* UA on the cors_exempt headers, which then goes to `preflight_controller`, which uses the user UA.

      I guess we could work out where the merge happens and make sure we remove the context UA from the `cors_exempt_headers` *if* the user UA is set? But then we need to make sure preflights avoid copying the user UA, too.

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Adam Rice
      • Bo Liu
      • Min Qin
      Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedNo-Unresolved-Comments
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: Icf56620f99f371ea2f128e6a3194d6096b0d62cd
      Gerrit-Change-Number: 5273743
      Gerrit-PatchSet: 21
      Gerrit-Owner: Andrew Brown <m...@ajbrown.au>
      Gerrit-Reviewer: Adam Rice <ri...@chromium.org>
      Gerrit-Reviewer: Andrew Brown <m...@ajbrown.au>
      Gerrit-Reviewer: Bo Liu <bo...@chromium.org>
      Gerrit-Reviewer: Min Qin <qin...@chromium.org>
      Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
      Gerrit-CC: Hiroki Nakagawa <nhi...@chromium.org>
      Gerrit-CC: James Maclean <wjma...@chromium.org>
      Gerrit-CC: James Su <su...@chromium.org>
      Gerrit-CC: Nate Chapin <jap...@chromium.org>
      Gerrit-Attention: Bo Liu <bo...@chromium.org>
      Gerrit-Attention: Adam Rice <ri...@chromium.org>
      Gerrit-Attention: Min Qin <qin...@chromium.org>
      Gerrit-Comment-Date: Fri, 27 Jun 2025 02:54:14 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Adam Rice (Gerrit)

      unread,
      Jun 27, 2025, 12:17:19 PMJun 27
      to Andrew Brown, Min Qin, Bo Liu, Hiroki Nakagawa, Takashi Toyoshima, James Maclean, James Su, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, devtools-re...@chromium.org, extension...@chromium.org, chromium-a...@chromium.org, mkwst+w...@chromium.org, horo+...@chromium.org, shimazu+se...@chromium.org, kinuko+ser...@chromium.org, servicewor...@chromium.org, antoniosarto...@chromium.org, kenjibah...@chromium.org, jsbell+ser...@chromium.org, arthursonzog...@chromium.org, blink-revie...@chromium.org, alexmo...@chromium.org, yhanad...@chromium.org, tranbaod...@chromium.org, nona+...@chromium.org, creis...@chromium.org, shuche...@chromium.org, jbauma...@chromium.org, navigation...@chromium.org, keithle...@chromium.org, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
      Attention needed from Andrew Brown, Bo Liu and Min Qin

      Adam Rice added 2 comments

      Patchset-level comments
      File-level comment, Patchset 21 (Latest):
      Adam Rice . resolved

      I think you're going to need to add a DevTools expert as a reviewer to be able to answer some of these questions.

      File third_party/blink/renderer/core/inspector/inspector_network_agent.cc
      Line 196, Patchset 21 (Latest): if (context_ua.has_value() and
      Adam Rice . unresolved

      Nit: use `&&` not `and` in C++ code.

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Andrew Brown
      • Bo Liu
      • Min Qin
      Gerrit-Attention: Min Qin <qin...@chromium.org>
      Gerrit-Attention: Andrew Brown <m...@ajbrown.au>
      Gerrit-Comment-Date: Fri, 27 Jun 2025 16:16:50 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Andrew Brown (Gerrit)

      unread,
      Jul 1, 2025, 2:07:48 AMJul 1
      to Alex Rudenko, Adam Rice, Min Qin, Bo Liu, Hiroki Nakagawa, Takashi Toyoshima, James Maclean, James Su, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, devtools-re...@chromium.org, extension...@chromium.org, chromium-a...@chromium.org, mkwst+w...@chromium.org, horo+...@chromium.org, shimazu+se...@chromium.org, kinuko+ser...@chromium.org, servicewor...@chromium.org, antoniosarto...@chromium.org, kenjibah...@chromium.org, jsbell+ser...@chromium.org, arthursonzog...@chromium.org, blink-revie...@chromium.org, alexmo...@chromium.org, yhanad...@chromium.org, tranbaod...@chromium.org, nona+...@chromium.org, creis...@chromium.org, shuche...@chromium.org, jbauma...@chromium.org, navigation...@chromium.org, keithle...@chromium.org, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
      Attention needed from Adam Rice and Alex Rudenko

      Andrew Brown added 3 comments

      Patchset-level comments
      File-level comment, Patchset 22 (Latest):
      Andrew Brown . unresolved

      Added Alex Rudenko to review for devtools knowledge... first alphabetical owner, sorry, I get it, my name starts with A too - I have a few changes that touch devtools stuff (in `inspector_network_agent.cc`) that feel like they could be done in smarter ways. Thoughts welcome.

      Also if someone could put it through a CQ dry run again that would be hugely appreciated - locally it looks like the devtools changes might have ended up fixing the remaining tests, but it would be good to check.

      File third_party/blink/renderer/core/inspector/inspector_network_agent.cc
      Line 196, Patchset 21: if (context_ua.has_value() and
      Adam Rice . resolved

      Nit: use `&&` not `and` in C++ code.

      Andrew Brown

      Done

      File third_party/blink/renderer/core/loader/frame_fetch_context_test.cc
      Line 1554, Patchset 21: PrepareRequestWhenWhenDetached) {
      Andrew Brown . resolved

      Typo, will fix in next patchset.

      Andrew Brown

      Done

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Adam Rice
      • Alex Rudenko
      Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedNo-Unresolved-Comments
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: Icf56620f99f371ea2f128e6a3194d6096b0d62cd
      Gerrit-Change-Number: 5273743
      Gerrit-PatchSet: 22
      Gerrit-Owner: Andrew Brown <m...@ajbrown.au>
      Gerrit-Reviewer: Adam Rice <ri...@chromium.org>
      Gerrit-Reviewer: Alex Rudenko <alexr...@chromium.org>
      Gerrit-Reviewer: Andrew Brown <m...@ajbrown.au>
      Gerrit-Reviewer: Bo Liu <bo...@chromium.org>
      Gerrit-Reviewer: Min Qin <qin...@chromium.org>
      Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
      Gerrit-CC: Hiroki Nakagawa <nhi...@chromium.org>
      Gerrit-CC: James Maclean <wjma...@chromium.org>
      Gerrit-CC: James Su <su...@chromium.org>
      Gerrit-CC: Nate Chapin <jap...@chromium.org>
      Gerrit-Attention: Adam Rice <ri...@chromium.org>
      Gerrit-Attention: Alex Rudenko <alexr...@chromium.org>
      Gerrit-Comment-Date: Tue, 01 Jul 2025 06:07:19 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Alex Rudenko (Gerrit)

      unread,
      Jul 1, 2025, 2:12:48 AMJul 1
      to Andrew Brown, Maksim Sadym, Adam Rice, Min Qin, Bo Liu, Hiroki Nakagawa, Takashi Toyoshima, James Maclean, James Su, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, devtools-re...@chromium.org, extension...@chromium.org, chromium-a...@chromium.org, mkwst+w...@chromium.org, horo+...@chromium.org, shimazu+se...@chromium.org, kinuko+ser...@chromium.org, servicewor...@chromium.org, antoniosarto...@chromium.org, kenjibah...@chromium.org, jsbell+ser...@chromium.org, arthursonzog...@chromium.org, blink-revie...@chromium.org, alexmo...@chromium.org, yhanad...@chromium.org, tranbaod...@chromium.org, nona+...@chromium.org, creis...@chromium.org, shuche...@chromium.org, jbauma...@chromium.org, navigation...@chromium.org, keithle...@chromium.org, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
      Attention needed from Adam Rice, Andrew Brown and Maksim Sadym

      Alex Rudenko added 1 comment

      Patchset-level comments
      Alex Rudenko . resolved

      @sa...@chromium.org could you please do the initial round of reviews for the devtools code?

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Adam Rice
      • Andrew Brown
      • Maksim Sadym
      Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedNo-Unresolved-Comments
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: Icf56620f99f371ea2f128e6a3194d6096b0d62cd
      Gerrit-Change-Number: 5273743
      Gerrit-PatchSet: 22
      Gerrit-Owner: Andrew Brown <m...@ajbrown.au>
      Gerrit-Reviewer: Adam Rice <ri...@chromium.org>
      Gerrit-Reviewer: Alex Rudenko <alexr...@chromium.org>
      Gerrit-Reviewer: Andrew Brown <m...@ajbrown.au>
      Gerrit-Reviewer: Bo Liu <bo...@chromium.org>
      Gerrit-Reviewer: Maksim Sadym <sa...@chromium.org>
      Gerrit-Reviewer: Min Qin <qin...@chromium.org>
      Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
      Gerrit-CC: Hiroki Nakagawa <nhi...@chromium.org>
      Gerrit-CC: James Maclean <wjma...@chromium.org>
      Gerrit-CC: James Su <su...@chromium.org>
      Gerrit-CC: Nate Chapin <jap...@chromium.org>
      Gerrit-Attention: Adam Rice <ri...@chromium.org>
      Gerrit-Attention: Andrew Brown <m...@ajbrown.au>
      Gerrit-Attention: Maksim Sadym <sa...@chromium.org>
      Gerrit-Comment-Date: Tue, 01 Jul 2025 06:12:31 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Maksim Sadym (Gerrit)

      unread,
      Jul 1, 2025, 7:59:11 AMJul 1
      to Andrew Brown, Adam Rice, Alex Rudenko, Min Qin, Bo Liu, Hiroki Nakagawa, Takashi Toyoshima, James Maclean, James Su, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, devtools-re...@chromium.org, extension...@chromium.org, chromium-a...@chromium.org, mkwst+w...@chromium.org, horo+...@chromium.org, shimazu+se...@chromium.org, kinuko+ser...@chromium.org, servicewor...@chromium.org, antoniosarto...@chromium.org, kenjibah...@chromium.org, jsbell+ser...@chromium.org, arthursonzog...@chromium.org, blink-revie...@chromium.org, alexmo...@chromium.org, yhanad...@chromium.org, tranbaod...@chromium.org, nona+...@chromium.org, creis...@chromium.org, shuche...@chromium.org, jbauma...@chromium.org, navigation...@chromium.org, keithle...@chromium.org, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
      Attention needed from Adam Rice, Alex Rudenko and Andrew Brown

      Maksim Sadym added 1 comment

      Patchset-level comments
      Alex Rudenko . resolved

      @sa...@chromium.org could you please do the initial round of reviews for the devtools code?

      Maksim Sadym

      Looking in. Need a bit more time for this.

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Adam Rice
      • Alex Rudenko
      • Andrew Brown
      Gerrit-Attention: Alex Rudenko <alexr...@chromium.org>
      Gerrit-Attention: Andrew Brown <m...@ajbrown.au>
      Gerrit-Comment-Date: Tue, 01 Jul 2025 11:58:54 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Alex Rudenko <alexr...@chromium.org>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Maksim Sadym (Gerrit)

      unread,
      Jul 1, 2025, 12:44:39 PMJul 1
      to Andrew Brown, Adam Rice, Alex Rudenko, Min Qin, Bo Liu, Hiroki Nakagawa, Takashi Toyoshima, James Maclean, James Su, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, devtools-re...@chromium.org, extension...@chromium.org, chromium-a...@chromium.org, mkwst+w...@chromium.org, horo+...@chromium.org, shimazu+se...@chromium.org, kinuko+ser...@chromium.org, servicewor...@chromium.org, antoniosarto...@chromium.org, kenjibah...@chromium.org, jsbell+ser...@chromium.org, arthursonzog...@chromium.org, blink-revie...@chromium.org, alexmo...@chromium.org, yhanad...@chromium.org, tranbaod...@chromium.org, nona+...@chromium.org, creis...@chromium.org, shuche...@chromium.org, jbauma...@chromium.org, navigation...@chromium.org, keithle...@chromium.org, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
      Attention needed from Adam Rice, Alex Rudenko and Andrew Brown

      Maksim Sadym added 3 comments

      Patchset-level comments
      Maksim Sadym . resolved

      I took a look only at the `.../inspector_network_agent.cc`. I will leave the judgement WRT `GetContextUserAgent` method to the fetch owners.

      File third_party/blink/renderer/core/inspector/inspector_network_agent.cc
      Line 195, Patchset 22 (Latest): // We need to make special care in the case of outgoing ResourceRequests
      Maksim Sadym . unresolved

      Please move this block to `BuildObjectForResourceRequest`.

      Line 1012, Patchset 22 (Latest): headers.Set(http_names::kReferer, AtomicString(request.ReferrerString()));
      Maksim Sadym . unresolved

      As long as this is the only place the `context_ua` is set, please move the logic for adding the user agent header from `BuildObjectForHeaders` extra parameter here.

      Gerrit-Comment-Date: Tue, 01 Jul 2025 16:44:22 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Alex Rudenko (Gerrit)

      unread,
      Jul 1, 2025, 1:24:18 PMJul 1
      to Andrew Brown, Adam Rice, Maksim Sadym, Min Qin, Bo Liu, Hiroki Nakagawa, Takashi Toyoshima, James Maclean, James Su, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, devtools-re...@chromium.org, extension...@chromium.org, chromium-a...@chromium.org, mkwst+w...@chromium.org, horo+...@chromium.org, shimazu+se...@chromium.org, kinuko+ser...@chromium.org, servicewor...@chromium.org, antoniosarto...@chromium.org, kenjibah...@chromium.org, jsbell+ser...@chromium.org, arthursonzog...@chromium.org, blink-revie...@chromium.org, alexmo...@chromium.org, yhanad...@chromium.org, tranbaod...@chromium.org, nona+...@chromium.org, creis...@chromium.org, shuche...@chromium.org, jbauma...@chromium.org, navigation...@chromium.org, keithle...@chromium.org, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
      Attention needed from Adam Rice and Andrew Brown

      Alex Rudenko added 2 comments

      Commit Message
      Line 9, Patchset 22 (Latest):Per spec, fetch & XMLHttpRequest should be able to set custom
      Alex Rudenko . unresolved

      could you please link to the parts of the spec that define this behavior?

      File third_party/blink/renderer/core/inspector/inspector_network_agent.cc
      Line 1015, Patchset 21: headers, std::make_optional(request.GetContextUserAgent())))
      Andrew Brown . unresolved

      I don't think CORS preflights go through this function, as CORS preflights still appear to be UA-less in Devtools (the actual request still has the header, just the inspector's `Network.requestWillBeSent` event is wrong.)

      But also, this behaviour isn't tested ATM (I think?) - the existing tests don't appear to be checking the inspector's view of the preflight, just the network's view of it (in `http/tests/inspector-protocol/emulation/user-agent-override-cors-preflight.js`)

      So, outstanding questions (the last of which I can answer myself, given time):

      • Should there be a test for this behaviour (sending the right UA on a preflight, and making sure Devtools sees it too)?
      • Where do preflights spawn into the inspector code? Preflights are spawned in the network process, as best I can tell (code lives in services/network, not third_party/blink), so I don't know how that information gets sent back to the render process's inspector stuff.
      Alex Rudenko

      I do not think we need to add extra headers in this event. We have requestWillBeSentExtraInfo that should report actual headers set by the network service. Could you please clarify why requestWillBeSentExtraInfo is not sufficient here?

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Adam Rice
      • Andrew Brown
      Gerrit-Attention: Andrew Brown <m...@ajbrown.au>
      Gerrit-Comment-Date: Tue, 01 Jul 2025 17:24:00 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Andrew Brown <m...@ajbrown.au>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Andrew Brown (Gerrit)

      unread,
      Jul 3, 2025, 12:31:05 AMJul 3
      to Adam Rice, Maksim Sadym, Alex Rudenko, Min Qin, Bo Liu, Hiroki Nakagawa, Takashi Toyoshima, James Maclean, James Su, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, devtools-re...@chromium.org, extension...@chromium.org, chromium-a...@chromium.org, mkwst+w...@chromium.org, horo+...@chromium.org, shimazu+se...@chromium.org, kinuko+ser...@chromium.org, servicewor...@chromium.org, antoniosarto...@chromium.org, kenjibah...@chromium.org, jsbell+ser...@chromium.org, arthursonzog...@chromium.org, blink-revie...@chromium.org, alexmo...@chromium.org, yhanad...@chromium.org, tranbaod...@chromium.org, nona+...@chromium.org, creis...@chromium.org, shuche...@chromium.org, jbauma...@chromium.org, navigation...@chromium.org, keithle...@chromium.org, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
      Attention needed from Adam Rice, Alex Rudenko and Maksim Sadym

      Andrew Brown added 7 comments

      Patchset-level comments
      File-level comment, Patchset 23 (Latest):
      Andrew Brown . resolved

      I've spent all week compiling and attempting to test and recompiling. I still have no clue if it's actually better, but it will at least not have the stupid failures the last CL run had (the bad optional access stuff) - if someone would be so kind as to hit the tryjob button that would probably save me ~6 more hours running stuff locally...

      Commit Message
      Line 9, Patchset 22:Per spec, fetch & XMLHttpRequest should be able to set custom
      Alex Rudenko . unresolved

      could you please link to the parts of the spec that define this behavior?

      Andrew Brown

      It all derives from https://fetch.spec.whatwg.org/#forbidden-request-header -- this list was updated to remove User-Agent in 2015.

      Now User-Agent isn't forbidden, it should be settable by users, and should not be on `net/http/http_util.cc`'s forbidden header list.

      Unfortunately, once you remove it from that list, it also starts always generating CORS preflights. Whether it should send preflights is not directly answered by the spec (it's ambiguous), but we are emulating Firefox's behaviour, as it seems unintuitive to send preflights for every single fetch request ever asking for "User-Agent". Plus, it will break large swathes of the web for things that aren't expecting to have to explicitly say that "User-Agent" is OK.

      There's other discussion on this CL about this, but to summarise where we're at:

      • user-agent set by user: preflight sent
      • user-agent set by devtools or browser: no preflight sent

      So the solution to the CORS issue is that we take the (devtools or browser) UA from the FetchContext, and instead of putting it straight in the headers, we have to hide it around until we get to a state where it won't trigger a CORS preflight.

      Unfortunately this means I've had to run around to a heap of random spots and make sure they're looking in the new spot for the UA, but eh. I probably have to update that description to summarise the new behaviour soon, as it seems to change every 2nd patchset.

      File third_party/blink/renderer/core/inspector/inspector_network_agent.cc
      Line 195, Patchset 22: // We need to make special care in the case of outgoing ResourceRequests
      Maksim Sadym . resolved

      Please move this block to `BuildObjectForResourceRequest`.

      Andrew Brown

      Done - your approach looks miles better.

      Line 199, Patchset 21: }
      Andrew Brown . resolved

      There has to be a better way to use `getString()` here, or use another function instead, but I could not for the life of me find documentation for `DictionaryValue`, and the code I found for it was autogenerated and didn't look like it had much of a better approach available.

      Andrew Brown

      Done

      Line 1012, Patchset 22: headers.Set(http_names::kReferer, AtomicString(request.ReferrerString()));
      Maksim Sadym . resolved

      As long as this is the only place the `context_ua` is set, please move the logic for adding the user agent header from `BuildObjectForHeaders` extra parameter here.

      Andrew Brown

      Yeah, it is - moved over, done!

      Line 1015, Patchset 21: headers, std::make_optional(request.GetContextUserAgent())))
      Andrew Brown . unresolved

      I don't think CORS preflights go through this function, as CORS preflights still appear to be UA-less in Devtools (the actual request still has the header, just the inspector's `Network.requestWillBeSent` event is wrong.)

      But also, this behaviour isn't tested ATM (I think?) - the existing tests don't appear to be checking the inspector's view of the preflight, just the network's view of it (in `http/tests/inspector-protocol/emulation/user-agent-override-cors-preflight.js`)

      So, outstanding questions (the last of which I can answer myself, given time):

      • Should there be a test for this behaviour (sending the right UA on a preflight, and making sure Devtools sees it too)?
      • Where do preflights spawn into the inspector code? Preflights are spawned in the network process, as best I can tell (code lives in services/network, not third_party/blink), so I don't know how that information gets sent back to the render process's inspector stuff.
      Alex Rudenko

      I do not think we need to add extra headers in this event. We have requestWillBeSentExtraInfo that should report actual headers set by the network service. Could you please clarify why requestWillBeSentExtraInfo is not sufficient here?

      Andrew Brown

      I'll be honest I am completely unfamiliar with DevTools and didn't know that existed; everything that I've done has been prompted by a few failing tests. My impression (and these changes) are to solve the fact that the new, cors-free "hiding" spot for the UA also needs to be given to the inspector.

      Looking at requestWillBeSentExtraInfo, that seems like exactly what we want here, but this will require some tests to be updated - there's at least 8 tests failing in `web_tests/http/tests/inspector_protocol` that all are expecting a User-Agent to be present on the original `requestWillBeSent` event (which it won't be, anymore).

      I could update those 8 tests to check requestWillBeSentExtraInfo, and then ensure the User-Agent is present there?

      Line 1121, Patchset 21: .setHeaders(BuildObjectForHeaders(headers_map, std::nullopt))
      Andrew Brown . resolved

      I'm also not fully convinced that optionals are what we want here, but it feels better than creating a `BuildObjectForRequestHeaders` function. Maybe not. Thoughts welcome.

      Andrew Brown

      Done

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Adam Rice
      • Alex Rudenko
      • Maksim Sadym
      Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedNo-Unresolved-Comments
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: Icf56620f99f371ea2f128e6a3194d6096b0d62cd
      Gerrit-Change-Number: 5273743
      Gerrit-PatchSet: 23
      Gerrit-Owner: Andrew Brown <m...@ajbrown.au>
      Gerrit-Reviewer: Adam Rice <ri...@chromium.org>
      Gerrit-Reviewer: Alex Rudenko <alexr...@chromium.org>
      Gerrit-Reviewer: Andrew Brown <m...@ajbrown.au>
      Gerrit-Reviewer: Bo Liu <bo...@chromium.org>
      Gerrit-Reviewer: Maksim Sadym <sa...@chromium.org>
      Gerrit-Reviewer: Min Qin <qin...@chromium.org>
      Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
      Gerrit-CC: Hiroki Nakagawa <nhi...@chromium.org>
      Gerrit-CC: James Maclean <wjma...@chromium.org>
      Gerrit-CC: James Su <su...@chromium.org>
      Gerrit-CC: Nate Chapin <jap...@chromium.org>
      Gerrit-Attention: Alex Rudenko <alexr...@chromium.org>
      Gerrit-Attention: Adam Rice <ri...@chromium.org>
      Gerrit-Attention: Maksim Sadym <sa...@chromium.org>
      Gerrit-Comment-Date: Thu, 03 Jul 2025 04:30:35 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Alex Rudenko <alexr...@chromium.org>
      Comment-In-Reply-To: Andrew Brown <m...@ajbrown.au>
      Comment-In-Reply-To: Maksim Sadym <sa...@chromium.org>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Alex Rudenko (Gerrit)

      unread,
      Jul 3, 2025, 1:24:44 AMJul 3
      to Andrew Brown, Adam Rice, Maksim Sadym, Min Qin, Bo Liu, Hiroki Nakagawa, Takashi Toyoshima, James Maclean, James Su, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, devtools-re...@chromium.org, extension...@chromium.org, chromium-a...@chromium.org, mkwst+w...@chromium.org, horo+...@chromium.org, shimazu+se...@chromium.org, kinuko+ser...@chromium.org, servicewor...@chromium.org, antoniosarto...@chromium.org, kenjibah...@chromium.org, jsbell+ser...@chromium.org, arthursonzog...@chromium.org, blink-revie...@chromium.org, alexmo...@chromium.org, yhanad...@chromium.org, tranbaod...@chromium.org, nona+...@chromium.org, creis...@chromium.org, shuche...@chromium.org, jbauma...@chromium.org, navigation...@chromium.org, keithle...@chromium.org, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
      Attention needed from Adam Rice, Andrew Brown and Maksim Sadym

      Alex Rudenko added 1 comment

      File third_party/blink/renderer/core/inspector/inspector_network_agent.cc
      Line 1015, Patchset 21: headers, std::make_optional(request.GetContextUserAgent())))
      Andrew Brown . unresolved

      I don't think CORS preflights go through this function, as CORS preflights still appear to be UA-less in Devtools (the actual request still has the header, just the inspector's `Network.requestWillBeSent` event is wrong.)

      But also, this behaviour isn't tested ATM (I think?) - the existing tests don't appear to be checking the inspector's view of the preflight, just the network's view of it (in `http/tests/inspector-protocol/emulation/user-agent-override-cors-preflight.js`)

      So, outstanding questions (the last of which I can answer myself, given time):

      • Should there be a test for this behaviour (sending the right UA on a preflight, and making sure Devtools sees it too)?
      • Where do preflights spawn into the inspector code? Preflights are spawned in the network process, as best I can tell (code lives in services/network, not third_party/blink), so I don't know how that information gets sent back to the render process's inspector stuff.
      Alex Rudenko

      I do not think we need to add extra headers in this event. We have requestWillBeSentExtraInfo that should report actual headers set by the network service. Could you please clarify why requestWillBeSentExtraInfo is not sufficient here?

      Andrew Brown

      I'll be honest I am completely unfamiliar with DevTools and didn't know that existed; everything that I've done has been prompted by a few failing tests. My impression (and these changes) are to solve the fact that the new, cors-free "hiding" spot for the UA also needs to be given to the inspector.

      Looking at requestWillBeSentExtraInfo, that seems like exactly what we want here, but this will require some tests to be updated - there's at least 8 tests failing in `web_tests/http/tests/inspector_protocol` that all are expecting a User-Agent to be present on the original `requestWillBeSent` event (which it won't be, anymore).

      I could update those 8 tests to check requestWillBeSentExtraInfo, and then ensure the User-Agent is present there?

      Alex Rudenko

      I think it would be better to not special case the header when reporting from the renderer and update the tests that do not contain the header anymore and make sure that ExtraInfo events from the network service actually contain the correct user agent header via a new test. I would suggest the network reviewers to review the non-DevTools changes first to make sure those are correct.

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Adam Rice
      • Andrew Brown
      • Maksim Sadym
      Gerrit-Attention: Adam Rice <ri...@chromium.org>
      Gerrit-Attention: Andrew Brown <m...@ajbrown.au>
      Gerrit-Attention: Maksim Sadym <sa...@chromium.org>
      Gerrit-Comment-Date: Thu, 03 Jul 2025 05:24:31 +0000
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Alex Rudenko (Gerrit)

      unread,
      Jul 3, 2025, 8:18:05 AMJul 3
      to Andrew Brown, Adam Rice, Maksim Sadym, Min Qin, Bo Liu, Hiroki Nakagawa, Takashi Toyoshima, James Maclean, James Su, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, devtools-re...@chromium.org, extension...@chromium.org, chromium-a...@chromium.org, mkwst+w...@chromium.org, horo+...@chromium.org, shimazu+se...@chromium.org, kinuko+ser...@chromium.org, servicewor...@chromium.org, antoniosarto...@chromium.org, kenjibah...@chromium.org, jsbell+ser...@chromium.org, arthursonzog...@chromium.org, blink-revie...@chromium.org, alexmo...@chromium.org, yhanad...@chromium.org, tranbaod...@chromium.org, nona+...@chromium.org, creis...@chromium.org, shuche...@chromium.org, jbauma...@chromium.org, navigation...@chromium.org, keithle...@chromium.org, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
      Attention needed from Adam Rice, Andrew Brown and Maksim Sadym

      Alex Rudenko added 1 comment

      File third_party/blink/renderer/core/inspector/inspector_network_agent.cc
      Line 1015, Patchset 21: headers, std::make_optional(request.GetContextUserAgent())))
      Andrew Brown . unresolved

      I don't think CORS preflights go through this function, as CORS preflights still appear to be UA-less in Devtools (the actual request still has the header, just the inspector's `Network.requestWillBeSent` event is wrong.)

      But also, this behaviour isn't tested ATM (I think?) - the existing tests don't appear to be checking the inspector's view of the preflight, just the network's view of it (in `http/tests/inspector-protocol/emulation/user-agent-override-cors-preflight.js`)

      So, outstanding questions (the last of which I can answer myself, given time):

      • Should there be a test for this behaviour (sending the right UA on a preflight, and making sure Devtools sees it too)?
      • Where do preflights spawn into the inspector code? Preflights are spawned in the network process, as best I can tell (code lives in services/network, not third_party/blink), so I don't know how that information gets sent back to the render process's inspector stuff.
      Alex Rudenko

      I do not think we need to add extra headers in this event. We have requestWillBeSentExtraInfo that should report actual headers set by the network service. Could you please clarify why requestWillBeSentExtraInfo is not sufficient here?

      Andrew Brown

      I'll be honest I am completely unfamiliar with DevTools and didn't know that existed; everything that I've done has been prompted by a few failing tests. My impression (and these changes) are to solve the fact that the new, cors-free "hiding" spot for the UA also needs to be given to the inspector.

      Looking at requestWillBeSentExtraInfo, that seems like exactly what we want here, but this will require some tests to be updated - there's at least 8 tests failing in `web_tests/http/tests/inspector_protocol` that all are expecting a User-Agent to be present on the original `requestWillBeSent` event (which it won't be, anymore).

      I could update those 8 tests to check requestWillBeSentExtraInfo, and then ensure the User-Agent is present there?

      Alex Rudenko

      I think it would be better to not special case the header when reporting from the renderer and update the tests that do not contain the header anymore and make sure that ExtraInfo events from the network service actually contain the correct user agent header via a new test. I would suggest the network reviewers to review the non-DevTools changes first to make sure those are correct.

      Alex Rudenko

      I was reviewing it again and the user agent actually is set by the client code, right? I wonder why is it no present in `request.HttpHeaderFields()`? It does sound like it should contain it if it is provided by the client.

      Gerrit-Comment-Date: Thu, 03 Jul 2025 12:17:49 +0000
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Alex Rudenko (Gerrit)

      unread,
      Jul 3, 2025, 8:20:15 AMJul 3
      to Andrew Brown, Adam Rice, Maksim Sadym, Min Qin, Bo Liu, Hiroki Nakagawa, Takashi Toyoshima, James Maclean, James Su, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, devtools-re...@chromium.org, extension...@chromium.org, chromium-a...@chromium.org, mkwst+w...@chromium.org, horo+...@chromium.org, shimazu+se...@chromium.org, kinuko+ser...@chromium.org, servicewor...@chromium.org, antoniosarto...@chromium.org, kenjibah...@chromium.org, jsbell+ser...@chromium.org, arthursonzog...@chromium.org, blink-revie...@chromium.org, alexmo...@chromium.org, yhanad...@chromium.org, tranbaod...@chromium.org, nona+...@chromium.org, creis...@chromium.org, shuche...@chromium.org, jbauma...@chromium.org, navigation...@chromium.org, keithle...@chromium.org, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
      Attention needed from Adam Rice, Andrew Brown and Maksim Sadym

      Alex Rudenko added 1 comment

      File third_party/blink/renderer/platform/loader/fetch/resource_request.h
      Line 231, Patchset 23 (Latest): context_user_agent_header_ = user_agent;
      Alex Rudenko . unresolved

      should this still write to the http header field via SetHttpHeaderField even if we need context_user_agent_header_ for the other logic?

      Gerrit-Comment-Date: Thu, 03 Jul 2025 12:20:03 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Andrew Brown (Gerrit)

      unread,
      Jul 3, 2025, 9:17:47 AMJul 3
      to Adam Rice, Maksim Sadym, Alex Rudenko, Min Qin, Bo Liu, Hiroki Nakagawa, Takashi Toyoshima, James Maclean, James Su, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, devtools-re...@chromium.org, extension...@chromium.org, chromium-a...@chromium.org, mkwst+w...@chromium.org, horo+...@chromium.org, shimazu+se...@chromium.org, kinuko+ser...@chromium.org, servicewor...@chromium.org, antoniosarto...@chromium.org, kenjibah...@chromium.org, jsbell+ser...@chromium.org, arthursonzog...@chromium.org, blink-revie...@chromium.org, alexmo...@chromium.org, yhanad...@chromium.org, tranbaod...@chromium.org, nona+...@chromium.org, creis...@chromium.org, shuche...@chromium.org, jbauma...@chromium.org, navigation...@chromium.org, keithle...@chromium.org, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
      Attention needed from Adam Rice, Alex Rudenko and Maksim Sadym

      Andrew Brown added 2 comments

      File third_party/blink/renderer/core/inspector/inspector_network_agent.cc
      Line 1015, Patchset 21: headers, std::make_optional(request.GetContextUserAgent())))
      Andrew Brown . unresolved

      I don't think CORS preflights go through this function, as CORS preflights still appear to be UA-less in Devtools (the actual request still has the header, just the inspector's `Network.requestWillBeSent` event is wrong.)

      But also, this behaviour isn't tested ATM (I think?) - the existing tests don't appear to be checking the inspector's view of the preflight, just the network's view of it (in `http/tests/inspector-protocol/emulation/user-agent-override-cors-preflight.js`)

      So, outstanding questions (the last of which I can answer myself, given time):

      • Should there be a test for this behaviour (sending the right UA on a preflight, and making sure Devtools sees it too)?
      • Where do preflights spawn into the inspector code? Preflights are spawned in the network process, as best I can tell (code lives in services/network, not third_party/blink), so I don't know how that information gets sent back to the render process's inspector stuff.
      Alex Rudenko

      I do not think we need to add extra headers in this event. We have requestWillBeSentExtraInfo that should report actual headers set by the network service. Could you please clarify why requestWillBeSentExtraInfo is not sufficient here?

      Andrew Brown

      I'll be honest I am completely unfamiliar with DevTools and didn't know that existed; everything that I've done has been prompted by a few failing tests. My impression (and these changes) are to solve the fact that the new, cors-free "hiding" spot for the UA also needs to be given to the inspector.

      Looking at requestWillBeSentExtraInfo, that seems like exactly what we want here, but this will require some tests to be updated - there's at least 8 tests failing in `web_tests/http/tests/inspector_protocol` that all are expecting a User-Agent to be present on the original `requestWillBeSent` event (which it won't be, anymore).

      I could update those 8 tests to check requestWillBeSentExtraInfo, and then ensure the User-Agent is present there?

      Alex Rudenko

      I think it would be better to not special case the header when reporting from the renderer and update the tests that do not contain the header anymore and make sure that ExtraInfo events from the network service actually contain the correct user agent header via a new test. I would suggest the network reviewers to review the non-DevTools changes first to make sure those are correct.

      Alex Rudenko

      I was reviewing it again and the user agent actually is set by the client code, right? I wonder why is it no present in `request.HttpHeaderFields()`? It does sound like it should contain it if it is provided by the client.

      Andrew Brown

      I'm not sure if I'm interpreting this right, but I'll attempt to explain; let me know if this helps. (My terminology is crappy, sorry; it's hard to overcome my non-chromium intuition of the definitions of "browser" and "client".)

      Firstly, you're right, the user-agent is set javascript code onto the normal `request.HttpHeaderFields()`. But, any User-Agent value that exists in these headers will cause a CORS OPTIONS request. (The reason it doesn't do this in real Chrome right now is because of the list in `/net/http/http_util.cc`, but that's like, the actual spec bug we're fixing.)

      If we put our internal value (the one that looks like `Mozilla/5.0 Chrome 140.0` etc etc) onto those headers, we'll end up triggering a CORS preflight request on every single web request we ever make.

      So we have to put our internal value somewhere else, so that it can be all combined together later. That somewhere else is (for the moment) the `request.GetContextUserAgent()` (named because the internal value comes from the `FetchContext`).

      Unfortunately, anywhere that we can put the UA that hides it from CORS, also hides it from a lot of other things (including DevTools).

      The alternative approach was to send the context value straight to the network process later on (patchset 19), but I thought I had to make sure it was accessible through a blink::ResourceRequest somewhere in order for DevTools to see it... *but* now I've learned that it's ok for DevTools to just get it in requestWillBeSentExtraInfo later on. So I think I'm going back to the patchset 19 approach.

      File third_party/blink/renderer/platform/loader/fetch/resource_request.h
      Line 231, Patchset 23 (Latest): context_user_agent_header_ = user_agent;
      Alex Rudenko . unresolved

      should this still write to the http header field via SetHttpHeaderField even if we need context_user_agent_header_ for the other logic?

      Andrew Brown

      I attempted to explain in the other comment. In brief, we have to have a separate ContextUserAgent that isn't just an ordinary http header because if we put the special browser user-agent into the ordinary http headers, we end up making CORS preflights on every single request, which is bad.

      Thanks to the suggestion you made about requestWillBeSetExtraInfo, I'm probably going to go back to the approach in patchset 19, where the browser/context/safe User-Agent goes straight onto the `network::ResourceRequest` and doesn't need any special-casing inside resource_request.h.

      So the `SetContextUserAgent()` stuff is not long for this world - I'll get to it tomorrow (AEST), and once that's uploaded, I'll re-ping Adam & Takashi to get another do-over/more thoughts from the network/fetch side. The context-based approach was their suggestion to begin with, but it will inevitably need some tweaks for some weirder (& worse) preflight behaviour that the DevTools testing made me spot.

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Adam Rice
      • Alex Rudenko
      • Maksim Sadym
      Gerrit-Attention: Alex Rudenko <alexr...@chromium.org>
      Gerrit-Attention: Adam Rice <ri...@chromium.org>
      Gerrit-Attention: Maksim Sadym <sa...@chromium.org>
      Gerrit-Comment-Date: Thu, 03 Jul 2025 13:17:23 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Andrew Brown (Gerrit)

      unread,
      Jul 4, 2025, 4:30:12 AMJul 4
      to Adam Rice, Maksim Sadym, Alex Rudenko, Min Qin, Bo Liu, Hiroki Nakagawa, Takashi Toyoshima, James Maclean, James Su, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, devtools-re...@chromium.org, extension...@chromium.org, chromium-a...@chromium.org, mkwst+w...@chromium.org, horo+...@chromium.org, shimazu+se...@chromium.org, kinuko+ser...@chromium.org, servicewor...@chromium.org, antoniosarto...@chromium.org, kenjibah...@chromium.org, jsbell+ser...@chromium.org, arthursonzog...@chromium.org, blink-revie...@chromium.org, alexmo...@chromium.org, yhanad...@chromium.org, tranbaod...@chromium.org, nona+...@chromium.org, creis...@chromium.org, shuche...@chromium.org, jbauma...@chromium.org, navigation...@chromium.org, keithle...@chromium.org, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
      Attention needed from Adam Rice, Alex Rudenko and Takashi Toyoshima

      Andrew Brown added 8 comments

      Patchset-level comments
      File-level comment, Patchset 14:
      Andrew Brown . resolved

      Happy new year everyone! Apologies for dragging this up right as everyone returns from a well-deserved break :)

      Figured I could use some of my summer free time to close this out for good. I worked out (some of, hopefully all) the failing devtools tests, which needed changes inside the preflight-summoning code - tagged Min Qin for review. I'm a little wary that I ended up needing to have weird case handling in the preflight code.

      I have two outstanding questions:

      • I've commented out the assertion in a test for frame_fetch_context. It's expecting that the User-Agent is set after calling PrepareRequest, but because this CL moves it to its own thing, that's no longer the case. Is this test checking something "deeper" that I should work out, or can it be safely removed? (I suspect this is the root cause of a few other test failures, but I never have been able to accurately run the full suite locally.)
      • Do my cases for User-Agent handling make sense: a fetch-set User-Agent overrides a devtools User-Agent overrides the default? I think we've settled this, but it may be different when you consider which User-Agent should be present on preflight OPTIONS requests. At this point, it follows the same order.
      Andrew Brown

      Ok, not quite all the failing devtools tests :(

      Some remaining failures I've traced back down to `ThrottlingURLLoader::StartNow()`, where it enters IPC/inheritance hell. I am almost willing to bet this will characterise all the remianing failures: issues in the various implementations of `URLLoaderFactory::CreateLoaderAndStart`.

      Basically, I have reason to believe there are one or more `URLLoader` implementations that don't combine the `cors_exempt_headers` in with the normal `headers` on a request - similar to the change I've already made in `preflight_controller.cc`. There are different `URLLoader`'s for different things, and I bet the one that deals with extensions will have a problem, and so will the one that deals with non-returning delayed requests for `fetchLater()`.

      Do you have any tips for tracking down which one(s) live on the path below the DevTools (and extension) code? The debug docs are fantastic for working bottom-up, where you have a crash and you need to work out where, but not so helpful for working top-down, where I have correct behaviour and I don't know where it stops.

      There are ~43 different types of `CreateLoaderAndStart` that could lead to my problem, each with their own very large stack of behaviour, and often calling into each other in hard-to-grasp ways. I can work through them eventually, but it's going to take a long time.

      Andrew Brown

      I was *almost* correct; I actually had to tell the parallel stack that the inspector protocol uses, that it still needs to go find the UA elsewhere.

      This means unfortunately all the work to keep the UA inside the FetchContext is useless, because the inspector protocol has no idea what context the request was made in, so there's just no way that the context-based approach is compatible with the behaviour inspector needs. I've gone back to the *original* way I did it, with a new field on the ResourceRequest.

      This lets us keep basically all of the original behaviour (stuff like PrepareRequest being the function call that actually sets the UA onto the blink::ResourceRequest, instead of it happening much later when populating the network::ResourceRequest). So a lot of this CL is now semi-superfluous, as there's still some remnants of the move-to-context (though these remnants are pretty ok, in my estimation. Maybe some string copying behaviour could be optimised, idk.)

      If it works as expected, there should (fingers crossed) be only a few failing tests:

      • ExtensionWebRequestApiPrerenderingTest.Load
      • ExtensionWebRequestApiPrerenderingTest.LoadIntoNewTab (next goal/s)
      • OutOfProcessPPAPITest.URLLoader3
      • PPAPINaClNewlibTest.URLLoader3 (ChromeOS only, so I can't test these locally)

      It may be time for a chromestatus.com entry? I feel like there's a lot of implementation-defined behaviour here that would be good to get more eyes on, and I'm planning to be able to work on this for the next 4-5 weeks straight.

      Andrew Brown

      Done

      File-level comment, Patchset 22:
      Andrew Brown . resolved

      Added Alex Rudenko to review for devtools knowledge... first alphabetical owner, sorry, I get it, my name starts with A too - I have a few changes that touch devtools stuff (in `inspector_network_agent.cc`) that feel like they could be done in smarter ways. Thoughts welcome.

      Also if someone could put it through a CQ dry run again that would be hugely appreciated - locally it looks like the devtools changes might have ended up fixing the remaining tests, but it would be good to check.

      Andrew Brown

      Done

      File-level comment, Patchset 24:
      Andrew Brown . unresolved

      Basically everything except a handful of Extension tests (discussed soon) should pass now -- @ Adam, CQ dry run please?

      That said, I have a few outstanding questions that may need broader conversations to resolve. I don't know if these are answerable with the reviewers I already have, or whether this is time for a chromestatus.com entry and/or emails to other mailing lists for different areas.

      • comments in `request_conversion.cc` are wondering how best to get the context UA over to the network process for OPTIONS requests to use
      • comments in `framework.js` are wondering what to do about any tests that rely/relied on DevTools for stuff
      • comments in `frame_fetch_context_test.cc` are wondering whether the new version of `PrepareRequestWhenDetached` is even remotely useful or sensible

      Importantly, though:

      • lots of tests have changed, especially those that relied on DevTools to see UAs in a `requestWillBeSent` event. How many new tests or modifications to old tests, are needed to make sure the UA is still present on a `requestWillBeSentExtraInfo`?
      • followup, which cases are sufficiently distinct that they're worth different tests for this? I've edited tests that involve redirects, cross-site redirects, etc etc -- can we assume it's all good with one more test for "UA on ExtraInfo" or do we need "UA on ExtraInfo for redirects", "UA on ExtraInfo for preflights", etc?
      Commit Message
      Line 9, Patchset 22:Per spec, fetch & XMLHttpRequest should be able to set custom
      Alex Rudenko . resolved

      could you please link to the parts of the spec that define this behavior?

      Andrew Brown

      It all derives from https://fetch.spec.whatwg.org/#forbidden-request-header -- this list was updated to remove User-Agent in 2015.

      Now User-Agent isn't forbidden, it should be settable by users, and should not be on `net/http/http_util.cc`'s forbidden header list.

      Unfortunately, once you remove it from that list, it also starts always generating CORS preflights. Whether it should send preflights is not directly answered by the spec (it's ambiguous), but we are emulating Firefox's behaviour, as it seems unintuitive to send preflights for every single fetch request ever asking for "User-Agent". Plus, it will break large swathes of the web for things that aren't expecting to have to explicitly say that "User-Agent" is OK.

      There's other discussion on this CL about this, but to summarise where we're at:

      • user-agent set by user: preflight sent
      • user-agent set by devtools or browser: no preflight sent

      So the solution to the CORS issue is that we take the (devtools or browser) UA from the FetchContext, and instead of putting it straight in the headers, we have to hide it around until we get to a state where it won't trigger a CORS preflight.

      Unfortunately this means I've had to run around to a heap of random spots and make sure they're looking in the new spot for the UA, but eh. I probably have to update that description to summarise the new behaviour soon, as it seems to change every 2nd patchset.

      Andrew Brown

      Description is back to being accurate now...

      File chrome/test/data/extensions/api_test/webrequest/framework.js
      Line 296, Patchset 25 (Latest):function checkUserAgent(headers) {
      Andrew Brown . unresolved

      This is the root cause of a couple remaining failures:

      • ExtensionWebRequestApiPrerenderingTest.Load
      • ExtensionWebRequestApiPrerenderingTest.LoadIntoNewTab

      They're using User-Agent as a litmus test for whether the headers on a request are valid, which is fine, but User-Agent is not going to be present on a DevTools "requestWillBeSent" event anymore. So we need a new way to do this.

      File third_party/blink/renderer/core/loader/frame_fetch_context_test.cc
      Line 1565, Patchset 25 (Latest): EXPECT_EQ("hi", GetFetchContext()->GetDefaultUserAgent());
      Andrew Brown . unresolved

      I would resurrect my comments from patchset 14, but they don't link through to the new code.

      Is this test sensible? I feel like it's not, because the name suggests to me that instead of checking UA the new way, we should instead be looking at whether PrepareRequest does it's job -- just using a different litmus test than User-Agent. Advice welcome.

      File third_party/blink/renderer/platform/loader/fetch/resource_request.h
      Line 231, Patchset 23: context_user_agent_header_ = user_agent;
      Alex Rudenko . resolved

      should this still write to the http header field via SetHttpHeaderField even if we need context_user_agent_header_ for the other logic?

      Andrew Brown

      I attempted to explain in the other comment. In brief, we have to have a separate ContextUserAgent that isn't just an ordinary http header because if we put the special browser user-agent into the ordinary http headers, we end up making CORS preflights on every single request, which is bad.

      Thanks to the suggestion you made about requestWillBeSetExtraInfo, I'm probably going to go back to the approach in patchset 19, where the browser/context/safe User-Agent goes straight onto the `network::ResourceRequest` and doesn't need any special-casing inside resource_request.h.

      So the `SetContextUserAgent()` stuff is not long for this world - I'll get to it tomorrow (AEST), and once that's uploaded, I'll re-ping Adam & Takashi to get another do-over/more thoughts from the network/fetch side. The context-based approach was their suggestion to begin with, but it will inevitably need some tweaks for some weirder (& worse) preflight behaviour that the DevTools testing made me spot.

      Andrew Brown

      Now updated and removed.

      File third_party/blink/renderer/platform/loader/fetch/url_loader/request_conversion.cc
      Andrew Brown . unresolved

      See above comment in `preflight_controller.cc` - it's both these pieces of code together.

      The key thing is at this point, we can't put the context UA onto the cors_exempt_headers without potentially accepting dodgy merge behaviour later when they get combined. So we have a `network::ResourceRequest` that has a user UA on the normal headers and *no* UA on the cors_exempt headers, which then goes to `preflight_controller`, which uses the user UA.

      I guess we could work out where the merge happens and make sure we remove the context UA from the `cors_exempt_headers` *if* the user UA is set? But then we need to make sure preflights avoid copying the user UA, too.

      Andrew Brown

      So the state of affairs is thus:

      • If the user provides a UA, it sits on the normal headers. In `request_conversion.cc`, we *can't* put the context UA onto the cors_exempt_headers, because that will actually clobber the user-provided one.
      • If the user doesn't provide a UA, then this code does exactly what it says; there are no issues here about different handling of a DevTools-set value vs an intrinsic browser value.

      But then, later (in `preflight_controller.cc`):

      • If the user didn't provide a UA, then the context UA is present on the cors_exempt_headers, so we can use that and we're good.
      • But if the user did provide a UA, it's present on the normal headers, and so there is no trace of the context UA. This is a big problem, because it means the only UA we have access to for our OPTIONS request is the user one, resulting in silly behaviour.

      I can think of a few ways to resolve this. Thoughts from you as reviewers would be appreciated but also this is getting to be touching stuff outside blink, so if there's another mailing list I should go contact, I'm happy to do that too.

      We could:
      - induce magic behaviour for a User-Agent at the point of merging the two sets of headers (only take the cors_exempt_headers version if the normal isn't there)
      - provide a different place for the context UA to live inside a `network::ResourceRequest` (so that it doesn't get auto-merged from the cors_exempt_headers)
      - we could set this all the time, and never use the cors_exempt_headers, or
      - we could set this only when the user also sets one, so the special-case to look for the new header only occurs in `preflight_controller.cc`)

      I'm going to do a dummy impl of the last option when I next have time, but I'm expecting it will need changes, so hopefully with your thoughts I can get ahead of the curve on a better approach.

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Adam Rice
      • Alex Rudenko
      • Takashi Toyoshima
      Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedNo-Unresolved-Comments
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: Icf56620f99f371ea2f128e6a3194d6096b0d62cd
      Gerrit-Change-Number: 5273743
      Gerrit-PatchSet: 25
      Gerrit-Owner: Andrew Brown <m...@ajbrown.au>
      Gerrit-Reviewer: Adam Rice <ri...@chromium.org>
      Gerrit-Reviewer: Alex Rudenko <alexr...@chromium.org>
      Gerrit-Reviewer: Andrew Brown <m...@ajbrown.au>
      Gerrit-Reviewer: Bo Liu <bo...@chromium.org>
      Gerrit-Reviewer: Maksim Sadym <sa...@chromium.org>
      Gerrit-Reviewer: Min Qin <qin...@chromium.org>
      Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
      Gerrit-CC: Hiroki Nakagawa <nhi...@chromium.org>
      Gerrit-CC: James Maclean <wjma...@chromium.org>
      Gerrit-CC: James Su <su...@chromium.org>
      Gerrit-CC: Nate Chapin <jap...@chromium.org>
      Gerrit-Attention: Adam Rice <ri...@chromium.org>
      Gerrit-Attention: Alex Rudenko <alexr...@chromium.org>
      Gerrit-Attention: Takashi Toyoshima <toyo...@chromium.org>
      Gerrit-Comment-Date: Fri, 04 Jul 2025 08:29:50 +0000
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Takashi Toyoshima (Gerrit)

      unread,
      Jul 14, 2025, 10:20:43 PMJul 14
      to Andrew Brown, Adam Rice, Maksim Sadym, Alex Rudenko, Min Qin, Bo Liu, Hiroki Nakagawa, James Maclean, James Su, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, devtools-re...@chromium.org, extension...@chromium.org, chromium-a...@chromium.org, mkwst+w...@chromium.org, horo+...@chromium.org, shimazu+se...@chromium.org, kinuko+ser...@chromium.org, servicewor...@chromium.org, antoniosarto...@chromium.org, kenjibah...@chromium.org, jsbell+ser...@chromium.org, arthursonzog...@chromium.org, blink-revie...@chromium.org, alexmo...@chromium.org, yhanad...@chromium.org, tranbaod...@chromium.org, nona+...@chromium.org, creis...@chromium.org, shuche...@chromium.org, jbauma...@chromium.org, navigation...@chromium.org, keithle...@chromium.org, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
      Attention needed from Adam Rice and Andrew Brown

      Takashi Toyoshima added 8 comments

      Patchset-level comments
      File-level comment, Patchset 26 (Latest):
      Takashi Toyoshima . resolved

      I tried refreshing my memory, but I'm sorry if I forget the previous discussion and say something inconsistent.

      Commit Message
      Line 15, Patchset 26 (Latest):Fixed: 571722
      Takashi Toyoshima . unresolved

      I think this is an ID for the old bug trackker, and now 40450316 is the right id for this. Can you check if https://crbug.com/40450316 is the right link for your intended bug, and update this number?

      ----

      Please fix this WARNING reported by Commit Message Validation: Did you intend to reference an old bug id? Please ensure this is a valid Buganizer ID and not an external system such as Monorail.

      Analyzer Description: Validates that commit messages conform to a specific format.
      Owner: ayeay...@google.com

      Did you intend to reference an old bug id? Please ensure this is a valid Buganizer ID and not an external system such as Monorail.

      To rerun the analyzer locally, run: `alint -- -c CommitMatch`

      For more information, see go/alint.

      File chrome/test/data/extensions/api_test/webrequest/framework.js
      Line 296, Patchset 25:function checkUserAgent(headers) {
      Andrew Brown . unresolved

      This is the root cause of a couple remaining failures:

      • ExtensionWebRequestApiPrerenderingTest.Load
      • ExtensionWebRequestApiPrerenderingTest.LoadIntoNewTab

      They're using User-Agent as a litmus test for whether the headers on a request are valid, which is fine, but User-Agent is not going to be present on a DevTools "requestWillBeSent" event anymore. So we need a new way to do this.

      Takashi Toyoshima

      Does this need help from qinmin@ ?
      IIUC, this means the webRequest API exposed header is changed, and we need to update the API document, and need an announcement for Extensions developers and enterprise users?

      File services/network/cors/preflight_controller.cc

      preflight_request->cors_exempt_headers.SetHeader(
      net::HttpRequestHeaders::kUserAgent, *user_agent);
      }
      Takashi Toyoshima . unresolved

      This is a duplicated operation as we run the same code at line 220 eventually.
      Can you remove?

      Line 216, Patchset 26 (Latest): // we can't use cors_exempt_headers, so the User-Agent will appear here
      Takashi Toyoshima . unresolved

      Maybe typo?
      I think you means the User-Agent in the normal headers here.
      So, s/cors_exempt_headers/it as it is not trustworthy/ ?

      Also expected behavior here is:
      1. if there is a DevTools provided User-Agent (in cors_exempt_headers), we use it
      2. if there is a JavaScript provided User-Agent (in headers), we ignore it, and use the context given User-Agent.

      Implementation-wise, this can be done simply by
      ```
      std::optional<std::string> user_agent = request.cors_exempt_headers.GetHeader(
      net::HttpRequestHeaders::kUserAgent);
      if (user_agent) {
      // Set DevTools given User-Agent to the preflight request
      preflight_request->headers.SetHeader(

      net::HttpRequestHeaders::kUserAgent, *user_agent);
      } else {
        // Remove JavaScript given User-Agent if it exists, and delegate to //net to set
      // a context given User-Agent
      preflight_request->headers.RemoveHeader(
      net::HttpRequestHeaders::kUserAgent);
      }
      ```
      Line 220, Patchset 21: net::HttpRequestHeaders::kUserAgent, *user_agent);
      Andrew Brown . unresolved

      I think this code has a problem, which is that if the user has set a UA, we don't bother setting the context UA onto the cors_exempt_headers (see below comment in `request_conversion.cc`). So if there's a user UA, a preflight will be sent asking whether UA is an OK header, but *using* the custom UA that the user already set. Which is daft.

      I don't know if we can fix it nicely, as I think we avoided setting UA onto both sets of headers in order to avoid merging issues with them later (header lists have no guaranteed merging behaviour, I think?). So we might have to add a special UA hiding spot to the `network::ResourceRequest` too, which is not great.

      Takashi Toyoshima

      My comment above can be an answer for this problem?

      File services/network/prefetch_matches.cc
      Line 227, Patchset 26 (Latest):// LINT.ThenChange(//tools/metrics/histograms/metadata/network/enums.xml:PrefetchMatchesResourceRequestField)
      Takashi Toyoshima . unresolved

      Please fix this ERROR reported by If This Then That: Changes in the preceding block may need to be reflected in these files: /tools/metrics/histograms/metadata/network/enums.xml If this does not apply, add 'NO_IFTTT=some reason...' to your commit message

      Analyzer Description: Reminders to change files when other files change
      Owner: ayeay...@google.com

      Changes in the preceding block may need to be reflected in these files: /tools/metrics/histograms/metadata/network/enums.xml If this does not apply, add 'NO_IFTTT=some reason...' to your commit message

      To rerun the analyzer locally, run: `alint -- -c IfThisThenAnalyzer`

      For more information, see go/alint.

      File services/network/public/cpp/resource_request.h
      Line 163, Patchset 26 (Latest): // Browser-intrinsic User-Agent string, to be used for preflight requests
      Takashi Toyoshima . unresolved

      This might not be needed if my comment on the preflight_controller.cc works.

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Adam Rice
      • Andrew Brown
      Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedNo-Unresolved-Comments
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: Icf56620f99f371ea2f128e6a3194d6096b0d62cd
      Gerrit-Change-Number: 5273743
      Gerrit-PatchSet: 26
      Gerrit-Owner: Andrew Brown <m...@ajbrown.au>
      Gerrit-Reviewer: Adam Rice <ri...@chromium.org>
      Gerrit-Reviewer: Alex Rudenko <alexr...@chromium.org>
      Gerrit-Reviewer: Andrew Brown <m...@ajbrown.au>
      Gerrit-Reviewer: Bo Liu <bo...@chromium.org>
      Gerrit-Reviewer: Maksim Sadym <sa...@chromium.org>
      Gerrit-Reviewer: Min Qin <qin...@chromium.org>
      Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
      Gerrit-CC: Hiroki Nakagawa <nhi...@chromium.org>
      Gerrit-CC: James Maclean <wjma...@chromium.org>
      Gerrit-CC: James Su <su...@chromium.org>
      Gerrit-CC: Nate Chapin <jap...@chromium.org>
      Gerrit-Attention: Adam Rice <ri...@chromium.org>
      Gerrit-Attention: Andrew Brown <m...@ajbrown.au>
      Gerrit-Comment-Date: Tue, 15 Jul 2025 02:20:18 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Andrew Brown <m...@ajbrown.au>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Takashi Toyoshima (Gerrit)

      unread,
      Jul 14, 2025, 10:23:03 PMJul 14
      to Andrew Brown, Takashi Nakayama, Adam Rice, Maksim Sadym, Alex Rudenko, Min Qin, Bo Liu, Hiroki Nakagawa, James Maclean, James Su, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, devtools-re...@chromium.org, extension...@chromium.org, chromium-a...@chromium.org, mkwst+w...@chromium.org, horo+...@chromium.org, shimazu+se...@chromium.org, kinuko+ser...@chromium.org, servicewor...@chromium.org, antoniosarto...@chromium.org, kenjibah...@chromium.org, jsbell+ser...@chromium.org, arthursonzog...@chromium.org, blink-revie...@chromium.org, alexmo...@chromium.org, yhanad...@chromium.org, tranbaod...@chromium.org, nona+...@chromium.org, creis...@chromium.org, shuche...@chromium.org, jbauma...@chromium.org, navigation...@chromium.org, keithle...@chromium.org, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
      Attention needed from Adam Rice, Andrew Brown and Takashi Nakayama

      Takashi Toyoshima added 1 comment

      Patchset-level comments
      Takashi Toyoshima . resolved

      cc: tnak as this is a User-Agent related CL.

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Adam Rice
      • Andrew Brown
      • Takashi Nakayama
      Gerrit-CC: Takashi Nakayama <tn...@chromium.org>
      Gerrit-Attention: Adam Rice <ri...@chromium.org>
      Gerrit-Attention: Takashi Nakayama <tn...@chromium.org>
      Gerrit-Attention: Andrew Brown <m...@ajbrown.au>
      Gerrit-Comment-Date: Tue, 15 Jul 2025 02:22:35 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Andrew Brown (Gerrit)

      unread,
      Jul 21, 2025, 5:30:32 AMJul 21
      to Takashi Nakayama, Adam Rice, Maksim Sadym, Alex Rudenko, Min Qin, Bo Liu, Hiroki Nakagawa, Takashi Toyoshima, James Maclean, James Su, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, devtools-re...@chromium.org, extension...@chromium.org, chromium-a...@chromium.org, mkwst+w...@chromium.org, horo+...@chromium.org, shimazu+se...@chromium.org, kinuko+ser...@chromium.org, servicewor...@chromium.org, antoniosarto...@chromium.org, kenjibah...@chromium.org, jsbell+ser...@chromium.org, arthursonzog...@chromium.org, blink-revie...@chromium.org, alexmo...@chromium.org, yhanad...@chromium.org, tranbaod...@chromium.org, nona+...@chromium.org, creis...@chromium.org, shuche...@chromium.org, jbauma...@chromium.org, navigation...@chromium.org, keithle...@chromium.org, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
      Attention needed from Adam Rice and Takashi Toyoshima

      Andrew Brown added 7 comments

      Patchset-level comments
      Takashi Toyoshima . resolved

      I tried refreshing my memory, but I'm sorry if I forget the previous discussion and say something inconsistent.

      Andrew Brown

      That's totally ok, this CL is so old & complex now I keep forgetting bits too.

      File-level comment, Patchset 27 (Latest):
      Andrew Brown . unresolved

      Apologies, the next patchset will take some time for me to upload as `git-credential-luci` has logged me out and is now forcing me to update my system to glibc 2.38. I've been meaning to switch distros for a while now so I guess this is as good an excuse as any.

      Commit Message
      Line 15, Patchset 26:Fixed: 571722
      Takashi Toyoshima . resolved

      I think this is an ID for the old bug trackker, and now 40450316 is the right id for this. Can you check if https://crbug.com/40450316 is the right link for your intended bug, and update this number?

      ----

      Please fix this WARNING reported by Commit Message Validation: Did you intend to reference an old bug id? Please ensure this is a valid Buganizer ID and not an external system such as Monorail.

      Analyzer Description: Validates that commit messages conform to a specific format.
      Owner: ayeay...@google.com

      Did you intend to reference an old bug id? Please ensure this is a valid Buganizer ID and not an external system such as Monorail.

      To rerun the analyzer locally, run: `alint -- -c CommitMatch`

      For more information, see go/alint.

      Andrew Brown

      Done :)

      File chrome/test/data/extensions/api_test/webrequest/framework.js
      Line 296, Patchset 25:function checkUserAgent(headers) {
      Andrew Brown . unresolved

      This is the root cause of a couple remaining failures:

      • ExtensionWebRequestApiPrerenderingTest.Load
      • ExtensionWebRequestApiPrerenderingTest.LoadIntoNewTab

      They're using User-Agent as a litmus test for whether the headers on a request are valid, which is fine, but User-Agent is not going to be present on a DevTools "requestWillBeSent" event anymore. So we need a new way to do this.

      Takashi Toyoshima

      Does this need help from qinmin@ ?
      IIUC, this means the webRequest API exposed header is changed, and we need to update the API document, and need an announcement for Extensions developers and enterprise users?

      Andrew Brown

      Hmm. I think at the moment, yes, but that should actually be fixable.

      My first idea is to ensure that the extensions stack combines the `cors_exempt_headers` into any headers returned to the user. I don't know if this is acceptable from a duplication-of-code-behaviour standpoint -- is it ok to have a bunch of places scattered around the code that pseudo-implement the network process's header merging behaviour?

      The thing is, I'm uncovering a lot of behaviour that's always been "wrong", but has always been "good enough" -- lots of places where the code only considers `network::ResourceRequest`'s |headers| without combining the |cors_exempt_headers|.

      Until now, |cors_exempt_headers| were niche, so it didn't matter, but now, User-Agent is on there... and lots of things care about User-Agent.

      I'll try to "fix" the tests by reintroducing the User-Agent to the webRequest API first, and then get qinmin@ 's thoughts on implementation detail.

      File services/network/cors/preflight_controller.cc
      Line 209, Patchset 26: if (user_agent) {

      preflight_request->cors_exempt_headers.SetHeader(
      net::HttpRequestHeaders::kUserAgent, *user_agent);
      }
      Takashi Toyoshima . resolved

      This is a duplicated operation as we run the same code at line 220 eventually.
      Can you remove?

      Andrew Brown

      Yeah, I can condense that down. Good spot.

      Line 216, Patchset 26: // we can't use cors_exempt_headers, so the User-Agent will appear here
      Takashi Toyoshima . unresolved

      Maybe typo?
      I think you means the User-Agent in the normal headers here.
      So, s/cors_exempt_headers/it as it is not trustworthy/ ?

      Also expected behavior here is:
      1. if there is a DevTools provided User-Agent (in cors_exempt_headers), we use it
      2. if there is a JavaScript provided User-Agent (in headers), we ignore it, and use the context given User-Agent.

      Implementation-wise, this can be done simply by
      ```
      std::optional<std::string> user_agent = request.cors_exempt_headers.GetHeader(
      net::HttpRequestHeaders::kUserAgent);
      if (user_agent) {
      // Set DevTools given User-Agent to the preflight request
      preflight_request->headers.SetHeader(
      net::HttpRequestHeaders::kUserAgent, *user_agent);
      } else {
      // Remove JavaScript given User-Agent if it exists, and delegate to //net to set
      // a context given User-Agent
      preflight_request->headers.RemoveHeader(
      net::HttpRequestHeaders::kUserAgent);
      }
      ```
      Andrew Brown

      I think my comments here aren't quite clear about the obscure boxes that we have to tick. In this case, the problem is when we have *both* a UA from fetch and a UA from DevTools.

      There are 4(+2) cases:

      • No UA at all: no preflight / send request with intrinsic UA
      • Fetch UA present: send preflight with intrinsic UA / send request with fetch UA
      • DevTools override & No UA on fetch: no preflight / send request with DevTools UA
      • DevTools override & Fetch UA present: send preflight with DevTools UA / send request with fetch UA
      • Plus,
      • no UA at all, but preflight generated by another header: send preflight and request with intrinsic UA
      • DevTools override & preflight generated by another header: send preflight and request with DevTools UA

      (The problem is case 4, and *not* either of the bonus cases - i.e. the problem only happens when a DevTools UA *and* a fetch UA are both present.)
      The reason this is an issue is because in `request_conversion.cc`, there's already a fetch UA on the `headers`. We can't put the devtools UA on the `cors_exempt_headers`, because that overrides the fetch UA on the normal `headers`.

      If we don't do anything extra (like the code you suggest above) then it's fine, but in case 4, what happens is blink simply doesn't have the ability to send through the DevTools-overridden User-Agent, so the preflight is made with the original, browser-intrinsic string.

      My current (local) code correctly handles all of these cases, but needs to use the `context_user_agent_for_preflights` as a bonus field to hold the DevTools UA when a fetch UA is already on the normal |headers|. I think the name is not particularly clear, and will clean up comments & naming in the next patchset.

      File services/network/prefetch_matches.cc
      Line 227, Patchset 26:// LINT.ThenChange(//tools/metrics/histograms/metadata/network/enums.xml:PrefetchMatchesResourceRequestField)
      Takashi Toyoshima . resolved

      Please fix this ERROR reported by If This Then That: Changes in the preceding block may need to be reflected in these files: /tools/metrics/histograms/metadata/network/enums.xml If this does not apply, add 'NO_IFTTT=some reason...' to your commit message

      Analyzer Description: Reminders to change files when other files change
      Owner: ayeay...@google.com

      Changes in the preceding block may need to be reflected in these files: /tools/metrics/histograms/metadata/network/enums.xml If this does not apply, add 'NO_IFTTT=some reason...' to your commit message

      To rerun the analyzer locally, run: `alint -- -c IfThisThenAnalyzer`

      For more information, see go/alint.

      Andrew Brown

      Done.

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Adam Rice
      • Takashi Toyoshima
      Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedNo-Unresolved-Comments
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: Icf56620f99f371ea2f128e6a3194d6096b0d62cd
      Gerrit-Change-Number: 5273743
      Gerrit-PatchSet: 27
      Gerrit-Owner: Andrew Brown <m...@ajbrown.au>
      Gerrit-Reviewer: Adam Rice <ri...@chromium.org>
      Gerrit-Reviewer: Alex Rudenko <alexr...@chromium.org>
      Gerrit-Reviewer: Andrew Brown <m...@ajbrown.au>
      Gerrit-Reviewer: Bo Liu <bo...@chromium.org>
      Gerrit-Reviewer: Maksim Sadym <sa...@chromium.org>
      Gerrit-Reviewer: Min Qin <qin...@chromium.org>
      Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
      Gerrit-CC: Hiroki Nakagawa <nhi...@chromium.org>
      Gerrit-CC: James Maclean <wjma...@chromium.org>
      Gerrit-CC: James Su <su...@chromium.org>
      Gerrit-CC: Nate Chapin <jap...@chromium.org>
      Gerrit-CC: Takashi Nakayama <tn...@chromium.org>
      Gerrit-Attention: Adam Rice <ri...@chromium.org>
      Gerrit-Attention: Takashi Toyoshima <toyo...@chromium.org>
      Gerrit-Comment-Date: Mon, 21 Jul 2025 09:30:06 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Andrew Brown <m...@ajbrown.au>
      Comment-In-Reply-To: Takashi Toyoshima <toyo...@chromium.org>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Takashi Toyoshima (Gerrit)

      unread,
      Jul 21, 2025, 11:22:52 PMJul 21
      to Andrew Brown, Takashi Nakayama, Adam Rice, Maksim Sadym, Alex Rudenko, Min Qin, Bo Liu, Hiroki Nakagawa, James Maclean, James Su, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, devtools-re...@chromium.org, extension...@chromium.org, chromium-a...@chromium.org, mkwst+w...@chromium.org, horo+...@chromium.org, shimazu+se...@chromium.org, kinuko+ser...@chromium.org, servicewor...@chromium.org, antoniosarto...@chromium.org, kenjibah...@chromium.org, jsbell+ser...@chromium.org, arthursonzog...@chromium.org, blink-revie...@chromium.org, alexmo...@chromium.org, yhanad...@chromium.org, tranbaod...@chromium.org, nona+...@chromium.org, creis...@chromium.org, shuche...@chromium.org, jbauma...@chromium.org, navigation...@chromium.org, keithle...@chromium.org, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
      Attention needed from Adam Rice and Andrew Brown

      Takashi Toyoshima added 6 comments

      File services/network/cors/preflight_controller.cc
      Takashi Toyoshima

      Ah, OK. I think you are saying about the MergeFrom() operations at ConfigureUrRequest in //services/network/url_loader_util.cc or URLLoader::FollowRedirect in //services/network/url_loader.cc where we override `headers` content with `cors_exempt_headers`.

      So, in such a case, how about clarifying the User-Agent handling more clearly.

      • headers['User-Agent']: value that was set by JavaScript
      • content_user_agent: default value that is defined by the browser (and can be overridden by DevTools)
      • cors_exempt_headers['User-Agent']: forbidden (remove 'User-Agent' exempt from the cors_exempt_header_list to ensure there is no other use cases)
      File services/network/prefetch_matches.cc
      Line 227, Patchset 26:// LINT.ThenChange(//tools/metrics/histograms/metadata/network/enums.xml:PrefetchMatchesResourceRequestField)
      Takashi Toyoshima . unresolved

      Please fix this ERROR reported by If This Then That: Changes in the preceding block may need to be reflected in these files: /tools/metrics/histograms/metadata/network/enums.xml If this does not apply, add 'NO_IFTTT=some reason...' to your commit message

      Analyzer Description: Reminders to change files when other files change
      Owner: ayeay...@google.com

      Changes in the preceding block may need to be reflected in these files: /tools/metrics/histograms/metadata/network/enums.xml If this does not apply, add 'NO_IFTTT=some reason...' to your commit message

      To rerun the analyzer locally, run: `alint -- -c IfThisThenAnalyzer`

      For more information, see go/alint.

      Andrew Brown

      Done.

      Takashi Toyoshima

      Not yet?
      We need to make an update also on //tools/metrics/histograms/metadata/network/enums.xml as the LINT error suggested.

      File services/network/public/cpp/resource_request.h
      Line 165, Patchset 27 (Latest): std::optional<std::string> context_user_agent_for_preflights = std::nullopt;
      Takashi Toyoshima . unresolved

      I prefer to drop "_for_preflights" suffix here as this information itself doesn't have any restriction for the usage.

      Also, I think this is not working over IPC now?
      As ResourceRequest is mapped to mojom::URLRequest, we also need to update url_request.mojom, and url_request_mojom_traits.*.
      You can check services/network/public/mojom/BUILD.gn to check the typemap for this class.

      File third_party/blink/renderer/platform/loader/fetch/fetch_context.h
      Line 200, Patchset 27 (Latest): virtual String GetDefaultUserAgent() const { NOTREACHED(); }
      Takashi Toyoshima . unresolved

      Can you drop the default implementation instead of adding NOTREACHED?
      We will prefer the compile time check rather than runtime check for this.

      File third_party/blink/renderer/platform/loader/fetch/resource_request.h
      Line 789, Patchset 27 (Latest): // The browser-supplied User-Agent string (comes from NetworkContext)
      Takashi Toyoshima . unresolved

      Do you mean FetchContext?

      File third_party/blink/renderer/platform/loader/fetch/url_loader/request_conversion.cc
      Line 309, Patchset 27 (Latest): dest->cors_exempt_headers.SetHeader(net::HttpRequestHeaders::kUserAgent,
      context_default_user_agent.Utf8());
      Takashi Toyoshima . unresolved

      So, can we set it always to the context_user_agent_for_preflights?

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Adam Rice
      • Andrew Brown
      Gerrit-Attention: Andrew Brown <m...@ajbrown.au>
      Gerrit-Comment-Date: Tue, 22 Jul 2025 03:22:29 +0000
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Andrew Brown (Gerrit)

      unread,
      Jul 24, 2025, 12:41:12 AMJul 24
      to Chromium Metrics Reviews, Takashi Nakayama, Adam Rice, Maksim Sadym, Alex Rudenko, Min Qin, Bo Liu, Hiroki Nakagawa, Takashi Toyoshima, James Maclean, James Su, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, asvitkine...@chromium.org, devtools-re...@chromium.org, extension...@chromium.org, chromium-a...@chromium.org, mkwst+w...@chromium.org, horo+...@chromium.org, shimazu+se...@chromium.org, kinuko+ser...@chromium.org, servicewor...@chromium.org, antoniosarto...@chromium.org, kenjibah...@chromium.org, jsbell+ser...@chromium.org, arthursonzog...@chromium.org, blink-revie...@chromium.org, alexmo...@chromium.org, yhanad...@chromium.org, tranbaod...@chromium.org, nona+...@chromium.org, creis...@chromium.org, shuche...@chromium.org, jbauma...@chromium.org, navigation...@chromium.org, keithle...@chromium.org, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
      Attention needed from Takashi Toyoshima

      Andrew Brown added 12 comments

      Patchset-level comments
      File-level comment, Patchset 24:
      Andrew Brown . resolved

      Basically everything except a handful of Extension tests (discussed soon) should pass now -- @ Adam, CQ dry run please?

      That said, I have a few outstanding questions that may need broader conversations to resolve. I don't know if these are answerable with the reviewers I already have, or whether this is time for a chromestatus.com entry and/or emails to other mailing lists for different areas.

      • comments in `request_conversion.cc` are wondering how best to get the context UA over to the network process for OPTIONS requests to use
      • comments in `framework.js` are wondering what to do about any tests that rely/relied on DevTools for stuff
      • comments in `frame_fetch_context_test.cc` are wondering whether the new version of `PrepareRequestWhenDetached` is even remotely useful or sensible

      Importantly, though:

      • lots of tests have changed, especially those that relied on DevTools to see UAs in a `requestWillBeSent` event. How many new tests or modifications to old tests, are needed to make sure the UA is still present on a `requestWillBeSentExtraInfo`?
      • followup, which cases are sufficiently distinct that they're worth different tests for this? I've edited tests that involve redirects, cross-site redirects, etc etc -- can we assume it's all good with one more test for "UA on ExtraInfo" or do we need "UA on ExtraInfo for redirects", "UA on ExtraInfo for preflights", etc?
      Andrew Brown

      Done

      File services/network/cors/preflight_controller.cc
      Andrew Brown

      That sounds like a good idea to me -- implemented. A CQ run will probably identify a ton of places I've missed that need the new UA merged, but que sera.

      Line 220, Patchset 21: net::HttpRequestHeaders::kUserAgent, *user_agent);
      Andrew Brown . resolved

      I think this code has a problem, which is that if the user has set a UA, we don't bother setting the context UA onto the cors_exempt_headers (see below comment in `request_conversion.cc`). So if there's a user UA, a preflight will be sent asking whether UA is an OK header, but *using* the custom UA that the user already set. Which is daft.

      I don't know if we can fix it nicely, as I think we avoided setting UA onto both sets of headers in order to avoid merging issues with them later (header lists have no guaranteed merging behaviour, I think?). So we might have to add a special UA hiding spot to the `network::ResourceRequest` too, which is not great.

      Takashi Toyoshima

      My comment above can be an answer for this problem?

      Andrew Brown

      Done via content_user_agent.

      File services/network/prefetch_matches.cc
      Line 227, Patchset 26:// LINT.ThenChange(//tools/metrics/histograms/metadata/network/enums.xml:PrefetchMatchesResourceRequestField)
      Takashi Toyoshima . resolved

      Please fix this ERROR reported by If This Then That: Changes in the preceding block may need to be reflected in these files: /tools/metrics/histograms/metadata/network/enums.xml If this does not apply, add 'NO_IFTTT=some reason...' to your commit message

      Analyzer Description: Reminders to change files when other files change
      Owner: ayeay...@google.com

      Changes in the preceding block may need to be reflected in these files: /tools/metrics/histograms/metadata/network/enums.xml If this does not apply, add 'NO_IFTTT=some reason...' to your commit message

      To rerun the analyzer locally, run: `alint -- -c IfThisThenAnalyzer`

      For more information, see go/alint.

      Andrew Brown

      Done.

      Takashi Toyoshima

      Not yet?
      We need to make an update also on //tools/metrics/histograms/metadata/network/enums.xml as the LINT error suggested.

      Andrew Brown

      Sorry, yes, I had done it locally, but couldn't upload (glibc issues, now resolved).

      File services/network/public/cpp/resource_request.h
      Line 165, Patchset 27: std::optional<std::string> context_user_agent_for_preflights = std::nullopt;
      Takashi Toyoshima . resolved

      I prefer to drop "_for_preflights" suffix here as this information itself doesn't have any restriction for the usage.

      Also, I think this is not working over IPC now?
      As ResourceRequest is mapped to mojom::URLRequest, we also need to update url_request.mojom, and url_request_mojom_traits.*.
      You can check services/network/public/mojom/BUILD.gn to check the typemap for this class.

      Andrew Brown

      Yeah, I discovered that locally too. It should be fully implemented now.

      Line 163, Patchset 26: // Browser-intrinsic User-Agent string, to be used for preflight requests
      Takashi Toyoshima . resolved

      This might not be needed if my comment on the preflight_controller.cc works.

      Andrew Brown

      Done

      File services/network/public/mojom/url_request.mojom
      Line 285, Patchset 28: // already set a User-Agent via fetch.
      Andrew Brown . unresolved

      Is the terminology in this comment sensible?

      File third_party/blink/renderer/core/inspector/inspector_network_agent.cc
      Line 1015, Patchset 21: headers, std::make_optional(request.GetContextUserAgent())))
      Andrew Brown . resolved

      I don't think CORS preflights go through this function, as CORS preflights still appear to be UA-less in Devtools (the actual request still has the header, just the inspector's `Network.requestWillBeSent` event is wrong.)

      But also, this behaviour isn't tested ATM (I think?) - the existing tests don't appear to be checking the inspector's view of the preflight, just the network's view of it (in `http/tests/inspector-protocol/emulation/user-agent-override-cors-preflight.js`)

      So, outstanding questions (the last of which I can answer myself, given time):

      • Should there be a test for this behaviour (sending the right UA on a preflight, and making sure Devtools sees it too)?
      • Where do preflights spawn into the inspector code? Preflights are spawned in the network process, as best I can tell (code lives in services/network, not third_party/blink), so I don't know how that information gets sent back to the render process's inspector stuff.
      Alex Rudenko

      I do not think we need to add extra headers in this event. We have requestWillBeSentExtraInfo that should report actual headers set by the network service. Could you please clarify why requestWillBeSentExtraInfo is not sufficient here?

      Andrew Brown

      I'll be honest I am completely unfamiliar with DevTools and didn't know that existed; everything that I've done has been prompted by a few failing tests. My impression (and these changes) are to solve the fact that the new, cors-free "hiding" spot for the UA also needs to be given to the inspector.

      Looking at requestWillBeSentExtraInfo, that seems like exactly what we want here, but this will require some tests to be updated - there's at least 8 tests failing in `web_tests/http/tests/inspector_protocol` that all are expecting a User-Agent to be present on the original `requestWillBeSent` event (which it won't be, anymore).

      I could update those 8 tests to check requestWillBeSentExtraInfo, and then ensure the User-Agent is present there?

      Alex Rudenko

      I think it would be better to not special case the header when reporting from the renderer and update the tests that do not contain the header anymore and make sure that ExtraInfo events from the network service actually contain the correct user agent header via a new test. I would suggest the network reviewers to review the non-DevTools changes first to make sure those are correct.

      Alex Rudenko

      I was reviewing it again and the user agent actually is set by the client code, right? I wonder why is it no present in `request.HttpHeaderFields()`? It does sound like it should contain it if it is provided by the client.

      Andrew Brown

      I'm not sure if I'm interpreting this right, but I'll attempt to explain; let me know if this helps. (My terminology is crappy, sorry; it's hard to overcome my non-chromium intuition of the definitions of "browser" and "client".)

      Firstly, you're right, the user-agent is set javascript code onto the normal `request.HttpHeaderFields()`. But, any User-Agent value that exists in these headers will cause a CORS OPTIONS request. (The reason it doesn't do this in real Chrome right now is because of the list in `/net/http/http_util.cc`, but that's like, the actual spec bug we're fixing.)

      If we put our internal value (the one that looks like `Mozilla/5.0 Chrome 140.0` etc etc) onto those headers, we'll end up triggering a CORS preflight request on every single web request we ever make.

      So we have to put our internal value somewhere else, so that it can be all combined together later. That somewhere else is (for the moment) the `request.GetContextUserAgent()` (named because the internal value comes from the `FetchContext`).

      Unfortunately, anywhere that we can put the UA that hides it from CORS, also hides it from a lot of other things (including DevTools).

      The alternative approach was to send the context value straight to the network process later on (patchset 19), but I thought I had to make sure it was accessible through a blink::ResourceRequest somewhere in order for DevTools to see it... *but* now I've learned that it's ok for DevTools to just get it in requestWillBeSentExtraInfo later on. So I think I'm going back to the patchset 19 approach.

      Andrew Brown

      Done

      File third_party/blink/renderer/platform/loader/fetch/fetch_context.h
      Line 200, Patchset 27: virtual String GetDefaultUserAgent() const { NOTREACHED(); }
      Takashi Toyoshima . unresolved

      Can you drop the default implementation instead of adding NOTREACHED?
      We will prefer the compile time check rather than runtime check for this.

      Andrew Brown

      I don't think we can, unfortunately -- e.g. `GetFeatureContext()` or `GetPermissionsPolicy()` just below. I think there has to be a default implementation.

      I'm not 100% confident on C++ internals, but I think the issue is that `fetch_context.h/cc` actually gets compiled into some real code at some point, so if you don't have a default implementation, the linker errors out.

      File third_party/blink/renderer/platform/loader/fetch/resource_request.h
      Line 789, Patchset 27: // The browser-supplied User-Agent string (comes from NetworkContext)
      Takashi Toyoshima . resolved

      Do you mean FetchContext?

      Andrew Brown

      Actually, this code isn't needed anymore -- removed entirely.

      File third_party/blink/renderer/platform/loader/fetch/url_loader/request_conversion.cc
      Line 310, Patchset 21: }
      Andrew Brown . resolved

      See above comment in `preflight_controller.cc` - it's both these pieces of code together.

      The key thing is at this point, we can't put the context UA onto the cors_exempt_headers without potentially accepting dodgy merge behaviour later when they get combined. So we have a `network::ResourceRequest` that has a user UA on the normal headers and *no* UA on the cors_exempt headers, which then goes to `preflight_controller`, which uses the user UA.

      I guess we could work out where the merge happens and make sure we remove the context UA from the `cors_exempt_headers` *if* the user UA is set? But then we need to make sure preflights avoid copying the user UA, too.

      Andrew Brown

      So the state of affairs is thus:

      • If the user provides a UA, it sits on the normal headers. In `request_conversion.cc`, we *can't* put the context UA onto the cors_exempt_headers, because that will actually clobber the user-provided one.
      • If the user doesn't provide a UA, then this code does exactly what it says; there are no issues here about different handling of a DevTools-set value vs an intrinsic browser value.

      But then, later (in `preflight_controller.cc`):

      • If the user didn't provide a UA, then the context UA is present on the cors_exempt_headers, so we can use that and we're good.
      • But if the user did provide a UA, it's present on the normal headers, and so there is no trace of the context UA. This is a big problem, because it means the only UA we have access to for our OPTIONS request is the user one, resulting in silly behaviour.

      I can think of a few ways to resolve this. Thoughts from you as reviewers would be appreciated but also this is getting to be touching stuff outside blink, so if there's another mailing list I should go contact, I'm happy to do that too.

      We could:
      - induce magic behaviour for a User-Agent at the point of merging the two sets of headers (only take the cors_exempt_headers version if the normal isn't there)
      - provide a different place for the context UA to live inside a `network::ResourceRequest` (so that it doesn't get auto-merged from the cors_exempt_headers)
      - we could set this all the time, and never use the cors_exempt_headers, or
      - we could set this only when the user also sets one, so the special-case to look for the new header only occurs in `preflight_controller.cc`)

      I'm going to do a dummy impl of the last option when I next have time, but I'm expecting it will need changes, so hopefully with your thoughts I can get ahead of the curve on a better approach.

      Andrew Brown

      Done

      Line 309, Patchset 27: dest->cors_exempt_headers.SetHeader(net::HttpRequestHeaders::kUserAgent,
      context_default_user_agent.Utf8());
      Takashi Toyoshima . resolved

      So, can we set it always to the context_user_agent_for_preflights?

      Andrew Brown

      Yeah, we can now just always put the context version on the content_user_agent; the actual value from the |headers| doesn't matter at this point.

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Takashi Toyoshima
      Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedNo-Unresolved-Comments
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: Icf56620f99f371ea2f128e6a3194d6096b0d62cd
      Gerrit-Change-Number: 5273743
      Gerrit-PatchSet: 29
      Gerrit-Owner: Andrew Brown <m...@ajbrown.au>
      Gerrit-Reviewer: Adam Rice <ri...@chromium.org>
      Gerrit-Reviewer: Alex Rudenko <alexr...@chromium.org>
      Gerrit-Reviewer: Andrew Brown <m...@ajbrown.au>
      Gerrit-Reviewer: Bo Liu <bo...@chromium.org>
      Gerrit-Reviewer: Maksim Sadym <sa...@chromium.org>
      Gerrit-Reviewer: Min Qin <qin...@chromium.org>
      Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
      Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
      Gerrit-CC: Hiroki Nakagawa <nhi...@chromium.org>
      Gerrit-CC: James Maclean <wjma...@chromium.org>
      Gerrit-CC: James Su <su...@chromium.org>
      Gerrit-CC: Nate Chapin <jap...@chromium.org>
      Gerrit-CC: Takashi Nakayama <tn...@chromium.org>
      Gerrit-Attention: Takashi Toyoshima <toyo...@chromium.org>
      Gerrit-Comment-Date: Thu, 24 Jul 2025 04:40:49 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Alex Rudenko <alexr...@chromium.org>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Andrew Brown (Gerrit)

      unread,
      Jul 24, 2025, 12:42:15 AMJul 24
      to Chromium Metrics Reviews, Takashi Nakayama, Adam Rice, Maksim Sadym, Alex Rudenko, Min Qin, Bo Liu, Hiroki Nakagawa, Takashi Toyoshima, James Maclean, James Su, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, asvitkine...@chromium.org, devtools-re...@chromium.org, extension...@chromium.org, chromium-a...@chromium.org, mkwst+w...@chromium.org, horo+...@chromium.org, shimazu+se...@chromium.org, kinuko+ser...@chromium.org, servicewor...@chromium.org, antoniosarto...@chromium.org, kenjibah...@chromium.org, jsbell+ser...@chromium.org, arthursonzog...@chromium.org, blink-revie...@chromium.org, alexmo...@chromium.org, yhanad...@chromium.org, tranbaod...@chromium.org, nona+...@chromium.org, creis...@chromium.org, shuche...@chromium.org, jbauma...@chromium.org, navigation...@chromium.org, keithle...@chromium.org, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
      Attention needed from Takashi Toyoshima

      Andrew Brown added 1 comment

      Patchset-level comments
      File-level comment, Patchset 27:
      Andrew Brown . resolved

      Apologies, the next patchset will take some time for me to upload as `git-credential-luci` has logged me out and is now forcing me to update my system to glibc 2.38. I've been meaning to switch distros for a while now so I guess this is as good an excuse as any.

      Andrew Brown

      Done.

      Gerrit-Comment-Date: Thu, 24 Jul 2025 04:41:44 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Andrew Brown <m...@ajbrown.au>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Takashi Toyoshima (Gerrit)

      unread,
      Jul 25, 2025, 12:15:38 AMJul 25
      to Andrew Brown, Chromium Metrics Reviews, Takashi Nakayama, Adam Rice, Maksim Sadym, Alex Rudenko, Min Qin, Bo Liu, Hiroki Nakagawa, James Maclean, James Su, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, asvitkine...@chromium.org, devtools-re...@chromium.org, extension...@chromium.org, chromium-a...@chromium.org, mkwst+w...@chromium.org, horo+...@chromium.org, shimazu+se...@chromium.org, kinuko+ser...@chromium.org, servicewor...@chromium.org, antoniosarto...@chromium.org, kenjibah...@chromium.org, jsbell+ser...@chromium.org, arthursonzog...@chromium.org, blink-revie...@chromium.org, alexmo...@chromium.org, yhanad...@chromium.org, tranbaod...@chromium.org, nona+...@chromium.org, creis...@chromium.org, shuche...@chromium.org, jbauma...@chromium.org, navigation...@chromium.org, keithle...@chromium.org, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
      Attention needed from Andrew Brown

      Takashi Toyoshima voted and added 1 comment

      Votes added by Takashi Toyoshima

      Commit-Queue+1

      1 comment

      File services/network/cors/preflight_controller.cc
      Takashi Toyoshima

      thanks. let me trigger the CQ+1 to check it.

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Andrew Brown
      Gerrit-Attention: Andrew Brown <m...@ajbrown.au>
      Gerrit-Comment-Date: Fri, 25 Jul 2025 04:15:01 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Andrew Brown (Gerrit)

      unread,
      Jul 26, 2025, 10:33:48 PMJul 26
      to Takashi Toyoshima, Chromium Metrics Reviews, Takashi Nakayama, Adam Rice, Maksim Sadym, Alex Rudenko, Min Qin, Bo Liu, Hiroki Nakagawa, James Maclean, James Su, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, asvitkine...@chromium.org, devtools-re...@chromium.org, extension...@chromium.org, chromium-a...@chromium.org, mkwst+w...@chromium.org, horo+...@chromium.org, shimazu+se...@chromium.org, kinuko+ser...@chromium.org, servicewor...@chromium.org, antoniosarto...@chromium.org, kenjibah...@chromium.org, jsbell+ser...@chromium.org, arthursonzog...@chromium.org, blink-revie...@chromium.org, alexmo...@chromium.org, yhanad...@chromium.org, tranbaod...@chromium.org, nona+...@chromium.org, creis...@chromium.org, shuche...@chromium.org, jbauma...@chromium.org, navigation...@chromium.org, keithle...@chromium.org, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
      Attention needed from Takashi Toyoshima

      Andrew Brown added 1 comment

      File services/network/cors/preflight_controller.cc
      Andrew Brown

      Quick fixes, should pass everything except `external/wpt/xhr/preserve-ua-header-on-redirect.htm` -- I'll look into that now.

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Takashi Toyoshima
      Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedNo-Unresolved-Comments
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: Icf56620f99f371ea2f128e6a3194d6096b0d62cd
      Gerrit-Change-Number: 5273743
      Gerrit-PatchSet: 30
      Gerrit-Owner: Andrew Brown <m...@ajbrown.au>
      Gerrit-Reviewer: Adam Rice <ri...@chromium.org>
      Gerrit-Reviewer: Alex Rudenko <alexr...@chromium.org>
      Gerrit-Reviewer: Andrew Brown <m...@ajbrown.au>
      Gerrit-Reviewer: Bo Liu <bo...@chromium.org>
      Gerrit-Reviewer: Maksim Sadym <sa...@chromium.org>
      Gerrit-Reviewer: Min Qin <qin...@chromium.org>
      Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
      Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
      Gerrit-CC: Hiroki Nakagawa <nhi...@chromium.org>
      Gerrit-CC: James Maclean <wjma...@chromium.org>
      Gerrit-CC: James Su <su...@chromium.org>
      Gerrit-CC: Nate Chapin <jap...@chromium.org>
      Gerrit-CC: Takashi Nakayama <tn...@chromium.org>
      Gerrit-Attention: Takashi Toyoshima <toyo...@chromium.org>
      Gerrit-Comment-Date: Sun, 27 Jul 2025 02:33:18 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Andrew Brown (Gerrit)

      unread,
      Jul 27, 2025, 6:49:23 AMJul 27
      to Takashi Toyoshima, Chromium Metrics Reviews, Takashi Nakayama, Adam Rice, Maksim Sadym, Alex Rudenko, Min Qin, Bo Liu, Hiroki Nakagawa, James Maclean, James Su, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, asvitkine...@chromium.org, devtools-re...@chromium.org, extension...@chromium.org, chromium-a...@chromium.org, mkwst+w...@chromium.org, horo+...@chromium.org, shimazu+se...@chromium.org, kinuko+ser...@chromium.org, servicewor...@chromium.org, antoniosarto...@chromium.org, kenjibah...@chromium.org, jsbell+ser...@chromium.org, arthursonzog...@chromium.org, blink-revie...@chromium.org, alexmo...@chromium.org, yhanad...@chromium.org, tranbaod...@chromium.org, nona+...@chromium.org, creis...@chromium.org, shuche...@chromium.org, jbauma...@chromium.org, navigation...@chromium.org, keithle...@chromium.org, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
      File services/network/cors/preflight_controller.cc
      Andrew Brown

      Not quite, actually -- the extension issues are a bit more formidable than I anticipated (and I've also been suffering through openSUSE build incompatibilities). Still working on it, though I might end up needing to ask for an Extensions expert opinion sooner than I thought.

      Gerrit-Comment-Date: Sun, 27 Jul 2025 10:48:48 +0000
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Andrew Brown (Gerrit)

      unread,
      Jul 27, 2025, 11:43:17 PMJul 27
      to Dave Tapuska, Takashi Toyoshima, Chromium Metrics Reviews, Takashi Nakayama, Adam Rice, Min Qin, Hiroki Nakagawa, James Maclean, James Su, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, asvitkine...@chromium.org, devtools-re...@chromium.org, extension...@chromium.org, chromium-a...@chromium.org, mkwst+w...@chromium.org, horo+...@chromium.org, shimazu+se...@chromium.org, kinuko+ser...@chromium.org, servicewor...@chromium.org, antoniosarto...@chromium.org, kenjibah...@chromium.org, jsbell+ser...@chromium.org, arthursonzog...@chromium.org, blink-revie...@chromium.org, alexmo...@chromium.org, yhanad...@chromium.org, tranbaod...@chromium.org, nona+...@chromium.org, creis...@chromium.org, shuche...@chromium.org, jbauma...@chromium.org, navigation...@chromium.org, keithle...@chromium.org, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
      Attention needed from Dave Tapuska and Takashi Toyoshima

      Andrew Brown added 1 comment

      Patchset-level comments
      File-level comment, Patchset 31 (Latest):
      Andrew Brown . unresolved

      Adding dtapuska@ to review for `content/public/test/url_loader_interceptor.cc`

      Hopefully ok, but interested to hear thoughts on performing header merges in different locations.

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Dave Tapuska
      • Takashi Toyoshima
      Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedNo-Unresolved-Comments
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: Icf56620f99f371ea2f128e6a3194d6096b0d62cd
      Gerrit-Change-Number: 5273743
      Gerrit-PatchSet: 31
      Gerrit-Owner: Andrew Brown <m...@ajbrown.au>
      Gerrit-Reviewer: Adam Rice <ri...@chromium.org>
      Gerrit-Reviewer: Andrew Brown <m...@ajbrown.au>
      Gerrit-Reviewer: Dave Tapuska <dtap...@chromium.org>
      Gerrit-Reviewer: Min Qin <qin...@chromium.org>
      Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
      Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
      Gerrit-CC: Hiroki Nakagawa <nhi...@chromium.org>
      Gerrit-CC: James Maclean <wjma...@chromium.org>
      Gerrit-CC: James Su <su...@chromium.org>
      Gerrit-CC: Nate Chapin <jap...@chromium.org>
      Gerrit-CC: Takashi Nakayama <tn...@chromium.org>
      Gerrit-Attention: Dave Tapuska <dtap...@chromium.org>
      Gerrit-Attention: Takashi Toyoshima <toyo...@chromium.org>
      Gerrit-Comment-Date: Mon, 28 Jul 2025 03:42:51 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Dave Tapuska (Gerrit)

      unread,
      Jul 28, 2025, 10:19:58 AMJul 28
      to Andrew Brown, Alex Moshchuk, Takashi Toyoshima, Chromium Metrics Reviews, Takashi Nakayama, Adam Rice, Min Qin, Hiroki Nakagawa, James Maclean, James Su, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, asvitkine...@chromium.org, devtools-re...@chromium.org, extension...@chromium.org, chromium-a...@chromium.org, mkwst+w...@chromium.org, horo+...@chromium.org, shimazu+se...@chromium.org, kinuko+ser...@chromium.org, servicewor...@chromium.org, antoniosarto...@chromium.org, kenjibah...@chromium.org, jsbell+ser...@chromium.org, arthursonzog...@chromium.org, blink-revie...@chromium.org, alexmo...@chromium.org, yhanad...@chromium.org, tranbaod...@chromium.org, nona+...@chromium.org, creis...@chromium.org, shuche...@chromium.org, jbauma...@chromium.org, navigation...@chromium.org, keithle...@chromium.org, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
      Attention needed from Alex Moshchuk, Andrew Brown and Takashi Toyoshima

      Dave Tapuska added 1 comment

      Patchset-level comments
      File-level comment, Patchset 33 (Latest):
      Dave Tapuska . resolved

      Going to defer to Alex here, since it something related to CORS.

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Alex Moshchuk
      • Andrew Brown
      • Takashi Toyoshima
      Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedNo-Unresolved-Comments
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: Icf56620f99f371ea2f128e6a3194d6096b0d62cd
      Gerrit-Change-Number: 5273743
      Gerrit-PatchSet: 33
      Gerrit-Owner: Andrew Brown <m...@ajbrown.au>
      Gerrit-Reviewer: Adam Rice <ri...@chromium.org>
      Gerrit-Reviewer: Alex Moshchuk <ale...@chromium.org>
      Gerrit-Reviewer: Andrew Brown <m...@ajbrown.au>
      Gerrit-Reviewer: Min Qin <qin...@chromium.org>
      Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
      Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
      Gerrit-CC: Hiroki Nakagawa <nhi...@chromium.org>
      Gerrit-CC: James Maclean <wjma...@chromium.org>
      Gerrit-CC: James Su <su...@chromium.org>
      Gerrit-CC: Nate Chapin <jap...@chromium.org>
      Gerrit-CC: Takashi Nakayama <tn...@chromium.org>
      Gerrit-Attention: Andrew Brown <m...@ajbrown.au>
      Gerrit-Attention: Alex Moshchuk <ale...@chromium.org>
      Gerrit-Attention: Takashi Toyoshima <toyo...@chromium.org>
      Gerrit-Comment-Date: Mon, 28 Jul 2025 14:19:51 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Oliver Dunk (Gerrit)

      unread,
      Jul 29, 2025, 8:54:46 AMJul 29
      to Andrew Brown, Devlin Cronin, Alex Moshchuk, Takashi Toyoshima, Chromium Metrics Reviews, Takashi Nakayama, Adam Rice, Min Qin, Hiroki Nakagawa, James Maclean, James Su, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, asvitkine...@chromium.org, devtools-re...@chromium.org, extension...@chromium.org, chromium-a...@chromium.org, mkwst+w...@chromium.org, horo+...@chromium.org, shimazu+se...@chromium.org, kinuko+ser...@chromium.org, servicewor...@chromium.org, antoniosarto...@chromium.org, kenjibah...@chromium.org, jsbell+ser...@chromium.org, arthursonzog...@chromium.org, blink-revie...@chromium.org, alexmo...@chromium.org, yhanad...@chromium.org, tranbaod...@chromium.org, nona+...@chromium.org, creis...@chromium.org, shuche...@chromium.org, jbauma...@chromium.org, navigation...@chromium.org, keithle...@chromium.org, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
      Attention needed from Alex Moshchuk, Andrew Brown, Devlin Cronin and Takashi Toyoshima

      Oliver Dunk added 1 comment

      Patchset-level comments
      Oliver Dunk . unresolved

      Hi @rdevlin...@chromium.org, could you take a look at this one? As described in [1], it sounds like this could impact if the `User-Agent` header is exposed in the webRequest API.

      [1] https://groups.google.com/a/chromium.org/d/msgid/chromium-extensions/14e9bbde-433c-4e64-ad3d-d79b36f93bdfn%40chromium.org?utm_medium=email&utm_source=footer

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Alex Moshchuk
      • Andrew Brown
      • Devlin Cronin
      • Takashi Toyoshima
      Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedNo-Unresolved-Comments
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: Icf56620f99f371ea2f128e6a3194d6096b0d62cd
      Gerrit-Change-Number: 5273743
      Gerrit-PatchSet: 33
      Gerrit-Owner: Andrew Brown <m...@ajbrown.au>
      Gerrit-Reviewer: Adam Rice <ri...@chromium.org>
      Gerrit-Reviewer: Alex Moshchuk <ale...@chromium.org>
      Gerrit-Reviewer: Andrew Brown <m...@ajbrown.au>
      Gerrit-Reviewer: Devlin Cronin <rdevlin...@chromium.org>
      Gerrit-Reviewer: Min Qin <qin...@chromium.org>
      Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
      Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
      Gerrit-CC: Hiroki Nakagawa <nhi...@chromium.org>
      Gerrit-CC: James Maclean <wjma...@chromium.org>
      Gerrit-CC: James Su <su...@chromium.org>
      Gerrit-CC: Nate Chapin <jap...@chromium.org>
      Gerrit-CC: Oliver Dunk <olive...@chromium.org>
      Gerrit-CC: Takashi Nakayama <tn...@chromium.org>
      Gerrit-Attention: Andrew Brown <m...@ajbrown.au>
      Gerrit-Attention: Devlin Cronin <rdevlin...@chromium.org>
      Gerrit-Attention: Alex Moshchuk <ale...@chromium.org>
      Gerrit-Attention: Takashi Toyoshima <toyo...@chromium.org>
      Gerrit-Comment-Date: Tue, 29 Jul 2025 12:54:27 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Devlin Cronin (Gerrit)

      unread,
      Jul 29, 2025, 10:49:39 AMJul 29
      to Andrew Brown, Devlin Cronin, Oliver Dunk, Alex Moshchuk, Takashi Toyoshima, Chromium Metrics Reviews, Takashi Nakayama, Adam Rice, Min Qin, Hiroki Nakagawa, James Maclean, James Su, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, asvitkine...@chromium.org, devtools-re...@chromium.org, extension...@chromium.org, chromium-a...@chromium.org, mkwst+w...@chromium.org, horo+...@chromium.org, shimazu+se...@chromium.org, kinuko+ser...@chromium.org, servicewor...@chromium.org, antoniosarto...@chromium.org, kenjibah...@chromium.org, jsbell+ser...@chromium.org, arthursonzog...@chromium.org, blink-revie...@chromium.org, alexmo...@chromium.org, yhanad...@chromium.org, tranbaod...@chromium.org, nona+...@chromium.org, creis...@chromium.org, shuche...@chromium.org, jbauma...@chromium.org, navigation...@chromium.org, keithle...@chromium.org, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
      Attention needed from Alex Moshchuk, Andrew Brown and Takashi Toyoshima

      Devlin Cronin added 1 comment

      Patchset-level comments
      Oliver Dunk . unresolved

      Hi @rdevlin...@chromium.org, could you take a look at this one? As described in [1], it sounds like this could impact if the `User-Agent` header is exposed in the webRequest API.

      [1] https://groups.google.com/a/chromium.org/d/msgid/chromium-extensions/14e9bbde-433c-4e64-ad3d-d79b36f93bdfn%40chromium.org?utm_medium=email&utm_source=footer

      Devlin Cronin

      Thanks for tagging me in, Oliver! I agree that this is concerning for extensions, since it's a potentially large behavior change.

      Would it be possible to preserve the existing behavior? The comment [here](https://chromium-review.googlesource.com/c/chromium/src/+/5273743/33/chrome/test/data/extensions/api_test/webrequest/framework.js) implies it is, with a bit of refactoring?

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Alex Moshchuk
      • Andrew Brown
      • Takashi Toyoshima
      Gerrit-Attention: Alex Moshchuk <ale...@chromium.org>
      Gerrit-Attention: Takashi Toyoshima <toyo...@chromium.org>
      Gerrit-Comment-Date: Tue, 29 Jul 2025 14:49:32 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Oliver Dunk <olive...@chromium.org>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Andrew Brown (Gerrit)

      unread,
      Jul 30, 2025, 5:32:22 AMJul 30
      to Devlin Cronin, Oliver Dunk, Alex Moshchuk, Takashi Toyoshima, Chromium Metrics Reviews, Takashi Nakayama, Adam Rice, Min Qin, Hiroki Nakagawa, James Maclean, James Su, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, asvitkine...@chromium.org, devtools-re...@chromium.org, extension...@chromium.org, chromium-a...@chromium.org, mkwst+w...@chromium.org, horo+...@chromium.org, shimazu+se...@chromium.org, kinuko+ser...@chromium.org, servicewor...@chromium.org, antoniosarto...@chromium.org, kenjibah...@chromium.org, jsbell+ser...@chromium.org, arthursonzog...@chromium.org, blink-revie...@chromium.org, alexmo...@chromium.org, yhanad...@chromium.org, tranbaod...@chromium.org, nona+...@chromium.org, creis...@chromium.org, shuche...@chromium.org, jbauma...@chromium.org, navigation...@chromium.org, keithle...@chromium.org, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
      Attention needed from Alex Moshchuk, Devlin Cronin and Takashi Toyoshima

      Andrew Brown added 2 comments

      Patchset-level comments
      Oliver Dunk . unresolved

      Hi @rdevlin...@chromium.org, could you take a look at this one? As described in [1], it sounds like this could impact if the `User-Agent` header is exposed in the webRequest API.

      [1] https://groups.google.com/a/chromium.org/d/msgid/chromium-extensions/14e9bbde-433c-4e64-ad3d-d79b36f93bdfn%40chromium.org?utm_medium=email&utm_source=footer

      Devlin Cronin

      Thanks for tagging me in, Oliver! I agree that this is concerning for extensions, since it's a potentially large behavior change.

      Would it be possible to preserve the existing behavior? The comment [here](https://chromium-review.googlesource.com/c/chromium/src/+/5273743/33/chrome/test/data/extensions/api_test/webrequest/framework.js) implies it is, with a bit of refactoring?

      Andrew Brown

      I wasn't sure when I posted to that mailing list, as the standard pattern for header merging isn't compatible with `OnBeforeChangeHeaders` taking a pointer to the headers, but upon further look, it appears possible to preserve the existing behaviour by just merging the new `content_user_agent` in the lead up to extensions triggering the `OnBeforeSendHeaders` event.

      This feels suspect, as it appears the headers sent to the event get re-placed back onto the `network::ResourceRequest`, so I don't know if there are other implications of merging the UA back in at this point, but I'm unsure -- thoughts welcome.

      File-level comment, Patchset 34 (Latest):
      Andrew Brown . unresolved

      Something in one of the rebase(s) is now causing a dangling ref when the browser closes :( so the tests are all failing. (Technically I can still run them and see if they pass the "test" section of the test, but they all error out immediately afterwards.) Got my weekend plans cut out for me.

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Alex Moshchuk
      • Devlin Cronin
      • Takashi Toyoshima
      Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedNo-Unresolved-Comments
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: Icf56620f99f371ea2f128e6a3194d6096b0d62cd
      Gerrit-Change-Number: 5273743
      Gerrit-PatchSet: 34
      Gerrit-Owner: Andrew Brown <m...@ajbrown.au>
      Gerrit-Reviewer: Adam Rice <ri...@chromium.org>
      Gerrit-Reviewer: Alex Moshchuk <ale...@chromium.org>
      Gerrit-Reviewer: Andrew Brown <m...@ajbrown.au>
      Gerrit-Reviewer: Devlin Cronin <rdevlin...@chromium.org>
      Gerrit-Reviewer: Min Qin <qin...@chromium.org>
      Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
      Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
      Gerrit-CC: Hiroki Nakagawa <nhi...@chromium.org>
      Gerrit-CC: James Maclean <wjma...@chromium.org>
      Gerrit-CC: James Su <su...@chromium.org>
      Gerrit-CC: Nate Chapin <jap...@chromium.org>
      Gerrit-CC: Oliver Dunk <olive...@chromium.org>
      Gerrit-CC: Takashi Nakayama <tn...@chromium.org>
      Gerrit-Attention: Devlin Cronin <rdevlin...@chromium.org>
      Gerrit-Attention: Alex Moshchuk <ale...@chromium.org>
      Gerrit-Attention: Takashi Toyoshima <toyo...@chromium.org>
      Gerrit-Comment-Date: Wed, 30 Jul 2025 09:31:53 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Oliver Dunk <olive...@chromium.org>
      Comment-In-Reply-To: Devlin Cronin <rdevlin...@chromium.org>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Alex Moshchuk (Gerrit)

      unread,
      Jul 30, 2025, 5:24:46 PMJul 30
      to Andrew Brown, Devlin Cronin, Oliver Dunk, Takashi Toyoshima, Chromium Metrics Reviews, Takashi Nakayama, Adam Rice, Min Qin, Hiroki Nakagawa, James Maclean, James Su, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, asvitkine...@chromium.org, devtools-re...@chromium.org, extension...@chromium.org, chromium-a...@chromium.org, mkwst+w...@chromium.org, horo+...@chromium.org, shimazu+se...@chromium.org, kinuko+ser...@chromium.org, servicewor...@chromium.org, antoniosarto...@chromium.org, kenjibah...@chromium.org, jsbell+ser...@chromium.org, arthursonzog...@chromium.org, blink-revie...@chromium.org, alexmo...@chromium.org, yhanad...@chromium.org, tranbaod...@chromium.org, nona+...@chromium.org, creis...@chromium.org, shuche...@chromium.org, jbauma...@chromium.org, navigation...@chromium.org, keithle...@chromium.org, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
      Attention needed from Andrew Brown, Devlin Cronin and Takashi Toyoshima

      Alex Moshchuk added 1 comment

      Patchset-level comments
      Andrew Brown . unresolved

      Adding dtapuska@ to review for `content/public/test/url_loader_interceptor.cc`

      Hopefully ok, but interested to hear thoughts on performing header merges in different locations.

      Alex Moshchuk

      I think this is a better question for network service and loading experts (some of whom are already reviewing this CL). That change looks good mechanically (I did wonder if it's beneficial at all to do the merging in a shared helper, so that this doesn't get out of sync if other headers are added in the future, but not sure how many other places actually end up doing this), but I don't really know much about the code involved here to review this deeper, so I'll have to defer to other reviewers. Happy to approve content/ once everybody's happy with the CL and outstanding questions are resolved.

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Andrew Brown
      • Devlin Cronin
      • Takashi Toyoshima
      Gerrit-Attention: Andrew Brown <m...@ajbrown.au>
      Gerrit-Attention: Devlin Cronin <rdevlin...@chromium.org>
      Gerrit-Attention: Takashi Toyoshima <toyo...@chromium.org>
      Gerrit-Comment-Date: Wed, 30 Jul 2025 21:24:40 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Andrew Brown <m...@ajbrown.au>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Devlin Cronin (Gerrit)

      unread,
      Aug 4, 2025, 7:39:16 PMAug 4
      to Andrew Brown, Devlin Cronin, Oliver Dunk, Alex Moshchuk, Takashi Toyoshima, Chromium Metrics Reviews, Takashi Nakayama, Adam Rice, Min Qin, Hiroki Nakagawa, James Maclean, James Su, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, asvitkine...@chromium.org, devtools-re...@chromium.org, extension...@chromium.org, chromium-a...@chromium.org, mkwst+w...@chromium.org, horo+...@chromium.org, shimazu+se...@chromium.org, kinuko+ser...@chromium.org, servicewor...@chromium.org, antoniosarto...@chromium.org, kenjibah...@chromium.org, jsbell+ser...@chromium.org, arthursonzog...@chromium.org, blink-revie...@chromium.org, alexmo...@chromium.org, yhanad...@chromium.org, tranbaod...@chromium.org, nona+...@chromium.org, creis...@chromium.org, shuche...@chromium.org, jbauma...@chromium.org, navigation...@chromium.org, keithle...@chromium.org, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
      Attention needed from Andrew Brown and Takashi Toyoshima

      Devlin Cronin added 1 comment

      Patchset-level comments
      Oliver Dunk . unresolved

      Hi @rdevlin...@chromium.org, could you take a look at this one? As described in [1], it sounds like this could impact if the `User-Agent` header is exposed in the webRequest API.

      [1] https://groups.google.com/a/chromium.org/d/msgid/chromium-extensions/14e9bbde-433c-4e64-ad3d-d79b36f93bdfn%40chromium.org?utm_medium=email&utm_source=footer

      Devlin Cronin

      Thanks for tagging me in, Oliver! I agree that this is concerning for extensions, since it's a potentially large behavior change.

      Would it be possible to preserve the existing behavior? The comment [here](https://chromium-review.googlesource.com/c/chromium/src/+/5273743/33/chrome/test/data/extensions/api_test/webrequest/framework.js) implies it is, with a bit of refactoring?

      Andrew Brown

      I wasn't sure when I posted to that mailing list, as the standard pattern for header merging isn't compatible with `OnBeforeChangeHeaders` taking a pointer to the headers, but upon further look, it appears possible to preserve the existing behaviour by just merging the new `content_user_agent` in the lead up to extensions triggering the `OnBeforeSendHeaders` event.

      This feels suspect, as it appears the headers sent to the event get re-placed back onto the `network::ResourceRequest`, so I don't know if there are other implications of merging the UA back in at this point, but I'm unsure -- thoughts welcome.

      Devlin Cronin

      I think that's probably mostly a question for net experts -- maybe @ri...@chromium.org has thoughts?

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Andrew Brown
      • Takashi Toyoshima
      Gerrit-Attention: Takashi Toyoshima <toyo...@chromium.org>
      Gerrit-Comment-Date: Mon, 04 Aug 2025 23:39:05 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Oliver Dunk <olive...@chromium.org>
      Comment-In-Reply-To: Andrew Brown <m...@ajbrown.au>
      Comment-In-Reply-To: Devlin Cronin <rdevlin...@chromium.org>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Adam Rice (Gerrit)

      unread,
      Aug 4, 2025, 8:36:37 PMAug 4
      to Andrew Brown, Devlin Cronin, Oliver Dunk, Alex Moshchuk, Takashi Toyoshima, Chromium Metrics Reviews, Takashi Nakayama, Min Qin, Hiroki Nakagawa, James Maclean, James Su, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, asvitkine...@chromium.org, devtools-re...@chromium.org, extension...@chromium.org, chromium-a...@chromium.org, mkwst+w...@chromium.org, horo+...@chromium.org, shimazu+se...@chromium.org, kinuko+ser...@chromium.org, servicewor...@chromium.org, antoniosarto...@chromium.org, kenjibah...@chromium.org, jsbell+ser...@chromium.org, arthursonzog...@chromium.org, blink-revie...@chromium.org, alexmo...@chromium.org, yhanad...@chromium.org, tranbaod...@chromium.org, nona+...@chromium.org, creis...@chromium.org, shuche...@chromium.org, jbauma...@chromium.org, navigation...@chromium.org, keithle...@chromium.org, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
      Attention needed from Andrew Brown and Takashi Toyoshima

      Adam Rice added 1 comment

      Patchset-level comments
      Oliver Dunk . unresolved

      Hi @rdevlin...@chromium.org, could you take a look at this one? As described in [1], it sounds like this could impact if the `User-Agent` header is exposed in the webRequest API.

      [1] https://groups.google.com/a/chromium.org/d/msgid/chromium-extensions/14e9bbde-433c-4e64-ad3d-d79b36f93bdfn%40chromium.org?utm_medium=email&utm_source=footer

      Devlin Cronin

      Thanks for tagging me in, Oliver! I agree that this is concerning for extensions, since it's a potentially large behavior change.

      Would it be possible to preserve the existing behavior? The comment [here](https://chromium-review.googlesource.com/c/chromium/src/+/5273743/33/chrome/test/data/extensions/api_test/webrequest/framework.js) implies it is, with a bit of refactoring?

      Andrew Brown

      I wasn't sure when I posted to that mailing list, as the standard pattern for header merging isn't compatible with `OnBeforeChangeHeaders` taking a pointer to the headers, but upon further look, it appears possible to preserve the existing behaviour by just merging the new `content_user_agent` in the lead up to extensions triggering the `OnBeforeSendHeaders` event.

      This feels suspect, as it appears the headers sent to the event get re-placed back onto the `network::ResourceRequest`, so I don't know if there are other implications of merging the UA back in at this point, but I'm unsure -- thoughts welcome.

      Devlin Cronin

      I think that's probably mostly a question for net experts -- maybe @ri...@chromium.org has thoughts?

      Adam Rice

      As far as I can tell from reading the code, the `request_` only changes the view of the world that extensions have and isn't passed back to the network stack, so changing it should be safe.

      Gerrit-Comment-Date: Tue, 05 Aug 2025 00:36:03 +0000
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Andrew Brown (Gerrit)

      unread,
      Aug 7, 2025, 9:11:39 PMAug 7
      to Devlin Cronin, Oliver Dunk, Alex Moshchuk, Takashi Toyoshima, Chromium Metrics Reviews, Takashi Nakayama, Adam Rice, Min Qin, Hiroki Nakagawa, James Maclean, James Su, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, asvitkine...@chromium.org, devtools-re...@chromium.org, extension...@chromium.org, chromium-a...@chromium.org, mkwst+w...@chromium.org, horo+...@chromium.org, shimazu+se...@chromium.org, kinuko+ser...@chromium.org, servicewor...@chromium.org, antoniosarto...@chromium.org, kenjibah...@chromium.org, jsbell+ser...@chromium.org, arthursonzog...@chromium.org, blink-revie...@chromium.org, alexmo...@chromium.org, yhanad...@chromium.org, tranbaod...@chromium.org, nona+...@chromium.org, creis...@chromium.org, shuche...@chromium.org, jbauma...@chromium.org, navigation...@chromium.org, keithle...@chromium.org, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
      Attention needed from Takashi Toyoshima

      Andrew Brown added 4 comments

      Patchset-level comments
      File-level comment, Patchset 31:
      Andrew Brown . resolved

      Adding dtapuska@ to review for `content/public/test/url_loader_interceptor.cc`

      Hopefully ok, but interested to hear thoughts on performing header merges in different locations.

      Alex Moshchuk

      I think this is a better question for network service and loading experts (some of whom are already reviewing this CL). That change looks good mechanically (I did wonder if it's beneficial at all to do the merging in a shared helper, so that this doesn't get out of sync if other headers are added in the future, but not sure how many other places actually end up doing this), but I don't really know much about the code involved here to review this deeper, so I'll have to defer to other reviewers. Happy to approve content/ once everybody's happy with the CL and outstanding questions are resolved.

      Andrew Brown

      Excellent -- thanks for the assist.

      File-level comment, Patchset 33:
      Oliver Dunk . resolved

      Hi @rdevlin...@chromium.org, could you take a look at this one? As described in [1], it sounds like this could impact if the `User-Agent` header is exposed in the webRequest API.

      [1] https://groups.google.com/a/chromium.org/d/msgid/chromium-extensions/14e9bbde-433c-4e64-ad3d-d79b36f93bdfn%40chromium.org?utm_medium=email&utm_source=footer

      Devlin Cronin

      Thanks for tagging me in, Oliver! I agree that this is concerning for extensions, since it's a potentially large behavior change.

      Would it be possible to preserve the existing behavior? The comment [here](https://chromium-review.googlesource.com/c/chromium/src/+/5273743/33/chrome/test/data/extensions/api_test/webrequest/framework.js) implies it is, with a bit of refactoring?

      Andrew Brown

      I wasn't sure when I posted to that mailing list, as the standard pattern for header merging isn't compatible with `OnBeforeChangeHeaders` taking a pointer to the headers, but upon further look, it appears possible to preserve the existing behaviour by just merging the new `content_user_agent` in the lead up to extensions triggering the `OnBeforeSendHeaders` event.

      This feels suspect, as it appears the headers sent to the event get re-placed back onto the `network::ResourceRequest`, so I don't know if there are other implications of merging the UA back in at this point, but I'm unsure -- thoughts welcome.

      Devlin Cronin

      I think that's probably mostly a question for net experts -- maybe @ri...@chromium.org has thoughts?

      Adam Rice

      As far as I can tell from reading the code, the `request_` only changes the view of the world that extensions have and isn't passed back to the network stack, so changing it should be safe.

      Andrew Brown

      Huh, that's excellent. I don't think I would have gotten that aspect, thanks for working that out!

      Andrew Brown . unresolved

      Something in one of the rebase(s) is now causing a dangling ref when the browser closes :( so the tests are all failing. (Technically I can still run them and see if they pass the "test" section of the test, but they all error out immediately afterwards.) Got my weekend plans cut out for me.

      Andrew Brown

      @toyo...@chromium.org Could you put this through the bots/dry run again?

      I'm still unable to test after a painful week of git tree corruption & completely impenetrable dangling pointer issues. Basically all I managed was to confirm that the dangling pointer occurs on `main` for me too, so it's clearly an issue with my build environment, not the actual contents of the CL.

      If my understanding is correct, the only remaining fail should be `external/wpt/xhr/preserve-ua-header-on-redirect.htm`.

      File chrome/test/data/extensions/api_test/webrequest/framework.js
      Line 296, Patchset 25:function checkUserAgent(headers) {
      Andrew Brown . resolved

      This is the root cause of a couple remaining failures:

      • ExtensionWebRequestApiPrerenderingTest.Load
      • ExtensionWebRequestApiPrerenderingTest.LoadIntoNewTab

      They're using User-Agent as a litmus test for whether the headers on a request are valid, which is fine, but User-Agent is not going to be present on a DevTools "requestWillBeSent" event anymore. So we need a new way to do this.

      Takashi Toyoshima

      Does this need help from qinmin@ ?
      IIUC, this means the webRequest API exposed header is changed, and we need to update the API document, and need an announcement for Extensions developers and enterprise users?

      Andrew Brown

      Hmm. I think at the moment, yes, but that should actually be fixable.

      My first idea is to ensure that the extensions stack combines the `cors_exempt_headers` into any headers returned to the user. I don't know if this is acceptable from a duplication-of-code-behaviour standpoint -- is it ok to have a bunch of places scattered around the code that pseudo-implement the network process's header merging behaviour?

      The thing is, I'm uncovering a lot of behaviour that's always been "wrong", but has always been "good enough" -- lots of places where the code only considers `network::ResourceRequest`'s |headers| without combining the |cors_exempt_headers|.

      Until now, |cors_exempt_headers| were niche, so it didn't matter, but now, User-Agent is on there... and lots of things care about User-Agent.

      I'll try to "fix" the tests by reintroducing the User-Agent to the webRequest API first, and then get qinmin@ 's thoughts on implementation detail.

      Andrew Brown

      Extensions should see the new UA now.

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Takashi Toyoshima
      Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedNo-Unresolved-Comments
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: Icf56620f99f371ea2f128e6a3194d6096b0d62cd
      Gerrit-Change-Number: 5273743
      Gerrit-PatchSet: 35
      Gerrit-Owner: Andrew Brown <m...@ajbrown.au>
      Gerrit-Reviewer: Adam Rice <ri...@chromium.org>
      Gerrit-Reviewer: Alex Moshchuk <ale...@chromium.org>
      Gerrit-Reviewer: Andrew Brown <m...@ajbrown.au>
      Gerrit-Reviewer: Devlin Cronin <rdevlin...@chromium.org>
      Gerrit-Reviewer: Min Qin <qin...@chromium.org>
      Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
      Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
      Gerrit-CC: Hiroki Nakagawa <nhi...@chromium.org>
      Gerrit-CC: James Maclean <wjma...@chromium.org>
      Gerrit-CC: James Su <su...@chromium.org>
      Gerrit-CC: Nate Chapin <jap...@chromium.org>
      Gerrit-CC: Oliver Dunk <olive...@chromium.org>
      Gerrit-CC: Takashi Nakayama <tn...@chromium.org>
      Gerrit-Attention: Takashi Toyoshima <toyo...@chromium.org>
      Gerrit-Comment-Date: Fri, 08 Aug 2025 01:11:14 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Oliver Dunk <olive...@chromium.org>
      Comment-In-Reply-To: Adam Rice <ri...@chromium.org>
      Comment-In-Reply-To: Andrew Brown <m...@ajbrown.au>
      Comment-In-Reply-To: Alex Moshchuk <ale...@chromium.org>
      Comment-In-Reply-To: Devlin Cronin <rdevlin...@chromium.org>
      Comment-In-Reply-To: Takashi Toyoshima <toyo...@chromium.org>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Devlin Cronin (Gerrit)

      unread,
      Aug 8, 2025, 4:52:23 PMAug 8
      to Andrew Brown, Devlin Cronin, Giovanni Ortuno Urquidi, Oliver Dunk, Alex Moshchuk, Takashi Toyoshima, Chromium Metrics Reviews, Takashi Nakayama, Adam Rice, Min Qin, Hiroki Nakagawa, James Maclean, James Su, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, asvitkine...@chromium.org, devtools-re...@chromium.org, extension...@chromium.org, chromium-a...@chromium.org, mkwst+w...@chromium.org, horo+...@chromium.org, shimazu+se...@chromium.org, kinuko+ser...@chromium.org, servicewor...@chromium.org, antoniosarto...@chromium.org, kenjibah...@chromium.org, jsbell+ser...@chromium.org, arthursonzog...@chromium.org, blink-revie...@chromium.org, alexmo...@chromium.org, yhanad...@chromium.org, tranbaod...@chromium.org, nona+...@chromium.org, creis...@chromium.org, shuche...@chromium.org, jbauma...@chromium.org, navigation...@chromium.org, keithle...@chromium.org, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
      Attention needed from Andrew Brown and Takashi Toyoshima

      Devlin Cronin voted and added 2 comments

      Votes added by Devlin Cronin

      Code-Review+1

      2 comments

      Patchset-level comments
      File-level comment, Patchset 35 (Latest):
      Devlin Cronin . resolved

      Thanks, Andrew! Extensions LGTM % nit, since there's now no behavior change.

      File extensions/browser/api/web_request/web_request_proxying_url_loader_factory.cc
      Line 760, Patchset 35 (Latest): request_.headers.MergeAndAddUA(request_.cors_exempt_headers,
      Devlin Cronin . unresolved

      nit: maybe add a brief comment about why we need to do this, since there's been a good amount of exploration / discussion?

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Andrew Brown
      • Takashi Toyoshima
      Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedNo-Unresolved-Comments
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: Icf56620f99f371ea2f128e6a3194d6096b0d62cd
      Gerrit-Change-Number: 5273743
      Gerrit-PatchSet: 35
      Gerrit-Owner: Andrew Brown <m...@ajbrown.au>
      Gerrit-Reviewer: Adam Rice <ri...@chromium.org>
      Gerrit-Reviewer: Alex Moshchuk <ale...@chromium.org>
      Gerrit-Reviewer: Andrew Brown <m...@ajbrown.au>
      Gerrit-Reviewer: Devlin Cronin <rdevlin...@chromium.org>
      Gerrit-Reviewer: Min Qin <qin...@chromium.org>
      Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
      Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
      Gerrit-CC: Giovanni Ortuno Urquidi <ort...@chromium.org>
      Gerrit-CC: Hiroki Nakagawa <nhi...@chromium.org>
      Gerrit-CC: James Maclean <wjma...@chromium.org>
      Gerrit-CC: James Su <su...@chromium.org>
      Gerrit-CC: Nate Chapin <jap...@chromium.org>
      Gerrit-CC: Oliver Dunk <olive...@chromium.org>
      Gerrit-CC: Takashi Nakayama <tn...@chromium.org>
      Gerrit-Attention: Andrew Brown <m...@ajbrown.au>
      Gerrit-Attention: Takashi Toyoshima <toyo...@chromium.org>
      Gerrit-Comment-Date: Fri, 08 Aug 2025 20:52:12 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Andrew Brown (Gerrit)

      unread,
      Aug 9, 2025, 1:57:34 AMAug 9
      to Devlin Cronin, Giovanni Ortuno Urquidi, Oliver Dunk, Alex Moshchuk, Takashi Toyoshima, Chromium Metrics Reviews, Takashi Nakayama, Adam Rice, Min Qin, Hiroki Nakagawa, James Maclean, James Su, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, asvitkine...@chromium.org, devtools-re...@chromium.org, extension...@chromium.org, chromium-a...@chromium.org, mkwst+w...@chromium.org, horo+...@chromium.org, shimazu+se...@chromium.org, kinuko+ser...@chromium.org, servicewor...@chromium.org, antoniosarto...@chromium.org, kenjibah...@chromium.org, jsbell+ser...@chromium.org, arthursonzog...@chromium.org, blink-revie...@chromium.org, alexmo...@chromium.org, yhanad...@chromium.org, tranbaod...@chromium.org, nona+...@chromium.org, creis...@chromium.org, shuche...@chromium.org, jbauma...@chromium.org, navigation...@chromium.org, keithle...@chromium.org, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
      Attention needed from Devlin Cronin

      Andrew Brown added 2 comments

      Patchset-level comments
      Devlin Cronin . unresolved

      Thanks, Andrew! Extensions LGTM % nit, since there's now no behavior change.

      Andrew Brown

      Unfortunately the current test results do make this seem like it's not yet fixed.

      The few failures I've actually drilled into are *all* requests that have gone through the extensions stack, now needing a specific `User-Agent` CORS preflight response.

      This means the User-Agent getting added onto the headers in the `OnBeforeSendHeaders` event is actually affecting the real network request somehow, causing it to spot a non-CORS-exempt header on the headers and send a preflight (which the tests don't correctly respond to).

      So all requests that go through the Extensions stack are generating a CORS preflight for the User-Agent header, which most things won't expect and respond to. We need to find an alternative approach; merging here isn't suitable.

      My first guess is that the associated callback function might be our solution, if it lets me pass the `content_user_agent` back up to the front-end consumer for merging outside of all of this business? I don't know if that's feasible/reasonable at all though, considering that goes back into the black hole of mojom; it looks like it would need a lot of modifications all over the place in unrelated contexts.

      Other than that... I'm not sure.

      File extensions/browser/api/web_request/web_request_proxying_url_loader_factory.cc
      Line 760, Patchset 35 (Latest): request_.headers.MergeAndAddUA(request_.cors_exempt_headers,
      Devlin Cronin . unresolved

      nit: maybe add a brief comment about why we need to do this, since there's been a good amount of exploration / discussion?

      Andrew Brown

      Can do, but TBD.

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Devlin Cronin
      Gerrit-Attention: Devlin Cronin <rdevlin...@chromium.org>
      Gerrit-Comment-Date: Sat, 09 Aug 2025 05:57:01 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Devlin Cronin <rdevlin...@chromium.org>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Takashi Toyoshima (Gerrit)

      unread,
      Aug 12, 2025, 7:07:54 AMAug 12
      to Andrew Brown, Devlin Cronin, Giovanni Ortuno Urquidi, Oliver Dunk, Alex Moshchuk, Chromium Metrics Reviews, Takashi Nakayama, Adam Rice, Min Qin, Hiroki Nakagawa, James Maclean, James Su, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, asvitkine...@chromium.org, devtools-re...@chromium.org, extension...@chromium.org, chromium-a...@chromium.org, mkwst+w...@chromium.org, horo+...@chromium.org, shimazu+se...@chromium.org, kinuko+ser...@chromium.org, servicewor...@chromium.org, antoniosarto...@chromium.org, kenjibah...@chromium.org, jsbell+ser...@chromium.org, arthursonzog...@chromium.org, blink-revie...@chromium.org, alexmo...@chromium.org, yhanad...@chromium.org, tranbaod...@chromium.org, nona+...@chromium.org, creis...@chromium.org, shuche...@chromium.org, jbauma...@chromium.org, navigation...@chromium.org, keithle...@chromium.org, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
      Attention needed from Andrew Brown and Devlin Cronin

      Takashi Toyoshima added 2 comments

      Patchset-level comments
      Takashi Toyoshima . resolved

      Sorry, I missed this reply.

      File third_party/blink/renderer/platform/loader/fetch/fetch_context.h
      Line 200, Patchset 27: virtual String GetDefaultUserAgent() const { NOTREACHED(); }
      Takashi Toyoshima . resolved

      Can you drop the default implementation instead of adding NOTREACHED?
      We will prefer the compile time check rather than runtime check for this.

      Andrew Brown

      I don't think we can, unfortunately -- e.g. `GetFeatureContext()` or `GetPermissionsPolicy()` just below. I think there has to be a default implementation.

      I'm not 100% confident on C++ internals, but I think the issue is that `fetch_context.h/cc` actually gets compiled into some real code at some point, so if you don't have a default implementation, the linker errors out.

      Takashi Toyoshima

      Ah, you are right. Sorry, I forgot the fact that this class could be directly used too.

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Andrew Brown
      • Devlin Cronin
      Gerrit-Attention: Andrew Brown <m...@ajbrown.au>
      Gerrit-Attention: Devlin Cronin <rdevlin...@chromium.org>
      Gerrit-Comment-Date: Tue, 12 Aug 2025 11:07:19 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Devlin Cronin (Gerrit)

      unread,
      Aug 13, 2025, 6:54:22 PMAug 13
      to Andrew Brown, Devlin Cronin, Giovanni Ortuno Urquidi, Oliver Dunk, Alex Moshchuk, Takashi Toyoshima, Chromium Metrics Reviews, Takashi Nakayama, Adam Rice, Min Qin, Hiroki Nakagawa, James Maclean, James Su, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, asvitkine...@chromium.org, devtools-re...@chromium.org, extension...@chromium.org, chromium-a...@chromium.org, mkwst+w...@chromium.org, horo+...@chromium.org, shimazu+se...@chromium.org, kinuko+ser...@chromium.org, servicewor...@chromium.org, antoniosarto...@chromium.org, kenjibah...@chromium.org, jsbell+ser...@chromium.org, arthursonzog...@chromium.org, blink-revie...@chromium.org, alexmo...@chromium.org, yhanad...@chromium.org, tranbaod...@chromium.org, nona+...@chromium.org, creis...@chromium.org, shuche...@chromium.org, jbauma...@chromium.org, navigation...@chromium.org, keithle...@chromium.org, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
      Attention needed from Andrew Brown

      Devlin Cronin added 1 comment

      Patchset-level comments
      Devlin Cronin . unresolved

      Thanks, Andrew! Extensions LGTM % nit, since there's now no behavior change.

      Andrew Brown

      Unfortunately the current test results do make this seem like it's not yet fixed.

      The few failures I've actually drilled into are *all* requests that have gone through the extensions stack, now needing a specific `User-Agent` CORS preflight response.

      This means the User-Agent getting added onto the headers in the `OnBeforeSendHeaders` event is actually affecting the real network request somehow, causing it to spot a non-CORS-exempt header on the headers and send a preflight (which the tests don't correctly respond to).

      So all requests that go through the Extensions stack are generating a CORS preflight for the User-Agent header, which most things won't expect and respond to. We need to find an alternative approach; merging here isn't suitable.

      My first guess is that the associated callback function might be our solution, if it lets me pass the `content_user_agent` back up to the front-end consumer for merging outside of all of this business? I don't know if that's feasible/reasonable at all though, considering that goes back into the black hole of mojom; it looks like it would need a lot of modifications all over the place in unrelated contexts.

      Other than that... I'm not sure.

      Devlin Cronin

      Thanks for the continued investigation!

      Unfortunately, I'm not sure of what the right solution here is, either. Since this is mostly touching the net stack, I'd defer to one of those owners. @ri...@chromium.org?

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Andrew Brown
      Submit Requirements:
        • requirement satisfiedCode-Coverage
        • requirement is not satisfiedCode-Owners
        • requirement is not satisfiedCode-Review
        • requirement is not satisfiedNo-Unresolved-Comments
        • requirement satisfiedRecitation-Check
        Gerrit-Comment-Date: Wed, 13 Aug 2025 22:54:08 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: No
        Comment-In-Reply-To: Andrew Brown <m...@ajbrown.au>
        Comment-In-Reply-To: Devlin Cronin <rdevlin...@chromium.org>
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Devlin Cronin (Gerrit)

        unread,
        Aug 13, 2025, 6:54:25 PMAug 13
        to Andrew Brown, Devlin Cronin, Giovanni Ortuno Urquidi, Oliver Dunk, Alex Moshchuk, Takashi Toyoshima, Chromium Metrics Reviews, Takashi Nakayama, Adam Rice, Min Qin, Hiroki Nakagawa, James Maclean, James Su, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, asvitkine...@chromium.org, devtools-re...@chromium.org, extension...@chromium.org, chromium-a...@chromium.org, mkwst+w...@chromium.org, horo+...@chromium.org, shimazu+se...@chromium.org, kinuko+ser...@chromium.org, servicewor...@chromium.org, antoniosarto...@chromium.org, kenjibah...@chromium.org, jsbell+ser...@chromium.org, arthursonzog...@chromium.org, blink-revie...@chromium.org, alexmo...@chromium.org, yhanad...@chromium.org, tranbaod...@chromium.org, nona+...@chromium.org, creis...@chromium.org, shuche...@chromium.org, jbauma...@chromium.org, navigation...@chromium.org, keithle...@chromium.org, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
        Attention needed from Andrew Brown

        Devlin Cronin voted Code-Review+0

        Code-Review+0
        Gerrit-Comment-Date: Wed, 13 Aug 2025 22:54:16 +0000
        Gerrit-HasComments: No
        Gerrit-Has-Labels: Yes
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Andrew Brown (Gerrit)

        unread,
        Aug 14, 2025, 5:21:32 AMAug 14
        to Clark DuVall, Devlin Cronin, Giovanni Ortuno Urquidi, Oliver Dunk, Alex Moshchuk, Takashi Toyoshima, Chromium Metrics Reviews, Takashi Nakayama, Adam Rice, Min Qin, Hiroki Nakagawa, James Maclean, James Su, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, asvitkine...@chromium.org, devtools-re...@chromium.org, extension...@chromium.org, chromium-a...@chromium.org, mkwst+w...@chromium.org, horo+...@chromium.org, shimazu+se...@chromium.org, kinuko+ser...@chromium.org, servicewor...@chromium.org, antoniosarto...@chromium.org, kenjibah...@chromium.org, jsbell+ser...@chromium.org, arthursonzog...@chromium.org, blink-revie...@chromium.org, alexmo...@chromium.org, yhanad...@chromium.org, tranbaod...@chromium.org, nona+...@chromium.org, creis...@chromium.org, shuche...@chromium.org, jbauma...@chromium.org, navigation...@chromium.org, keithle...@chromium.org, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
        Attention needed from Adam Rice and Clark DuVall

        Andrew Brown added 5 comments

        Patchset-level comments
        File-level comment, Patchset 34:
        Andrew Brown . resolved

        Something in one of the rebase(s) is now causing a dangling ref when the browser closes :( so the tests are all failing. (Technically I can still run them and see if they pass the "test" section of the test, but they all error out immediately afterwards.) Got my weekend plans cut out for me.

        Andrew Brown

        @toyo...@chromium.org Could you put this through the bots/dry run again?

        I'm still unable to test after a painful week of git tree corruption & completely impenetrable dangling pointer issues. Basically all I managed was to confirm that the dangling pointer occurs on `main` for me too, so it's clearly an issue with my build environment, not the actual contents of the CL.

        If my understanding is correct, the only remaining fail should be `external/wpt/xhr/preserve-ua-header-on-redirect.htm`.

        Devlin Cronin . unresolved

        Thanks, Andrew! Extensions LGTM % nit, since there's now no behavior change.

        Andrew Brown

        Unfortunately the current test results do make this seem like it's not yet fixed.

        The few failures I've actually drilled into are *all* requests that have gone through the extensions stack, now needing a specific `User-Agent` CORS preflight response.

        This means the User-Agent getting added onto the headers in the `OnBeforeSendHeaders` event is actually affecting the real network request somehow, causing it to spot a non-CORS-exempt header on the headers and send a preflight (which the tests don't correctly respond to).

        So all requests that go through the Extensions stack are generating a CORS preflight for the User-Agent header, which most things won't expect and respond to. We need to find an alternative approach; merging here isn't suitable.

        My first guess is that the associated callback function might be our solution, if it lets me pass the `content_user_agent` back up to the front-end consumer for merging outside of all of this business? I don't know if that's feasible/reasonable at all though, considering that goes back into the black hole of mojom; it looks like it would need a lot of modifications all over the place in unrelated contexts.

        Other than that... I'm not sure.

        Devlin Cronin

        Thanks for the continued investigation!

        Unfortunately, I'm not sure of what the right solution here is, either. Since this is mostly touching the net stack, I'd defer to one of those owners. @ri...@chromium.org?

        Andrew Brown

        I don't know if this is taboo to ping a second person for the same stuff, but I'll also add @cdu...@chromium.org for thoughts -- I was snooping the `OWNERS` of nearby code and he sounds like he might have expertise in this area (specifically the overlap between extensions & networking).

        (Relevant file is `extensions/browser/api/web_request/web_request_proxying_url_loader_factory.cc` w/r/t "How do we get the `content_user_agent` into Extensions before `OnBeforeSendHeaders` fires, without merging it into the request's normal headers?")

        File-level comment, Patchset 37 (Latest):
        Andrew Brown . unresolved

        I've temporarily commented out the mystery-tbd-Extensions-merging stuff that we're still working out -- could someone put this CL through a dryrun so I can check the redirect implementation is all working? I've made changes that fixed the last dubious test locally; just want to check it hasn't broken anything else in the process.

        It should pass everything *but* the two Extensions tests.

        File extensions/browser/api/web_request/web_request_proxying_url_loader_factory.cc
        Line 760, Patchset 35: request_.headers.MergeAndAddUA(request_.cors_exempt_headers,
        Devlin Cronin . resolved

        nit: maybe add a brief comment about why we need to do this, since there's been a good amount of exploration / discussion?

        Andrew Brown

        Can do, but TBD.

        Andrew Brown

        I'll resolve this comment for now, but I'll make sure there's a good few comments around whatever the final implementation ends up being.

        File services/network/cors/preflight_controller.cc
        Andrew Brown

        I'll just leave this one unresolved because it has the nicest summary of the whole setup we've got going here.

        Open in Gerrit

        Related details

        Attention is currently required from:
        • Adam Rice
        • Clark DuVall
        Submit Requirements:
        • requirement satisfiedCode-Coverage
        • requirement is not satisfiedCode-Owners
        • requirement is not satisfiedCode-Review
        • requirement is not satisfiedNo-Unresolved-Comments
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: comment
        Gerrit-Project: chromium/src
        Gerrit-Branch: main
        Gerrit-Change-Id: Icf56620f99f371ea2f128e6a3194d6096b0d62cd
        Gerrit-Change-Number: 5273743
        Gerrit-PatchSet: 37
        Gerrit-Owner: Andrew Brown <m...@ajbrown.au>
        Gerrit-Reviewer: Adam Rice <ri...@chromium.org>
        Gerrit-Reviewer: Alex Moshchuk <ale...@chromium.org>
        Gerrit-Reviewer: Andrew Brown <m...@ajbrown.au>
        Gerrit-Reviewer: Devlin Cronin <rdevlin...@chromium.org>
        Gerrit-Reviewer: Min Qin <qin...@chromium.org>
        Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
        Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
        Gerrit-CC: Clark DuVall <cdu...@chromium.org>
        Gerrit-CC: Giovanni Ortuno Urquidi <ort...@chromium.org>
        Gerrit-CC: Hiroki Nakagawa <nhi...@chromium.org>
        Gerrit-CC: James Maclean <wjma...@chromium.org>
        Gerrit-CC: James Su <su...@chromium.org>
        Gerrit-CC: Nate Chapin <jap...@chromium.org>
        Gerrit-CC: Oliver Dunk <olive...@chromium.org>
        Gerrit-CC: Takashi Nakayama <tn...@chromium.org>
        Gerrit-Attention: Clark DuVall <cdu...@chromium.org>
        Gerrit-Attention: Adam Rice <ri...@chromium.org>
        Gerrit-Comment-Date: Thu, 14 Aug 2025 09:21:05 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: No
        Comment-In-Reply-To: Andrew Brown <m...@ajbrown.au>
        Comment-In-Reply-To: Devlin Cronin <rdevlin...@chromium.org>
        Comment-In-Reply-To: Takashi Toyoshima <toyo...@chromium.org>
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Adam Rice (Gerrit)

        unread,
        Aug 14, 2025, 5:39:53 AMAug 14
        to Andrew Brown, Clark DuVall, Devlin Cronin, Giovanni Ortuno Urquidi, Oliver Dunk, Alex Moshchuk, Takashi Toyoshima, Chromium Metrics Reviews, Takashi Nakayama, Min Qin, Hiroki Nakagawa, James Maclean, James Su, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, asvitkine...@chromium.org, devtools-re...@chromium.org, extension...@chromium.org, chromium-a...@chromium.org, mkwst+w...@chromium.org, horo+...@chromium.org, shimazu+se...@chromium.org, kinuko+ser...@chromium.org, servicewor...@chromium.org, antoniosarto...@chromium.org, kenjibah...@chromium.org, jsbell+ser...@chromium.org, arthursonzog...@chromium.org, blink-revie...@chromium.org, alexmo...@chromium.org, yhanad...@chromium.org, tranbaod...@chromium.org, nona+...@chromium.org, creis...@chromium.org, shuche...@chromium.org, jbauma...@chromium.org, navigation...@chromium.org, keithle...@chromium.org, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
        Attention needed from Adam Rice and Clark DuVall

        Adam Rice added 3 comments

        Patchset-level comments
        Devlin Cronin . unresolved

        Thanks, Andrew! Extensions LGTM % nit, since there's now no behavior change.

        Andrew Brown

        Unfortunately the current test results do make this seem like it's not yet fixed.

        The few failures I've actually drilled into are *all* requests that have gone through the extensions stack, now needing a specific `User-Agent` CORS preflight response.

        This means the User-Agent getting added onto the headers in the `OnBeforeSendHeaders` event is actually affecting the real network request somehow, causing it to spot a non-CORS-exempt header on the headers and send a preflight (which the tests don't correctly respond to).

        So all requests that go through the Extensions stack are generating a CORS preflight for the User-Agent header, which most things won't expect and respond to. We need to find an alternative approach; merging here isn't suitable.

        My first guess is that the associated callback function might be our solution, if it lets me pass the `content_user_agent` back up to the front-end consumer for merging outside of all of this business? I don't know if that's feasible/reasonable at all though, considering that goes back into the black hole of mojom; it looks like it would need a lot of modifications all over the place in unrelated contexts.

        Other than that... I'm not sure.

        Devlin Cronin

        Thanks for the continued investigation!

        Unfortunately, I'm not sure of what the right solution here is, either. Since this is mostly touching the net stack, I'd defer to one of those owners. @ri...@chromium.org?

        Adam Rice

        I misunderstood the code when I looked at it before. This is happening before we call `CreateLoaderAndStart()`, so any modifications to `request_` will affect the real request. So we can't modify `request_` here.

        What I propose instead is to create a new `headers_with_user_agent_` member variable in the `InProgressRequest` class, which is a copy of `request_.headers` but with the User-Agent header added. Then anywhere we are currently calling a WebRequestEventRouter with a pointer to `request_.headers`, pass a pointer to `headers_with_user_agent_` instead.

        Any code which modifies `request_.headers`, for example WebRequestProxyingURLLoaderFactory::InProgressRequest::FollowRedirect(), must recreate `headers_with_user_agent_` to make sure it remains correct. Possibly it will be sufficient to put that code in the UpdateRequestInfo() method?

        The extra cost of copying the headers on the request fast path bothers me, but I can't see any way around it.

        File net/http/http_request_headers.h
        Line 184, Patchset 35: void MergeAndAddUA(const HttpRequestHeaders& other,
        Adam Rice . unresolved
        Since this method is rather specialised and doesn't require access to HttpRequestHeaders internals, I would prefer if it was not a method on the class. A static function in `net::HttpUtil`  would be preferable. Something like
        ```
        static HttpRequestHeaders MergeHeadersAndAddUserAgent(
        net::HttpRequestHeaders info,
        const net::HttpRequestHeaders& from,
        std::optional<std::string> user_agent);
        ```
        The asymmetry between the passing convention for the parameters is so you can do
        ```
        existing =
        net::HttpUtil::MergeHeadersAndAddUserAgent(std::move(existing), extra_headers, user_agent);
        ```
        and it will efficiently move the `existing` object to the output, or
        ```
        net::HttpRequestHeaders merged =
        net::HttpUtil::MargeHeadersAndAddUserAgent(base, extra_headers, user_agent);
        ```
        when you need a new object.
        File services/network/public/mojom/url_request.mojom
        Line 285, Patchset 28: // already set a User-Agent via fetch.
        Andrew Brown . unresolved

        Is the terminology in this comment sensible?

        Adam Rice

        How about something like:
        ```
        The correct value for the "User-Agent" header from the point-of-view of the
        caller, after DevTools and other overrides have been applied. If this is not set, the "User-Agent" value configured on the NetworkContext will be used instead.
        This can be overridden by setting a "User-Agent" in `headers`, but that will
        require a CORS preflight for an untrusted client.

        The `User-Agent` header cannot be set both in `cors_exempt_headers` as it will
        not be merged correctly if it was also set in `headers`.
        ```

        Open in Gerrit

        Related details

        Attention is currently required from:
        • Adam Rice
        • Clark DuVall
        Submit Requirements:
        • requirement satisfiedCode-Coverage
        • requirement is not satisfiedCode-Owners
        • requirement is not satisfiedCode-Review
        • requirement is not satisfiedNo-Unresolved-Comments
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: comment
        Gerrit-Project: chromium/src
        Gerrit-Branch: main
        Gerrit-Change-Id: Icf56620f99f371ea2f128e6a3194d6096b0d62cd
        Gerrit-Change-Number: 5273743
        Gerrit-PatchSet: 35
        Gerrit-Owner: Andrew Brown <m...@ajbrown.au>
        Gerrit-Reviewer: Adam Rice <ri...@chromium.org>
        Gerrit-Reviewer: Alex Moshchuk <ale...@chromium.org>
        Gerrit-Reviewer: Andrew Brown <m...@ajbrown.au>
        Gerrit-Reviewer: Devlin Cronin <rdevlin...@chromium.org>
        Gerrit-Reviewer: Min Qin <qin...@chromium.org>
        Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
        Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
        Gerrit-CC: Clark DuVall <cdu...@chromium.org>
        Gerrit-CC: Giovanni Ortuno Urquidi <ort...@chromium.org>
        Gerrit-CC: Hiroki Nakagawa <nhi...@chromium.org>
        Gerrit-CC: James Maclean <wjma...@chromium.org>
        Gerrit-CC: James Su <su...@chromium.org>
        Gerrit-CC: Nate Chapin <jap...@chromium.org>
        Gerrit-CC: Oliver Dunk <olive...@chromium.org>
        Gerrit-CC: Takashi Nakayama <tn...@chromium.org>
        Gerrit-Attention: Clark DuVall <cdu...@chromium.org>
        Gerrit-Attention: Adam Rice <ri...@chromium.org>
        Gerrit-Comment-Date: Thu, 14 Aug 2025 09:39:22 +0000
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Adam Rice (Gerrit)

        unread,
        Aug 17, 2025, 12:53:06 PMAug 17
        to Andrew Brown, Clark DuVall, Devlin Cronin, Giovanni Ortuno Urquidi, Oliver Dunk, Alex Moshchuk, Takashi Toyoshima, Chromium Metrics Reviews, Takashi Nakayama, Min Qin, Hiroki Nakagawa, James Maclean, James Su, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, asvitkine...@chromium.org, devtools-re...@chromium.org, extension...@chromium.org, chromium-a...@chromium.org, mkwst+w...@chromium.org, horo+...@chromium.org, shimazu+se...@chromium.org, kinuko+ser...@chromium.org, servicewor...@chromium.org, antoniosarto...@chromium.org, kenjibah...@chromium.org, jsbell+ser...@chromium.org, arthursonzog...@chromium.org, blink-revie...@chromium.org, alexmo...@chromium.org, yhanad...@chromium.org, tranbaod...@chromium.org, nona+...@chromium.org, creis...@chromium.org, shuche...@chromium.org, jbauma...@chromium.org, navigation...@chromium.org, keithle...@chromium.org, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
        Attention needed from Andrew Brown and Clark DuVall

        Adam Rice added 1 comment

        File third_party/blink/renderer/core/loader/frame_fetch_context_test.cc
        Line 1565, Patchset 25: EXPECT_EQ("hi", GetFetchContext()->GetDefaultUserAgent());
        Andrew Brown . unresolved

        I would resurrect my comments from patchset 14, but they don't link through to the new code.

        Is this test sensible? I feel like it's not, because the name suggests to me that instead of checking UA the new way, we should instead be looking at whether PrepareRequest does it's job -- just using a different litmus test than User-Agent. Advice welcome.

        Adam Rice

        Looking at the original CL, there does seem to be a point to this:
        https://chromium-review.googlesource.com/c/chromium/src/+/518743

        Detaching the page causes the user agent string to be cached, and so the test is verifying that the code is doing this correctly.

        Maybe add some comments, but keep it the same? Or add another test that does actually call `PrepareRequest()` and verifies something else it is supposed to be doing?

        Open in Gerrit

        Related details

        Attention is currently required from:
        • Andrew Brown
        • Clark DuVall
        Submit Requirements:
        • requirement satisfiedCode-Coverage
        • requirement is not satisfiedCode-Owners
        • requirement is not satisfiedCode-Review
        • requirement is not satisfiedNo-Unresolved-Comments
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: comment
        Gerrit-Project: chromium/src
        Gerrit-Branch: main
        Gerrit-Change-Id: Icf56620f99f371ea2f128e6a3194d6096b0d62cd
        Gerrit-Change-Number: 5273743
        Gerrit-PatchSet: 37
        Gerrit-Owner: Andrew Brown <m...@ajbrown.au>
        Gerrit-Reviewer: Adam Rice <ri...@chromium.org>
        Gerrit-Reviewer: Alex Moshchuk <ale...@chromium.org>
        Gerrit-Reviewer: Andrew Brown <m...@ajbrown.au>
        Gerrit-Reviewer: Devlin Cronin <rdevlin...@chromium.org>
        Gerrit-Reviewer: Min Qin <qin...@chromium.org>
        Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
        Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
        Gerrit-CC: Clark DuVall <cdu...@chromium.org>
        Gerrit-CC: Giovanni Ortuno Urquidi <ort...@chromium.org>
        Gerrit-CC: Hiroki Nakagawa <nhi...@chromium.org>
        Gerrit-CC: James Maclean <wjma...@chromium.org>
        Gerrit-CC: James Su <su...@chromium.org>
        Gerrit-CC: Nate Chapin <jap...@chromium.org>
        Gerrit-CC: Oliver Dunk <olive...@chromium.org>
        Gerrit-CC: Takashi Nakayama <tn...@chromium.org>
        Gerrit-Attention: Clark DuVall <cdu...@chromium.org>
        Gerrit-Attention: Andrew Brown <m...@ajbrown.au>
        Gerrit-Comment-Date: Sun, 17 Aug 2025 16:52:49 +0000
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Andrew Brown (Gerrit)

        unread,
        Aug 17, 2025, 11:33:39 PMAug 17
        to Adam Rice, Clark DuVall, Devlin Cronin, Giovanni Ortuno Urquidi, Oliver Dunk, Alex Moshchuk, Takashi Toyoshima, Chromium Metrics Reviews, Takashi Nakayama, Min Qin, Hiroki Nakagawa, James Maclean, James Su, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, asvitkine...@chromium.org, devtools-re...@chromium.org, extension...@chromium.org, chromium-a...@chromium.org, mkwst+w...@chromium.org, horo+...@chromium.org, shimazu+se...@chromium.org, kinuko+ser...@chromium.org, servicewor...@chromium.org, antoniosarto...@chromium.org, kenjibah...@chromium.org, jsbell+ser...@chromium.org, arthursonzog...@chromium.org, blink-revie...@chromium.org, alexmo...@chromium.org, yhanad...@chromium.org, tranbaod...@chromium.org, nona+...@chromium.org, creis...@chromium.org, shuche...@chromium.org, jbauma...@chromium.org, navigation...@chromium.org, keithle...@chromium.org, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
        Attention needed from Adam Rice and Clark DuVall

        Andrew Brown added 5 comments

        Patchset-level comments
        Devlin Cronin . unresolved

        Thanks, Andrew! Extensions LGTM % nit, since there's now no behavior change.

        Andrew Brown

        Unfortunately the current test results do make this seem like it's not yet fixed.

        The few failures I've actually drilled into are *all* requests that have gone through the extensions stack, now needing a specific `User-Agent` CORS preflight response.

        This means the User-Agent getting added onto the headers in the `OnBeforeSendHeaders` event is actually affecting the real network request somehow, causing it to spot a non-CORS-exempt header on the headers and send a preflight (which the tests don't correctly respond to).

        So all requests that go through the Extensions stack are generating a CORS preflight for the User-Agent header, which most things won't expect and respond to. We need to find an alternative approach; merging here isn't suitable.

        My first guess is that the associated callback function might be our solution, if it lets me pass the `content_user_agent` back up to the front-end consumer for merging outside of all of this business? I don't know if that's feasible/reasonable at all though, considering that goes back into the black hole of mojom; it looks like it would need a lot of modifications all over the place in unrelated contexts.

        Other than that... I'm not sure.

        Devlin Cronin

        Thanks for the continued investigation!

        Unfortunately, I'm not sure of what the right solution here is, either. Since this is mostly touching the net stack, I'd defer to one of those owners. @ri...@chromium.org?

        Adam Rice

        I misunderstood the code when I looked at it before. This is happening before we call `CreateLoaderAndStart()`, so any modifications to `request_` will affect the real request. So we can't modify `request_` here.

        What I propose instead is to create a new `headers_with_user_agent_` member variable in the `InProgressRequest` class, which is a copy of `request_.headers` but with the User-Agent header added. Then anywhere we are currently calling a WebRequestEventRouter with a pointer to `request_.headers`, pass a pointer to `headers_with_user_agent_` instead.

        Any code which modifies `request_.headers`, for example WebRequestProxyingURLLoaderFactory::InProgressRequest::FollowRedirect(), must recreate `headers_with_user_agent_` to make sure it remains correct. Possibly it will be sufficient to put that code in the UpdateRequestInfo() method?

        The extra cost of copying the headers on the request fast path bothers me, but I can't see any way around it.

        Andrew Brown

        I've implemented this (I think?) -- dryrun please.

        I've called it `user_visible_headers_` with the logic that they're the headers that get sent back up to the "user" (i.e. extensions). Terminology check would be appreciated.

        My first attempt (which is now uploaded) seemed to pass the tests that I ran locally, which scares me a little, but if it works it works.

        Having now written it, I definitely can see where you're not keen on the extra copy... it feels bad to be making the `user_visible_headers_` in the constructor and then completely remaking them again in `ContinueToBeforeSendHeaders`. There might be a way around it if we try to ensure that `user_visible_headers_` are updated wherever the `headers` change? But that seems like a lot of code complexity, so eh.

        File-level comment, Patchset 37:
        Andrew Brown . resolved

        I've temporarily commented out the mystery-tbd-Extensions-merging stuff that we're still working out -- could someone put this CL through a dryrun so I can check the redirect implementation is all working? I've made changes that fixed the last dubious test locally; just want to check it hasn't broken anything else in the process.

        It should pass everything *but* the two Extensions tests.

        Andrew Brown

        Done

        File net/http/http_request_headers.h
        Line 184, Patchset 35: void MergeAndAddUA(const HttpRequestHeaders& other,
        Adam Rice . resolved
        Since this method is rather specialised and doesn't require access to HttpRequestHeaders internals, I would prefer if it was not a method on the class. A static function in `net::HttpUtil`  would be preferable. Something like
        ```
        static HttpRequestHeaders MergeHeadersAndAddUserAgent(
        net::HttpRequestHeaders info,
        const net::HttpRequestHeaders& from,
        std::optional<std::string> user_agent);
        ```
        The asymmetry between the passing convention for the parameters is so you can do
        ```
        existing =
        net::HttpUtil::MergeHeadersAndAddUserAgent(std::move(existing), extra_headers, user_agent);
        ```
        and it will efficiently move the `existing` object to the output, or
        ```
        net::HttpRequestHeaders merged =
        net::HttpUtil::MargeHeadersAndAddUserAgent(base, extra_headers, user_agent);
        ```
        when you need a new object.
        Andrew Brown

        Huh, nifty. Done!

        File services/network/public/mojom/url_request.mojom
        Line 285, Patchset 28: // already set a User-Agent via fetch.
        Andrew Brown . resolved

        Is the terminology in this comment sensible?

        Adam Rice

        How about something like:
        ```
        The correct value for the "User-Agent" header from the point-of-view of the
        caller, after DevTools and other overrides have been applied. If this is not set, the "User-Agent" value configured on the NetworkContext will be used instead.
        This can be overridden by setting a "User-Agent" in `headers`, but that will
        require a CORS preflight for an untrusted client.

        The `User-Agent` header cannot be set both in `cors_exempt_headers` as it will
        not be merged correctly if it was also set in `headers`.
        ```

        Andrew Brown

        Added with a few slight changes.

        File third_party/blink/renderer/core/loader/frame_fetch_context_test.cc
        Line 1565, Patchset 25: EXPECT_EQ("hi", GetFetchContext()->GetDefaultUserAgent());
        Andrew Brown . unresolved

        I would resurrect my comments from patchset 14, but they don't link through to the new code.

        Is this test sensible? I feel like it's not, because the name suggests to me that instead of checking UA the new way, we should instead be looking at whether PrepareRequest does it's job -- just using a different litmus test than User-Agent. Advice welcome.

        Adam Rice

        Looking at the original CL, there does seem to be a point to this:
        https://chromium-review.googlesource.com/c/chromium/src/+/518743

        Detaching the page causes the user agent string to be cached, and so the test is verifying that the code is doing this correctly.

        Maybe add some comments, but keep it the same? Or add another test that does actually call `PrepareRequest()` and verifies something else it is supposed to be doing?

        Andrew Brown

        I've added a new `PrepareRequestWhenDetached` that checks the UkmSourceID.

        I think that should be equivalent(?), as far as the old test was checking that you could call PrepareRequest while detached and it would still do some sort of stuff.

        Open in Gerrit

        Related details

        Attention is currently required from:
        • Adam Rice
        • Clark DuVall
        Submit Requirements:
        • requirement satisfiedCode-Coverage
        • requirement is not satisfiedCode-Owners
        • requirement is not satisfiedCode-Review
        • requirement is not satisfiedNo-Unresolved-Comments
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: comment
        Gerrit-Project: chromium/src
        Gerrit-Branch: main
        Gerrit-Change-Id: Icf56620f99f371ea2f128e6a3194d6096b0d62cd
        Gerrit-Change-Number: 5273743
        Gerrit-PatchSet: 38
        Gerrit-Owner: Andrew Brown <m...@ajbrown.au>
        Gerrit-Reviewer: Adam Rice <ri...@chromium.org>
        Gerrit-Reviewer: Alex Moshchuk <ale...@chromium.org>
        Gerrit-Reviewer: Andrew Brown <m...@ajbrown.au>
        Gerrit-Reviewer: Devlin Cronin <rdevlin...@chromium.org>
        Gerrit-Reviewer: Min Qin <qin...@chromium.org>
        Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
        Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
        Gerrit-CC: Clark DuVall <cdu...@chromium.org>
        Gerrit-CC: Giovanni Ortuno Urquidi <ort...@chromium.org>
        Gerrit-CC: Hiroki Nakagawa <nhi...@chromium.org>
        Gerrit-CC: James Maclean <wjma...@chromium.org>
        Gerrit-CC: James Su <su...@chromium.org>
        Gerrit-CC: Nate Chapin <jap...@chromium.org>
        Gerrit-CC: Oliver Dunk <olive...@chromium.org>
        Gerrit-CC: Takashi Nakayama <tn...@chromium.org>
        Gerrit-Attention: Clark DuVall <cdu...@chromium.org>
        Gerrit-Attention: Adam Rice <ri...@chromium.org>
        Gerrit-Comment-Date: Mon, 18 Aug 2025 03:33:08 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: No
        Comment-In-Reply-To: Adam Rice <ri...@chromium.org>
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Adam Rice (Gerrit)

        unread,
        Aug 18, 2025, 4:49:14 PMAug 18
        to Andrew Brown, Clark DuVall, Devlin Cronin, Giovanni Ortuno Urquidi, Oliver Dunk, Alex Moshchuk, Takashi Toyoshima, Chromium Metrics Reviews, Takashi Nakayama, Min Qin, Hiroki Nakagawa, James Maclean, James Su, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, asvitkine...@chromium.org, devtools-re...@chromium.org, extension...@chromium.org, chromium-a...@chromium.org, mkwst+w...@chromium.org, horo+...@chromium.org, shimazu+se...@chromium.org, kinuko+ser...@chromium.org, servicewor...@chromium.org, antoniosarto...@chromium.org, kenjibah...@chromium.org, jsbell+ser...@chromium.org, arthursonzog...@chromium.org, blink-revie...@chromium.org, alexmo...@chromium.org, yhanad...@chromium.org, tranbaod...@chromium.org, nona+...@chromium.org, creis...@chromium.org, shuche...@chromium.org, jbauma...@chromium.org, navigation...@chromium.org, keithle...@chromium.org, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
        Attention needed from Adam Rice, Andrew Brown and Clark DuVall

        Adam Rice voted and added 6 comments

        Votes added by Adam Rice

        Commit-Queue+1

        6 comments

        File extensions/browser/api/web_request/web_request_proxying_url_loader_factory.h
        Line 218, Patchset 40 (Latest): net::HttpRequestHeaders user_visible_headers_;
        Adam Rice . unresolved

        How about `script_exposed_headers_` as an alternative name?

        Line 217, Patchset 40 (Latest): // that has to happen further down (after CORS checks).
        Adam Rice . unresolved

        I suggest "has to happen in the network service" would be clearer.

        File extensions/browser/api/web_request/web_request_proxying_url_loader_factory.cc
        Line 189, Patchset 40 (Latest): user_visible_headers_ = net::HttpUtil::MergeHeadersAndAddUserAgent(
        Adam Rice . unresolved

        I think this should go in the member initialiser section above. Also in the other constructor below.

        File net/http/http_util.cc
        Line 433, Patchset 40 (Latest): *(user_agent));
        Adam Rice . unresolved

        Nit: `()` around `user_agent` are not needed.

        File services/network/url_loader.cc
        Line 830, Patchset 40 (Latest): net::HttpRequestHeaders::kUserAgent, *(content_user_agent_));
        Adam Rice . unresolved

        Nit: `()` not needed around `content_user_agent_`.

        File third_party/blink/renderer/core/loader/frame_fetch_context_test.cc
        Line 1582, Patchset 40 (Latest): EXPECT_EQ(ukm::kInvalidSourceId, request.GetUkmSourceId());
        Adam Rice . unresolved

        Unfortunately `ukm::kInvalidSourceId` is the default value for this field, so it doesn't really prove that `PrepareRequest()` did anything.

        Open in Gerrit

        Related details

        Attention is currently required from:
        • Adam Rice
        • Andrew Brown
        • Clark DuVall
        Submit Requirements:
        • requirement satisfiedCode-Coverage
        • requirement is not satisfiedCode-Owners
        • requirement is not satisfiedCode-Review
        • requirement is not satisfiedNo-Unresolved-Comments
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: comment
        Gerrit-Project: chromium/src
        Gerrit-Branch: main
        Gerrit-Change-Id: Icf56620f99f371ea2f128e6a3194d6096b0d62cd
        Gerrit-Change-Number: 5273743
        Gerrit-PatchSet: 40
        Gerrit-Owner: Andrew Brown <m...@ajbrown.au>
        Gerrit-Reviewer: Adam Rice <ri...@chromium.org>
        Gerrit-Reviewer: Alex Moshchuk <ale...@chromium.org>
        Gerrit-Reviewer: Andrew Brown <m...@ajbrown.au>
        Gerrit-Reviewer: Devlin Cronin <rdevlin...@chromium.org>
        Gerrit-Reviewer: Min Qin <qin...@chromium.org>
        Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
        Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
        Gerrit-CC: Clark DuVall <cdu...@chromium.org>
        Gerrit-CC: Giovanni Ortuno Urquidi <ort...@chromium.org>
        Gerrit-CC: Hiroki Nakagawa <nhi...@chromium.org>
        Gerrit-CC: James Maclean <wjma...@chromium.org>
        Gerrit-CC: James Su <su...@chromium.org>
        Gerrit-CC: Nate Chapin <jap...@chromium.org>
        Gerrit-CC: Oliver Dunk <olive...@chromium.org>
        Gerrit-CC: Takashi Nakayama <tn...@chromium.org>
        Gerrit-Attention: Clark DuVall <cdu...@chromium.org>
        Gerrit-Attention: Adam Rice <ri...@chromium.org>
        Gerrit-Attention: Andrew Brown <m...@ajbrown.au>
        Gerrit-Comment-Date: Mon, 18 Aug 2025 20:48:57 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: Yes
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Andrew Brown (Gerrit)

        unread,
        Aug 21, 2025, 7:01:32 AMAug 21
        to Adam Rice, Clark DuVall, Devlin Cronin, Giovanni Ortuno Urquidi, Oliver Dunk, Alex Moshchuk, Takashi Toyoshima, Chromium Metrics Reviews, Takashi Nakayama, Min Qin, Hiroki Nakagawa, James Maclean, James Su, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, asvitkine...@chromium.org, devtools-re...@chromium.org, extension...@chromium.org, chromium-a...@chromium.org, mkwst+w...@chromium.org, horo+...@chromium.org, shimazu+se...@chromium.org, kinuko+ser...@chromium.org, servicewor...@chromium.org, antoniosarto...@chromium.org, kenjibah...@chromium.org, jsbell+ser...@chromium.org, arthursonzog...@chromium.org, blink-revie...@chromium.org, alexmo...@chromium.org, yhanad...@chromium.org, tranbaod...@chromium.org, nona+...@chromium.org, creis...@chromium.org, shuche...@chromium.org, jbauma...@chromium.org, navigation...@chromium.org, keithle...@chromium.org, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
        Attention needed from Adam Rice and Clark DuVall

        Andrew Brown added 1 comment

        File third_party/blink/renderer/core/loader/frame_fetch_context_test.cc
        Line 1582, Patchset 40 (Latest): EXPECT_EQ(ukm::kInvalidSourceId, request.GetUkmSourceId());
        Adam Rice . unresolved

        Unfortunately `ukm::kInvalidSourceId` is the default value for this field, so it doesn't really prove that `PrepareRequest()` did anything.

        Andrew Brown

        Ah, so it is. I spotted in `t/b/r/core/testing/dummy_page_holder.cc:134` that the document source ID for these tests was initialised specifically as `kInvalidSourceId`, so I figured it would be a decent test example, but didn't check the ResourceRequest default.

        Would it be possible to add a quick constant to ukm, call it `ukm::kTestingSourceID`, that could be set at `dummy_page_holder.cc:134` and used for this test? I'm a little surprised there's not one already, but I guess it would be a bit niche.

        Otherwise the next option would be looking into `request.SetStorageApiAccess` in `FrameFetchContext::PrepareRequest` to see if it sets a value we can test.

        Open in Gerrit

        Related details

        Attention is currently required from:
        • Adam Rice
        • Clark DuVall
        Gerrit-Comment-Date: Thu, 21 Aug 2025 11:00:57 +0000
        Gerrit-HasComments: Yes
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Adam Rice (Gerrit)

        unread,
        Aug 22, 2025, 5:04:30 PMAug 22
        to Andrew Brown, Clark DuVall, Devlin Cronin, Giovanni Ortuno Urquidi, Oliver Dunk, Alex Moshchuk, Takashi Toyoshima, Chromium Metrics Reviews, Takashi Nakayama, Min Qin, Hiroki Nakagawa, James Maclean, James Su, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, asvitkine...@chromium.org, devtools-re...@chromium.org, extension...@chromium.org, chromium-a...@chromium.org, mkwst+w...@chromium.org, horo+...@chromium.org, shimazu+se...@chromium.org, kinuko+ser...@chromium.org, servicewor...@chromium.org, antoniosarto...@chromium.org, kenjibah...@chromium.org, jsbell+ser...@chromium.org, arthursonzog...@chromium.org, blink-revie...@chromium.org, alexmo...@chromium.org, yhanad...@chromium.org, tranbaod...@chromium.org, nona+...@chromium.org, creis...@chromium.org, shuche...@chromium.org, jbauma...@chromium.org, navigation...@chromium.org, keithle...@chromium.org, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
        Attention needed from Andrew Brown and Clark DuVall

        Adam Rice added 1 comment

        File third_party/blink/renderer/core/loader/frame_fetch_context_test.cc
        Line 1582, Patchset 40 (Latest): EXPECT_EQ(ukm::kInvalidSourceId, request.GetUkmSourceId());
        Adam Rice . unresolved

        Unfortunately `ukm::kInvalidSourceId` is the default value for this field, so it doesn't really prove that `PrepareRequest()` did anything.

        Andrew Brown

        Ah, so it is. I spotted in `t/b/r/core/testing/dummy_page_holder.cc:134` that the document source ID for these tests was initialised specifically as `kInvalidSourceId`, so I figured it would be a decent test example, but didn't check the ResourceRequest default.

        Would it be possible to add a quick constant to ukm, call it `ukm::kTestingSourceID`, that could be set at `dummy_page_holder.cc:134` and used for this test? I'm a little surprised there's not one already, but I guess it would be a bit niche.

        Otherwise the next option would be looking into `request.SetStorageApiAccess` in `FrameFetchContext::PrepareRequest` to see if it sets a value we can test.

        Adam Rice

        On further inspection, PrepareRequest() only does two things when detached, and the only one that has a side effect is setting the user agent. So there's nothing here we can test. I think we should just delete this "PrepareRequestWhenDetached" test because it isn't adding any value.

        Open in Gerrit

        Related details

        Attention is currently required from:
        • Andrew Brown
        • Clark DuVall
        Gerrit-Attention: Andrew Brown <m...@ajbrown.au>
        Gerrit-Comment-Date: Fri, 22 Aug 2025 21:04:15 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: No
        Comment-In-Reply-To: Adam Rice <ri...@chromium.org>
        Comment-In-Reply-To: Andrew Brown <m...@ajbrown.au>
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Andrew Brown (Gerrit)

        unread,
        Aug 22, 2025, 8:07:01 PMAug 22
        to Adam Rice, Clark DuVall, Devlin Cronin, Giovanni Ortuno Urquidi, Oliver Dunk, Alex Moshchuk, Takashi Toyoshima, Chromium Metrics Reviews, Takashi Nakayama, Min Qin, Hiroki Nakagawa, James Maclean, James Su, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, Nate Chapin, asvitkine...@chromium.org, devtools-re...@chromium.org, extension...@chromium.org, chromium-a...@chromium.org, mkwst+w...@chromium.org, horo+...@chromium.org, shimazu+se...@chromium.org, kinuko+ser...@chromium.org, servicewor...@chromium.org, antoniosarto...@chromium.org, kenjibah...@chromium.org, jsbell+ser...@chromium.org, arthursonzog...@chromium.org, blink-revie...@chromium.org, alexmo...@chromium.org, yhanad...@chromium.org, tranbaod...@chromium.org, nona+...@chromium.org, creis...@chromium.org, shuche...@chromium.org, jbauma...@chromium.org, navigation...@chromium.org, keithle...@chromium.org, blink-...@chromium.org, blundell+...@chromium.org, gavinp...@chromium.org, kinuko...@chromium.org, loading-re...@chromium.org, loading...@chromium.org, net-r...@chromium.org, network-ser...@chromium.org
        Attention needed from Adam Rice and Clark DuVall

        Andrew Brown added 8 comments

        Patchset-level comments
        Devlin Cronin . unresolved

        Thanks, Andrew! Extensions LGTM % nit, since there's now no behavior change.

        Andrew Brown

        Unfortunately the current test results do make this seem like it's not yet fixed.

        The few failures I've actually drilled into are *all* requests that have gone through the extensions stack, now needing a specific `User-Agent` CORS preflight response.

        This means the User-Agent getting added onto the headers in the `OnBeforeSendHeaders` event is actually affecting the real network request somehow, causing it to spot a non-CORS-exempt header on the headers and send a preflight (which the tests don't correctly respond to).

        So all requests that go through the Extensions stack are generating a CORS preflight for the User-Agent header, which most things won't expect and respond to. We need to find an alternative approach; merging here isn't suitable.

        My first guess is that the associated callback function might be our solution, if it lets me pass the `content_user_agent` back up to the front-end consumer for merging outside of all of this business? I don't know if that's feasible/reasonable at all though, considering that goes back into the black hole of mojom; it looks like it would need a lot of modifications all over the place in unrelated contexts.

        Other than that... I'm not sure.

        Devlin Cronin

        Thanks for the continued investigation!

        Unfortunately, I'm not sure of what the right solution here is, either. Since this is mostly touching the net stack, I'd defer to one of those owners. @ri...@chromium.org?

        Adam Rice

        I misunderstood the code when I looked at it before. This is happening before we call `CreateLoaderAndStart()`, so any modifications to `request_` will affect the real request. So we can't modify `request_` here.

        What I propose instead is to create a new `headers_with_user_agent_` member variable in the `InProgressRequest` class, which is a copy of `request_.headers` but with the User-Agent header added. Then anywhere we are currently calling a WebRequestEventRouter with a pointer to `request_.headers`, pass a pointer to `headers_with_user_agent_` instead.

        Any code which modifies `request_.headers`, for example WebRequestProxyingURLLoaderFactory::InProgressRequest::FollowRedirect(), must recreate `headers_with_user_agent_` to make sure it remains correct. Possibly it will be sufficient to put that code in the UpdateRequestInfo() method?

        The extra cost of copying the headers on the request fast path bothers me, but I can't see any way around it.

        Andrew Brown

        I've implemented this (I think?) -- dryrun please.

        I've called it `user_visible_headers_` with the logic that they're the headers that get sent back up to the "user" (i.e. extensions). Terminology check would be appreciated.

        My first attempt (which is now uploaded) seemed to pass the tests that I ran locally, which scares me a little, but if it works it works.

        Having now written it, I definitely can see where you're not keen on the extra copy... it feels bad to be making the `user_visible_headers_` in the constructor and then completely remaking them again in `ContinueToBeforeSendHeaders`. There might be a way around it if we try to ensure that `user_visible_headers_` are updated wherever the `headers` change? But that seems like a lot of code complexity, so eh.

        Andrew Brown

        Continuing this discussion, I think we have further problems.

        The entire extensions stack seems to pass around the one headers object for all modifications, including the actual modifications that extensions could make (e.g. by DeclarativeNetRequest). So we have to somehow get these modifications back to the real request somehow (*without* passing the content_user_agent and triggering CORS).

        I can think of two ways forwards to try to maintain the existing behaviour:
        - Literally just check the value of the User-Agent header when the `proxying_url_loader` gets the headers back, and if it's an exact match for the `content_user_agent`, remove it.
        Problems: 1. we would actually have to check string equality for the header value, which has a bit of of a bad code smell, and 2. What happens in the pathological case where an extension manually sets the header to the same value?
        - Somehow special-case the User-Agent *inside* net::HttpRequestHeaders. Basically, store some sort of flag for "has the UA been modified," and only remove the UA if the headers object reports it as unchanged. (I attempted to originally do this by making an actual subclass of `net::HttpRequestHeaders` inside the `InProgressRequest` that had special user-agent-tracking behaviour. I was probably messing up the inheritance somehow but it didn't seem like a good solution.)
        Problems: modifying the actual `net::HttpRequestHeaders` for this seems like a bad idea.
        File extensions/browser/api/web_request/web_request_proxying_url_loader_factory.h
        Line 218, Patchset 40: net::HttpRequestHeaders user_visible_headers_;
        Adam Rice . resolved

        How about `script_exposed_headers_` as an alternative name?

        Andrew Brown

        Done

        Line 217, Patchset 40: // that has to happen further down (after CORS checks).
        Adam Rice . resolved

        I suggest "has to happen in the network service" would be clearer.

        Andrew Brown

        Done

        File extensions/browser/api/web_request/web_request_proxying_url_loader_factory.cc
        Line 189, Patchset 40: user_visible_headers_ = net::HttpUtil::MergeHeadersAndAddUserAgent(
        Adam Rice . resolved

        I think this should go in the member initialiser section above. Also in the other constructor below.

        Andrew Brown

        Done

        File net/http/http_util.cc
        Line 433, Patchset 40: *(user_agent));
        Adam Rice . resolved

        Nit: `()` around `user_agent` are not needed.

        Andrew Brown

        Done

        File services/network/url_loader.cc
        Line 830, Patchset 40: net::HttpRequestHeaders::kUserAgent, *(content_user_agent_));
        Adam Rice . resolved

        Nit: `()` not needed around `content_user_agent_`.

        Andrew Brown

        Done

        File third_party/blink/renderer/core/loader/frame_fetch_context_test.cc
        Line 1565, Patchset 25: EXPECT_EQ("hi", GetFetchContext()->GetDefaultUserAgent());
        Andrew Brown . resolved

        I would resurrect my comments from patchset 14, but they don't link through to the new code.

        Is this test sensible? I feel like it's not, because the name suggests to me that instead of checking UA the new way, we should instead be looking at whether PrepareRequest does it's job -- just using a different litmus test than User-Agent. Advice welcome.

        Adam Rice

        Looking at the original CL, there does seem to be a point to this:
        https://chromium-review.googlesource.com/c/chromium/src/+/518743

        Detaching the page causes the user agent string to be cached, and so the test is verifying that the code is doing this correctly.

        Maybe add some comments, but keep it the same? Or add another test that does actually call `PrepareRequest()` and verifies something else it is supposed to be doing?

        Andrew Brown

        I've added a new `PrepareRequestWhenDetached` that checks the UkmSourceID.

        I think that should be equivalent(?), as far as the old test was checking that you could call PrepareRequest while detached and it would still do some sort of stuff.

        Andrew Brown

        Done

        Line 1582, Patchset 40: EXPECT_EQ(ukm::kInvalidSourceId, request.GetUkmSourceId());
        Adam Rice . resolved

        Unfortunately `ukm::kInvalidSourceId` is the default value for this field, so it doesn't really prove that `PrepareRequest()` did anything.

        Andrew Brown

        Ah, so it is. I spotted in `t/b/r/core/testing/dummy_page_holder.cc:134` that the document source ID for these tests was initialised specifically as `kInvalidSourceId`, so I figured it would be a decent test example, but didn't check the ResourceRequest default.

        Would it be possible to add a quick constant to ukm, call it `ukm::kTestingSourceID`, that could be set at `dummy_page_holder.cc:134` and used for this test? I'm a little surprised there's not one already, but I guess it would be a bit niche.

        Otherwise the next option would be looking into `request.SetStorageApiAccess` in `FrameFetchContext::PrepareRequest` to see if it sets a value we can test.

        Adam Rice

        On further inspection, PrepareRequest() only does two things when detached, and the only one that has a side effect is setting the user agent. So there's nothing here we can test. I think we should just delete this "PrepareRequestWhenDetached" test because it isn't adding any value.

        Andrew Brown

        Alright, sweet.

        Open in Gerrit

        Related details

        Attention is currently required from:
        • Adam Rice
        • Clark DuVall
        Submit Requirements:
        • requirement satisfiedCode-Coverage
        • requirement is not satisfiedCode-Owners
        • requirement is not satisfiedCode-Review
        • requirement is not satisfiedNo-Unresolved-Comments
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: comment
        Gerrit-Project: chromium/src
        Gerrit-Branch: main
        Gerrit-Change-Id: Icf56620f99f371ea2f128e6a3194d6096b0d62cd
        Gerrit-Change-Number: 5273743
        Gerrit-PatchSet: 41
        Gerrit-Owner: Andrew Brown <m...@ajbrown.au>
        Gerrit-Reviewer: Adam Rice <ri...@chromium.org>
        Gerrit-Reviewer: Alex Moshchuk <ale...@chromium.org>
        Gerrit-Reviewer: Andrew Brown <m...@ajbrown.au>
        Gerrit-Reviewer: Devlin Cronin <rdevlin...@chromium.org>
        Gerrit-Reviewer: Min Qin <qin...@chromium.org>
        Gerrit-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
        Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
        Gerrit-CC: Clark DuVall <cdu...@chromium.org>
        Gerrit-CC: Giovanni Ortuno Urquidi <ort...@chromium.org>
        Gerrit-CC: Hiroki Nakagawa <nhi...@chromium.org>
        Gerrit-CC: James Maclean <wjma...@chromium.org>
        Gerrit-CC: James Su <su...@chromium.org>
        Gerrit-CC: Nate Chapin <jap...@chromium.org>
        Gerrit-CC: Oliver Dunk <olive...@chromium.org>
        Gerrit-CC: Takashi Nakayama <tn...@chromium.org>
        Gerrit-Attention: Clark DuVall <cdu...@chromium.org>
        Gerrit-Attention: Adam Rice <ri...@chromium.org>
        Gerrit-Comment-Date: Sat, 23 Aug 2025 00:06:26 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: No
        Comment-In-Reply-To: Adam Rice <ri...@chromium.org>
        Comment-In-Reply-To: Andrew Brown <m...@ajbrown.au>
        Comment-In-Reply-To: Devlin Cronin <rdevlin...@chromium.org>
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy
        It is loading more messages.
        0 new messages