[webkit-reviews] review granted: [Bug 134524] [Cocoa] Ensure that the WebKit bundle version in the user agent string continues to match the current format : [Attachment 234271] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Jul 2 14:52:54 PDT 2014


Simon Fraser (smfr) <simon.fraser at apple.com> has granted Mark Rowe (bdash)
<mrowe at apple.com>'s request for review:
Bug 134524: [Cocoa] Ensure that the WebKit bundle version in the user agent
string continues to match the current format
https://bugs.webkit.org/show_bug.cgi?id=134524

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

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


> Source/WebCore/page/cocoa/UserAgent.mm:69
> +    // We include at most three components of the bundle version in the user
agent string.
> +    NSString *bundleVersion =
userVisibleWebKitBundleVersionFromFullVersion(fullWebKitVersion);
> +    NSScanner *scanner = [NSScanner scannerWithString:bundleVersion];
> +    NSInteger periodCount = 0;
> +    while (true) {
> +	   if (![scanner scanUpToString:@"." intoString:nullptr] ||
scanner.isAtEnd)
> +	       return bundleVersion;
> +
> +	   if (++periodCount == 3)
> +	       return [bundleVersion substringToIndex:scanner.scanLocation];
> +
> +	   ++scanner.scanLocation;
> +    }
> +
> +    ASSERT_NOT_REACHED();

Can we do this in C++?


More information about the webkit-reviews mailing list