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 |
} |