Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(52)

Unified Diff: webkit/glue/webkit_glue.cc

Issue 8590022: Work around wrong UA sniffing by Yahoo! JAPAN (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed review comments Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/glue/webkit_glue.cc
diff --git a/webkit/glue/webkit_glue.cc b/webkit/glue/webkit_glue.cc
index 5e47fe4ee986e7a00b176f8b2b7f24db7f4e6fb7..47240a5e1ec9cd24c08388819491985781c6baab 100644
--- a/webkit/glue/webkit_glue.cc
+++ b/webkit/glue/webkit_glue.cc
@@ -350,8 +350,8 @@ class UserAgentState {
private:
mutable std::string user_agent_;
- // The UA string when we're pretending to be Mac Safari.
- mutable std::string mimic_mac_safari_user_agent_;
+ // The UA string when we're pretending to be Mac Safari or Win Firefox.
+ mutable std::string user_agent_for_spoofing_hack_;
mutable bool user_agent_requested_;
bool user_agent_is_overridden_;
@@ -393,17 +393,45 @@ const std::string& UserAgentState::Get(const GURL& url) const {
// Workarounds for sites that use misguided UA sniffing.
if (!user_agent_is_overridden_) {
#if defined(OS_MACOSX)
- if (url.host() == "www.microsoft.com" &&
- StartsWithASCII(url.path(), "/getsilverlight", false)) {
+ if ((url.host() == "www.microsoft.com" &&
+ StartsWithASCII(url.path(), "/getsilverlight", false)) ||
+ // Problematic Yahoo! JAPAN pages
+ (url.host() == "headlines.yahoo.co.jp" &&
+ StartsWithASCII(url.path(), "/videonews/", true)) ||
+ (url.host() == "downloads.yahoo.co.jp" &&
+ StartsWithASCII(url.path(), "/docs/silverlight/", true)) ||
+ url.host() == "gyao.yahoo.co.jp") {
tony 2011/11/18 18:35:10 Please make a helper function for the yahoo cases.
Yuzo 2011/11/21 02:22:01 Done.
// The landing page for updating Silverlight gives a confusing experience
// in browsers that Silverlight doesn't officially support; spoof as
// Safari to reduce the chance that users won't complete updates.
// Should be removed if the sniffing is removed: http://crbug.com/88211
- if (mimic_mac_safari_user_agent_.empty()) {
- mimic_mac_safari_user_agent_ =
+
+ // The above Yahoo! JAPAN pages erroneously judge that Silverlight does
+ // not support Chromium. Until the pages are fixed, spoof the UA.
+ // http://crbug.com/104426
+ if (user_agent_for_spoofing_hack_.empty()) {
+ user_agent_for_spoofing_hack_ =
BuildUserAgentFromProduct("Version/5.0.4 Safari/533.20.27");
}
- return mimic_mac_safari_user_agent_;
+ return user_agent_for_spoofing_hack_;
+ }
+#elif defined(OS_WIN)
+ if ((url.host() == "headlines.yahoo.co.jp" &&
+ StartsWithASCII(url.path(), "/videonews/", true)) ||
+ (url.host() == "weather.yahoo.co.jp" &&
+ StartsWithASCII(url.path(), "/weather/zoomradar/", true)) ||
+ url.host() == "promotion.shopping.yahoo.co.jp") {
+ // The above Yahoo! JAPAN pages erroneously judge that Silverlight does
+ // not support Chromium. Until the pages are fixed, spoof the UA.
+ // Note that the set of the pages can be different from that for Mac.
+ // http://crbug.com/104426
+ if (user_agent_for_spoofing_hack_.empty()) {
+ // Pretend to be Firefox. Mac Safari doesn't support Silverlight.
+ user_agent_for_spoofing_hack_ =
+ "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0) Gecko/20100101 "
+ "Firefox/8.0";
+ }
+ return user_agent_for_spoofing_hack_;
}
#endif
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698