Changeset 170735 in webkit
- Timestamp:
- Jul 2, 2014 4:02:45 PM (10 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r170734 r170735 1 2014-07-01 Mark Rowe <mrowe@apple.com> 2 3 Ensure that the WebKit bundle version in the user agent string continues to match the current format. 4 <https://webkit.org/b/134524> / <rdar://problem/17447771> 5 6 Reviewed by Simon Fraser. 7 8 * page/cocoa/UserAgent.h: 9 * page/cocoa/UserAgent.mm: 10 (WebCore::userVisibleWebKitBundleVersionFromFullVersion): Updated to take an NSString now that it's internal 11 to the file. 12 (WebCore::userAgentBundleVersionFromFullVersionString): Limit the bundle version included in the user agent 13 string to three components. 14 * page/ios/UserAgentIOS.mm: 15 (WebCore::standardUserAgentWithApplicationName): Update to call userAgentBundleVersionFromFullVersionString. 16 * page/mac/UserAgentMac.mm: 17 (WebCore::standardUserAgentWithApplicationName): Ditto. 18 1 19 2014-07-01 Mark Rowe <mrowe@apple.com> 2 20 -
trunk/Source/WebCore/page/cocoa/UserAgent.h
r170734 r170735 34 34 35 35 String systemMarketingVersionForUserAgentString(); 36 String user VisibleWebKitBundleVersionFromFullVersion(const String&);36 String userAgentBundleVersionFromFullVersionString(const String&); 37 37 38 38 } -
trunk/Source/WebCore/page/cocoa/UserAgent.mm
r170734 r170735 39 39 } 40 40 41 String userVisibleWebKitBundleVersionFromFullVersion(const String& fullWebKitVersionString)41 static NSString *userVisibleWebKitBundleVersionFromFullVersion(NSString *fullWebKitVersion) 42 42 { 43 NSString *fullWebKitVersion = fullWebKitVersionString;44 45 43 // If the version is longer than 3 digits then the leading digits represent the version of the OS. Our user agent 46 44 // string should not include the leading digits, so strip them off and report the rest as the version. <rdar://problem/4997547> … … 53 51 } 54 52 53 String userAgentBundleVersionFromFullVersionString(const String& fullWebKitVersion) 54 { 55 // We include at most three components of the bundle version in the user agent string. 56 NSString *bundleVersion = userVisibleWebKitBundleVersionFromFullVersion(fullWebKitVersion); 57 NSScanner *scanner = [NSScanner scannerWithString:bundleVersion]; 58 NSInteger periodCount = 0; 59 while (true) { 60 if (![scanner scanUpToString:@"." intoString:nullptr] || scanner.isAtEnd) 61 return bundleVersion; 62 63 if (++periodCount == 3) 64 return [bundleVersion substringToIndex:scanner.scanLocation]; 65 66 ++scanner.scanLocation; 67 } 68 69 ASSERT_NOT_REACHED(); 70 } 71 55 72 } // namespace WebCore -
trunk/Source/WebCore/page/ios/UserAgentIOS.mm
r170734 r170735 45 45 } 46 46 47 NSString *webKitVersion = user VisibleWebKitBundleVersionFromFullVersion(fullWebKitVersionString);47 NSString *webKitVersion = userAgentBundleVersionFromFullVersionString(fullWebKitVersionString); 48 48 CFStringRef deviceName = wkGetDeviceName(); 49 49 CFStringRef osNameForUserAgent = wkGetOSNameForUserAgent(); -
trunk/Source/WebCore/page/mac/UserAgentMac.mm
r170734 r170735 42 42 { 43 43 String osVersion = systemMarketingVersionForUserAgentString(); 44 String webKitVersionString = user VisibleWebKitBundleVersionFromFullVersion(fullWebKitVersionString);44 String webKitVersionString = userAgentBundleVersionFromFullVersionString(fullWebKitVersionString); 45 45 46 46 if (applicationName.isEmpty())
Note: See TracChangeset
for help on using the changeset viewer.