Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Need a mechanism to override navigator.userAgent
https://bugs.webkit.org/show_bug.cgi?id=193762 <rdar://problem/47504939> Reviewed by Brent Fulgham. Source/WebCore: Added the ability to specify user agent string just for navigator.userAgent via DocumentLoader. * loader/DocumentLoader.h: (WebCore::DocumentLoader::setCustomJavaScriptUserAgent): (WebCore::DocumentLoader::customJavaScriptUserAgent const): * loader/FrameLoader.cpp: (WebCore::FrameLoader::userAgentForJavaScript const): * loader/FrameLoader.h: * page/Navigator.cpp: (WebCore::Navigator::userAgent const): Source/WebKit: This patch adds a new _WKWebsitePolicies SPI to specify the user agent string returned by navigator.userAgent without affecting the user agent string used to send network requests. Tests: WebKit.WebsitePoliciesCustomJavaScriptUserAgent WebKit.WebsitePoliciesCustomUserAgents * 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 setCustomJavaScriptUserAgent:]): (-[_WKWebsitePolicies customJavaScriptUserAgent]): Tools: Added test cases for _WKWebsitePolicies.customJavaScriptUserAgent. * TestWebKitAPI/Tests/WebKitCocoa/WebsitePolicies.mm: (-[CustomJavaScriptUserAgentDelegate _webView:decidePolicyForNavigationAction:userInfo:decisionHandler:]): (-[CustomJavaScriptUserAgentDelegate webView:didFinishNavigation:]): Canonical link: https://commits.webkit.org/208372@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240541 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Showing
14 changed files
with
203 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters