Title: [159916] releases/WebKitGTK/webkit-2.2/Source/WebCore
Revision
159916
Author
[email protected]
Date
2013-12-02 01:15:10 -0800 (Mon, 02 Dec 2013)

Log Message

Merge r159572 - [GTK] Remove Chromium as user agent and claim to be Safari in OS X
https://bugs.webkit.org/show_bug.cgi?id=124229

Reviewed by Martin Robinson.

http://www.duolingo.com/ doesn't get render correctly because it uses
Chrome/Chromium specific variables, added after it was forked. Because
of this, it is necessary to remove the Chrome/Chromium identification
in the user agent. Also, from now on, by default, The GTK+ port will
claim to be Safari in OS X to avoid loading wrong resources.

* platform/gtk/UserAgentGtk.cpp:
(WebCore::standardUserAgent):

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-2.2/Source/WebCore/ChangeLog (159915 => 159916)


--- releases/WebKitGTK/webkit-2.2/Source/WebCore/ChangeLog	2013-12-02 09:08:31 UTC (rev 159915)
+++ releases/WebKitGTK/webkit-2.2/Source/WebCore/ChangeLog	2013-12-02 09:15:10 UTC (rev 159916)
@@ -1,3 +1,19 @@
+2013-11-20  Víctor Manuel Jáquez Leal  <[email protected]>
+
+        [GTK] Remove Chromium as user agent and claim to be Safari in OS X
+        https://bugs.webkit.org/show_bug.cgi?id=124229
+
+        Reviewed by Martin Robinson.
+
+        http://www.duolingo.com/ doesn't get render correctly because it uses
+        Chrome/Chromium specific variables, added after it was forked. Because
+        of this, it is necessary to remove the Chrome/Chromium identification
+        in the user agent. Also, from now on, by default, The GTK+ port will
+        claim to be Safari in OS X to avoid loading wrong resources.
+
+        * platform/gtk/UserAgentGtk.cpp:
+        (WebCore::standardUserAgent):
+
 2013-09-24  Lorenzo Tilve  <[email protected]>
 
         [GTK] Fix compilation problems when setting ENABLE_DRAG_SUPPORT = FALSE

Modified: releases/WebKitGTK/webkit-2.2/Source/WebCore/platform/gtk/UserAgentGtk.cpp (159915 => 159916)


--- releases/WebKitGTK/webkit-2.2/Source/WebCore/platform/gtk/UserAgentGtk.cpp	2013-12-02 09:08:31 UTC (rev 159915)
+++ releases/WebKitGTK/webkit-2.2/Source/WebCore/platform/gtk/UserAgentGtk.cpp	2013-12-02 09:15:10 UTC (rev 159916)
@@ -36,6 +36,21 @@
 
 namespace WebCore {
 
+#if OS(DARWIN) || OS(UNIX)
+static const char* cpuDescriptionForUAString()
+{
+#if CPU(PPC) || CPU(PPC64)
+    return "PPC";
+#elif CPU(X86) || CPU(X86_64)
+    return "Intel";
+#elif CPU(ARM) || CPU(ARM64)
+    return "ARM";
+#else
+    return "Unknown";
+#endif
+}
+#endif
+
 static const char* platformForUAString()
 {
 #if PLATFORM(X11)
@@ -59,19 +74,11 @@
 
 #if OS(WINDOWS)
     uaOSVersion = windowsVersionForUAString();
-#elif OS(DARWIN)
-#if CPU(X86) || CPU(X86_64)
-    uaOSVersion = "Intel Mac OS X";
+#elif OS(DARWIN) || OS(UNIX)
+    // We will always claim to be Safari in Mac OS X, since Safari in Linux triggers the iOS path on
+    // some websites.
+    uaOSVersion = String::format("%s Mac OS X", cpuDescriptionForUAString());
 #else
-    uaOSVersion = "PPC Mac OS X";
-#endif
-#elif OS(UNIX)
-    struct utsname name;
-    if (uname(&name) != -1)
-        uaOSVersion = String::format("%s %s", name.sysname, name.machine);
-    else
-        uaOSVersion = String("Unknown");
-#else
     uaOSVersion = String("Unknown");
 #endif
     return uaOSVersion;
@@ -79,17 +86,16 @@
 
 String standardUserAgent(const String& applicationName, const String& applicationVersion)
 {
-    // Create a default user agent string with a liberal interpretation of 
+    // Create a default user agent string with a liberal interpretation of
     // https://developer.mozilla.org/en-US/docs/User_Agent_Strings_Reference
     //
     // Forming a functional user agent is really difficult. We must mention Safari, because some
     // sites check for that when detecting WebKit browsers. Additionally some sites assume that
-    // browsers that are "Safari" but not running on OS X are the Safari iOS browser, so we
-    // also claim to be  Chromium. Getting this wrong can cause sites to load the wrong _javascript_,
-    // CSS, or custom fonts. In some cases sites won't load resources at all.
+    // browsers that are "Safari" but not running on OS X are the Safari iOS browse. Getting this
+    // wrong can cause sites to load the wrong _javascript_, CSS, or custom fonts. In some cases
+    // sites won't load resources at all.
     DEFINE_STATIC_LOCAL(const CString, uaVersion, (String::format("%i.%i", USER_AGENT_GTK_MAJOR_VERSION, USER_AGENT_GTK_MINOR_VERSION).utf8()));
-    DEFINE_STATIC_LOCAL(const String, staticUA, (String::format("Mozilla/5.0 (%s; %s) AppleWebKit/%s (KHTML, like Gecko) "
-                                                                "Chromium/25.0.1349.2 Chrome/25.0.1349.2 Safari/%s",
+    DEFINE_STATIC_LOCAL(const String, staticUA, (String::format("Mozilla/5.0 (%s; %s) AppleWebKit/%s (KHTML, like Gecko) Safari/%s",
                                                                 platformForUAString(), platformVersionForUAString().utf8().data(),
                                                                 uaVersion.data(), uaVersion.data())));
     if (applicationName.isEmpty())
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to