Title: [160412] trunk/Source
Revision
160412
Author
[email protected]
Date
2013-12-10 23:25:45 -0800 (Tue, 10 Dec 2013)

Log Message

<http://webkit.org/b/125556> WebKit doesn't deal with longer bundle versions correctly
<rdar://problem/15634192>

Reviewed by Dan Bernstein.

Source/WebKit/mac:

* WebView/WebView.mm:
(createUserVisibleWebKitVersionString): Strip as many leading digits as is necessary to
bring the major component of the version down to 3 digits.

Source/WebKit2:

* UIProcess/mac/WebPageProxyMac.mm:
(WebKit::userVisibleWebKitVersionString): Strip as many leading digits as is necessary to
bring the major component of the version down to 3 digits.

Modified Paths

Diff

Modified: trunk/Source/WebKit/mac/ChangeLog (160411 => 160412)


--- trunk/Source/WebKit/mac/ChangeLog	2013-12-11 06:50:19 UTC (rev 160411)
+++ trunk/Source/WebKit/mac/ChangeLog	2013-12-11 07:25:45 UTC (rev 160412)
@@ -1,3 +1,14 @@
+2013-12-10  Mark Rowe  <[email protected]>
+
+        <http://webkit.org/b/125556> WebKit doesn't deal with longer bundle versions correctly
+        <rdar://problem/15634192>
+
+        Reviewed by Dan Bernstein.
+
+        * WebView/WebView.mm:
+        (createUserVisibleWebKitVersionString): Strip as many leading digits as is necessary to
+        bring the major component of the version down to 3 digits.
+
 2013-12-09  Sam Weinig  <[email protected]>
 
         Fix the build of projects including <WebKit/WebUIDelegatePrivate.h>

Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (160411 => 160412)


--- trunk/Source/WebKit/mac/WebView/WebView.mm	2013-12-11 06:50:19 UTC (rev 160411)
+++ trunk/Source/WebKit/mac/WebView/WebView.mm	2013-12-11 07:25:45 UTC (rev 160412)
@@ -594,15 +594,14 @@
 
 static NSString *createUserVisibleWebKitVersionString()
 {
-    // If the version is 4 digits long or longer, then the first digit represents
-    // the version of the OS. Our user agent string should not include this first digit,
-    // so strip it off and report the rest as the version. <rdar://problem/4997547>
+    // If the version is longer than 3 digits then the leading digits represent the version of the OS. Our user agent
+    // string should not include the leading digits, so strip them off and report the rest as the version. <rdar://problem/4997547>
     NSString *fullVersion = [[NSBundle bundleForClass:[WebView class]] objectForInfoDictionaryKey:(NSString *)kCFBundleVersionKey];
     NSRange nonDigitRange = [fullVersion rangeOfCharacterFromSet:[[NSCharacterSet decimalDigitCharacterSet] invertedSet]];
-    if (nonDigitRange.location == NSNotFound && [fullVersion length] >= 4)
-        return [[fullVersion substringFromIndex:1] copy];
-    if (nonDigitRange.location != NSNotFound && nonDigitRange.location >= 4)
-        return [[fullVersion substringFromIndex:1] copy];
+    if (nonDigitRange.location == NSNotFound && fullVersion.length > 3)
+        return [[fullVersion substringFromIndex:fullVersion.length - 3] copy];
+    if (nonDigitRange.location != NSNotFound && nonDigitRange.location > 3)
+        return [[fullVersion substringFromIndex:nonDigitRange.location - 3] copy];
     return [fullVersion copy];
 }
 

Modified: trunk/Source/WebKit2/ChangeLog (160411 => 160412)


--- trunk/Source/WebKit2/ChangeLog	2013-12-11 06:50:19 UTC (rev 160411)
+++ trunk/Source/WebKit2/ChangeLog	2013-12-11 07:25:45 UTC (rev 160412)
@@ -1,3 +1,14 @@
+2013-12-10  Mark Rowe  <[email protected]>
+
+        <http://webkit.org/b/125556> WebKit doesn't deal with longer bundle versions correctly
+        <rdar://problem/15634192>
+
+        Reviewed by Dan Bernstein.
+
+        * UIProcess/mac/WebPageProxyMac.mm:
+        (WebKit::userVisibleWebKitVersionString): Strip as many leading digits as is necessary to
+        bring the major component of the version down to 3 digits.
+
 2013-12-10  Ryuan Choi  <[email protected]>
 
         Unreviewed GTK build fix attempt after r160395 (second)

Modified: trunk/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm (160411 => 160412)


--- trunk/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm	2013-12-11 06:50:19 UTC (rev 160411)
+++ trunk/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm	2013-12-11 07:25:45 UTC (rev 160412)
@@ -92,15 +92,14 @@
 
 static String userVisibleWebKitVersionString()
 {
-    // If the version is 4 digits long or longer, then the first digit represents
-    // the version of the OS. Our user agent string should not include this first digit,
-    // so strip it off and report the rest as the version. <rdar://problem/4997547>
+    // If the version is longer than 3 digits then the leading digits represent the version of the OS. Our user agent
+    // string should not include the leading digits, so strip them off and report the rest as the version. <rdar://problem/4997547>
     NSString *fullVersion = [[NSBundle bundleForClass:NSClassFromString(@"WKView")] objectForInfoDictionaryKey:(NSString *)kCFBundleVersionKey];
     NSRange nonDigitRange = [fullVersion rangeOfCharacterFromSet:[[NSCharacterSet decimalDigitCharacterSet] invertedSet]];
-    if (nonDigitRange.location == NSNotFound && [fullVersion length] >= 4)
-        return [fullVersion substringFromIndex:1];
-    if (nonDigitRange.location != NSNotFound && nonDigitRange.location >= 4)
-        return [fullVersion substringFromIndex:1];
+    if (nonDigitRange.location == NSNotFound && fullVersion.length > 3)
+        return [fullVersion substringFromIndex:fullVersion.length - 3];
+    if (nonDigitRange.location != NSNotFound && nonDigitRange.location > 3)
+        return [fullVersion substringFromIndex:nonDigitRange.location - 3];
     return fullVersion;
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to