From 12f8323ae8e5e469fb0b662f29bd8fedadb85faa Mon Sep 17 00:00:00 2001 From: Benjamin Poulain Date: Sat, 21 Aug 2010 21:40:59 +0200 Subject: Add support for domain option in the ad block module Some ads were not filtered because they were incorrectly matched by the whitelist. This is because we ignore options, including the domain restrictions. For example, the white filter: @@||pagead2.googlesyndication.com/pagead/show_ads.js$domain=kde.org would match any page regardless of the domain restriction. So no ads from pagead2.googlesyndication.com were filtered. This patch adds support for "domain" options in the fallback rules (the other AdBlockRuleImpl rejects options). The domain of the frame making the request is now compared to the option to take the right decision. This patch requires Qt 4.7 with a recent QtWebKit 2.0. --- src/adblock/adblockruletextmatchimpl.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/adblock/adblockruletextmatchimpl.cpp') diff --git a/src/adblock/adblockruletextmatchimpl.cpp b/src/adblock/adblockruletextmatchimpl.cpp index 892d78e0..2d534a3a 100644 --- a/src/adblock/adblockruletextmatchimpl.cpp +++ b/src/adblock/adblockruletextmatchimpl.cpp @@ -38,9 +38,10 @@ AdBlockRuleTextMatchImpl::AdBlockRuleTextMatchImpl(const QString &filter) m_textToMatch.remove(QL1C('*')); } -bool AdBlockRuleTextMatchImpl::match(const QString &encodedUrl, const QString &encodedUrlLowerCase) const +bool AdBlockRuleTextMatchImpl::match(const QNetworkRequest &request, const QString &encodedUrl, const QString &encodedUrlLowerCase) const { Q_UNUSED(encodedUrl); + Q_UNUSED(request); // Case sensitive compare is faster, but would be incorrect with encodedUrl since // we do want case insensitive. // What we do is work on a lowercase version of m_textToMatch, and compare to the lowercase -- cgit v1.2.1