Changeset 170734 in webkit
- Timestamp:
- Jul 2, 2014, 4:02:43 PM (12 years ago)
- Location:
- trunk/Source
- Files:
-
- 10 edited
-
WebCore/ChangeLog (modified) (1 diff)
-
WebCore/page/cocoa/UserAgent.h (modified) (1 diff)
-
WebCore/page/cocoa/UserAgent.mm (modified) (1 diff)
-
WebCore/page/ios/UserAgentIOS.mm (modified) (2 diffs)
-
WebCore/page/mac/UserAgentMac.mm (modified) (1 diff)
-
WebKit/mac/ChangeLog (modified) (1 diff)
-
WebKit/mac/WebView/WebView.mm (modified) (1 diff)
-
WebKit2/ChangeLog (modified) (1 diff)
-
WebKit2/UIProcess/ios/WebPageProxyIOS.mm (modified) (1 diff)
-
WebKit2/UIProcess/mac/WebPageProxyMac.mm (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r170730 r170734 1 2014-07-01 Mark Rowe <mrowe@apple.com> 2 3 <https://webkit.org/b/134522> Remove duplication in code that prepares the user agent string on Mac and iOS 4 5 Reviewed by Simon Fraser. 6 7 * page/cocoa/UserAgent.h: 8 * page/cocoa/UserAgent.mm: 9 (WebCore::userVisibleWebKitBundleVersionFromFullVersion): Moved from WebKit2. 10 * page/ios/UserAgentIOS.mm: 11 (WebCore::standardUserAgentWithApplicationName): Pass the WebKit bundle version through userVisibleWebKitBundleVersionFromFullVersion 12 before including it in the user agent string. 13 * page/mac/UserAgentMac.mm: 14 (WebCore::standardUserAgentWithApplicationName): Ditto. 15 1 16 2014-07-02 Mark Rowe <mrowe@apple.com> 2 17 -
trunk/Source/WebCore/page/cocoa/UserAgent.h
r170730 r170734 30 30 31 31 namespace WebCore { 32 32 33 String standardUserAgentWithApplicationName(const String& applicationName, const String& webkitVersionString); 34 33 35 String systemMarketingVersionForUserAgentString(); 36 String userVisibleWebKitBundleVersionFromFullVersion(const String&); 37 34 38 } 35 39 -
trunk/Source/WebCore/page/cocoa/UserAgent.mm
r170730 r170734 39 39 } 40 40 41 String userVisibleWebKitBundleVersionFromFullVersion(const String& fullWebKitVersionString) 42 { 43 NSString *fullWebKitVersion = fullWebKitVersionString; 44 45 // If the version is longer than 3 digits then the leading digits represent the version of the OS. Our user agent 46 // string should not include the leading digits, so strip them off and report the rest as the version. <rdar://problem/4997547> 47 NSRange nonDigitRange = [fullWebKitVersion rangeOfCharacterFromSet:[[NSCharacterSet decimalDigitCharacterSet] invertedSet]]; 48 if (nonDigitRange.location == NSNotFound && fullWebKitVersion.length > 3) 49 return [fullWebKitVersion substringFromIndex:fullWebKitVersion.length - 3]; 50 if (nonDigitRange.location != NSNotFound && nonDigitRange.location > 3) 51 return [fullWebKitVersion substringFromIndex:nonDigitRange.location - 3]; 52 return fullWebKitVersion; 53 } 54 41 55 } // namespace WebCore -
trunk/Source/WebCore/page/ios/UserAgentIOS.mm
r170730 r170734 32 32 namespace WebCore { 33 33 34 String standardUserAgentWithApplicationName(const String& applicationName, const String& webkitVersionString)34 String standardUserAgentWithApplicationName(const String& applicationName, const String& fullWebKitVersionString) 35 35 { 36 36 if (CFStringRef overrideUserAgent = wkGetUserAgent()) … … 45 45 } 46 46 47 NSString *webKitVersion = webkitVersionString;47 NSString *webKitVersion = userVisibleWebKitBundleVersionFromFullVersion(fullWebKitVersionString); 48 48 CFStringRef deviceName = wkGetDeviceName(); 49 49 CFStringRef osNameForUserAgent = wkGetOSNameForUserAgent(); -
trunk/Source/WebCore/page/mac/UserAgentMac.mm
r170730 r170734 39 39 #endif 40 40 41 String standardUserAgentWithApplicationName(const String& applicationName, const String& webKitVersionString)41 String standardUserAgentWithApplicationName(const String& applicationName, const String& fullWebKitVersionString) 42 42 { 43 43 String osVersion = systemMarketingVersionForUserAgentString(); 44 String webKitVersionString = userVisibleWebKitBundleVersionFromFullVersion(fullWebKitVersionString); 44 45 45 46 if (applicationName.isEmpty()) -
trunk/Source/WebKit/mac/ChangeLog
r170710 r170734 1 2014-07-01 Mark Rowe <mrowe@apple.com> 2 3 <https://webkit.org/b/134522> Remove duplication in code that prepares the user agent string on Mac and iOS 4 5 Reviewed by Simon Fraser. 6 7 * WebView/WebView.mm: 8 (webKitBundleVersionString): Return the entire CFBundleVersion now that WebCore handles formatting it. 9 (+[WebView _standardUserAgentWithApplicationName:]): 10 1 11 2014-07-02 Dan Bernstein <mitz@apple.com> 2 12 -
trunk/Source/WebKit/mac/WebView/WebView.mm
r170710 r170734 678 678 @implementation WebView (WebPrivate) 679 679 680 static String userVisibleWebKitVersionString() 681 { 682 // If the version is longer than 3 digits then the leading digits represent the version of the OS. Our user agent 683 // string should not include the leading digits, so strip them off and report the rest as the version. <rdar://problem/4997547> 684 NSString *fullVersion = [[NSBundle bundleForClass:[WebView class]] objectForInfoDictionaryKey:(NSString *)kCFBundleVersionKey]; 685 NSRange nonDigitRange = [fullVersion rangeOfCharacterFromSet:[[NSCharacterSet decimalDigitCharacterSet] invertedSet]]; 686 if (nonDigitRange.location == NSNotFound && fullVersion.length > 3) 687 return [fullVersion substringFromIndex:fullVersion.length - 3]; 688 if (nonDigitRange.location != NSNotFound && nonDigitRange.location > 3) 689 return [fullVersion substringFromIndex:nonDigitRange.location - 3]; 690 return fullVersion; 680 static String webKitBundleVersionString() 681 { 682 return [[NSBundle bundleForClass:[WebView class]] objectForInfoDictionaryKey:(NSString *)kCFBundleVersionKey]; 691 683 } 692 684 693 685 + (NSString *)_standardUserAgentWithApplicationName:(NSString *)applicationName 694 686 { 695 return standardUserAgentWithApplicationName(applicationName, userVisibleWebKitVersionString());687 return standardUserAgentWithApplicationName(applicationName, webKitBundleVersionString()); 696 688 } 697 689 -
trunk/Source/WebKit2/ChangeLog
r170733 r170734 1 2014-07-01 Mark Rowe <mrowe@apple.com> 2 3 <https://webkit.org/b/134522> Remove duplication in code that prepares the user agent string on Mac and iOS 4 5 Reviewed by Simon Fraser. 6 7 * UIProcess/ios/WebPageProxyIOS.mm: 8 (WebKit::webKitBundleVersionString): Return the entire CFBundleVersion now that WebCore handles formatting it. 9 (WebKit::WebPageProxy::standardUserAgent): 10 * UIProcess/mac/WebPageProxyMac.mm: 11 (WebKit::webKitBundleVersionString): Ditto. 12 (WebKit::WebPageProxy::standardUserAgent): 13 1 14 2014-06-28 Oliver Hunt <oliver@apple.com> 2 15 -
trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm
r170491 r170734 62 62 } 63 63 64 static String userVisibleWebKitVersionString() 65 { 66 // If the version is longer than 3 digits then the leading digits represent the version of the OS. Our user agent 67 // string should not include the leading digits, so strip them off and report the rest as the version. <rdar://problem/4997547> 68 NSString *fullVersion = [[NSBundle bundleForClass:NSClassFromString(@"WKView")] objectForInfoDictionaryKey:(NSString *)kCFBundleVersionKey]; 69 NSRange nonDigitRange = [fullVersion rangeOfCharacterFromSet:[[NSCharacterSet decimalDigitCharacterSet] invertedSet]]; 70 if (nonDigitRange.location == NSNotFound && fullVersion.length > 3) 71 return [fullVersion substringFromIndex:fullVersion.length - 3]; 72 if (nonDigitRange.location != NSNotFound && nonDigitRange.location > 3) 73 return [fullVersion substringFromIndex:nonDigitRange.location - 3]; 74 return fullVersion; 75 } 76 77 String WebPageProxy::standardUserAgent(const String& applicationName) 78 { 79 return standardUserAgentWithApplicationName(applicationName, userVisibleWebKitVersionString()); 64 static String webKitBundleVersionString() 65 { 66 return [[NSBundle bundleForClass:NSClassFromString(@"WKWebView")] objectForInfoDictionaryKey:(NSString *)kCFBundleVersionKey]; 67 } 68 69 String WebPageProxy::standardUserAgent(const String& applicationNameForUserAgent) 70 { 71 return standardUserAgentWithApplicationName(applicationNameForUserAgent, webKitBundleVersionString()); 80 72 } 81 73 -
trunk/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm
r170569 r170734 98 98 } 99 99 100 static String userVisibleWebKitVersionString() 101 { 102 // If the version is longer than 3 digits then the leading digits represent the version of the OS. Our user agent 103 // string should not include the leading digits, so strip them off and report the rest as the version. <rdar://problem/4997547> 104 NSString *fullVersion = [[NSBundle bundleForClass:NSClassFromString(@"WKView")] objectForInfoDictionaryKey:(NSString *)kCFBundleVersionKey]; 105 NSRange nonDigitRange = [fullVersion rangeOfCharacterFromSet:[[NSCharacterSet decimalDigitCharacterSet] invertedSet]]; 106 if (nonDigitRange.location == NSNotFound && fullVersion.length > 3) 107 return [fullVersion substringFromIndex:fullVersion.length - 3]; 108 if (nonDigitRange.location != NSNotFound && nonDigitRange.location > 3) 109 return [fullVersion substringFromIndex:nonDigitRange.location - 3]; 110 return fullVersion; 100 static String webKitBundleVersionString() 101 { 102 return [[NSBundle bundleForClass:NSClassFromString(@"WKView")] objectForInfoDictionaryKey:(NSString *)kCFBundleVersionKey]; 111 103 } 112 104 113 105 String WebPageProxy::standardUserAgent(const String& applicationNameForUserAgent) 114 106 { 115 return standardUserAgentWithApplicationName(applicationNameForUserAgent, userVisibleWebKitVersionString());107 return standardUserAgentWithApplicationName(applicationNameForUserAgent, webKitBundleVersionString()); 116 108 } 117 109
Note:
See TracChangeset
for help on using the changeset viewer.