Title: [272921] trunk
Revision
272921
Author
commit-qu...@webkit.org
Date
2021-02-16 12:20:21 -0800 (Tue, 16 Feb 2021)

Log Message

[GTK] Need new user agent quirk for Google Docs and Google Drive
https://bugs.webkit.org/show_bug.cgi?id=221845

Patch by Michael Catanzaro <mcatanz...@gnome.org> on 2021-02-16
Reviewed by Adrian Perez de Castro.

Source/WebCore:

Switch Google Docs to use a Chrome browser quirk instead of an Internet Explorer quirk.
Remove the Google Drive quirk altogether. Remove the Internet Explorer and Windows platform
quirks, which are no longer used. Retarget the Google Docs quirk to apply only to
docs.google.com because we no longer need to send the quirk to accounts.youtube.com for it
to be effective. Lastly, update Chrome and Firefox version strings for good measure.

* platform/UserAgentQuirks.cpp:
(WebCore::urlRequiresChromeBrowser):
(WebCore::urlRequiresLinuxDesktopPlatform):
(WebCore::UserAgentQuirks::quirksForURL):
(WebCore::UserAgentQuirks::stringForQuirk):
(WebCore::urlRequiresInternetExplorerBrowser): Deleted.
(WebCore::urlRequiresWindowsPlatform): Deleted.
* platform/glib/UserAgentGLib.cpp:
(WebCore::buildUserAgentString):

Tools:

* TestWebKitAPI/Tests/WebCore/UserAgentQuirks.cpp:
(TestWebKitAPI::assertUserAgentForURLHasChromeBrowserQuirk):
(TestWebKitAPI::assertUserAgentForURLHasFirefoxBrowserQuirk):
(TestWebKitAPI::assertUserAgentForURLHasLinuxPlatformQuirk):
(TestWebKitAPI::assertUserAgentForURLHasMacPlatformQuirk):
(TestWebKitAPI::TEST):
(TestWebKitAPI::assertUserAgentForURLHasInternetExplorerBrowserQuirk): Deleted.
(TestWebKitAPI::assertUserAgentForURLHasWindowsPlatformQuirk): Deleted.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (272920 => 272921)


--- trunk/Source/WebCore/ChangeLog	2021-02-16 19:40:01 UTC (rev 272920)
+++ trunk/Source/WebCore/ChangeLog	2021-02-16 20:20:21 UTC (rev 272921)
@@ -1,3 +1,26 @@
+2021-02-16  Michael Catanzaro  <mcatanz...@gnome.org>
+
+        [GTK] Need new user agent quirk for Google Docs and Google Drive
+        https://bugs.webkit.org/show_bug.cgi?id=221845
+
+        Reviewed by Adrian Perez de Castro.
+
+        Switch Google Docs to use a Chrome browser quirk instead of an Internet Explorer quirk.
+        Remove the Google Drive quirk altogether. Remove the Internet Explorer and Windows platform
+        quirks, which are no longer used. Retarget the Google Docs quirk to apply only to
+        docs.google.com because we no longer need to send the quirk to accounts.youtube.com for it
+        to be effective. Lastly, update Chrome and Firefox version strings for good measure.
+
+        * platform/UserAgentQuirks.cpp:
+        (WebCore::urlRequiresChromeBrowser):
+        (WebCore::urlRequiresLinuxDesktopPlatform):
+        (WebCore::UserAgentQuirks::quirksForURL):
+        (WebCore::UserAgentQuirks::stringForQuirk):
+        (WebCore::urlRequiresInternetExplorerBrowser): Deleted.
+        (WebCore::urlRequiresWindowsPlatform): Deleted.
+        * platform/glib/UserAgentGLib.cpp:
+        (WebCore::buildUserAgentString):
+
 2021-02-16  Alex Christensen  <achristen...@webkit.org>
 
         Add API to disable HTTPS upgrade

Modified: trunk/Source/WebCore/platform/UserAgentQuirks.cpp (272920 => 272921)


