Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge r169799 - [GTK] Use a different user agent string depending on …
…the site https://bugs.webkit.org/show_bug.cgi?id=132681 Reviewed by Anders Carlsson. Source/WebCore: We have changed the user agent string several times to try to fix broken websites that require specific things in the UA string to properly work. But everytime we change the UA string to fix a website we break others. We could use different UA string depending on the website. UserAgentGtk code has also been cleaned up, using NeverDestroyed instead of DEPRECATED_DEFINE_STATIC_LOCAL and avoiding unneeded conversions to UTF-8. * platform/gtk/UserAgentGtk.cpp: (WebCore::UserAgentQuirks::UserAgentQuirks): New helper private class to handle user agent quirks. (WebCore::UserAgentQuirks::add): (WebCore::UserAgentQuirks::contains): (WebCore::UserAgentQuirks::isEmpty): (WebCore::platformForUAString): Bring back this method that was removed to always pretend to be Macintosh. (WebCore::platformVersionForUAString): Return a different platform version depending on the actual platform. (WebCore::versionForUAString): Return the WebKit version. (WebCore::buildUserAgentString): Helper function to build the user agent taking into account the UserAgentQuirks received. (WebCore::standardUserAgentStatic): Standard user agent string when no quirks are present. (WebCore::standardUserAgent): (WebCore::standardUserAgentForURL): New method that returns the user agent string for the given URL. * platform/gtk/UserAgentGtk.h: Source/WebKit2: * UIProcess/API/gtk/WebKitSettings.cpp: (webkit_settings_class_init): Enable site specific quirks setting by default. * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::userAgent): Pass the given URL to WebPage. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::userAgent): Try to get the user agent for the URL received falling back to the current one otherwise. * WebProcess/WebPage/WebPage.h: (WebKit::WebPage::platformUserAgent): Added. * WebProcess/WebPage/efl/WebPageEfl.cpp: (WebKit::WebPage::platformUserAgent): Return null String. * WebProcess/WebPage/gtk/WebPageGtk.cpp: (WebKit::WebPage::platformUserAgent): Use WebCore::standardUserAgentForURL() when site specific quirks setting is enabled. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::platformUserAgent): Return null String. * WebProcess/WebPage/mac/WebPageMac.mm: (WebKit::WebPage::platformUserAgent): Return null String. Tools: Add a unit test to check user agent quirks. * TestWebKitAPI/PlatformGTK.cmake: * TestWebKitAPI/Tests/WebCore/gtk/UserAgentQuirks.cpp: Added. (TestWebKitAPI::TEST): * TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitSettings.cpp: (testWebKitSettings): Site specific quirks setting is now enabled by default.
- Loading branch information
1 parent
211a5a9
commit d890643
Showing
15 changed files
with
303 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.