Index: compiled/filter/ElemHideBase.cpp |
=================================================================== |
--- a/compiled/filter/ElemHideBase.cpp |
+++ b/compiled/filter/ElemHideBase.cpp |
@@ -137,25 +137,27 @@ |
return converted; |
} |
return OwnedString(text); |
} |
} |
-ElemHideBase::ElemHideBase(Type type, const String& text, const ElemHideData& data) |
+ElemHideBase::ElemHideBase(Type type, const String& text, |
+ const ElemHideData& data, const ParsedDomains& parsedDomains) |
: ActiveFilter(type, ConvertFilter(text, data.mSelectorStart), false), |
mData(data) |
{ |
if (mData.HasDomains()) |
- ParseDomains(mData.GetDomainsSource(mText), u','); |
+ FillDomains(mData.GetDomainsSource(mText), parsedDomains); |
} |
-Filter::Type ElemHideBase::Parse(DependentString& text, ElemHideData& data) |
+Filter::Type ElemHideBase::Parse(DependentString& text, DependentString& error, |
+ ElemHideData& data, ParsedDomains& parsedDomains) |
{ |
StringScanner scanner(text); |
// Domains part |
bool seenSpaces = false; |
while (!scanner.done()) |
{ |
String::value_type next = scanner.next(); |
@@ -201,16 +203,24 @@ |
data.mSelectorStart = scanner.position() + 1; |
// We are done validating, now we can normalize whitespace and the domain part |
if (seenSpaces) |
NormalizeWhitespace(text, data.mDomainsEnd, data.mSelectorStart); |
DependentString(text, 0, data.mDomainsEnd).toLower(); |
+ parsedDomains = |
+ ParseDomainsInternal(data.GetDomainsSource(text), u',', false); |
+ if (parsedDomains.hasEmpty) |
+ { |
+ error = u"filter_invalid_domain"_str; |
+ return Type::INVALID; |
+ } |
+ |
if (exception) |
return Type::ELEMHIDEEXCEPTION; |
if (emulation) |
return Type::ELEMHIDEEMULATION; |
return Type::ELEMHIDE; |
} |