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

Unified Diff: compiled/filter/Filter.cpp

Issue 29600641: Issue 5175 - Reject element hiding filter with empty domain names (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Make the new test more functional Created March 6, 2018, 7:47 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 | « compiled/filter/ElemHideFilter.cpp ('k') | compiled/filter/RegExpFilter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: compiled/filter/Filter.cpp
===================================================================
--- a/compiled/filter/Filter.cpp
+++ b/compiled/filter/Filter.cpp
@@ -102,21 +102,22 @@
// Parsing also normalizes the filter text, so it has to be done before the
// lookup in knownFilters.
union
{
RegExpFilterData regexp;
ElemHideData elemhide;
} data;
bool needConversion = false;
+ ParsedDomains parsedDomains;
DependentString error;
Filter::Type type = CommentFilter::Parse(text);
if (type == Filter::Type::UNKNOWN)
- type = ElemHideBase::Parse(text, data.elemhide, needConversion);
+ type = ElemHideBase::Parse(text, error, data.elemhide, needConversion, parsedDomains);
if (type == Filter::Type::UNKNOWN)
type = RegExpFilter::Parse(text, error, data.regexp);
if (needConversion)
text = ElemHideBase::ConvertFilter(text, data.elemhide.mSelectorStart);
// At that point we failed the conversion.
if (text.empty())
@@ -140,23 +141,24 @@
break;
case BlockingFilter::classType:
filter = FilterPtr(new BlockingFilter(text, data.regexp), false);
break;
case WhitelistFilter::classType:
filter = FilterPtr(new WhitelistFilter(text, data.regexp), false);
break;
case ElemHideFilter::classType:
- filter = FilterPtr(new ElemHideFilter(text, data.elemhide), false);
+ filter = FilterPtr(new ElemHideFilter(text, data.elemhide,
+ parsedDomains), false);
break;
case ElemHideException::classType:
- filter = FilterPtr(new ElemHideException(text, data.elemhide), false);
+ filter = FilterPtr(new ElemHideException(text, data.elemhide, parsedDomains), false);
break;
case ElemHideEmulationFilter::classType:
- filter = FilterPtr(new ElemHideEmulationFilter(text, data.elemhide), false);
+ filter = FilterPtr(new ElemHideEmulationFilter(text, data.elemhide, parsedDomains), false);
if (static_cast<ElemHideEmulationFilter*>(filter.get())->IsGeneric())
filter = FilterPtr(new InvalidFilter(text, u"filter_elemhideemulation_nodomain"_str), false);
break;
default:
// This should never happen but just in case
return nullptr;
}
« no previous file with comments | « compiled/filter/ElemHideFilter.cpp ('k') | compiled/filter/RegExpFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld