| Summary: | Web Inspector: When there is a UA override on Safari, choosing a UA override in Develop Menu is not working | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Karl Dubost <karlcow> |
| Component: | Web Inspector | Assignee: | Abrar Rahman Protyasha <a_protyasha> |
| Status: | RESOLVED FIXED | ||
| Severity: | Normal | CC: | a_protyasha, inspector-bugzilla-changes, webkit-bug-importer |
| Priority: | P2 | Keywords: | InRadar |
| Version: | Safari 17 | ||
| Hardware: | All | ||
| OS: | All | ||
| See Also: | https://bugs.webkit.org/show_bug.cgi?id=263619 | ||
|
Description
Karl Dubost
2023-11-30 05:50:24 PST
Ah, I see what's happening here.
In `FrameLoader::userAgent()`, after we assign the UA string to a site-specific quirk, we don't consult the `WebLocalFrameLoaderClient` for the UA string anymore. Notice the `userAgent.isEmpty()` check, which is false if we have a site-specific quirk:
```
// From FrameLoader::userAgent()
if (userAgent.isEmpty())
userAgent = m_client->userAgent(url);
```
`WebLocalFrameLoaderClient::userAgent` gives us the UA string set on the web page, which happens to be either the default UA string or a custom UA string (such as the UA override from Safari's develop menu).
So, it seems like we need to jiggle around our logic in `FrameLoader::userAgent()`, but I don't think we have enough fidelity to tell when we should be consulting the site-specific quirk and when we should instead be consulting `WebLocalFrameLoader::userAgent` because it will tell us a custom UA string set using the `WKPageSetCustomUserAgent` API (again, such as the UA override from Safari's develop menu).
Pull request: https://github.com/WebKit/WebKit/pull/22694 Committed 273001@main (65e9ef262a03): <https://commits.webkit.org/273001@main> Reviewed commits have been landed. Closing PR #22694 and removing active labels. |