Index: compiled/filter/ElemHideBase.cpp |
=================================================================== |
--- a/compiled/filter/ElemHideBase.cpp |
+++ b/compiled/filter/ElemHideBase.cpp |
@@ -61,24 +61,26 @@ |
static constexpr String::value_type OLD_PROPS_SELECTOR[] = u"[-abp-properties="; |
static constexpr String::size_type OLD_PROPS_SELECTOR_LEN = str_length_of(OLD_PROPS_SELECTOR); |
static constexpr String::value_type PROPS_SELECTOR[] = u":-abp-properties("; |
static constexpr String::size_type PROPS_SELECTOR_LEN = str_length_of(PROPS_SELECTOR); |
} |
-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, text, false), mData(data) |
{ |
if (mData.HasDomains()) |
- ParseDomains(mData.GetDomainsSource(mText), u','); |
+ FillDomains(mData.GetDomainsSource(mText), parsedDomains); |
} |
-Filter::Type ElemHideBase::Parse(DependentString& text, ElemHideData& data, bool& needConversion) |
+Filter::Type ElemHideBase::Parse(DependentString& text, DependentString& error, |
+ ElemHideData& data, bool& needConversion, |
+ ParsedDomains& parsedDomains) |
{ |
needConversion = false; |
StringScanner scanner(text); |
// Domains part |
bool seenSpaces = false; |
while (!scanner.done()) |
@@ -126,16 +128,23 @@ |
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; |
+ } |
// We still need to check the old syntax. It will be converted when |
// we instantiate the filter. |
if (!emulation && |
text.find(OLD_PROPS_SELECTOR, data.mSelectorStart, OLD_PROPS_SELECTOR_LEN) != text.npos) |
{ |
needConversion = true; |
emulation = !exception; |
} |