Changeset 240646 in webkit
- Timestamp:
- Jan 28, 2019 11:15:00 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r240644 r240646 1 2019-01-28 Ryosuke Niwa <rniwa@webkit.org> 2 3 User agent string override for navigator.userAgent should be site specific quirks 4 https://bugs.webkit.org/show_bug.cgi?id=193950 5 6 Reviewed by Brent Fulgham. 7 8 In order to make it possible to toggle the UA string override just for navigator.userAgent via Web Inspector, 9 we need to put this override behind the site specific quirks. Because WebInspector overrides Page's setting 10 without updating WKPreferences, there is no way for WKWebView client's to know whether the site specific quirks 11 had been disabled or not. 12 13 * loader/DocumentLoader.h: 14 (WebCore::DocumentLoader::setCustomJavaScriptUserAgentAsSiteSpecificQuirks): 15 (WebCore::DocumentLoader::customJavaScriptUserAgentAsSiteSpecificQuirks const): 16 (WebCore::DocumentLoader::setCustomJavaScriptUserAgent): Deleted. 17 (WebCore::DocumentLoader::customJavaScriptUserAgent const): Deleted. 18 * loader/FrameLoader.cpp: 19 (WebCore::FrameLoader::userAgentForJavaScript const): 20 1 21 2019-01-28 Devin Rousso <drousso@apple.com> 2 22 -
trunk/Source/WebCore/loader/DocumentLoader.h
r240541 r240646 272 272 const String& customUserAgent() const { return m_customUserAgent; } 273 273 274 void setCustomJavaScriptUserAgent (const String& customJavaScriptUserAgent) { m_customJavaScriptUserAgent = customJavaScriptUserAgent; }275 const String& customJavaScriptUserAgent () const { return m_customJavaScriptUserAgent; }274 void setCustomJavaScriptUserAgentAsSiteSpecificQuirks(const String& customUserAgent) { m_customJavaScriptUserAgentAsSiteSpecificQuirks = customUserAgent; } 275 const String& customJavaScriptUserAgentAsSiteSpecificQuirks() const { return m_customJavaScriptUserAgentAsSiteSpecificQuirks; } 276 276 277 277 void setCustomNavigatorPlatform(const String& customNavigatorPlatform) { m_customNavigatorPlatform = customNavigatorPlatform; } … … 547 547 #endif 548 548 String m_customUserAgent; 549 String m_customJavaScriptUserAgent ;549 String m_customJavaScriptUserAgentAsSiteSpecificQuirks; 550 550 String m_customNavigatorPlatform; 551 551 bool m_userContentExtensionsEnabled { true }; -
trunk/Source/WebCore/loader/FrameLoader.cpp
r240549 r240646 2716 2716 2717 2717 if (auto* documentLoader = m_frame.mainFrame().loader().activeDocumentLoader()) { 2718 userAgent = documentLoader->customJavaScriptUserAgent(); 2718 if (m_frame.settings().needsSiteSpecificQuirks()) 2719 userAgent = documentLoader->customJavaScriptUserAgentAsSiteSpecificQuirks(); 2719 2720 if (userAgent.isEmpty()) 2720 2721 userAgent = documentLoader->customUserAgent(); -
trunk/Source/WebKit/ChangeLog
r240645 r240646 1 2019-01-28 Ryosuke Niwa <rniwa@webkit.org> 2 3 User agent string override for navigator.userAgent should be site specific quirks 4 https://bugs.webkit.org/show_bug.cgi?id=193950 5 6 Reviewed by Brent Fulgham. 7 8 Renamed the various member variables, functions, properties and selectors. 9 10 * Shared/WebsitePoliciesData.cpp: 11 (WebKit::WebsitePoliciesData::encode const): 12 (WebKit::WebsitePoliciesData::decode): 13 (WebKit::WebsitePoliciesData::applyToDocumentLoader): 14 * Shared/WebsitePoliciesData.h: 15 * UIProcess/API/APIWebsitePolicies.cpp: 16 (API::WebsitePolicies::data): 17 * UIProcess/API/APIWebsitePolicies.h: 18 * UIProcess/API/Cocoa/_WKWebsitePolicies.h: 19 * UIProcess/API/Cocoa/_WKWebsitePolicies.mm: 20 (-[_WKWebsitePolicies setCustomJavaScriptUserAgentAsSiteSpecificQuirks:]): Renamed from setCustomJavaScriptUserAgent. 21 (-[_WKWebsitePolicies customJavaScriptUserAgentAsSiteSpecificQuirks]): Renamed from customJavaScriptUserAgent. 22 1 23 2019-01-28 Commit Queue <commit-queue@webkit.org> 2 24 -
trunk/Source/WebKit/Shared/WebsitePoliciesData.cpp
r240541 r240646 45 45 encoder << websiteDataStoreParameters; 46 46 encoder << customUserAgent; 47 encoder << customJavaScriptUserAgent ;47 encoder << customJavaScriptUserAgentAsSiteSpecificQuirks; 48 48 encoder << customNavigatorPlatform; 49 49 } … … 91 91 return WTF::nullopt; 92 92 93 Optional<String> customJavaScriptUserAgent ;94 decoder >> customJavaScriptUserAgent ;95 if (!customJavaScriptUserAgent )93 Optional<String> customJavaScriptUserAgentAsSiteSpecificQuirks; 94 decoder >> customJavaScriptUserAgentAsSiteSpecificQuirks; 95 if (!customJavaScriptUserAgentAsSiteSpecificQuirks) 96 96 return WTF::nullopt; 97 97 … … 110 110 WTFMove(*websiteDataStoreParameters), 111 111 WTFMove(*customUserAgent), 112 WTFMove(*customJavaScriptUserAgent ),112 WTFMove(*customJavaScriptUserAgentAsSiteSpecificQuirks), 113 113 WTFMove(*customNavigatorPlatform), 114 114 } }; … … 119 119 documentLoader.setCustomHeaderFields(WTFMove(websitePolicies.customHeaderFields)); 120 120 documentLoader.setCustomUserAgent(websitePolicies.customUserAgent); 121 documentLoader.setCustomJavaScriptUserAgent (websitePolicies.customJavaScriptUserAgent);121 documentLoader.setCustomJavaScriptUserAgentAsSiteSpecificQuirks(websitePolicies.customJavaScriptUserAgentAsSiteSpecificQuirks); 122 122 documentLoader.setCustomNavigatorPlatform(websitePolicies.customNavigatorPlatform); 123 123 documentLoader.setDeviceOrientationEventEnabled(websitePolicies.deviceOrientationEventEnabled); -
trunk/Source/WebKit/Shared/WebsitePoliciesData.h
r240541 r240646 55 55 Optional<WebsiteDataStoreParameters> websiteDataStoreParameters; 56 56 String customUserAgent; 57 String customJavaScriptUserAgent ;57 String customJavaScriptUserAgentAsSiteSpecificQuirks; 58 58 String customNavigatorPlatform; 59 59 -
trunk/Source/WebKit/UIProcess/API/APIWebsitePolicies.cpp
r240541 r240646 58 58 parameters = m_websiteDataStore->websiteDataStore().parameters(); 59 59 return { contentBlockersEnabled(), deviceOrientationEventEnabled(), allowedAutoplayQuirks(), autoplayPolicy(), 60 customHeaderFields(), popUpPolicy(), WTFMove(parameters), m_customUserAgent, m_customJavaScriptUserAgent , m_customNavigatorPlatform };60 customHeaderFields(), popUpPolicy(), WTFMove(parameters), m_customUserAgent, m_customJavaScriptUserAgentAsSiteSpecificQuirks, m_customNavigatorPlatform }; 61 61 } 62 62 -
trunk/Source/WebKit/UIProcess/API/APIWebsitePolicies.h
r240541 r240646 76 76 const WTF::String& customUserAgent() const { return m_customUserAgent; } 77 77 78 void setCustomJavaScriptUserAgent (const WTF::String& customJavaScriptUserAgent) { m_customJavaScriptUserAgent = customJavaScriptUserAgent; }79 const WTF::String& customJavaScriptUserAgent () const { return m_customJavaScriptUserAgent; }78 void setCustomJavaScriptUserAgentAsSiteSpecificQuirks(const WTF::String& customUserAgent) { m_customJavaScriptUserAgentAsSiteSpecificQuirks = customUserAgent; } 79 const WTF::String& customJavaScriptUserAgentAsSiteSpecificQuirks() const { return m_customJavaScriptUserAgentAsSiteSpecificQuirks; } 80 80 81 81 void setCustomNavigatorPlatform(const WTF::String& customNavigatorPlatform) { m_customNavigatorPlatform = customNavigatorPlatform; } … … 93 93 RefPtr<WebsiteDataStore> m_websiteDataStore; 94 94 WTF::String m_customUserAgent; 95 WTF::String m_customJavaScriptUserAgent ;95 WTF::String m_customJavaScriptUserAgentAsSiteSpecificQuirks; 96 96 WTF::String m_customNavigatorPlatform; 97 97 }; -
trunk/Source/WebKit/UIProcess/API/Cocoa/_WKWebsitePolicies.h
r240541 r240646 60 60 @property (nonatomic, strong) WKWebsiteDataStore *websiteDataStore WK_API_AVAILABLE(macosx(10.13.4), ios(11.3)); 61 61 @property (nonatomic, copy) NSString *customUserAgent WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA)); 62 @property (nonatomic, copy) NSString *customJavaScriptUserAgent WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));62 @property (nonatomic, copy) NSString *customJavaScriptUserAgentAsSiteSpecificQuirks WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA)); 63 63 @property (nonatomic, copy) NSString *customNavigatorPlatform WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA)); 64 64 @property (nonatomic) BOOL deviceOrientationEventEnabled WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA)); -
trunk/Source/WebKit/UIProcess/API/Cocoa/_WKWebsitePolicies.mm
r240541 r240646 210 210 } 211 211 212 - (void)setCustomJavaScriptUserAgent :(NSString *)customUserAgent213 { 214 _websitePolicies->setCustomJavaScriptUserAgent (customUserAgent);215 } 216 217 - (NSString *)customJavaScriptUserAgent 218 { 219 return _websitePolicies->customJavaScriptUserAgent ();212 - (void)setCustomJavaScriptUserAgentAsSiteSpecificQuirks:(NSString *)customUserAgent 213 { 214 _websitePolicies->setCustomJavaScriptUserAgentAsSiteSpecificQuirks(customUserAgent); 215 } 216 217 - (NSString *)customJavaScriptUserAgentAsSiteSpecificQuirks 218 { 219 return _websitePolicies->customJavaScriptUserAgentAsSiteSpecificQuirks(); 220 220 } 221 221 -
trunk/Tools/ChangeLog
r240641 r240646 1 2019-01-28 Ryosuke Niwa <rniwa@webkit.org> 2 3 User agent string override for navigator.userAgent should be site specific quirks 4 https://bugs.webkit.org/show_bug.cgi?id=193950 5 6 Reviewed by Brent Fulgham. 7 8 Updated per the _WKWebsitePolicies rename. 9 10 * TestWebKitAPI/Tests/WebKitCocoa/WebsitePolicies.mm: 11 (-[CustomJavaScriptUserAgentDelegate _webView:decidePolicyForNavigationAction:userInfo:decisionHandler:]): 12 1 13 2019-01-28 Ross Kirsling <ross.kirsling@sony.com> 2 14 -
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebsitePolicies.mm
r240541 r240646 30 30 #import <WebKit/WKNavigationDelegatePrivate.h> 31 31 #import <WebKit/WKPagePrivate.h> 32 #import <WebKit/WKPreferencesPrivate.h> 32 33 #import <WebKit/WKPreferencesRefPrivate.h> 33 34 #import <WebKit/WKUIDelegatePrivate.h> … … 1115 1116 _WKWebsitePolicies *websitePolicies = [[[_WKWebsitePolicies alloc] init] autorelease]; 1116 1117 if (navigationAction.targetFrame.mainFrame) { 1117 [websitePolicies setCustomJavaScriptUserAgent :@"Foo Custom JavaScript UserAgent"];1118 [websitePolicies setCustomJavaScriptUserAgentAsSiteSpecificQuirks:@"Foo Custom JavaScript UserAgent"]; 1118 1119 if (_setCustomUserAgent) 1119 1120 [websitePolicies setCustomUserAgent:@"Foo Custom Request UserAgent"]; … … 1143 1144 }]; 1144 1145 [configuration setURLSchemeHandler:schemeHandler.get() forURLScheme:@"test"]; 1146 [configuration preferences]._needsSiteSpecificQuirks = YES; 1145 1147 1146 1148 auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get()]); … … 1174 1176 }]; 1175 1177 [configuration setURLSchemeHandler:schemeHandler.get() forURLScheme:@"test"]; 1178 [configuration preferences]._needsSiteSpecificQuirks = YES; 1176 1179 1177 1180 auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get()]);
Note: See TracChangeset
for help on using the changeset viewer.