chromium user-agent changes

121 views
Skip to first unread message

Andrew Brown

unread,
Jul 29, 2025, 3:56:54 AMJul 29
to Chromium Extensions
Hi extensions team,

I've been working (for quite some time) on improving the handling of User-Agents in chromium, with a view to closing out some super-old standards incompliant behaviour -- https://issues.chromium.org/issues/40450316. As user-agents are used basically everywhere for basically everything, I'm now at a stage where I'm seeking advice from extensions expert(s) about a few failing test cases and what I can realistically do to fix them.

I have a CL here: https://chromium-review.googlesource.com/c/chromium/src/+/5273743 -- in order to pass ExtensionWebRequestApiPrerenderingTest.Load and ExtensionWebRequestApiPrerenderingTest.LoadIntoNewTab, the easiest way I can see is to just make an API change and no longer guarantee that `OnBeforeSendHeaders` will see a User-Agent (It would still appear in `OnSendHeaders`, as usual). This approach is currently implemented in the CL.

Making this API change would be in line with similar changes made to DevTools, where the inspector-protocol `RequestWillBeSent` no longer sees a User-Agent in all cases, but the final User-Agent is present on `RequestWillBeSentExtraInfo` later on.

However, API changes, especially an API this notable and a header as common as User-Agent, are big and annoying, so I'd like to avoid that if possible. The changes as I made to WebRequestProxyingURLLoaderFactory::InProgressRequest:: ContinueToSendHeaders can't easily be applied to the relevant backend for `OnBeforeSendHeaders`, unless I've missed something (very likely).

Any advice, thoughts, queries, concerns, etc. are welcome.
- Andrew

al

unread,
Jul 29, 2025, 8:06:59 AMJul 29
to Chromium Extensions, Andrew Brown
Hi Andrew,

I unfortunately can't provide advice - my apologies - but I do wish you the very best of luck on this. 
As a dev that has had to turn to declarativeNetRequest to just set the user-agent I find it unfathomable that Chromium has a bug like the one you linked.

And if you find it's, as you say, just way above your pay grade, I still commend your valiant effort and courage to attempt to fix it.
This recent gem of a comment in the thread, is a miserable indicator of $GOOG's interest in patching it, so your effort is not in vain.

All the best.

Oliver Dunk

unread,
Jul 29, 2025, 8:56:11 AMJul 29
to Andrew Brown, Chromium Extensions
Hi Andrew,

Thanks so much for flagging this.

Despite the name, this mailing list isn't heavily used for extension development, so you're unlikely to get an answer here. However, I've added Devlin as a reviewer on the CL. He is deeply involved in the internals and should be able to share more thoughts on this from a platform perspective.
Oliver Dunk | DevRel, Chrome Extensions | https://developer.chrome.com/ | London, GB


--
You received this message because you are subscribed to the Google Groups "Chromium Extensions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-extens...@chromium.org.
To view this discussion visit https://groups.google.com/a/chromium.org/d/msgid/chromium-extensions/14e9bbde-433c-4e64-ad3d-d79b36f93bdfn%40chromium.org.

Andrew Brown

unread,
Jul 29, 2025, 9:00:34 PMJul 29
to Chromium Extensions, Oliver Dunk, Chromium Extensions, Andrew Brown
Hah, yeah, I figured that out about ~5-10 min after posting, but then the message got sent to moderation purgatory anyway.
Much appreciated for your involvement on the CL -- fingers crossed.
Reply all
Reply to author
Forward
0 new messages