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

Unified Diff: compiled/filter/ActiveFilter.h

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 | « no previous file | compiled/filter/ActiveFilter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: compiled/filter/ActiveFilter.h
===================================================================
--- a/compiled/filter/ActiveFilter.h
+++ b/compiled/filter/ActiveFilter.h
@@ -37,24 +37,45 @@
name = value;\
if (FilterNotifier::Topic::topic != FilterNotifier::Topic::NONE)\
{\
FilterNotifier::FilterChange(FilterNotifier::Topic::topic, *this);\
}\
}\
}
+struct ParsedDomains
+{
+ struct Domain {
+ String::size_type pos;
+ String::size_type len;
+ bool reverse;
+ };
+ bool hasIncludes;
+ bool hasEmpty;
+ std::vector<Domain> domains;
+
+ ParsedDomains()
+ : hasIncludes(false), hasEmpty(false)
+ {
+ }
+};
+
class ActiveFilter : public Filter
{
public:
typedef StringMap<bool> DomainMap;
virtual DomainMap* GetDomains() const;
protected:
typedef StringSet SitekeySet;
- void ParseDomains(const String& domains, String::value_type separator) const;
+ static ParsedDomains ParseDomainsInternal(const String& domains,
+ String::value_type separator, bool ignoreTrailingDot);
+ void FillDomains(const String& domains, const ParsedDomains& parsed) const;
+ void ParseDomains(const String& domains,
+ String::value_type separator, bool ignoreTrailingDot) const;
void AddSitekey(const String& sitekey) const;
virtual SitekeySet* GetSitekeys() const;
mutable std::unique_ptr<DomainMap> mDomains;
mutable std::unique_ptr<SitekeySet> mSitekeys;
private:
bool mIgnoreTrailingDot;
public:
static constexpr Type classType = Type::ACTIVE;
« no previous file with comments | « no previous file | compiled/filter/ActiveFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld