[webkit-reviews] review granted: [Bug 134522] Remove duplication in code that prepares the user agent string on Mac and iOS : [Attachment 234216] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Jul 2 14:49:46 PDT 2014


Simon Fraser (smfr) <simon.fraser at apple.com> has granted Mark Rowe (bdash)
<mrowe at apple.com>'s request for review:
Bug 134522: Remove duplication in code that prepares the user agent string on
Mac and iOS
https://bugs.webkit.org/show_bug.cgi?id=134522

Attachment 234216: Patch
https://bugs.webkit.org/attachment.cgi?id=234216&action=review

------- Additional Comments from Simon Fraser (smfr) <simon.fraser at apple.com>
View in context: https://bugs.webkit.org/attachment.cgi?id=234216&action=review


> Source/WebCore/page/cocoa/UserAgent.mm:51
> +    // 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>
> +    NSRange nonDigitRange = [fullWebKitVersion
rangeOfCharacterFromSet:[[NSCharacterSet decimalDigitCharacterSet]
invertedSet]];
> +    if (nonDigitRange.location == NSNotFound && fullWebKitVersion.length >
3)
> +	   return [fullWebKitVersion
substringFromIndex:fullWebKitVersion.length - 3];
> +    if (nonDigitRange.location != NSNotFound && nonDigitRange.location > 3)
> +	   return [fullWebKitVersion substringFromIndex:nonDigitRange.location
- 3];

Sad that we go to NSString and back.

> Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm:66
> +    return [[NSBundle bundleForClass:NSClassFromString(@"WKView")]
objectForInfoDictionaryKey:(NSString *)kCFBundleVersionKey];

There's a WKView in WebCore. Is that really the one we want?

> Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm:102
> +    return [[NSBundle bundleForClass:NSClassFromString(@"WKView")]
objectForInfoDictionaryKey:(NSString *)kCFBundleVersionKey];

WKView again?


More information about the webkit-reviews mailing list