--- trunk/Source/WebCore/platform/UserAgentQuirks.cpp	2021-02-16 19:40:01 UTC (rev 272920)
+++ trunk/Source/WebCore/platform/UserAgentQuirks.cpp	2021-02-16 20:20:21 UTC (rev 272921)
@@ -81,6 +81,10 @@
     if (baseDomain == "bankofamerica.com")
         return true;
 
+    // Google Docs shows an unsupported browser warning with WebKitGTK's
+    // standard user agent.
+    if (domain == "docs.google.com")
+        return true;
 
     return false;
 }
@@ -106,31 +110,6 @@
     return false;
 }
 
-static bool urlRequiresInternetExplorerBrowser(const URL& url)
-{
-    String domain = url.host().toString();
-
-    // This quirk actually has nothing to do with YouTube. It's needed to avoid
-    // unsupported browser warnings on Google Docs. Why do we need this weird
-    // quirk? We cannot use Chrome or Firefox quirks because Google then uses
-    // features that don't work in WebKit. And we can't use our macOS platform
-    // quirk because Google then expects command keys and doesn't support basic
-    // keyboard shortcuts. We could pretend to be Edge, but adding Chromium is
-    // likely to break in the same way as a Chrome quirk. So that leaves us
-    // with IE browser as the final reasonable option. This will break
-    // eventually, but hopefully not for a long time, because we are probably
-    // out of options when it does.
-    if (domain == "accounts.youtube.com" || domain == "docs.google.com")
-        return true;
-
-    // Google Drive shows an unsupported browser warning with WebKitGTK's
-    // standard user agent.
-    if (domain == "drive.google.com")
-        return true;
-
-    return false;
-}
-
 static bool urlRequiresMacintoshPlatform(const URL& url)
 {
     String domain = url.host().toString();
@@ -168,14 +147,9 @@
     return false;
 }
 
-static bool urlRequiresWindowsPlatform(const URL& url)
-{
-    return urlRequiresInternetExplorerBrowser(url);
-}
-
 static bool urlRequiresLinuxDesktopPlatform(const URL& url)
 {
-    return isGoogle(url) && !urlRequiresInternetExplorerBrowser(url) && chassisType() != WTF::ChassisType::Mobile;
+    return isGoogle(url) && chassisType() != WTF::ChassisType::Mobile;
 }
 
 UserAgentQuirks UserAgentQuirks::quirksForURL(const URL& url)
@@ -188,13 +162,9 @@
         quirks.add(UserAgentQuirks::NeedsChromeBrowser);
     else if (urlRequiresFirefoxBrowser(url))
         quirks.add(UserAgentQuirks::NeedsFirefoxBrowser);
-    else if (urlRequiresInternetExplorerBrowser(url))
-        quirks.add(UserAgentQuirks::NeedsInternetExplorerBrowser);
 
     if (urlRequiresMacintoshPlatform(url))
         quirks.add(UserAgentQuirks::NeedsMacintoshPlatform);
-    else if (urlRequiresWindowsPlatform(url))
-        quirks.add(UserAgentQuirks::NeedsWindowsPlatform);
     else if (urlRequiresLinuxDesktopPlatform(url))
         quirks.add(UserAgentQuirks::NeedsLinuxDesktopPlatform);
 
