Bug 281212
| Summary: | Disable iPad Mini UA overrides when Site Specific Hacks are disabled | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Karl Dubost <karlcow> |
| Component: | WebKit Misc. | Assignee: | Brent Fulgham <bfulgham> |
| Status: | RESOLVED FIXED | ||
| Severity: | Normal | CC: | webkit-bug-importer |
| Priority: | P2 | Keywords: | InRadar |
| Version: | WebKit Nightly Build | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Bug Depends on: | 269335 | ||
| Bug Blocks: | |||
Karl Dubost
This is a followup on bug 269335
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Karl Dubost
rdar://50035167
Karl Dubost
Currently some sites have an iPad Mini UA override, when their desktop site is not compatible with the iPad (often because of touch events)
As of now, it is not possible for someone to test the site without the UA override by disabling the Site Specific Hacks in Web Inspector.
https://github.com/WebKit/WebKit/blob/e5129b67d050188136b89e6666472ca59339256e/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm#L1405-L1412
There is no check for the Quirks preference.
```
enum class RecommendDesktopClassBrowsingForRequest { No, Yes, Auto };
static RecommendDesktopClassBrowsingForRequest desktopClassBrowsingRecommendedForRequest(const WebCore::ResourceRequest& request)
{
// FIXME: This should be additionally gated on site-specific quirks being enabled.
// See also: <rdar://problem/50035167>.
// The list of domain names is currently available in Source/WebCore/page/Quirks.cpp
if (Quirks::needsIPadMiniUserAgent(request.url()))
return RecommendDesktopClassBrowsingForRequest::No;
// content cut for brevity …
}
```
The method is static and does not have access to document.
but this is called by
```
bool WebPageProxy::isDesktopClassBrowsingRecommended(const WebCore::ResourceRequest& request) const
{
auto desktopClassBrowsingRecommendation = desktopClassBrowsingRecommendedForRequest(request);
if (desktopClassBrowsingRecommendation == RecommendDesktopClassBrowsingForRequest::Yes)
return true;
if (desktopClassBrowsingRecommendation == RecommendDesktopClassBrowsingForRequest::No)
return false;
// content cut for brevity …
}
```
which is itself called by
```
bool WebPageProxy::useDesktopClassBrowsing(const API::WebsitePolicies& policies, const WebCore::ResourceRequest& request) const
{
switch (policies.preferredContentMode()) {
case WebContentMode::Recommended: {
return isDesktopClassBrowsingRecommended(request);
}
// content cut for brevity …
}
```
that should make it possible to access the settings
if (m_frame->settings().needsSiteSpecificQuirks()) { }
Karl Dubost
Pull request: https://github.com/WebKit/WebKit/pull/35044
Brent Fulgham
Pull request: https://github.com/WebKit/WebKit/pull/35081
EWS
Committed 285166@main (d146f360321a): <https://commits.webkit.org/285166@main>
Reviewed commits have been landed. Closing PR #35081 and removing active labels.