From 183b6b639758eda562da345b5eaaa49b263dad8b Mon Sep 17 00:00:00 2001 From: "sfalken@apple.com" Date: Tue, 19 May 2009 03:23:44 +0000 Subject: [PATCH] WebKit/mac: 2009-05-18 Sam Weinig Can't see Apple ad on nytimes.com unless I spoof the user agent Add user agent hack for pointroll.com. Reviewed by Steve Falkenburg. * WebView/WebView.mm: (-[WebView WebCore::_userAgentForURL:WebCore::]): WebKit/win: 2009-05-18 Steve Falkenburg Can't see Apple ad on nytimes.com unless I spoof the user agent Add user agent hack for pointroll.com. Reviewed by Sam Weinig. * WebView.cpp: git-svn-id: http://svn.webkit.org/repository/webkit/trunk@43848 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- WebKit/mac/ChangeLog | 11 +++++++++++ WebKit/mac/WebView/WebView.mm | 6 +++++- WebKit/win/ChangeLog | 10 ++++++++++ WebKit/win/WebView.cpp | 10 +++++++++- 4 files changed, 35 insertions(+), 2 deletions(-) diff --git a/WebKit/mac/ChangeLog b/WebKit/mac/ChangeLog index b1038ed07957..c44970c0624f 100644 --- a/WebKit/mac/ChangeLog +++ b/WebKit/mac/ChangeLog @@ -1,3 +1,14 @@ +2009-05-18 Sam Weinig + + Can't see Apple ad on nytimes.com unless I spoof the user agent + + Add user agent hack for pointroll.com. + + Reviewed by Steve Falkenburg. + + * WebView/WebView.mm: + (-[WebView WebCore::_userAgentForURL:WebCore::]): + 2009-05-16 Anders Carlsson Reviewed by Sam Weinig and Dan Bernstein. diff --git a/WebKit/mac/WebView/WebView.mm b/WebKit/mac/WebView/WebView.mm index 4f9d693349c4..05fce4a66176 100644 --- a/WebKit/mac/WebView/WebView.mm +++ b/WebKit/mac/WebView/WebView.mm @@ -5271,7 +5271,11 @@ static WebFrameView *containingFrameView(NSView *view) - (WebCore::String)_userAgentForURL:(const WebCore::KURL&)url { if (_private->useSiteSpecificSpoofing) { - // No current site-specific spoofs. + if (url.host() == "ads.pointroll.com") { + // Can't see Apple ad on nytimes.com unless I spoof the user agent + DEFINE_STATIC_LOCAL(const String, uaForAdsPointroll, ("Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_7; en-us) AppleWebKit/525.28.3 (KHTML, like Gecko) Version/3.2.3 Safari/525.28.3")); + return uaForAdsPointroll; + } } if (_private->userAgent.isNull()) diff --git a/WebKit/win/ChangeLog b/WebKit/win/ChangeLog index 4f8ed9a79e3c..3ee3b2356272 100644 --- a/WebKit/win/ChangeLog +++ b/WebKit/win/ChangeLog @@ -1,3 +1,13 @@ +2009-05-18 Steve Falkenburg + + Can't see Apple ad on nytimes.com unless I spoof the user agent + + Add user agent hack for pointroll.com. + + Reviewed by Sam Weinig. + + * WebView.cpp: + 2009-05-13 Dmitry Titov Rubber-stamped by Mark Rowe. diff --git a/WebKit/win/WebView.cpp b/WebKit/win/WebView.cpp index b032d8edc3c2..de8a43dd9864 100644 --- a/WebKit/win/WebView.cpp +++ b/WebKit/win/WebView.cpp @@ -2011,11 +2011,19 @@ exit: return versionStr; } -const String& WebView::userAgentForKURL(const KURL&) +const String& WebView::userAgentForKURL(const KURL& url) { if (m_userAgentOverridden) return m_userAgentCustom; + if (allowSiteSpecificHacks()) { + if (url.host() == "ads.pointroll.com") { + // Can't see Apple ad on nytimes.com unless I spoof the user agent + DEFINE_STATIC_LOCAL(const String, uaForAdsPointroll, ("Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/525.28.3 (KHTML, like Gecko) Version/3.2.3 Safari/525.29")); + return uaForAdsPointroll; + } + } + if (!m_userAgentStandard.length()) m_userAgentStandard = WebView::standardUserAgentWithApplicationName(m_applicationName); return m_userAgentStandard; -- 2.36.0