The WebKit version portion of the user agent string has historically had at most three components. There's no guarantee that the WebKit framework's bundle version will be limited in this fashion. We should ensure that the version inserted in to the user agent string continues to match the historical format. <rdar://problem/17447771>
Created attachment 234217 [details] Patch
Created attachment 234271 [details] Patch
Comment on attachment 234271 [details] Patch 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++?
(In reply to comment #3) > (From update of attachment 234271 [details]) > Can we do this in C++? It seemed preferable for the code to match our other internal implementation rather than writing it twice.
Landed in r170735. <https://trac.webkit.org/r170735>