@@ -206,15 +176,11 @@
     switch (quirk) {
     case NeedsChromeBrowser:
         // Get versions from https://chromium.googlesource.com/chromium/src.git
-        return "Chrome/86.0.4208.2"_s;
+        return "Chrome/90.0.4419.1"_s;
     case NeedsFirefoxBrowser:
-        return "; rv:80.0) Gecko/20100101 Firefox/80.0"_s;
-    case NeedsInternetExplorerBrowser:
-        return "; Trident/7.0; rv:11.0) like Gecko"_s;
+        return "; rv:87.0) Gecko/20100101 Firefox/87.0"_s;
     case NeedsMacintoshPlatform:
         return "Macintosh; Intel Mac OS X 10_15"_s;
-    case NeedsWindowsPlatform:
-        return "Windows NT 10.0"_s;
     case NeedsLinuxDesktopPlatform:
         return "X11; Linux x86_64"_s;
     case NumUserAgentQuirks:

Modified: trunk/Source/WebCore/platform/glib/UserAgentGLib.cpp (272920 => 272921)


--- trunk/Source/WebCore/platform/glib/UserAgentGLib.cpp	2021-02-16 19:40:01 UTC (rev 272920)
+++ trunk/Source/WebCore/platform/glib/UserAgentGLib.cpp	2021-02-16 20:20:21 UTC (rev 272921)
@@ -89,8 +89,6 @@
 
     if (quirks.contains(UserAgentQuirks::NeedsMacintoshPlatform))
         uaString.append(UserAgentQuirks::stringForQuirk(UserAgentQuirks::NeedsMacintoshPlatform));
-    else if (quirks.contains(UserAgentQuirks::NeedsWindowsPlatform))
-        uaString.append(UserAgentQuirks::stringForQuirk(UserAgentQuirks::NeedsWindowsPlatform));
     else if (quirks.contains(UserAgentQuirks::NeedsLinuxDesktopPlatform))
         uaString.append(UserAgentQuirks::stringForQuirk(UserAgentQuirks::NeedsLinuxDesktopPlatform));
     else {
@@ -106,10 +104,6 @@
         uaString.append(UserAgentQuirks::stringForQuirk(UserAgentQuirks::NeedsFirefoxBrowser));
         return uaString.toString();
     }
-    if (quirks.contains(UserAgentQuirks::NeedsInternetExplorerBrowser)) {
-        uaString.append(UserAgentQuirks::stringForQuirk(UserAgentQuirks::NeedsInternetExplorerBrowser));
-        return uaString.toString();
-    }
 
     uaString.appendLiteral(") AppleWebKit/");
     uaString.append(versionForUAString());

Modified: trunk/Tools/ChangeLog (272920 => 272921)


--- trunk/Tools/ChangeLog	2021-02-16 19:40:01 UTC (rev 272920)
+++ trunk/Tools/ChangeLog	2021-02-16 20:20:21 UTC (rev 272921)
@@ -1,3 +1,19 @@
+2021-02-16  Michael Catanzaro  <mcatanz...@gnome.org>
+
+        [GTK] Need new user agent quirk for Google Docs and Google Drive
+        https://bugs.webkit.org/show_bug.cgi?id=221845
+
+        Reviewed by Adrian Perez de Castro.
+
+        * TestWebKitAPI/Tests/WebCore/UserAgentQuirks.cpp:
+        (TestWebKitAPI::assertUserAgentForURLHasChromeBrowserQuirk):
+        (TestWebKitAPI::assertUserAgentForURLHasFirefoxBrowserQuirk):
+        (TestWebKitAPI::assertUserAgentForURLHasLinuxPlatformQuirk):
+        (TestWebKitAPI::assertUserAgentForURLHasMacPlatformQuirk):
+        (TestWebKitAPI::TEST):
+        (TestWebKitAPI::assertUserAgentForURLHasInternetExplorerBrowserQuirk): Deleted.
+        (TestWebKitAPI::assertUserAgentForURLHasWindowsPlatformQuirk): Deleted.
+
 2021-02-16  Alex Christensen  <achristen...@webkit.org>
 
         Add API to disable HTTPS upgrade

Modified: trunk/Tools/TestWebKitAPI/Tests/WebCore/UserAgentQuirks.cpp (272920 => 272921)


--- trunk/Tools/TestWebKitAPI/Tests/WebCore/UserAgentQuirks.cpp	2021-02-16 19:40:01 UTC (rev 272920)
+++ trunk/Tools/TestWebKitAPI/Tests/WebCore/UserAgentQuirks.cpp	2021-02-16 20:20:21 UTC (rev 272921)
@@ -41,7 +41,6 @@
     EXPECT_FALSE(uaString.contains("Chromium"));
     EXPECT_FALSE(uaString.contains("Firefox"));
     EXPECT_FALSE(uaString.contains("Version"));
-    EXPECT_FALSE(uaString.contains("Trident"));
 }
 
 static void assertUserAgentForURLHasFirefoxBrowserQuirk(const char* url)
@@ -53,21 +52,8 @@
     EXPECT_FALSE(uaString.contains("Chromium"));
     EXPECT_TRUE(uaString.contains("Firefox"));
     EXPECT_FALSE(uaString.contains("Version"));
