Commit bd1c791e authored by Gauthier Ambard's avatar Gauthier Ambard Committed by Commit Bot

[iOS] Freeze Safari version in Mobile UserAgent

This CL freezes the Safari version in the Mobile User Agent, aligning with
https://blog.chromium.org/2019/05/improving-privacy-and-security-on-web.html.

It will also increase compatibility with WebKit, as it is frozen in
WebKit mobile User Agent.

The iOS 12 version was introduced in http://crrev.com/c/1102485.
This CL was made during the beta version of iOS 12, my guess is that the
version was frozen in WebKit before the Stable version was released, so we
released a wrong version by mistake.

Bug: 1026615
Change-Id: I7641bc54327f3d135501dc47c365c4458ca8dace
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1926488
Commit-Queue: Gauthier Ambard <gambard@chromium.org>
Reviewed-by: default avatarAaron Tagliaboschi <aarontag@chromium.org>
Reviewed-by: default avatarPeter Lee <pkl@chromium.org>
Reviewed-by: default avatarEugene But <eugenebut@chromium.org>
Cr-Commit-Position: refs/heads/master@{#720198}
parent 630b85ce
......@@ -95,20 +95,12 @@ std::string BuildUserAgentFromProduct(UserAgentType type,
if (type == web::UserAgentType::DESKTOP)
return kDesktopUserAgent;
std::string safari_version;
if (@available(iOS 13, *)) {
safari_version = "604.1";
} else {
safari_version = "605.1";
}
DCHECK_EQ(web::UserAgentType::MOBILE, type);
std::string user_agent;
base::StringAppendF(&user_agent,
"Mozilla/5.0 (%s) AppleWebKit/605.1.15"
" (KHTML, like Gecko) %s Mobile/15E148 Safari/%s",
BuildOSCpuInfo(type).c_str(), product.c_str(),
safari_version.c_str());
" (KHTML, like Gecko) %s Mobile/15E148 Safari/604.1",
BuildOSCpuInfo(type).c_str(), product.c_str());
return user_agent;
}
......
......@@ -70,20 +70,12 @@ TEST_F(UserAgentTest, MobileUserAgentForProduct) {
&os_major_version, &os_minor_version, &os_bugfix_version);
base::StringAppendF(&os_version, "%d_%d", os_major_version, os_minor_version);
std::string safari_version;
if (@available(iOS 13, *)) {
safari_version = "604.1";
} else {
safari_version = "605.1";
}
std::string expected_user_agent;
base::StringAppendF(
&expected_user_agent,
"Mozilla/5.0 (%s; CPU %s %s like Mac OS X) AppleWebKit/605.1.15 (KHTML, "
"like Gecko) %s Mobile/15E148 Safari/%s",
platform.c_str(), cpu.c_str(), os_version.c_str(), product.c_str(),
safari_version.c_str());
"like Gecko) %s Mobile/15E148 Safari/604.1",
platform.c_str(), cpu.c_str(), os_version.c_str(), product.c_str());
std::string result =
BuildUserAgentFromProduct(web::UserAgentType::MOBILE, product);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment