Skip to content
Permalink
Browse files
Unreviewed, reverting r273084.
https://bugs.webkit.org/show_bug.cgi?id=222905

User agent quirks still needed after all

Reverted changeset:

"[GTK] Remove all Google user agent quirks except for Google
Docs"
https://bugs.webkit.org/show_bug.cgi?id=222039
https://trac.webkit.org/changeset/273084

Canonical link: https://commits.webkit.org/235006@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@274070 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
webkit-commit-queue committed Mar 8, 2021
1 parent d56fc20 commit b43c0f0a738b8655a6d0d71c9ee001fd36c75c79
Showing 5 changed files with 62 additions and 0 deletions.
@@ -1,3 +1,17 @@
2021-03-08 Commit Queue <commit-queue@webkit.org>

Unreviewed, reverting r273084.
https://bugs.webkit.org/show_bug.cgi?id=222905

User agent quirks still needed after all

Reverted changeset:

"[GTK] Remove all Google user agent quirks except for Google
Docs"
https://bugs.webkit.org/show_bug.cgi?id=222039
https://trac.webkit.org/changeset/273084

2021-03-08 Chris Lord <clord@igalia.com>

Allow creation of a CSSFontSelector with a non-Document ScriptExecutionContext
@@ -123,6 +123,11 @@ static bool urlRequiresMacintoshPlatform(const URL& url)
return false;
}

static bool urlRequiresLinuxDesktopPlatform(const URL& url)
{
return isGoogle(url) && chassisType() != WTF::ChassisType::Mobile;
}

UserAgentQuirks UserAgentQuirks::quirksForURL(const URL& url)
{
ASSERT(!url.isNull());
@@ -136,6 +141,8 @@ UserAgentQuirks UserAgentQuirks::quirksForURL(const URL& url)

if (urlRequiresMacintoshPlatform(url))
quirks.add(UserAgentQuirks::NeedsMacintoshPlatform);
else if (urlRequiresLinuxDesktopPlatform(url))
quirks.add(UserAgentQuirks::NeedsLinuxDesktopPlatform);

return quirks;
}
@@ -150,6 +157,8 @@ String UserAgentQuirks::stringForQuirk(UserAgentQuirk quirk)
return "; rv:87.0) Gecko/20100101 Firefox/87.0"_s;
case NeedsMacintoshPlatform:
return "Macintosh; Intel Mac OS X 10_15"_s;
case NeedsLinuxDesktopPlatform:
return "X11; Linux x86_64"_s;
case NumUserAgentQuirks:
default:
ASSERT_NOT_REACHED();
@@ -89,6 +89,8 @@ static String buildUserAgentString(const UserAgentQuirks& quirks)

if (quirks.contains(UserAgentQuirks::NeedsMacintoshPlatform))
uaString.append(UserAgentQuirks::stringForQuirk(UserAgentQuirks::NeedsMacintoshPlatform));
else if (quirks.contains(UserAgentQuirks::NeedsLinuxDesktopPlatform))
uaString.append(UserAgentQuirks::stringForQuirk(UserAgentQuirks::NeedsLinuxDesktopPlatform));
else {
uaString.append(platformForUAString());
uaString.appendLiteral("; ");
@@ -1,3 +1,17 @@
2021-03-08 Commit Queue <commit-queue@webkit.org>

Unreviewed, reverting r273084.
https://bugs.webkit.org/show_bug.cgi?id=222905

User agent quirks still needed after all

Reverted changeset:

"[GTK] Remove all Google user agent quirks except for Google
Docs"
https://bugs.webkit.org/show_bug.cgi?id=222039
https://trac.webkit.org/changeset/273084

2021-03-07 Wenson Hsieh <wenson_hsieh@apple.com>

[iOS] maild hits a simulated crash when ENABLE(APP_HIGHLIGHTS) is defined
@@ -54,6 +54,17 @@ static void assertUserAgentForURLHasFirefoxBrowserQuirk(const char* url)
EXPECT_FALSE(uaString.contains("Version"));
}

static void assertUserAgentForURLHasLinuxPlatformQuirk(const char* url)
{
String uaString = standardUserAgentForURL(URL({ }, url));

EXPECT_TRUE(uaString.contains("Linux"));
EXPECT_FALSE(uaString.contains("Macintosh"));
EXPECT_FALSE(uaString.contains("Mac OS X"));
EXPECT_FALSE(uaString.contains("Chrome"));
EXPECT_FALSE(uaString.contains("FreeBSD"));
}

static void assertUserAgentForURLHasMacPlatformQuirk(const char* url)
{
String uaString = standardUserAgentForURL(URL({ }, url));
@@ -71,6 +82,12 @@ TEST(UserAgentTest, Quirks)
String uaString = standardUserAgentForURL(URL({ }, "http://www.webkit.org/"));
EXPECT_TRUE(uaString.isNull());

#if !OS(LINUX) || !CPU(X86_64)
// Google quirk should not affect sites with similar domains.
uaString = standardUserAgentForURL(URL({ }, "http://www.googleblog.com/"));
EXPECT_FALSE(uaString.contains("Linux x86_64"));
#endif

assertUserAgentForURLHasChromeBrowserQuirk("http://typekit.com/");
assertUserAgentForURLHasChromeBrowserQuirk("http://typekit.net/");
assertUserAgentForURLHasChromeBrowserQuirk("http://auth.mayohr.com/");
@@ -83,6 +100,12 @@ TEST(UserAgentTest, Quirks)
assertUserAgentForURLHasFirefoxBrowserQuirk("http://www.netflix.com/");
#endif

assertUserAgentForURLHasLinuxPlatformQuirk("http://www.google.com/");
assertUserAgentForURLHasLinuxPlatformQuirk("http://www.google.es/");
assertUserAgentForURLHasLinuxPlatformQuirk("http://calendar.google.com/");
assertUserAgentForURLHasLinuxPlatformQuirk("http://plus.google.com/");
assertUserAgentForURLHasLinuxPlatformQuirk("http://fonts.googleapis.com/");

assertUserAgentForURLHasMacPlatformQuirk("http://www.yahoo.com/");
assertUserAgentForURLHasMacPlatformQuirk("http://finance.yahoo.com/");
assertUserAgentForURLHasMacPlatformQuirk("http://intl.taobao.com/");

0 comments on commit b43c0f0

Please sign in to comment.