[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.2.3-2-25-gb2c19be
Gustavo Noronha Silva
kov at debian.org
Mon Sep 6 13:10:19 UTC 2010
The following commit has been merged in the debian/unstable branch:
commit b2c19bead621c3f6f5c1228058e915437a733638
Author: Gustavo Noronha Silva <kov at debian.org>
Date: Fri Sep 3 17:55:04 2010 -0300
New stable release - 1.2.4
* New stable release
- fixes the following CVEs (thus urgency=high):
CVE-2010-1781 CVE-2010-1782 CVE-2010-1784 CVE-2010-1785
CVE-2010-1786 CVE-2010-1787 CVE-2010-1788 CVE-2010-1790
CVE-2010-1792 CVE-2010-1793 CVE-2010-2648
* debian/patches/04-spoof-user-agent-to-google.patch:
- updated from the latest patch proposed for inclusion upstream
- does not have the annoying g_message() (Closes: #592670)
diff --git a/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp b/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp
index a2dc0b5..ee79f70 100644
--- a/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp
+++ b/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp
@@ -96,111 +96,96 @@ typedef HashSet<String> GoogleDomainsSet;
static void initializeDomainsList(GoogleDomainsSet& googleDomains)
{
- // Google search domains, plus *.google.com.
- googleDomains.add("google.biz");
- googleDomains.add("google.com");
- googleDomains.add("google.net");
- googleDomains.add("google.org");
- googleDomains.add("google.ae");
- googleDomains.add("google.ag");
- googleDomains.add("google.am");
- googleDomains.add("google.at");
- googleDomains.add("google.az");
- googleDomains.add("google.be");
- googleDomains.add("google.bi");
- googleDomains.add("google.ca");
- googleDomains.add("google.cc");
- googleDomains.add("google.cd");
- googleDomains.add("google.cg");
- googleDomains.add("google.ch");
- googleDomains.add("google.cl");
- googleDomains.add("google.com.br");
- googleDomains.add("google.co.uk");
- googleDomains.add("google.co.jp");
- googleDomains.add("google.de");
- googleDomains.add("google.dj");
- googleDomains.add("google.dk");
- googleDomains.add("google.es");
- googleDomains.add("google.fi");
- googleDomains.add("google.fm");
- googleDomains.add("google.fr");
- googleDomains.add("google.gg");
- googleDomains.add("google.gl");
- googleDomains.add("google.gm");
- googleDomains.add("google.gs");
- googleDomains.add("google.hn");
- googleDomains.add("google.hu");
- googleDomains.add("google.ie");
- googleDomains.add("google.it");
- googleDomains.add("google.je");
- googleDomains.add("google.kz");
- googleDomains.add("google.li");
- googleDomains.add("google.lt");
- googleDomains.add("google.lu");
- googleDomains.add("google.lv");
- googleDomains.add("google.ma");
- googleDomains.add("google.ms");
- googleDomains.add("google.mu");
- googleDomains.add("google.mw");
- googleDomains.add("google.nl");
- googleDomains.add("google.no");
- googleDomains.add("google.nu");
- googleDomains.add("google.pl");
- googleDomains.add("google.pn");
- googleDomains.add("google.pt");
- googleDomains.add("google.ru");
- googleDomains.add("google.rw");
- googleDomains.add("google.sh");
- googleDomains.add("google.sk");
- googleDomains.add("google.sm");
- googleDomains.add("google.st");
- googleDomains.add("google.td");
- googleDomains.add("google.tk");
- googleDomains.add("google.tp");
- googleDomains.add("google.tv");
- googleDomains.add("google.us");
- googleDomains.add("google.uz");
- googleDomains.add("google.ws");
-
- // Youtube-related domains.
- googleDomains.add("youtube.com");
- googleDomains.add("ytimg.com");
-
- // GMail.
- googleDomains.add("gmail.com");
-
- // Google static files domain.
- googleDomains.add("gstatic.com");
+ // 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("co.uk");
+ googleDomains.add("co.jp");
+ googleDomains.add("de");
+ googleDomains.add("dj");
+ googleDomains.add("dk");
+ 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 bool isGoogleDomain(String host)
{
DEFINE_STATIC_LOCAL(HashSet<String>, googleDomains, ());
- DEFINE_STATIC_LOCAL(Vector<String>, googleNamespaces, ());
+ DEFINE_STATIC_LOCAL(Vector<String>, otherGoogleDomains, ());
if (googleDomains.isEmpty()) {
- googleNamespaces.append(".google.");
- googleNamespaces.append(".gmail.");
- googleNamespaces.append(".youtube.");
- googleNamespaces.append(".gstatic.");
- googleNamespaces.append(".ytimg.");
+ otherGoogleDomains.append("gmail.com");
+ otherGoogleDomains.append("youtube.com");
+ otherGoogleDomains.append("gstatic.com");
+ otherGoogleDomains.append("ytimg.com");
initializeDomainsList(googleDomains);
}
- // First we try a full-match, for cases such as 'youtube.com' as opposed to
- // 'www.youtube.com'.
- if (googleDomains.contains(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."))))
return true;
- // Then we check the possibility of the URL being a subdomain of well-known google domains.
- for (unsigned int i = 0; i < googleNamespaces.size(); i++) {
- int position = host.find(googleNamespaces.at(i));
- if (position > 0) {
- if (googleDomains.contains(host.substring(position + 1)))
- return true;
- return false;
- }
+ // 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;
@@ -213,9 +198,10 @@ String FrameLoaderClient::userAgent(const KURL& url)
gboolean useQuirks;
g_object_get(settings, "enable-site-specific-quirks", &useQuirks, NULL);
- // For Google domains, identify as Chrome, so they don't give us a broken experience.
+ // For Google domains, drop the browser's custom User Agent string, and use the standard
+ // WebKit/Safari one, so they don't give us a broken experience.
if (useQuirks && isGoogleDomain(url.host()))
- return chromeUserAgent();
+ return webkitUserAgent();
return String::fromUTF8(webkit_web_settings_get_user_agent(settings));
}
diff --git a/WebKit/gtk/webkit/webkitprivate.h b/WebKit/gtk/webkit/webkitprivate.h
index cb4c254..3bebcb5 100644
--- a/WebKit/gtk/webkit/webkitprivate.h
+++ b/WebKit/gtk/webkit/webkitprivate.h
@@ -54,11 +54,11 @@
#include "Geolocation.h"
#include "HistoryItem.h"
#include "Settings.h"
+#include "Page.h"
+#include "PlatformString.h"
#include "Frame.h"
#include "InspectorClientGtk.h"
#include "FrameLoaderClient.h"
-#include "Page.h"
-#include "PlatformString.h"
#include "ResourceHandle.h"
#include "ResourceRequest.h"
#include "ResourceResponse.h"
@@ -182,9 +182,6 @@ extern "C" {
PassRefPtr<WebCore::Frame>
webkit_web_frame_init_with_web_view(WebKitWebView*, WebCore::HTMLFrameOwnerElement*);
- WebCore::String
- chromeUserAgent();
-
void
webkit_web_frame_core_frame_gone(WebKitWebFrame*);
@@ -217,6 +214,9 @@ extern "C" {
WebKitWebResource*
webkit_web_resource_new_with_core_resource(PassRefPtr<WebCore::ArchiveResource>);
+ WebCore::String
+ webkitUserAgent();
+
void
webkit_web_resource_init_with_core_resource(WebKitWebResource*, PassRefPtr<WebCore::ArchiveResource>);
diff --git a/WebKit/gtk/webkit/webkitwebsettings.cpp b/WebKit/gtk/webkit/webkitwebsettings.cpp
index fe63fdb..89bc546 100644
--- a/WebKit/gtk/webkit/webkitwebsettings.cpp
+++ b/WebKit/gtk/webkit/webkitwebsettings.cpp
@@ -163,81 +163,69 @@ enum {
// Create a default user agent string
// This is a liberal interpretation of http://www.mozilla.org/build/revised-user-agent-strings.html
// See also http://developer.apple.com/internet/safari/faq.html#anchor2
-static String webkit_get_platform()
+static String webkitPlatform()
{
- char* platform;
-
#if PLATFORM(X11)
- platform = g_strdup("X11");
+ DEFINE_STATIC_LOCAL(const String, uaPlatform, (String("X11")));
#elif OS(WINDOWS)
- platform = g_strdup("Windows");
+ DEFINE_STATIC_LOCAL(const String, uaPlatform, (String("Windows")));
#elif PLATFORM(MAC)
- platform = g_strdup("Macintosh");
+ DEFINE_STATIC_LOCAL(const String, uaPlatform, (String("Macintosh")));
#elif defined(GDK_WINDOWING_DIRECTFB)
- platform = g_strdup("DirectFB");
+ DEFINE_STATIC_LOCAL(const String, uaPlatform, (String("DirectFB")));
#else
- platform = g_strdup("Unknown");
+ DEFINE_STATIC_LOCAL(const String, uaPlatform, (String("Unknown")));
#endif
- DEFINE_STATIC_LOCAL(const String, uaPlatform, (String::fromUTF8(platform)));
- g_free(platform);
-
return uaPlatform;
}
-static String webkit_get_os_version()
+static String webkitOSVersion()
{
- char* osVersion;
-
// FIXME: platform/version detection can be shared.
#if OS(DARWIN)
#if CPU(X86)
- osVersion = g_strdup("Intel Mac OS X");
+ DEFINE_STATIC_LOCAL(const String, uaOSVersion, (String("Intel Mac OS X")));
#else
- osVersion = g_strdup("PPC Mac OS X");
+ DEFINE_STATIC_LOCAL(const String, uaOSVersion, (String("PPC Mac OS X")));
#endif
#elif OS(UNIX)
+ DEFINE_STATIC_LOCAL(String, uaOSVersion, (String()));
+
+ if (!uaOSVersion.isEmpty())
+ return uaOSVersion;
+
struct utsname name;
+ GOwnPtr<gchar> osVersion;
if (uname(&name) != -1)
- osVersion = g_strdup_printf("%s %s", name.sysname, name.machine);
+ osVersion.set(g_strdup_printf("%s %s", name.sysname, name.machine));
else
- osVersion = g_strdup("Unknown");
+ osVersion.set(g_strdup("Unknown"));
+ uaOSVersion = String::fromUTF8(osVersion.get());
#elif OS(WINDOWS)
- // FIXME: Compute the Windows version
- osVersion = g_strdup("Windows");
-
+ DEFINE_STATIC_LOCAL(const String, uaOSVersion, (String("Windows")));
#else
- osVersion = g_strdup("Unknown");
+ DEFINE_STATIC_LOCAL(const String, uaOSVersion, (String("Unknown")));
#endif
- DEFINE_STATIC_LOCAL(const String, uaOSVersion, (String::fromUTF8(osVersion)));
-
return uaOSVersion;
}
-static String webkit_get_user_agent()
+String webkitUserAgent()
{
// We mention Safari since many broken sites check for it (OmniWeb does this too)
// We re-use the WebKit version, though it doesn't seem to matter much in practice
DEFINE_STATIC_LOCAL(const String, uaVersion, (String::format("%d.%d+", WEBKIT_USER_AGENT_MAJOR_VERSION, WEBKIT_USER_AGENT_MINOR_VERSION)));
- DEFINE_STATIC_LOCAL(const String, staticUA, (String::format("Mozilla/5.0 (%s; U; %s; %s) AppleWebKit/%s (KHTML, like Gecko) Safari/%s",
- webkit_get_platform().utf8().data(), webkit_get_os_version().utf8().data(), defaultLanguage().utf8().data(), uaVersion.utf8().data(), uaVersion.utf8().data())));
+ DEFINE_STATIC_LOCAL(const String, staticUA, (String::format("Mozilla/5.0 (%s; U; %s; %s) AppleWebKit/%s (KHTML, like Gecko) Version/5.0 Safari/%s",
+ webkitPlatform().utf8().data(), webkitOSVersion().utf8().data(), defaultLanguage().utf8().data(), uaVersion.utf8().data(), uaVersion.utf8().data())));
return staticUA;
}
-String chromeUserAgent()
-{
- DEFINE_STATIC_LOCAL(const String, uaChrome, (String::format("Mozilla/5.0 (%s; U; %s; en-US) AppleWebKit/534.0 (KHTML, like Gecko) Chrome/6.0.411.0 Safari/534.0",
- webkit_get_platform().utf8().data(), webkit_get_os_version().utf8().data())));
-
- return uaChrome;
-}
-
static void webkit_web_settings_finalize(GObject* object);
static void webkit_web_settings_set_property(GObject* object, guint prop_id, const GValue* value, GParamSpec* pspec);
@@ -628,7 +616,7 @@ static void webkit_web_settings_class_init(WebKitWebSettingsClass* klass)
g_param_spec_string("user-agent",
_("User Agent"),
_("The User-Agent string used by WebKitGtk"),
- webkit_get_user_agent().utf8().data(),
+ webkitUserAgent().utf8().data(),
flags));
/**
@@ -1055,7 +1043,7 @@ static void webkit_web_settings_set_property(GObject* object, guint prop_id, con
case PROP_USER_AGENT:
g_free(priv->user_agent);
if (!g_value_get_string(value) || !strlen(g_value_get_string(value)))
- priv->user_agent = g_strdup(webkit_get_user_agent().utf8().data());
+ priv->user_agent = g_strdup(webkitUserAgent().utf8().data());
else
priv->user_agent = g_strdup(g_value_get_string(value));
break;
diff --git a/debian/changelog b/debian/changelog
index 5003af7..948b561 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,18 @@
+webkit (1.2.4-1) unstable; urgency=high
+
+ * New stable release
+ - fixes the following CVEs (thus urgency=high):
+
+ CVE-2010-1781 CVE-2010-1782 CVE-2010-1784 CVE-2010-1785
+ CVE-2010-1786 CVE-2010-1787 CVE-2010-1788 CVE-2010-1790
+ CVE-2010-1792 CVE-2010-1793 CVE-2010-2648
+
+ * debian/patches/04-spoof-user-agent-to-google.patch:
+ - updated from the latest patch proposed for inclusion upstream
+ - does not have the annoying g_message() (Closes: #592670)
+
+ -- Gustavo Noronha Silva <kov at debian.org> Fri, 03 Sep 2010 17:52:14 -0300
+
webkit (1.2.3-2) unstable; urgency=low
* debian/patches/04-spoof-user-agent-to-google.patch:
diff --git a/debian/patches/04-spoof-user-agent-to-google.patch b/debian/patches/04-spoof-user-agent-to-google.patch
index 434d9b7..d3969a2 100644
--- a/debian/patches/04-spoof-user-agent-to-google.patch
+++ b/debian/patches/04-spoof-user-agent-to-google.patch
@@ -1,22 +1,5 @@
-From bb336fd07a8bf11ee22ec7361d77c8a765033001 Mon Sep 17 00:00:00 2001
-From: Gustavo Noronha Silva <kov at debian.org>
-Date: Tue, 10 Aug 2010 19:59:21 -0300
-Subject: [PATCH] Spoof User-Agent when talking to Google sites
-
-Some Google sites do User-Agent sniffing and cripple the experience
-for browsers that are not in their white lists. This includes not
-delivering the nice fade-in effect for Google's main page, and HTML5
-videos on Youtube. This change makes WebKitGTK+ fake being Chrome
-through the User-Agent field whenever the "site specific quirks"
-setting is enabled.
----
- WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp | 127 +++++++++++++++++++-
- WebKit/gtk/webkit/webkitprivate.h | 6 +-
- WebKit/gtk/webkit/webkitwebsettings.cpp | 35 +++++-
- 3 files changed, 159 insertions(+), 9 deletions(-)
-
diff --git a/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp b/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp
-index 7187244..4e58cd3 100644
+index 7187244..ee79f70 100644
--- a/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp
+++ b/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp
@@ -47,6 +47,7 @@
@@ -27,7 +10,7 @@ index 7187244..4e58cd3 100644
#include "PlatformString.h"
#include "PluginDatabase.h"
#include "RenderPart.h"
-@@ -91,9 +92,131 @@ FrameLoaderClient::~FrameLoaderClient()
+@@ -91,9 +92,117 @@ FrameLoaderClient::~FrameLoaderClient()
g_object_unref(m_policyDecision);
}
@@ -36,111 +19,96 @@ index 7187244..4e58cd3 100644
+
+static void initializeDomainsList(GoogleDomainsSet& googleDomains)
+{
-+ // Google search domains, plus *.google.com.
-+ googleDomains.add("google.biz");
-+ googleDomains.add("google.com");
-+ googleDomains.add("google.net");
-+ googleDomains.add("google.org");
-+ googleDomains.add("google.ae");
-+ googleDomains.add("google.ag");
-+ googleDomains.add("google.am");
-+ googleDomains.add("google.at");
-+ googleDomains.add("google.az");
-+ googleDomains.add("google.be");
-+ googleDomains.add("google.bi");
-+ googleDomains.add("google.ca");
-+ googleDomains.add("google.cc");
-+ googleDomains.add("google.cd");
-+ googleDomains.add("google.cg");
-+ googleDomains.add("google.ch");
-+ googleDomains.add("google.cl");
-+ googleDomains.add("google.com.br");
-+ googleDomains.add("google.co.uk");
-+ googleDomains.add("google.co.jp");
-+ googleDomains.add("google.de");
-+ googleDomains.add("google.dj");
-+ googleDomains.add("google.dk");
-+ googleDomains.add("google.es");
-+ googleDomains.add("google.fi");
-+ googleDomains.add("google.fm");
-+ googleDomains.add("google.fr");
-+ googleDomains.add("google.gg");
-+ googleDomains.add("google.gl");
-+ googleDomains.add("google.gm");
-+ googleDomains.add("google.gs");
-+ googleDomains.add("google.hn");
-+ googleDomains.add("google.hu");
-+ googleDomains.add("google.ie");
-+ googleDomains.add("google.it");
-+ googleDomains.add("google.je");
-+ googleDomains.add("google.kz");
-+ googleDomains.add("google.li");
-+ googleDomains.add("google.lt");
-+ googleDomains.add("google.lu");
-+ googleDomains.add("google.lv");
-+ googleDomains.add("google.ma");
-+ googleDomains.add("google.ms");
-+ googleDomains.add("google.mu");
-+ googleDomains.add("google.mw");
-+ googleDomains.add("google.nl");
-+ googleDomains.add("google.no");
-+ googleDomains.add("google.nu");
-+ googleDomains.add("google.pl");
-+ googleDomains.add("google.pn");
-+ googleDomains.add("google.pt");
-+ googleDomains.add("google.ru");
-+ googleDomains.add("google.rw");
-+ googleDomains.add("google.sh");
-+ googleDomains.add("google.sk");
-+ googleDomains.add("google.sm");
-+ googleDomains.add("google.st");
-+ googleDomains.add("google.td");
-+ googleDomains.add("google.tk");
-+ googleDomains.add("google.tp");
-+ googleDomains.add("google.tv");
-+ googleDomains.add("google.us");
-+ googleDomains.add("google.uz");
-+ googleDomains.add("google.ws");
-+
-+ // Youtube-related domains.
-+ googleDomains.add("youtube.com");
-+ googleDomains.add("ytimg.com");
-+
-+ // GMail.
-+ googleDomains.add("gmail.com");
-+
-+ // Google static files domain.
-+ googleDomains.add("gstatic.com");
++ // 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("co.uk");
++ googleDomains.add("co.jp");
++ googleDomains.add("de");
++ googleDomains.add("dj");
++ googleDomains.add("dk");
++ 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 bool isGoogleDomain(String host)
+{
+ DEFINE_STATIC_LOCAL(HashSet<String>, googleDomains, ());
-+ DEFINE_STATIC_LOCAL(Vector<String>, googleNamespaces, ());
++ DEFINE_STATIC_LOCAL(Vector<String>, otherGoogleDomains, ());
+
+ if (googleDomains.isEmpty()) {
-+ googleNamespaces.append(".google.");
-+ googleNamespaces.append(".gmail.");
-+ googleNamespaces.append(".youtube.");
-+ googleNamespaces.append(".gstatic.");
-+ googleNamespaces.append(".ytimg.");
++ otherGoogleDomains.append("gmail.com");
++ otherGoogleDomains.append("youtube.com");
++ otherGoogleDomains.append("gstatic.com");
++ otherGoogleDomains.append("ytimg.com");
+
+ initializeDomainsList(googleDomains);
+ }
+
-+ // First we try a full-match, for cases such as 'youtube.com' as opposed to
-+ // 'www.youtube.com'.
-+ if (googleDomains.contains(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."))))
+ return true;
+
-+ // Then we check the possibility of the URL being a subdomain of well-known google domains.
-+ for (unsigned int i = 0; i < googleNamespaces.size(); i++) {
-+ int position = host.find(googleNamespaces.at(i));
-+ if (position > 0) {
-+ if (googleDomains.contains(host.substring(position + 1)))
-+ return true;
-+ return false;
-+ }
++ // 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;
@@ -153,110 +121,143 @@ index 7187244..4e58cd3 100644
+ gboolean useQuirks;
+ g_object_get(settings, "enable-site-specific-quirks", &useQuirks, NULL);
+
-+ // For Google domains, identify as Chrome, so they don't give us a broken experience.
++ // For Google domains, drop the browser's custom User Agent string, and use the standard
++ // WebKit/Safari one, so they don't give us a broken experience.
+ if (useQuirks && isGoogleDomain(url.host()))
-+ return chromeUserAgent();
++ return webkitUserAgent();
+
return String::fromUTF8(webkit_web_settings_get_user_agent(settings));
}
diff --git a/WebKit/gtk/webkit/webkitprivate.h b/WebKit/gtk/webkit/webkitprivate.h
-index d51d681..c6b8273 100644
+index d51d681..1af4a28 100644
--- a/WebKit/gtk/webkit/webkitprivate.h
+++ b/WebKit/gtk/webkit/webkitprivate.h
-@@ -54,10 +54,11 @@
- #include "Geolocation.h"
+@@ -55,6 +55,7 @@
#include "HistoryItem.h"
#include "Settings.h"
--#include "Page.h"
+ #include "Page.h"
++#include "PlatformString.h"
#include "Frame.h"
#include "InspectorClientGtk.h"
#include "FrameLoaderClient.h"
-+#include "Page.h"
-+#include "PlatformString.h"
- #include "ResourceHandle.h"
- #include "ResourceRequest.h"
- #include "ResourceResponse.h"
-@@ -181,6 +182,9 @@ extern "C" {
- PassRefPtr<WebCore::Frame>
- webkit_web_frame_init_with_web_view(WebKitWebView*, WebCore::HTMLFrameOwnerElement*);
+@@ -213,6 +214,9 @@ extern "C" {
+ WebKitWebResource*
+ webkit_web_resource_new_with_core_resource(PassRefPtr<WebCore::ArchiveResource>);
+ WebCore::String
-+ chromeUserAgent();
++ webkitUserAgent();
+
void
- webkit_web_frame_core_frame_gone(WebKitWebFrame*);
+ webkit_web_resource_init_with_core_resource(WebKitWebResource*, PassRefPtr<WebCore::ArchiveResource>);
diff --git a/WebKit/gtk/webkit/webkitwebsettings.cpp b/WebKit/gtk/webkit/webkitwebsettings.cpp
-index 19c4168..fe63fdb 100644
+index 19c4168..89bc546 100644
--- a/WebKit/gtk/webkit/webkitwebsettings.cpp
+++ b/WebKit/gtk/webkit/webkitwebsettings.cpp
-@@ -163,10 +163,9 @@ enum {
+@@ -163,56 +163,65 @@ enum {
// Create a default user agent string
// This is a liberal interpretation of http://www.mozilla.org/build/revised-user-agent-strings.html
// See also http://developer.apple.com/internet/safari/faq.html#anchor2
-static String webkit_get_user_agent()
-+static String webkit_get_platform()
++static String webkitPlatform()
{
- gchar* platform;
- gchar* osVersion;
-+ char* platform;
-
+-
#if PLATFORM(X11)
- platform = g_strdup("X11");
-@@ -180,6 +179,16 @@ static String webkit_get_user_agent()
- platform = g_strdup("Unknown");
+- platform = g_strdup("X11");
++ DEFINE_STATIC_LOCAL(const String, uaPlatform, (String("X11")));
+ #elif OS(WINDOWS)
+- platform = g_strdup("Windows");
++ DEFINE_STATIC_LOCAL(const String, uaPlatform, (String("Windows")));
+ #elif PLATFORM(MAC)
+- platform = g_strdup("Macintosh");
++ DEFINE_STATIC_LOCAL(const String, uaPlatform, (String("Macintosh")));
+ #elif defined(GDK_WINDOWING_DIRECTFB)
+- platform = g_strdup("DirectFB");
++ DEFINE_STATIC_LOCAL(const String, uaPlatform, (String("DirectFB")));
+ #else
+- platform = g_strdup("Unknown");
++ DEFINE_STATIC_LOCAL(const String, uaPlatform, (String("Unknown")));
#endif
-+ DEFINE_STATIC_LOCAL(const String, uaPlatform, (String::fromUTF8(platform)));
-+ g_free(platform);
-+
+ return uaPlatform;
+}
+
-+static String webkit_get_os_version()
++static String webkitOSVersion()
+{
-+ char* osVersion;
-+
// FIXME: platform/version detection can be shared.
#if OS(DARWIN)
-@@ -204,19 +213,31 @@ static String webkit_get_user_agent()
- osVersion = g_strdup("Unknown");
+ #if CPU(X86)
+- osVersion = g_strdup("Intel Mac OS X");
++ DEFINE_STATIC_LOCAL(const String, uaOSVersion, (String("Intel Mac OS X")));
+ #else
+- osVersion = g_strdup("PPC Mac OS X");
++ DEFINE_STATIC_LOCAL(const String, uaOSVersion, (String("PPC Mac OS X")));
#endif
-+ DEFINE_STATIC_LOCAL(const String, uaOSVersion, (String::fromUTF8(osVersion)));
+ #elif OS(UNIX)
++ DEFINE_STATIC_LOCAL(String, uaOSVersion, (String()));
+
++ if (!uaOSVersion.isEmpty())
++ return uaOSVersion;
++
+ struct utsname name;
++ GOwnPtr<gchar> osVersion;
+ if (uname(&name) != -1)
+- osVersion = g_strdup_printf("%s %s", name.sysname, name.machine);
++ osVersion.set(g_strdup_printf("%s %s", name.sysname, name.machine));
+ else
+- osVersion = g_strdup("Unknown");
++ osVersion.set(g_strdup("Unknown"));
+
++ uaOSVersion = String::fromUTF8(osVersion.get());
+ #elif OS(WINDOWS)
+- // FIXME: Compute the Windows version
+- osVersion = g_strdup("Windows");
+-
++ DEFINE_STATIC_LOCAL(const String, uaOSVersion, (String("Windows")));
+ #else
+- osVersion = g_strdup("Unknown");
++ DEFINE_STATIC_LOCAL(const String, uaOSVersion, (String("Unknown")));
+ #endif
+
+ return uaOSVersion;
+}
+
-+static String webkit_get_user_agent()
++String webkitUserAgent()
+{
// We mention Safari since many broken sites check for it (OmniWeb does this too)
// We re-use the WebKit version, though it doesn't seem to matter much in practice
DEFINE_STATIC_LOCAL(const String, uaVersion, (String::format("%d.%d+", WEBKIT_USER_AGENT_MAJOR_VERSION, WEBKIT_USER_AGENT_MINOR_VERSION)));
- DEFINE_STATIC_LOCAL(const String, staticUA, (String::format("Mozilla/5.0 (%s; U; %s; %s) AppleWebKit/%s (KHTML, like Gecko) Safari/%s",
+- DEFINE_STATIC_LOCAL(const String, staticUA, (String::format("Mozilla/5.0 (%s; U; %s; %s) AppleWebKit/%s (KHTML, like Gecko) Safari/%s",
- platform, osVersion, defaultLanguage().utf8().data(), uaVersion.utf8().data(), uaVersion.utf8().data())));
-
- g_free(osVersion);
- g_free(platform);
-+ webkit_get_platform().utf8().data(), webkit_get_os_version().utf8().data(), defaultLanguage().utf8().data(), uaVersion.utf8().data(), uaVersion.utf8().data())));
++ DEFINE_STATIC_LOCAL(const String, staticUA, (String::format("Mozilla/5.0 (%s; U; %s; %s) AppleWebKit/%s (KHTML, like Gecko) Version/5.0 Safari/%s",
++ webkitPlatform().utf8().data(), webkitOSVersion().utf8().data(), defaultLanguage().utf8().data(), uaVersion.utf8().data(), uaVersion.utf8().data())));
return staticUA;
}
+@@ -607,7 +616,7 @@ static void webkit_web_settings_class_init(WebKitWebSettingsClass* klass)
+ g_param_spec_string("user-agent",
+ _("User Agent"),
+ _("The User-Agent string used by WebKitGtk"),
+- webkit_get_user_agent().utf8().data(),
++ webkitUserAgent().utf8().data(),
+ flags));
-+String chromeUserAgent()
-+{
-+ DEFINE_STATIC_LOCAL(const String, uaChrome, (String::format("Mozilla/5.0 (%s; U; %s; en-US) AppleWebKit/534.0 (KHTML, like Gecko) Chrome/6.0.411.0 Safari/534.0",
-+ webkit_get_platform().utf8().data(), webkit_get_os_version().utf8().data())));
-+
-+ return uaChrome;
-+}
-+
- static void webkit_web_settings_finalize(GObject* object);
-
- static void webkit_web_settings_set_property(GObject* object, guint prop_id, const GValue* value, GParamSpec* pspec);
---
-1.7.1
-
+ /**
+@@ -1034,7 +1043,7 @@ static void webkit_web_settings_set_property(GObject* object, guint prop_id, con
+ case PROP_USER_AGENT:
+ g_free(priv->user_agent);
+ if (!g_value_get_string(value) || !strlen(g_value_get_string(value)))
+- priv->user_agent = g_strdup(webkit_get_user_agent().utf8().data());
++ priv->user_agent = g_strdup(webkitUserAgent().utf8().data());
+ else
+ priv->user_agent = g_strdup(g_value_get_string(value));
+ break;
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list