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: Rebased patch. Created March 6, 2018, 7:32 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
@@ -38,27 +38,49 @@
name = value;\
if (ABP_NS::FilterNotifier::Topic::topic != ABP_NS::FilterNotifier::Topic::NONE)\
{\
ABP_NS::FilterNotifier::FilterChange(ABP_NS::FilterNotifier::Topic::topic, *this);\
}\
}\
}
+
ABP_NS_BEGIN
+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;
static const DependentString DEFAULT_DOMAIN;
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;
@@ -72,9 +94,9 @@
const String& sitekey = DependentString()) const;
bool BINDINGS_EXPORTED IsActiveOnlyOnDomain(DependentString& docDomain) const;
bool BINDINGS_EXPORTED IsGeneric() const;
OwnedString BINDINGS_EXPORTED Serialize() const;
};
typedef intrusive_ptr<ActiveFilter> ActiveFilterPtr;
-ABP_NS_END
+ABP_NS_END
« 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