Changeset 225562 in webkit
- Timestamp:
- Dec 5, 2017 5:59:53 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r225561 r225562 1 2017-12-05 Brent Fulgham <bfulgham@apple.com> 2 3 Limit user agent versioning to an upper bound 4 https://bugs.webkit.org/show_bug.cgi?id=180365 5 <rdar://problem/34550617> 6 7 Reviewed by Joseph Pecoraro. 8 9 * fast/dom/navigator-userAgent-frozen-expected.txt: Added. 10 * fast/dom/navigator-userAgent-frozen.html: Added. 11 1 12 2017-12-05 Javier Fernandez <jfernandez@igalia.com> 2 13 -
trunk/Source/WebCore/ChangeLog
r225555 r225562 1 2017-12-05 Brent Fulgham <bfulgham@apple.com> 2 3 Limit user agent versioning to an upper bound 4 https://bugs.webkit.org/show_bug.cgi?id=180365 5 <rdar://problem/34550617> 6 7 Reviewed by Joseph Pecoraro. 8 9 Freeze the version reported as User Agent to OS 10.13.4 (OS 11.3 on iOS) and WebKit 605.1.15 10 for User Agent purposes. 11 12 Test: fast/dom/navigator-userAgent-frozen.html 13 14 * page/cocoa/UserAgent.h: 15 * page/cocoa/UserAgent.mm: 16 (WebCore::versionPredatesFreeze): Helper function. Returns true for Version 10.13.3 or older. 17 (WebCore::systemMarketingVersionForUserAgentString): 18 (WebCore::userAgentBundleVersion): 19 (WebCore::userVisibleWebKitBundleVersionFromFullVersion): Deleted. 20 (WebCore::userAgentBundleVersionFromFullVersionString): Deleted. 21 * page/ios/UserAgentIOS.mm: 22 (WebCore::standardUserAgentWithApplicationName): Don't take the WebKit bundle version 23 as an argument, or pass it to the user agent string generator. 24 * page/mac/UserAgentMac.mm: 25 (WebCore::standardUserAgentWithApplicationName): Ditto. 26 1 27 2017-12-05 Matt Lewis <jlewis3@apple.com> 2 28 -
trunk/Source/WebCore/page/cocoa/UserAgent.h
r172849 r225562 1 1 /* 2 * Copyright (C) 2014 Apple Inc. All rights reserved.2 * Copyright (C) 2014-2017 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 31 31 namespace WebCore { 32 32 33 WEBCORE_EXPORT String standardUserAgentWithApplicationName(const String& applicationName , const String& webkitVersionString);33 WEBCORE_EXPORT String standardUserAgentWithApplicationName(const String& applicationName); 34 34 35 35 String systemMarketingVersionForUserAgentString(); 36 String userAgentBundleVersion FromFullVersionString(const String&);36 String userAgentBundleVersion(); 37 37 38 38 } -
trunk/Source/WebCore/page/cocoa/UserAgent.mm
r170735 r225562 1 1 /* 2 * Copyright (C) 2014 Apple Inc. All rights reserved.2 * Copyright (C) 2014-2017 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 27 27 #import "UserAgent.h" 28 28 29 #import "SystemVersion.h"30 31 29 namespace WebCore { 32 30 … … 36 34 // we were concerned about old DHTML libraries interpreting "4." as Netscape 4. That's no longer a concern for us 37 35 // but we're sticking with the underscores for compatibility with the format used by older versions of Safari. 38 return [systemMarketingVersion() stringByReplacingOccurrencesOfString:@"." withString:@"_"]; 36 #if PLATFORM(MAC) 37 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300 38 return ASCIILiteral("10_13_4"); 39 #elif __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200 40 return ASCIILiteral("10_12_6"); 41 #else 42 return ASCIILiteral("10_11_6"); 43 #endif 44 #else 45 return ASCIILiteral("11_3"); 46 #endif 39 47 } 40 48 41 static NSString *userVisibleWebKitBundleVersionFromFullVersion(NSString *fullWebKitVersion)49 String userAgentBundleVersion() 42 50 { 43 // If the version is longer than 3 digits then the leading digits represent the version of the OS. Our user agent 44 // string should not include the leading digits, so strip them off and report the rest as the version. <rdar://problem/4997547> 45 NSRange nonDigitRange = [fullWebKitVersion rangeOfCharacterFromSet:[[NSCharacterSet decimalDigitCharacterSet] invertedSet]]; 46 if (nonDigitRange.location == NSNotFound && fullWebKitVersion.length > 3) 47 return [fullWebKitVersion substringFromIndex:fullWebKitVersion.length - 3]; 48 if (nonDigitRange.location != NSNotFound && nonDigitRange.location > 3) 49 return [fullWebKitVersion substringFromIndex:nonDigitRange.location - 3]; 50 return fullWebKitVersion; 51 } 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(); 51 return ASCIILiteral("605.1.15"); 70 52 } 71 53 -
trunk/Source/WebCore/page/ios/UserAgentIOS.mm
r222898 r225562 1 1 /* 2 * Copyright (C) 2014 Apple Inc. All rights reserved.2 * Copyright (C) 2014-2017 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 78 78 } 79 79 80 String standardUserAgentWithApplicationName(const String& applicationName , const String& fullWebKitVersionString)80 String standardUserAgentWithApplicationName(const String& applicationName) 81 81 { 82 82 // Check to see if there is a user agent override for all WebKit clients. … … 89 89 90 90 // FIXME: We should implement this with String and/or StringBuilder instead. 91 NSString *webKitVersion = userAgentBundleVersion FromFullVersionString(fullWebKitVersionString);91 NSString *webKitVersion = userAgentBundleVersion(); 92 92 NSString *osMarketingVersionString = systemMarketingVersionForUserAgentString(); 93 93 if (applicationName.isEmpty()) -
trunk/Source/WebCore/page/mac/UserAgentMac.mm
r170735 r225562 1 1 /* 2 * Copyright (C) 2014 Apple Inc. All rights reserved.2 * Copyright (C) 2014-2017 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 39 39 #endif 40 40 41 String standardUserAgentWithApplicationName(const String& applicationName , const String& fullWebKitVersionString)41 String standardUserAgentWithApplicationName(const String& applicationName) 42 42 { 43 43 String osVersion = systemMarketingVersionForUserAgentString(); 44 String webKitVersionString = userAgentBundleVersion FromFullVersionString(fullWebKitVersionString);44 String webKitVersionString = userAgentBundleVersion(); 45 45 46 46 if (applicationName.isEmpty()) -
trunk/Source/WebKit/ChangeLog
r225553 r225562 1 2017-12-05 Brent Fulgham <bfulgham@apple.com> 2 3 Limit user agent versioning to an upper bound 4 https://bugs.webkit.org/show_bug.cgi?id=180365 5 <rdar://problem/34550617> 6 7 Reviewed by Joseph Pecoraro. 8 9 * UIProcess/ios/WebPageProxyIOS.mm: 10 (WebKit::WebPageProxy::standardUserAgent): Don't pass the WebKit bundle version when 11 creatin the User Agent string. 12 (WebKit::webKitBundleVersionString): Deleted. 13 * UIProcess/mac/WebPageProxyMac.mm: 14 (WebKit::WebPageProxy::standardUserAgent): Ditto. 15 (WebKit::webKitBundleVersionString): Deleted. 16 1 17 2017-12-05 Alex Christensen <achristensen@webkit.org> 2 18 -
trunk/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm
r224029 r225562 1 1 /* 2 * Copyright (C) 2012-201 6Apple Inc. All rights reserved.2 * Copyright (C) 2012-2017 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 69 69 } 70 70 71 static String webKitBundleVersionString()72 {73 return [[NSBundle bundleForClass:NSClassFromString(@"WKWebView")] objectForInfoDictionaryKey:(NSString *)kCFBundleVersionKey];74 }75 76 71 String WebPageProxy::standardUserAgent(const String& applicationNameForUserAgent) 77 72 { 78 return standardUserAgentWithApplicationName(applicationNameForUserAgent , webKitBundleVersionString());73 return standardUserAgentWithApplicationName(applicationNameForUserAgent); 79 74 } 80 75 -
trunk/Source/WebKit/UIProcess/mac/WebPageProxyMac.mm
r225117 r225562 1 1 /* 2 * Copyright (C) 2010-201 6Apple Inc. All rights reserved.2 * Copyright (C) 2010-2017 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 92 92 } 93 93 94 static String webKitBundleVersionString()95 {96 return [[NSBundle bundleForClass:NSClassFromString(@"WKView")] objectForInfoDictionaryKey:(NSString *)kCFBundleVersionKey];97 }98 99 94 String WebPageProxy::standardUserAgent(const String& applicationNameForUserAgent) 100 95 { 101 return standardUserAgentWithApplicationName(applicationNameForUserAgent , webKitBundleVersionString());96 return standardUserAgentWithApplicationName(applicationNameForUserAgent); 102 97 } 103 98 -
trunk/Source/WebKitLegacy/mac/ChangeLog
r225559 r225562 1 2017-12-05 Brent Fulgham <bfulgham@apple.com> 2 3 Limit user agent versioning to an upper bound 4 https://bugs.webkit.org/show_bug.cgi?id=180365 5 <rdar://problem/34550617> 6 7 Reviewed by Joseph Pecoraro. 8 9 * WebView/WebView.mm: 10 (+[WebView _standardUserAgentWithApplicationName:]): Don't pass the WebKit bundle version when 11 creating the User Agent string. 12 (webKitBundleVersionString): Deleted. 13 1 14 2017-12-05 Andy Estes <aestes@apple.com> 2 15 -
trunk/Source/WebKitLegacy/mac/WebView/WebView.mm
r225369 r225562 1133 1133 @implementation WebView (WebPrivate) 1134 1134 1135 static String webKitBundleVersionString()1136 {1137 return [[NSBundle bundleForClass:[WebView class]] objectForInfoDictionaryKey:(NSString *)kCFBundleVersionKey];1138 }1139 1140 1135 + (NSString *)_standardUserAgentWithApplicationName:(NSString *)applicationName 1141 1136 { 1142 return standardUserAgentWithApplicationName(applicationName , webKitBundleVersionString());1137 return standardUserAgentWithApplicationName(applicationName); 1143 1138 } 1144 1139
Note: See TracChangeset
for help on using the changeset viewer.