Changeset 159572 in webkit
- Timestamp:
- Nov 20, 2013 10:44:01 AM (10 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r159570 r159572 1 2013-11-20 Víctor Manuel Jáquez Leal <vjaquez@igalia.com> 2 3 [GTK] Remove Chromium as user agent and claim to be Safari in OS X 4 https://bugs.webkit.org/show_bug.cgi?id=124229 5 6 Reviewed by Martin Robinson. 7 8 http://www.duolingo.com/ doesn't get render correctly because it uses 9 Chrome/Chromium specific variables, added after it was forked. Because 10 of this, it is necessary to remove the Chrome/Chromium identification 11 in the user agent. Also, from now on, by default, The GTK+ port will 12 claim to be Safari in OS X to avoid loading wrong resources. 13 14 * platform/gtk/UserAgentGtk.cpp: 15 (WebCore::standardUserAgent): 16 1 17 2013-11-20 Commit Queue <commit-queue@webkit.org> 2 18 -
trunk/Source/WebCore/platform/gtk/UserAgentGtk.cpp
r145795 r159572 37 37 namespace WebCore { 38 38 39 #if OS(DARWIN) || OS(UNIX) 40 static const char* cpuDescriptionForUAString() 41 { 42 #if CPU(PPC) || CPU(PPC64) 43 return "PPC"; 44 #elif CPU(X86) || CPU(X86_64) 45 return "Intel"; 46 #elif CPU(ARM) || CPU(ARM64) 47 return "ARM"; 48 #else 49 return "Unknown"; 50 #endif 51 } 52 #endif 53 39 54 static const char* platformForUAString() 40 55 { … … 60 75 #if OS(WINDOWS) 61 76 uaOSVersion = windowsVersionForUAString(); 62 #elif OS(DARWIN) 63 #if CPU(X86) || CPU(X86_64) 64 uaOSVersion = "Intel Mac OS X"; 65 #else 66 uaOSVersion = "PPC Mac OS X"; 67 #endif 68 #elif OS(UNIX) 69 struct utsname name; 70 if (uname(&name) != -1) 71 uaOSVersion = String::format("%s %s", name.sysname, name.machine); 72 else 73 uaOSVersion = String("Unknown"); 77 #elif OS(DARWIN) || OS(UNIX) 78 // We will always claim to be Safari in Mac OS X, since Safari in Linux triggers the iOS path on 79 // some websites. 80 uaOSVersion = String::format("%s Mac OS X", cpuDescriptionForUAString()); 74 81 #else 75 82 uaOSVersion = String("Unknown"); … … 80 87 String standardUserAgent(const String& applicationName, const String& applicationVersion) 81 88 { 82 // Create a default user agent string with a liberal interpretation of 89 // Create a default user agent string with a liberal interpretation of 83 90 // https://developer.mozilla.org/en-US/docs/User_Agent_Strings_Reference 84 91 // 85 92 // Forming a functional user agent is really difficult. We must mention Safari, because some 86 93 // sites check for that when detecting WebKit browsers. Additionally some sites assume that 87 // browsers that are "Safari" but not running on OS X are the Safari iOS browse r, so we88 // also claim to be Chromium. Getting this wrong can cause sites to load the wrong JavaScript,89 // CSS, or custom fonts. In some casessites won't load resources at all.94 // browsers that are "Safari" but not running on OS X are the Safari iOS browse. Getting this 95 // wrong can cause sites to load the wrong JavaScript, CSS, or custom fonts. In some cases 96 // sites won't load resources at all. 90 97 DEFINE_STATIC_LOCAL(const CString, uaVersion, (String::format("%i.%i", USER_AGENT_GTK_MAJOR_VERSION, USER_AGENT_GTK_MINOR_VERSION).utf8())); 91 DEFINE_STATIC_LOCAL(const String, staticUA, (String::format("Mozilla/5.0 (%s; %s) AppleWebKit/%s (KHTML, like Gecko) " 92 "Chromium/25.0.1349.2 Chrome/25.0.1349.2 Safari/%s", 98 DEFINE_STATIC_LOCAL(const String, staticUA, (String::format("Mozilla/5.0 (%s; %s) AppleWebKit/%s (KHTML, like Gecko) Safari/%s", 93 99 platformForUAString(), platformVersionForUAString().utf8().data(), 94 100 uaVersion.data(), uaVersion.data())));
Note: See TracChangeset
for help on using the changeset viewer.