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: Created Nov. 7, 2017, 11:17 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
@@ -99,21 +99,22 @@
// Parsing also normalizes the filter text, so it has to be done before the
// lookup in knownFilters.
union
{
RegExpFilterData regexp;
ElemHideData elemhide;
} data;
+ ParsedDomains parsedDomains;
DependentString error;
Filter::Type type = CommentFilter::Parse(text);
if (type == Filter::Type::UNKNOWN)
- type = ElemHideBase::Parse(text, data.elemhide);
+ type = ElemHideBase::Parse(text, error, data.elemhide, parsedDomains);
if (type == Filter::Type::UNKNOWN)
type = RegExpFilter::Parse(text, error, data.regexp);
auto knownFilter = knownFilters.find(text);
if (knownFilter)
{
knownFilter->second->AddRef();
return knownFilter->second;
@@ -130,23 +131,26 @@
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