<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[170882] releases/WebKitGTK/webkit-2.4</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/170882">170882</a></dd>
<dt>Author</dt> <dd>carlosgc@webkit.org</dd>
<dt>Date</dt> <dd>2014-07-08 02:40:42 -0700 (Tue, 08 Jul 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>[GTK][Stable] Google Maps doesn't work with Version/X in the user agent
https://bugs.webkit.org/show_bug.cgi?id=134631
Reviewed by Sergio Villar Senin.
Source/WebCore:
Because of the JSC version used in stable branch, when the
Version/X string is present in the user agent, google maps uses
JavaScript API that we don't support. Move the google domain quirks
from WebKit1 to WebCore and add a quirk for google maps.
* platform/gtk/UserAgentGtk.cpp:
(WebCore::googleDomains):
(WebCore::otherGoogleDomains):
(WebCore::isGoogleDomain): Returns whether the given host is a
known google domain
(WebCore::buildUserAgentString): Do not include the Version/X
string in the user agent if the ShouldNotIncludeSafariVersion
quirk is present.
(WebCore::standardUserAgentForURL): Add RequiresStandardUserAgent
quirk for any google doamin and ShouldNotIncludeSafariVersion for
Google Maps.
Source/WebKit/gtk:
Remove user agent quirks for google domains, since they are now
implemented in WebCore.
* WebCoreSupport/FrameLoaderClientGtk.cpp:
(WebKit::FrameLoaderClient::userAgent): Pass the WebCore::URL
const reference to webkitWebSettingsUserAgentForURI().
* webkit/webkitwebsettings.cpp:
(webkitWebSettingsUserAgentForURI): Use
WebCore::standardUserAgentForURL() when site specific quirks are enabled.
* webkit/webkitwebsettingsprivate.h:
Tools:
Move user agent quirks tests from WebKit1 to WebCore.
* TestWebKitAPI/Tests/WebCore/gtk/UserAgentQuirks.cpp:
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/WebKitGtk/testwebsettings.c:
(test_webkit_web_settings_user_agent):</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#releasesWebKitGTKwebkit24SourceWebCoreChangeLog">releases/WebKitGTK/webkit-2.4/Source/WebCore/ChangeLog</a></li>
<li><a href="#releasesWebKitGTKwebkit24SourceWebCoreplatformgtkUserAgentGtkcpp">releases/WebKitGTK/webkit-2.4/Source/WebCore/platform/gtk/UserAgentGtk.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit24SourceWebKitgtkChangeLog">releases/WebKitGTK/webkit-2.4/Source/WebKit/gtk/ChangeLog</a></li>
<li><a href="#releasesWebKitGTKwebkit24SourceWebKitgtkWebCoreSupportFrameLoaderClientGtkcpp">releases/WebKitGTK/webkit-2.4/Source/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit24SourceWebKitgtkwebkitwebkitwebsettingscpp">releases/WebKitGTK/webkit-2.4/Source/WebKit/gtk/webkit/webkitwebsettings.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit24SourceWebKitgtkwebkitwebkitwebsettingsprivateh">releases/WebKitGTK/webkit-2.4/Source/WebKit/gtk/webkit/webkitwebsettingsprivate.h</a></li>
<li><a href="#releasesWebKitGTKwebkit24ToolsChangeLog">releases/WebKitGTK/webkit-2.4/Tools/ChangeLog</a></li>
<li><a href="#releasesWebKitGTKwebkit24ToolsTestWebKitAPITestsWebCoregtkUserAgentQuirkscpp">releases/WebKitGTK/webkit-2.4/Tools/TestWebKitAPI/Tests/WebCore/gtk/UserAgentQuirks.cpp</a></li>
<li><a href="#releasesWebKitGTKwebkit24ToolsTestWebKitAPITestsWebKitGtktestwebsettingsc">releases/WebKitGTK/webkit-2.4/Tools/TestWebKitAPI/Tests/WebKitGtk/testwebsettings.c</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="releasesWebKitGTKwebkit24SourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.4/Source/WebCore/ChangeLog (170881 => 170882)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.4/Source/WebCore/ChangeLog        2014-07-08 09:24:31 UTC (rev 170881)
+++ releases/WebKitGTK/webkit-2.4/Source/WebCore/ChangeLog        2014-07-08 09:40:42 UTC (rev 170882)
</span><span class="lines">@@ -1,3 +1,27 @@
</span><ins>+2014-07-04 Carlos Garcia Campos <cgarcia@igalia.com>
+
+ [GTK][Stable] Google Maps doesn't work with Version/X in the user agent
+ https://bugs.webkit.org/show_bug.cgi?id=134631
+
+ Reviewed by Sergio Villar Senin.
+
+ Because of the JSC version used in stable branch, when the
+ Version/X string is present in the user agent, google maps uses
+ JavaScript API that we don't support. Move the google domain quirks
+ from WebKit1 to WebCore and add a quirk for google maps.
+
+ * platform/gtk/UserAgentGtk.cpp:
+ (WebCore::googleDomains):
+ (WebCore::otherGoogleDomains):
+ (WebCore::isGoogleDomain): Returns whether the given host is a
+ known google domain
+ (WebCore::buildUserAgentString): Do not include the Version/X
+ string in the user agent if the ShouldNotIncludeSafariVersion
+ quirk is present.
+ (WebCore::standardUserAgentForURL): Add RequiresStandardUserAgent
+ quirk for any google doamin and ShouldNotIncludeSafariVersion for
+ Google Maps.
+
</ins><span class="cx"> 2014-06-27 Philippe Normand <pnormand@igalia.com>
</span><span class="cx">
</span><span class="cx"> [GTK] 8tracks.com triggers annoying pop-up window/installation of "About protocol source plugin" (GStreamer?)
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit24SourceWebCoreplatformgtkUserAgentGtkcpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.4/Source/WebCore/platform/gtk/UserAgentGtk.cpp (170881 => 170882)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.4/Source/WebCore/platform/gtk/UserAgentGtk.cpp        2014-07-08 09:24:31 UTC (rev 170881)
+++ releases/WebKitGTK/webkit-2.4/Source/WebCore/platform/gtk/UserAgentGtk.cpp        2014-07-08 09:40:42 UTC (rev 170882)
</span><span class="lines">@@ -27,8 +27,10 @@
</span><span class="cx"> #include "UserAgentGtk.h"
</span><span class="cx">
</span><span class="cx"> #include "URL.h"
</span><ins>+#include <wtf/HashSet.h>
</ins><span class="cx"> #include <wtf/NeverDestroyed.h>
</span><span class="cx"> #include <wtf/text/StringBuilder.h>
</span><ins>+#include <wtf/text/StringHash.h>
</ins><span class="cx">
</span><span class="cx"> #if OS(UNIX)
</span><span class="cx"> #include <sys/utsname.h>
</span><span class="lines">@@ -40,6 +42,8 @@
</span><span class="cx"> public:
</span><span class="cx"> enum UserAgentQuirk {
</span><span class="cx"> NeedsMacintoshPlatform,
</span><ins>+ RequiresStandardUserAgent,
+ ShouldNotClaimToBeSafari,
</ins><span class="cx">
</span><span class="cx"> NumUserAgentQuirks
</span><span class="cx"> };
</span><span class="lines">@@ -69,6 +73,107 @@
</span><span class="cx"> uint32_t m_quirks;
</span><span class="cx"> };
</span><span class="cx">
</span><ins>+static const HashSet<String>& googleDomains()
+{
+ static NeverDestroyed<HashSet<String>> domains(std::initializer_list<String>({
+ "biz",
+ "com",
+ "net",
+ "org",
+ "ae",
+ "ag",
+ "am",
+ "at",
+ "az",
+ "be",
+ "bi",
+ "ca",
+ "cc",
+ "cd",
+ "cg",
+ "ch",
+ "cl",
+ "com.br",
+ "com.do",
+ "co.uk",
+ "co.kr",
+ "co.jp",
+ "de",
+ "dj",
+ "dk",
+ "ee",
+ "es",
+ "fi",
+ "fm",
+ "fr",
+ "gg",
+ "gl",
+ "gm",
+ "gs",
+ "hn",
+ "hu",
+ "ie",
+ "it",
+ "je",
+ "kz",
+ "li",
+ "lt",
+ "lu",
+ "lv",
+ "ma",
+ "ms",
+ "mu",
+ "mw",
+ "nl",
+ "no",
+ "nu",
+ "pl",
+ "pn",
+ "pt",
+ "ru",
+ "rw",
+ "sh",
+ "sk",
+ "sm",
+ "st",
+ "td",
+ "tk",
+ "tp",
+ "tv",
+ "us",
+ "uz",
+ "ws"
+ }));
+ return domains;
+}
+
+static const Vector<String>& otherGoogleDomains()
+{
+ static NeverDestroyed<Vector<String>> otherDomains(std::initializer_list<String>({
+ "gmail.com",
+ "youtube.com",
+ "gstatic.com",
+ "ytimg.com"
+ }));
+ return otherDomains;
+}
+
+static bool isGoogleDomain(String host)
+{
+ // First check if this is one of the various google.com international domains.
+ int position = host.find(".google.");
+ if (position > 0 && googleDomains().contains(host.substring(position + sizeof(".google.") - 1)))
+ return true;
+
+ // Then we check the possibility of it being one of the other, .com-only google domains.
+ for (unsigned i = 0; i < otherGoogleDomains().size(); i++) {
+ if (host.endsWith(otherGoogleDomains().at(i)))
+ return true;
+ }
+
+ return false;
+}
+
</ins><span class="cx"> static const char* cpuDescriptionForUAString()
</span><span class="cx"> {
</span><span class="cx"> #if CPU(PPC) || CPU(PPC64)
</span><span class="lines">@@ -138,11 +243,15 @@
</span><span class="cx">
</span><span class="cx"> uaString.appendLiteral(") AppleWebKit/");
</span><span class="cx"> uaString.append(versionForUAString());
</span><del>- // Version/X is mandatory *before* Safari/X to be a valid Safari UA. See
- // https://bugs.webkit.org/show_bug.cgi?id=133403 for details.
- uaString.appendLiteral(" (KHTML, like Gecko) Version/8.0 Safari/");
- uaString.append(versionForUAString());
</del><span class="cx">
</span><ins>+ uaString.appendLiteral(" (KHTML, like Gecko)");
+ if (!quirks.contains(UserAgentQuirks::ShouldNotClaimToBeSafari)) {
+ // Version/X is mandatory *before* Safari/X to be a valid Safari UA. See
+ // https://bugs.webkit.org/show_bug.cgi?id=133403 for details.
+ uaString.appendLiteral(" Version/8.0 Safari/");
+ uaString.append(versionForUAString());
+ }
+
</ins><span class="cx"> return uaString.toString();
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -180,6 +289,14 @@
</span><span class="cx"> // www.yahoo.com redirects to the mobile version when Linux is present in the UA,
</span><span class="cx"> // use always Macintosh as platform. See https://bugs.webkit.org/show_bug.cgi?id=125444.
</span><span class="cx"> quirks.add(UserAgentQuirks::NeedsMacintoshPlatform);
</span><ins>+ } else if (isGoogleDomain(url.host())) {
+ // For Google domains, drop the browser's custom User Agent string, and use the
+ // standard one, so they don't give us a broken experience.
+ quirks.add(UserAgentQuirks::RequiresStandardUserAgent);
+
+ // Google Maps uses new JavaScript API not supported by us when Safari Version is present in the user agent.
+ if (url.host().startsWith("maps.") || url.path().startsWith("/maps"))
+ quirks.add(UserAgentQuirks::ShouldNotClaimToBeSafari);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // The null string means we don't need a specific UA for the given URL.
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit24SourceWebKitgtkChangeLog"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.4/Source/WebKit/gtk/ChangeLog (170881 => 170882)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.4/Source/WebKit/gtk/ChangeLog        2014-07-08 09:24:31 UTC (rev 170881)
+++ releases/WebKitGTK/webkit-2.4/Source/WebKit/gtk/ChangeLog        2014-07-08 09:40:42 UTC (rev 170882)
</span><span class="lines">@@ -1,3 +1,21 @@
</span><ins>+2014-07-04 Carlos Garcia Campos <cgarcia@igalia.com>
+
+ [GTK][Stable] Google Maps doesn't work with Version/X in the user agent
+ https://bugs.webkit.org/show_bug.cgi?id=134631
+
+ Reviewed by Sergio Villar Senin.
+
+ Remove user agent quirks for google domains, since they are now
+ implemented in WebCore.
+
+ * WebCoreSupport/FrameLoaderClientGtk.cpp:
+ (WebKit::FrameLoaderClient::userAgent): Pass the WebCore::URL
+ const reference to webkitWebSettingsUserAgentForURI().
+ * webkit/webkitwebsettings.cpp:
+ (webkitWebSettingsUserAgentForURI): Use
+ WebCore::standardUserAgentForURL() when site specific quirks are enabled.
+ * webkit/webkitwebsettingsprivate.h:
+
</ins><span class="cx"> 2014-05-26 Carlos Garcia Campos <cgarcia@igalia.com>
</span><span class="cx">
</span><span class="cx"> Unreviewed. Update NEWS and Versions.m4 for 2.4.3 release.
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit24SourceWebKitgtkWebCoreSupportFrameLoaderClientGtkcpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.4/Source/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp (170881 => 170882)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.4/Source/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp        2014-07-08 09:24:31 UTC (rev 170881)
+++ releases/WebKitGTK/webkit-2.4/Source/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp        2014-07-08 09:40:42 UTC (rev 170882)
</span><span class="lines">@@ -123,7 +123,7 @@
</span><span class="cx"> String FrameLoaderClient::userAgent(const URL& url)
</span><span class="cx"> {
</span><span class="cx"> WebKitWebSettings* settings = webkit_web_view_get_settings(getViewFromFrame(m_frame));
</span><del>- GUniquePtr<gchar> userAgentString(webkitWebSettingsUserAgentForURI(settings, url.string().utf8().data()));
</del><ins>+ GUniquePtr<gchar> userAgentString(webkitWebSettingsUserAgentForURI(settings, url));
</ins><span class="cx"> return String::fromUTF8(userAgentString.get());
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit24SourceWebKitgtkwebkitwebkitwebsettingscpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.4/Source/WebKit/gtk/webkit/webkitwebsettings.cpp (170881 => 170882)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.4/Source/WebKit/gtk/webkit/webkitwebsettings.cpp        2014-07-08 09:24:31 UTC (rev 170881)
+++ releases/WebKitGTK/webkit-2.4/Source/WebKit/gtk/webkit/webkitwebsettings.cpp        2014-07-08 09:40:42 UTC (rev 170882)
</span><span class="lines">@@ -1504,121 +1504,6 @@
</span><span class="cx"> return webSettings->priv->userAgent.data();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static void initializeDomainsList(HashSet<String>& googleDomains)
-{
- // Google search domains.
- googleDomains.add("biz");
- googleDomains.add("com");
- googleDomains.add("net");
- googleDomains.add("org");
- googleDomains.add("ae");
- googleDomains.add("ag");
- googleDomains.add("am");
- googleDomains.add("at");
- googleDomains.add("az");
- googleDomains.add("be");
- googleDomains.add("bi");
- googleDomains.add("ca");
- googleDomains.add("cc");
- googleDomains.add("cd");
- googleDomains.add("cg");
- googleDomains.add("ch");
- googleDomains.add("cl");
- googleDomains.add("com.br");
- googleDomains.add("com.do");
- googleDomains.add("co.uk");
- googleDomains.add("co.kr");
- googleDomains.add("co.jp");
- googleDomains.add("de");
- googleDomains.add("dj");
- googleDomains.add("dk");
- googleDomains.add("ee");
- googleDomains.add("es");
- googleDomains.add("fi");
- googleDomains.add("fm");
- googleDomains.add("fr");
- googleDomains.add("gg");
- googleDomains.add("gl");
- googleDomains.add("gm");
- googleDomains.add("gs");
- googleDomains.add("hn");
- googleDomains.add("hu");
- googleDomains.add("ie");
- googleDomains.add("it");
- googleDomains.add("je");
- googleDomains.add("kz");
- googleDomains.add("li");
- googleDomains.add("lt");
- googleDomains.add("lu");
- googleDomains.add("lv");
- googleDomains.add("ma");
- googleDomains.add("ms");
- googleDomains.add("mu");
- googleDomains.add("mw");
- googleDomains.add("nl");
- googleDomains.add("no");
- googleDomains.add("nu");
- googleDomains.add("pl");
- googleDomains.add("pn");
- googleDomains.add("pt");
- googleDomains.add("ru");
- googleDomains.add("rw");
- googleDomains.add("sh");
- googleDomains.add("sk");
- googleDomains.add("sm");
- googleDomains.add("st");
- googleDomains.add("td");
- googleDomains.add("tk");
- googleDomains.add("tp");
- googleDomains.add("tv");
- googleDomains.add("us");
- googleDomains.add("uz");
- googleDomains.add("ws");
-}
-
-static void initializeOtherGoogleDomains(Vector<String>& otherGoogleDomains)
-{
- otherGoogleDomains.append("gmail.com");
- otherGoogleDomains.append("youtube.com");
- otherGoogleDomains.append("gstatic.com");
- otherGoogleDomains.append("ytimg.com");
-}
-
-static bool isGoogleDomain(String host)
-{
- DEFINE_STATIC_LOCAL(HashSet<String>, googleDomains, ());
- DEFINE_STATIC_LOCAL(Vector<String>, otherGoogleDomains, ());
-
- if (googleDomains.isEmpty())
- initializeDomainsList(googleDomains);
-
- if (otherGoogleDomains.isEmpty())
- initializeOtherGoogleDomains(otherGoogleDomains);
-
- // First check if this is one of the various google.com international domains.
- int position = host.find(".google.");
- if (position > 0 && googleDomains.contains(host.substring(position + sizeof(".google.") - 1)))
- return true;
-
- // Then we check the possibility of it being one of the other, .com-only google domains.
- for (unsigned int i = 0; i < otherGoogleDomains.size(); i++) {
- if (host.endsWith(otherGoogleDomains.at(i)))
- return true;
- }
-
- return false;
-}
-
-static String userAgentForURL(const URL& url)
-{
- // For Google domains, drop the browser's custom User Agent string, and use the
- // standard one, so they don't give us a broken experience.
- if (isGoogleDomain(url.host()))
- return standardUserAgent();
-
- return String();
-}
-
</del><span class="cx"> /*
</span><span class="cx"> * Private usage only.
</span><span class="cx"> * webkitWebSettingsUserAgentForURI:
</span><span class="lines">@@ -1644,14 +1529,13 @@
</span><span class="cx"> * Returns: (transfer full): a newly allocated string containing the
</span><span class="cx"> * User-Agent that will be sent for the given URI.
</span><span class="cx"> */
</span><del>-char* webkitWebSettingsUserAgentForURI(WebKitWebSettings* webSettings, const char* uri)
</del><ins>+char* webkitWebSettingsUserAgentForURI(WebKitWebSettings* webSettings, const WebCore::URL& url)
</ins><span class="cx"> {
</span><del>- if (webSettings->priv->enableSiteSpecificQuirks) {
- String userAgentString = userAgentForURL(WebCore::URL(WebCore::URL(), String::fromUTF8(uri)));
</del><ins>+ if (webSettings->priv->enableSiteSpecificQuirks && !url.isNull()) {
+ String userAgentString = WebCore::standardUserAgentForURL(url);
</ins><span class="cx"> if (!userAgentString.isEmpty())
</span><span class="cx"> return g_strdup(userAgentString.utf8().data());
</span><span class="cx"> }
</span><del>-
</del><span class="cx"> return g_strdup(webkit_web_settings_get_user_agent(webSettings));
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit24SourceWebKitgtkwebkitwebkitwebsettingsprivateh"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.4/Source/WebKit/gtk/webkit/webkitwebsettingsprivate.h (170881 => 170882)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.4/Source/WebKit/gtk/webkit/webkitwebsettingsprivate.h        2014-07-08 09:24:31 UTC (rev 170881)
+++ releases/WebKitGTK/webkit-2.4/Source/WebKit/gtk/webkit/webkitwebsettingsprivate.h        2014-07-08 09:40:42 UTC (rev 170882)
</span><span class="lines">@@ -23,6 +23,7 @@
</span><span class="cx"> #ifndef webkitwebsettingsprivate_h
</span><span class="cx"> #define webkitwebsettingsprivate_h
</span><span class="cx">
</span><ins>+#include "URL.h"
</ins><span class="cx"> #include "webkitwebsettings.h"
</span><span class="cx"> #include <wtf/text/CString.h>
</span><span class="cx">
</span><span class="lines">@@ -92,7 +93,7 @@
</span><span class="cx">
</span><span class="cx"> WEBKIT_API void webkit_web_settings_add_extra_plugin_directory(WebKitWebView*, const gchar* directory);
</span><span class="cx">
</span><del>-WEBKIT_API char* webkitWebSettingsUserAgentForURI(WebKitWebSettings*, const gchar* uri);
</del><ins>+WEBKIT_API char* webkitWebSettingsUserAgentForURI(WebKitWebSettings*, const WebCore::URL&);
</ins><span class="cx">
</span><span class="cx"> GSList* webkitWebViewGetEnchantDicts(WebKitWebView*);
</span><span class="cx">
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit24ToolsChangeLog"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.4/Tools/ChangeLog (170881 => 170882)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.4/Tools/ChangeLog        2014-07-08 09:24:31 UTC (rev 170881)
+++ releases/WebKitGTK/webkit-2.4/Tools/ChangeLog        2014-07-08 09:40:42 UTC (rev 170882)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2014-07-04 Carlos Garcia Campos <cgarcia@igalia.com>
+
+ [GTK][Stable] Google Maps doesn't work with Version/X in the user agent
+ https://bugs.webkit.org/show_bug.cgi?id=134631
+
+ Reviewed by Sergio Villar Senin.
+
+ Move user agent quirks tests from WebKit1 to WebCore.
+
+ * TestWebKitAPI/Tests/WebCore/gtk/UserAgentQuirks.cpp:
+ (TestWebKitAPI::TEST):
+ * TestWebKitAPI/Tests/WebKitGtk/testwebsettings.c:
+ (test_webkit_web_settings_user_agent):
+
</ins><span class="cx"> 2014-02-05 Zan Dobersek <zdobersek@igalia.com>
</span><span class="cx">
</span><span class="cx"> Remove the WTF_COMPILER_SUPPORTS_CXX_GENERALIZED_INITIALIZERS macro
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit24ToolsTestWebKitAPITestsWebCoregtkUserAgentQuirkscpp"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.4/Tools/TestWebKitAPI/Tests/WebCore/gtk/UserAgentQuirks.cpp (170881 => 170882)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.4/Tools/TestWebKitAPI/Tests/WebCore/gtk/UserAgentQuirks.cpp        2014-07-08 09:24:31 UTC (rev 170881)
+++ releases/WebKitGTK/webkit-2.4/Tools/TestWebKitAPI/Tests/WebCore/gtk/UserAgentQuirks.cpp        2014-07-08 09:40:42 UTC (rev 170882)
</span><span class="lines">@@ -43,6 +43,21 @@
</span><span class="cx"> EXPECT_TRUE(uaString.contains("Macintosh"));
</span><span class="cx"> EXPECT_TRUE(uaString.contains("Mac OS X"));
</span><span class="cx"> EXPECT_FALSE(uaString.contains("Linux"));
</span><ins>+
+ // For Google domains we always return the standard UA.
+ uaString = standardUserAgent();
+ EXPECT_FALSE(uaString.isNull());
+ EXPECT_TRUE(uaString == standardUserAgentForURL(URL(ParsedURLString, "http://www.google.com/")));
+ EXPECT_TRUE(uaString == standardUserAgentForURL(URL(ParsedURLString, "http://calendar.google.com/")));
+ EXPECT_TRUE(uaString == standardUserAgentForURL(URL(ParsedURLString, "http://gmail.com/")));
+ EXPECT_TRUE(uaString == standardUserAgentForURL(URL(ParsedURLString, "http://www.google.com.br/")));
+ EXPECT_TRUE(uaString == standardUserAgentForURL(URL(ParsedURLString, "http://www.youtube.com/")));
+ EXPECT_TRUE(uaString != standardUserAgentForURL(URL(ParsedURLString, "http://www.google.uk.not.com.br/")));
+
+ // For Google Maps we remove the Version/8.0 string.
+ uaString = standardUserAgentForURL(URL(ParsedURLString, "http://maps.google.com/"));
+ EXPECT_TRUE(uaString == standardUserAgentForURL(URL(ParsedURLString, "http://www.google.com/maps/")));
+ EXPECT_FALSE(uaString.contains("Version/8.0 Safari/"));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> } // namespace TestWebKitAPI
</span></span></pre></div>
<a id="releasesWebKitGTKwebkit24ToolsTestWebKitAPITestsWebKitGtktestwebsettingsc"></a>
<div class="modfile"><h4>Modified: releases/WebKitGTK/webkit-2.4/Tools/TestWebKitAPI/Tests/WebKitGtk/testwebsettings.c (170881 => 170882)</h4>
<pre class="diff"><span>
<span class="info">--- releases/WebKitGTK/webkit-2.4/Tools/TestWebKitAPI/Tests/WebKitGtk/testwebsettings.c        2014-07-08 09:24:31 UTC (rev 170881)
+++ releases/WebKitGTK/webkit-2.4/Tools/TestWebKitAPI/Tests/WebKitGtk/testwebsettings.c        2014-07-08 09:40:42 UTC (rev 170882)
</span><span class="lines">@@ -22,9 +22,6 @@
</span><span class="cx"> #include <gtk/gtk.h>
</span><span class="cx"> #include <webkit/webkit.h>
</span><span class="cx">
</span><del>-/* Private API */
-char* webkitWebSettingsUserAgentForURI(WebKitWebSettings *settings, const char *uri);
-
</del><span class="cx"> static void test_webkit_web_settings_copy(void)
</span><span class="cx"> {
</span><span class="cx"> WebKitWebSettings *settings = webkit_web_settings_new();
</span><span class="lines">@@ -61,31 +58,6 @@
</span><span class="cx"> g_free(defaultEncoding);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static void test_non_quirky_user_agents(WebKitWebSettings *settings, const char *defaultUserAgent)
-{
- char *userAgent = 0;
-
- // test a custom UA string
- userAgent = 0;
- g_object_set(settings, "user-agent", "testwebsettings/0.1", NULL);
- g_object_get(settings,"user-agent", &userAgent, NULL);
- g_assert_cmpstr(userAgent, ==, "testwebsettings/0.1");
- g_free(userAgent);
-
- // setting it to NULL or an empty value should give us the default UA string
- userAgent = 0;
- g_object_set(settings, "user-agent", 0, NULL);
- g_object_get(settings,"user-agent", &userAgent, NULL);
- g_assert_cmpstr(userAgent, ==, defaultUserAgent);
- g_free(userAgent);
-
- userAgent = 0;
- g_object_set(settings, "user-agent", "", NULL);
- g_object_get(settings,"user-agent", &userAgent, NULL);
- g_assert_cmpstr(userAgent, ==, defaultUserAgent);
- g_free(userAgent);
-}
-
</del><span class="cx"> static void test_webkit_web_settings_user_agent(void)
</span><span class="cx"> {
</span><span class="cx"> WebKitWebSettings *settings;
</span><span class="lines">@@ -103,50 +75,26 @@
</span><span class="cx"> g_assert(g_strstr_len(defaultUserAgent, -1, "Version/8.0 Safari/"));
</span><span class="cx"> g_assert(g_strstr_len(defaultUserAgent, -1, "Version/8.0") < g_strstr_len(defaultUserAgent, -1, "Safari/"));
</span><span class="cx">
</span><del>- test_non_quirky_user_agents(settings, defaultUserAgent);
-
- /* Test quirky google domains */
</del><ins>+ // test a custom UA string
+ userAgent = 0;
</ins><span class="cx"> g_object_set(settings, "user-agent", "testwebsettings/0.1", NULL);
</span><del>-
- userAgent = webkitWebSettingsUserAgentForURI(settings, "http://www.google.com/");
</del><ins>+ g_object_get(settings,"user-agent", &userAgent, NULL);
</ins><span class="cx"> g_assert_cmpstr(userAgent, ==, "testwebsettings/0.1");
</span><span class="cx"> g_free(userAgent);
</span><span class="cx">
</span><del>- userAgent = webkitWebSettingsUserAgentForURI(settings, "http://gmail.com/");
- g_assert_cmpstr(userAgent, ==, "testwebsettings/0.1");
- g_free(userAgent);
-
- userAgent = webkitWebSettingsUserAgentForURI(settings, "http://www.google.com.br/");
- g_assert_cmpstr(userAgent, ==, "testwebsettings/0.1");
- g_free(userAgent);
-
- userAgent = webkitWebSettingsUserAgentForURI(settings, "http://calendar.google.com/");
- g_assert_cmpstr(userAgent, ==, "testwebsettings/0.1");
- g_free(userAgent);
-
- /* Now enable quirks handling */
- g_object_set(settings, "enable-site-specific-quirks", TRUE, NULL);
-
- test_non_quirky_user_agents(settings, defaultUserAgent);
-
- g_object_set(settings, "user-agent", "testwebsettings/0.1", NULL);
-
- userAgent = webkitWebSettingsUserAgentForURI(settings, "http://www.google.com/");
</del><ins>+ // setting it to NULL or an empty value should give us the default UA string
+ userAgent = 0;
+ g_object_set(settings, "user-agent", 0, NULL);
+ g_object_get(settings,"user-agent", &userAgent, NULL);
</ins><span class="cx"> g_assert_cmpstr(userAgent, ==, defaultUserAgent);
</span><span class="cx"> g_free(userAgent);
</span><span class="cx">
</span><del>- userAgent = webkitWebSettingsUserAgentForURI(settings, "http://gmail.com/");
</del><ins>+ userAgent = 0;
+ g_object_set(settings, "user-agent", "", NULL);
+ g_object_get(settings,"user-agent", &userAgent, NULL);
</ins><span class="cx"> g_assert_cmpstr(userAgent, ==, defaultUserAgent);
</span><span class="cx"> g_free(userAgent);
</span><span class="cx">
</span><del>- userAgent = webkitWebSettingsUserAgentForURI(settings, "http://www.google.com.br/");
- g_assert_cmpstr(userAgent, ==, defaultUserAgent);
- g_free(userAgent);
-
- userAgent = webkitWebSettingsUserAgentForURI(settings, "http://www.google.uk.not.com.br/");
- g_assert_cmpstr(userAgent, ==, "testwebsettings/0.1");
- g_free(userAgent);
-
</del><span class="cx"> g_free(defaultUserAgent);
</span><span class="cx"> g_object_unref(webView);
</span><span class="cx"> }
</span></span></pre>
</div>
</div>
</body>
</html>