<!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  &lt;cgarcia@igalia.com&gt;
+
+        [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  &lt;pnormand@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [GTK] 8tracks.com triggers annoying pop-up window/installation of &quot;About protocol source plugin&quot; (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 &quot;UserAgentGtk.h&quot;
</span><span class="cx"> 
</span><span class="cx"> #include &quot;URL.h&quot;
</span><ins>+#include &lt;wtf/HashSet.h&gt;
</ins><span class="cx"> #include &lt;wtf/NeverDestroyed.h&gt;
</span><span class="cx"> #include &lt;wtf/text/StringBuilder.h&gt;
</span><ins>+#include &lt;wtf/text/StringHash.h&gt;
</ins><span class="cx"> 
</span><span class="cx"> #if OS(UNIX)
</span><span class="cx"> #include &lt;sys/utsname.h&gt;
</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&lt;String&gt;&amp; googleDomains()
+{
+    static NeverDestroyed&lt;HashSet&lt;String&gt;&gt; domains(std::initializer_list&lt;String&gt;({
+        &quot;biz&quot;,
+        &quot;com&quot;,
+        &quot;net&quot;,
+        &quot;org&quot;,
+        &quot;ae&quot;,
+        &quot;ag&quot;,
+        &quot;am&quot;,
+        &quot;at&quot;,
+        &quot;az&quot;,
+        &quot;be&quot;,
+        &quot;bi&quot;,
+        &quot;ca&quot;,
+        &quot;cc&quot;,
+        &quot;cd&quot;,
+        &quot;cg&quot;,
+        &quot;ch&quot;,
+        &quot;cl&quot;,
+        &quot;com.br&quot;,
+        &quot;com.do&quot;,
+        &quot;co.uk&quot;,
+        &quot;co.kr&quot;,
+        &quot;co.jp&quot;,
+        &quot;de&quot;,
+        &quot;dj&quot;,
+        &quot;dk&quot;,
+        &quot;ee&quot;,
+        &quot;es&quot;,
+        &quot;fi&quot;,
+        &quot;fm&quot;,
+        &quot;fr&quot;,
+        &quot;gg&quot;,
+        &quot;gl&quot;,
+        &quot;gm&quot;,
+        &quot;gs&quot;,
+        &quot;hn&quot;,
+        &quot;hu&quot;,
+        &quot;ie&quot;,
+        &quot;it&quot;,
+        &quot;je&quot;,
+        &quot;kz&quot;,
+        &quot;li&quot;,
+        &quot;lt&quot;,
+        &quot;lu&quot;,
+        &quot;lv&quot;,
+        &quot;ma&quot;,
+        &quot;ms&quot;,
+        &quot;mu&quot;,
+        &quot;mw&quot;,
+        &quot;nl&quot;,
+        &quot;no&quot;,
+        &quot;nu&quot;,
+        &quot;pl&quot;,
+        &quot;pn&quot;,
+        &quot;pt&quot;,
+        &quot;ru&quot;,
+        &quot;rw&quot;,
+        &quot;sh&quot;,
+        &quot;sk&quot;,
+        &quot;sm&quot;,
+        &quot;st&quot;,
+        &quot;td&quot;,
+        &quot;tk&quot;,
+        &quot;tp&quot;,
+        &quot;tv&quot;,
+        &quot;us&quot;,
+        &quot;uz&quot;,
+        &quot;ws&quot;
+    }));
+    return domains;
+}
+
+static const Vector&lt;String&gt;&amp; otherGoogleDomains()
+{
+    static NeverDestroyed&lt;Vector&lt;String&gt;&gt; otherDomains(std::initializer_list&lt;String&gt;({
+        &quot;gmail.com&quot;,
+        &quot;youtube.com&quot;,
+        &quot;gstatic.com&quot;,
+        &quot;ytimg.com&quot;
+    }));
+    return otherDomains;
+}
+
+static bool isGoogleDomain(String host)
+{
+    // First check if this is one of the various google.com international domains.
+    int position = host.find(&quot;.google.&quot;);
+    if (position &gt; 0 &amp;&amp; googleDomains().contains(host.substring(position + sizeof(&quot;.google.&quot;) - 1)))
+        return true;
+
+    // Then we check the possibility of it being one of the other, .com-only google domains.
+    for (unsigned i = 0; i &lt; 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(&quot;) AppleWebKit/&quot;);
</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(&quot; (KHTML, like Gecko) Version/8.0 Safari/&quot;);
-    uaString.append(versionForUAString());
</del><span class="cx"> 
</span><ins>+    uaString.appendLiteral(&quot; (KHTML, like Gecko)&quot;);
+    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(&quot; Version/8.0 Safari/&quot;);
+        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(&quot;maps.&quot;) || url.path().startsWith(&quot;/maps&quot;))
+            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  &lt;cgarcia@igalia.com&gt;
+
+        [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  &lt;cgarcia@igalia.com&gt;
</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&amp; url)
</span><span class="cx"> {
</span><span class="cx">     WebKitWebSettings* settings = webkit_web_view_get_settings(getViewFromFrame(m_frame));
</span><del>-    GUniquePtr&lt;gchar&gt; userAgentString(webkitWebSettingsUserAgentForURI(settings, url.string().utf8().data()));
</del><ins>+    GUniquePtr&lt;gchar&gt; 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-&gt;priv-&gt;userAgent.data();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static void initializeDomainsList(HashSet&lt;String&gt;&amp; googleDomains)
-{
-    // Google search domains.
-    googleDomains.add(&quot;biz&quot;);
-    googleDomains.add(&quot;com&quot;);
-    googleDomains.add(&quot;net&quot;);
-    googleDomains.add(&quot;org&quot;);
-    googleDomains.add(&quot;ae&quot;);
-    googleDomains.add(&quot;ag&quot;);
-    googleDomains.add(&quot;am&quot;);
-    googleDomains.add(&quot;at&quot;);
-    googleDomains.add(&quot;az&quot;);
-    googleDomains.add(&quot;be&quot;);
-    googleDomains.add(&quot;bi&quot;);
-    googleDomains.add(&quot;ca&quot;);
-    googleDomains.add(&quot;cc&quot;);
-    googleDomains.add(&quot;cd&quot;);
-    googleDomains.add(&quot;cg&quot;);
-    googleDomains.add(&quot;ch&quot;);
-    googleDomains.add(&quot;cl&quot;);
-    googleDomains.add(&quot;com.br&quot;);
-    googleDomains.add(&quot;com.do&quot;);
-    googleDomains.add(&quot;co.uk&quot;);
-    googleDomains.add(&quot;co.kr&quot;);
-    googleDomains.add(&quot;co.jp&quot;);
-    googleDomains.add(&quot;de&quot;);
-    googleDomains.add(&quot;dj&quot;);
-    googleDomains.add(&quot;dk&quot;);
-    googleDomains.add(&quot;ee&quot;);
-    googleDomains.add(&quot;es&quot;);
-    googleDomains.add(&quot;fi&quot;);
-    googleDomains.add(&quot;fm&quot;);
-    googleDomains.add(&quot;fr&quot;);
-    googleDomains.add(&quot;gg&quot;);
-    googleDomains.add(&quot;gl&quot;);
-    googleDomains.add(&quot;gm&quot;);
-    googleDomains.add(&quot;gs&quot;);
-    googleDomains.add(&quot;hn&quot;);
-    googleDomains.add(&quot;hu&quot;);
-    googleDomains.add(&quot;ie&quot;);
-    googleDomains.add(&quot;it&quot;);
-    googleDomains.add(&quot;je&quot;);
-    googleDomains.add(&quot;kz&quot;);
-    googleDomains.add(&quot;li&quot;);
-    googleDomains.add(&quot;lt&quot;);
-    googleDomains.add(&quot;lu&quot;);
-    googleDomains.add(&quot;lv&quot;);
-    googleDomains.add(&quot;ma&quot;);
-    googleDomains.add(&quot;ms&quot;);
-    googleDomains.add(&quot;mu&quot;);
-    googleDomains.add(&quot;mw&quot;);
-    googleDomains.add(&quot;nl&quot;);
-    googleDomains.add(&quot;no&quot;);
-    googleDomains.add(&quot;nu&quot;);
-    googleDomains.add(&quot;pl&quot;);
-    googleDomains.add(&quot;pn&quot;);
-    googleDomains.add(&quot;pt&quot;);
-    googleDomains.add(&quot;ru&quot;);
-    googleDomains.add(&quot;rw&quot;);
-    googleDomains.add(&quot;sh&quot;);
-    googleDomains.add(&quot;sk&quot;);
-    googleDomains.add(&quot;sm&quot;);
-    googleDomains.add(&quot;st&quot;);
-    googleDomains.add(&quot;td&quot;);
-    googleDomains.add(&quot;tk&quot;);
-    googleDomains.add(&quot;tp&quot;);
-    googleDomains.add(&quot;tv&quot;);
-    googleDomains.add(&quot;us&quot;);
-    googleDomains.add(&quot;uz&quot;);
-    googleDomains.add(&quot;ws&quot;);
-}
-
-static void initializeOtherGoogleDomains(Vector&lt;String&gt;&amp; otherGoogleDomains)
-{
-    otherGoogleDomains.append(&quot;gmail.com&quot;);
-    otherGoogleDomains.append(&quot;youtube.com&quot;);
-    otherGoogleDomains.append(&quot;gstatic.com&quot;);
-    otherGoogleDomains.append(&quot;ytimg.com&quot;);
-}
-
-static bool isGoogleDomain(String host)
-{
-    DEFINE_STATIC_LOCAL(HashSet&lt;String&gt;, googleDomains, ());
-    DEFINE_STATIC_LOCAL(Vector&lt;String&gt;, 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(&quot;.google.&quot;);
-    if (position &gt; 0 &amp;&amp; googleDomains.contains(host.substring(position + sizeof(&quot;.google.&quot;) - 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 &lt; otherGoogleDomains.size(); i++) {
-        if (host.endsWith(otherGoogleDomains.at(i)))
-            return true;
-    }
-
-    return false;
-}
-
-static String userAgentForURL(const URL&amp; 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&amp; url)
</ins><span class="cx"> {
</span><del>-    if (webSettings-&gt;priv-&gt;enableSiteSpecificQuirks) {
-        String userAgentString = userAgentForURL(WebCore::URL(WebCore::URL(), String::fromUTF8(uri)));
</del><ins>+    if (webSettings-&gt;priv-&gt;enableSiteSpecificQuirks &amp;&amp; !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 &quot;URL.h&quot;
</ins><span class="cx"> #include &quot;webkitwebsettings.h&quot;
</span><span class="cx"> #include &lt;wtf/text/CString.h&gt;
</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&amp;);
</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  &lt;cgarcia@igalia.com&gt;
+
+        [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  &lt;zdobersek@igalia.com&gt;
</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(&quot;Macintosh&quot;));
</span><span class="cx">     EXPECT_TRUE(uaString.contains(&quot;Mac OS X&quot;));
</span><span class="cx">     EXPECT_FALSE(uaString.contains(&quot;Linux&quot;));
</span><ins>+
+    // For Google domains we always return the standard UA.
+    uaString = standardUserAgent();
+    EXPECT_FALSE(uaString.isNull());
+    EXPECT_TRUE(uaString == standardUserAgentForURL(URL(ParsedURLString, &quot;http://www.google.com/&quot;)));
+    EXPECT_TRUE(uaString == standardUserAgentForURL(URL(ParsedURLString, &quot;http://calendar.google.com/&quot;)));
+    EXPECT_TRUE(uaString == standardUserAgentForURL(URL(ParsedURLString, &quot;http://gmail.com/&quot;)));
+    EXPECT_TRUE(uaString == standardUserAgentForURL(URL(ParsedURLString, &quot;http://www.google.com.br/&quot;)));
+    EXPECT_TRUE(uaString == standardUserAgentForURL(URL(ParsedURLString, &quot;http://www.youtube.com/&quot;)));
+    EXPECT_TRUE(uaString != standardUserAgentForURL(URL(ParsedURLString, &quot;http://www.google.uk.not.com.br/&quot;)));
+
+    // For Google Maps we remove the Version/8.0 string.
+    uaString = standardUserAgentForURL(URL(ParsedURLString, &quot;http://maps.google.com/&quot;));
+    EXPECT_TRUE(uaString == standardUserAgentForURL(URL(ParsedURLString, &quot;http://www.google.com/maps/&quot;)));
+    EXPECT_FALSE(uaString.contains(&quot;Version/8.0 Safari/&quot;));
</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 &lt;gtk/gtk.h&gt;
</span><span class="cx"> #include &lt;webkit/webkit.h&gt;
</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, &quot;user-agent&quot;, &quot;testwebsettings/0.1&quot;, NULL);
-    g_object_get(settings,&quot;user-agent&quot;, &amp;userAgent, NULL);
-    g_assert_cmpstr(userAgent, ==, &quot;testwebsettings/0.1&quot;);
-    g_free(userAgent);
-
-    // setting it to NULL or an empty value should give us the default UA string
-    userAgent = 0;
-    g_object_set(settings, &quot;user-agent&quot;, 0, NULL);
-    g_object_get(settings,&quot;user-agent&quot;, &amp;userAgent, NULL);
-    g_assert_cmpstr(userAgent, ==, defaultUserAgent);
-    g_free(userAgent);
-
-    userAgent = 0;
-    g_object_set(settings, &quot;user-agent&quot;, &quot;&quot;, NULL);
-    g_object_get(settings,&quot;user-agent&quot;, &amp;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, &quot;Version/8.0 Safari/&quot;));
</span><span class="cx">     g_assert(g_strstr_len(defaultUserAgent, -1, &quot;Version/8.0&quot;) &lt; g_strstr_len(defaultUserAgent, -1, &quot;Safari/&quot;));
</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, &quot;user-agent&quot;, &quot;testwebsettings/0.1&quot;, NULL);
</span><del>-
-    userAgent = webkitWebSettingsUserAgentForURI(settings, &quot;http://www.google.com/&quot;);
</del><ins>+    g_object_get(settings,&quot;user-agent&quot;, &amp;userAgent, NULL);
</ins><span class="cx">     g_assert_cmpstr(userAgent, ==, &quot;testwebsettings/0.1&quot;);
</span><span class="cx">     g_free(userAgent);
</span><span class="cx"> 
</span><del>-    userAgent = webkitWebSettingsUserAgentForURI(settings, &quot;http://gmail.com/&quot;);
-    g_assert_cmpstr(userAgent, ==, &quot;testwebsettings/0.1&quot;);
-    g_free(userAgent);
-
-    userAgent = webkitWebSettingsUserAgentForURI(settings, &quot;http://www.google.com.br/&quot;);
-    g_assert_cmpstr(userAgent, ==, &quot;testwebsettings/0.1&quot;);
-    g_free(userAgent);
-
-    userAgent = webkitWebSettingsUserAgentForURI(settings, &quot;http://calendar.google.com/&quot;);
-    g_assert_cmpstr(userAgent, ==, &quot;testwebsettings/0.1&quot;);
-    g_free(userAgent);
-
-    /* Now enable quirks handling */
-    g_object_set(settings, &quot;enable-site-specific-quirks&quot;, TRUE, NULL);
-
-    test_non_quirky_user_agents(settings, defaultUserAgent);
-
-    g_object_set(settings, &quot;user-agent&quot;, &quot;testwebsettings/0.1&quot;, NULL);
-
-    userAgent = webkitWebSettingsUserAgentForURI(settings, &quot;http://www.google.com/&quot;);
</del><ins>+    // setting it to NULL or an empty value should give us the default UA string
+    userAgent = 0;
+    g_object_set(settings, &quot;user-agent&quot;, 0, NULL);
+    g_object_get(settings,&quot;user-agent&quot;, &amp;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, &quot;http://gmail.com/&quot;);
</del><ins>+    userAgent = 0;
+    g_object_set(settings, &quot;user-agent&quot;, &quot;&quot;, NULL);
+    g_object_get(settings,&quot;user-agent&quot;, &amp;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, &quot;http://www.google.com.br/&quot;);
-    g_assert_cmpstr(userAgent, ==, defaultUserAgent);
-    g_free(userAgent);
-
-    userAgent = webkitWebSettingsUserAgentForURI(settings, &quot;http://www.google.uk.not.com.br/&quot;);
-    g_assert_cmpstr(userAgent, ==, &quot;testwebsettings/0.1&quot;);
-    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>