User agent string override for navigator.userAgent should be site specific quirks
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 29 Jan 2019 07:15:00 +0000 (07:15 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 29 Jan 2019 07:15:00 +0000 (07:15 +0000)
commit5d4189d9907784459377e2dec9c83ce87b6f36f5
tree83dd1d1a53a52c7e6027686cc8037f247cda7964
parentb7ca69193f87aacbfee5ddfc3280de3a124463e6
User agent string override for navigator.userAgent should be site specific quirks
https://bugs.webkit.org/show_bug.cgi?id=193950

Reviewed by Brent Fulgham.

Source/WebCore:

In order to make it possible to toggle the UA string override just for navigator.userAgent via Web Inspector,
we need to put this override behind the site specific quirks. Because WebInspector overrides Page's setting
without updating WKPreferences, there is no way for WKWebView client's to know whether the site specific quirks
had been disabled or not.

* loader/DocumentLoader.h:
(WebCore::DocumentLoader::setCustomJavaScriptUserAgentAsSiteSpecificQuirks):
(WebCore::DocumentLoader::customJavaScriptUserAgentAsSiteSpecificQuirks const):
(WebCore::DocumentLoader::setCustomJavaScriptUserAgent): Deleted.
(WebCore::DocumentLoader::customJavaScriptUserAgent const): Deleted.
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::userAgentForJavaScript const):

Source/WebKit:

Renamed the various member variables, functions, properties and selectors.

* Shared/WebsitePoliciesData.cpp:
(WebKit::WebsitePoliciesData::encode const):
(WebKit::WebsitePoliciesData::decode):
(WebKit::WebsitePoliciesData::applyToDocumentLoader):
* Shared/WebsitePoliciesData.h:
* UIProcess/API/APIWebsitePolicies.cpp:
(API::WebsitePolicies::data):
* UIProcess/API/APIWebsitePolicies.h:
* UIProcess/API/Cocoa/_WKWebsitePolicies.h:
* UIProcess/API/Cocoa/_WKWebsitePolicies.mm:
(-[_WKWebsitePolicies setCustomJavaScriptUserAgentAsSiteSpecificQuirks:]): Renamed from setCustomJavaScriptUserAgent.
(-[_WKWebsitePolicies customJavaScriptUserAgentAsSiteSpecificQuirks]): Renamed from customJavaScriptUserAgent.

Tools:

Updated per the _WKWebsitePolicies rename.

* TestWebKitAPI/Tests/WebKitCocoa/WebsitePolicies.mm:
(-[CustomJavaScriptUserAgentDelegate _webView:decidePolicyForNavigationAction:userInfo:decisionHandler:]):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240646 268f45cc-cd09-0410-ab3c-d52691b4dbfc
12 files changed:
Source/WebCore/ChangeLog
Source/WebCore/loader/DocumentLoader.h
Source/WebCore/loader/FrameLoader.cpp
Source/WebKit/ChangeLog
Source/WebKit/Shared/WebsitePoliciesData.cpp
Source/WebKit/Shared/WebsitePoliciesData.h
Source/WebKit/UIProcess/API/APIWebsitePolicies.cpp
Source/WebKit/UIProcess/API/APIWebsitePolicies.h
Source/WebKit/UIProcess/API/Cocoa/_WKWebsitePolicies.h
Source/WebKit/UIProcess/API/Cocoa/_WKWebsitePolicies.mm
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WebKitCocoa/WebsitePolicies.mm