-    EXPECT_FALSE(uaString.contains("Trident"));
 }
 
-static void assertUserAgentForURLHasInternetExplorerBrowserQuirk(const char* url)
-{
-    String uaString = standardUserAgentForURL(URL({ }, url));
-
-    EXPECT_FALSE(uaString.contains("Chrome"));
-    EXPECT_FALSE(uaString.contains("Safari"));
-    EXPECT_FALSE(uaString.contains("Chromium"));
-    EXPECT_FALSE(uaString.contains("Firefox"));
-    EXPECT_FALSE(uaString.contains("Version"));
-    EXPECT_TRUE(uaString.contains("Trident"));
-}
-
 static void assertUserAgentForURLHasLinuxPlatformQuirk(const char* url)
 {
     String uaString = standardUserAgentForURL(URL({ }, url));
@@ -75,23 +61,10 @@
     EXPECT_TRUE(uaString.contains("Linux"));
     EXPECT_FALSE(uaString.contains("Macintosh"));
     EXPECT_FALSE(uaString.contains("Mac OS X"));
-    EXPECT_FALSE(uaString.contains("Windows"));
     EXPECT_FALSE(uaString.contains("Chrome"));
     EXPECT_FALSE(uaString.contains("FreeBSD"));
 }
 
-static void assertUserAgentForURLHasWindowsPlatformQuirk(const char* url)
-{
-    String uaString = standardUserAgentForURL(URL({ }, url));
-
-    EXPECT_FALSE(uaString.contains("Macintosh"));
-    EXPECT_FALSE(uaString.contains("Mac OS X"));
-    EXPECT_FALSE(uaString.contains("Linux"));
-    EXPECT_TRUE(uaString.contains("Windows"));
-    EXPECT_FALSE(uaString.contains("Chrome"));
-    EXPECT_FALSE(uaString.contains("FreeBSD"));
-}
-
 static void assertUserAgentForURLHasMacPlatformQuirk(const char* url)
 {
     String uaString = standardUserAgentForURL(URL({ }, url));
@@ -99,7 +72,6 @@
     EXPECT_TRUE(uaString.contains("Macintosh"));
     EXPECT_TRUE(uaString.contains("Mac OS X"));
     EXPECT_FALSE(uaString.contains("Linux"));
-    EXPECT_FALSE(uaString.contains("Windows"));
     EXPECT_FALSE(uaString.contains("Chrome"));
     EXPECT_FALSE(uaString.contains("FreeBSD"));
 }
@@ -120,6 +92,7 @@
     assertUserAgentForURLHasChromeBrowserQuirk("http://typekit.net/");
     assertUserAgentForURLHasChromeBrowserQuirk("http://auth.mayohr.com/");
     assertUserAgentForURLHasChromeBrowserQuirk("http://bankofamerica.com/");
+    assertUserAgentForURLHasChromeBrowserQuirk("http://docs.google.com/");
 
     assertUserAgentForURLHasFirefoxBrowserQuirk("http://bugzilla.redhat.com/");
 
@@ -127,14 +100,6 @@
     assertUserAgentForURLHasFirefoxBrowserQuirk("http://www.netflix.com/");
 #endif
 
-    assertUserAgentForURLHasInternetExplorerBrowserQuirk("http://accounts.youtube.com/");
-    assertUserAgentForURLHasInternetExplorerBrowserQuirk("http://docs.google.com/");
-    assertUserAgentForURLHasInternetExplorerBrowserQuirk("http://drive.google.com/");
-
-    assertUserAgentForURLHasWindowsPlatformQuirk("http://accounts.youtube.com/");
-    assertUserAgentForURLHasWindowsPlatformQuirk("http://docs.google.com/");
-    assertUserAgentForURLHasWindowsPlatformQuirk("http://drive.google.com/");
-
     assertUserAgentForURLHasLinuxPlatformQuirk("http://www.google.com/");
     assertUserAgentForURLHasLinuxPlatformQuirk("http://www.google.es/");
     assertUserAgentForURLHasLinuxPlatformQuirk("http://calendar.google.com/");
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to