Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: src/FilterEngine.cpp

Issue 5768603836088320: Issue 1564-Fix FilterEngine::Matches for allowing request which is whitelisted in the ascendant node
Patch Set: Created Nov. 13, 2014, 12:58 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/FilterEngine.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/FilterEngine.cpp
===================================================================
--- a/src/FilterEngine.cpp
+++ b/src/FilterEngine.cpp
@@ -274,14 +274,25 @@
std::string lastDocumentUrl = documentUrls.front();
for (std::vector<std::string>::const_iterator it = documentUrls.begin();
- it != documentUrls.end(); it++) {
- const std::string documentUrl = *it;
- AdblockPlus::FilterPtr match = CheckFilterMatch(documentUrl,
- CONTENT_TYPE_DOCUMENT,
- lastDocumentUrl);
+ it != documentUrls.end(); ++it)
+ {
+ lastDocumentUrl = *it;
+ AdblockPlus::FilterPtr match = CheckFilterMatch(url, contentType,
+ lastDocumentUrl);
Oleksandr 2014/11/13 13:32:18 I would add a comment before CheckFilterMatch some
sergei 2014/11/13 13:58:13 added
if (match && match->GetType() == AdblockPlus::Filter::TYPE_EXCEPTION)
- return match;
- lastDocumentUrl = documentUrl;
+ return match;
+ // We need to start from the same url for the filters like
+ // @@||example.org^$document, because "document — the page itself", so
+ // we whitelist the everything which is requested by the page example.org.
Oleksandr 2014/11/13 13:32:18 This comment is confusing, I would remove it.
sergei 2014/11/13 13:58:13 See the updated version. It says ''parent'' but we
+ for (std::vector<std::string>::const_iterator ii = it;
+ ii != documentUrls.end(); ++ii)
+ {
+ const std::string& documentUrl = *ii;
+ AdblockPlus::FilterPtr match = CheckFilterMatch(documentUrl,
+ CONTENT_TYPE_DOCUMENT, lastDocumentUrl);
Oleksandr 2014/11/13 13:32:18 Before this CheckFilterMatch I'll add a comment li
sergei 2014/11/13 13:58:13 add before the for loop
+ if (match && match->GetType() == AdblockPlus::Filter::TYPE_EXCEPTION)
+ return match;
+ }
}
return CheckFilterMatch(url, contentType, lastDocumentUrl);
« no previous file with comments | « no previous file | test/FilterEngine.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld