[webkit-reviews] review granted: [Bug 195990] [Cocoa] Refactor some helper functions for building UserAgent strings : [Attachment 365320] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Mar 20 12:32:30 PDT 2019

Brent Fulgham <bfulgham at webkit.org> has granted Wenson Hsieh
<wenson_hsieh at apple.com>'s request for review:
Bug 195990: [Cocoa] Refactor some helper functions for building UserAgent

Attachment 365320: Patch


--- Comment #3 from Brent Fulgham <bfulgham at webkit.org> ---
Comment on attachment 365320
  --> https://bugs.webkit.org/attachment.cgi?id=365320

View in context: https://bugs.webkit.org/attachment.cgi?id=365320&action=review

I think this all looks fine, bug please consider whether the two methods could
be combined into one Cocoa variant.

> Source/WebCore/platform/UserAgent.h:34
> +enum class UserAgentType { Default, Desktop };

Do we also need to codify the concept of a Mobile site?

> Source/WebCore/platform/ios/UserAgentIOS.mm:79
> +String standardUserAgentWithApplicationName(const String& applicationName,
UserAgentType type)

It seems weird that we have a Mac and an iOS version of this, rather than just
a Cocoa version. Maybe if it we did, we could have a UserAgentType::Mobile to
give a mobile UA, and UserAgentType::Desktop to force Desktop UA, and
UserAgentType::Default to do the right thing based on build type?

> Source/WebCore/platform/ios/UserAgentIOS.mm:83
> +	   return makeString("Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14)
AppleWebKit/605.1.15 (KHTML, like Gecko)", appNameSuffix);

I wonder if we could make the 10_14 somehow pick up the current macOS revision
for the current source target, since we have TARGET_MAC_OS_X_VERSION_MAJOR. But
obviously not for this patch.

More information about the webkit-reviews mailing list