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

Unified Diff: lib/elemHide.js

Issue 29791555: Issue 6727 - Use string rather than map for single-domain filters (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Rebase Created June 6, 2018, 11:39 a.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 | lib/filterClasses.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/elemHide.js
===================================================================
--- a/lib/elemHide.js
+++ b/lib/elemHide.js
@@ -67,16 +67,20 @@
/**
* Adds a filter to the lookup table of filters by domain.
* @param {Filter} filter
*/
function addToFiltersByDomain(filter)
{
let domains = filter.domains || defaultDomains;
+
+ if (typeof domains == "string")
+ domains = [[domains, true]];
+
for (let [domain, isIncluded] of domains)
{
// There's no need to note that a filter is generically disabled.
if (!isIncluded && domain == "")
continue;
let filters = filtersByDomain.get(domain);
if (!filters)
@@ -183,17 +187,21 @@
{
filterBySelector.delete(filter.selector);
unconditionalSelectors = null;
}
// Conditionally applied element hiding filters
else
{
let domains = filter.domains || defaultDomains;
- for (let domain of domains.keys())
+
+ if (typeof domains == "string")
+ domains = [[domains]];
+
+ for (let [domain] of domains)
{
let filters = filtersByDomain.get(domain);
if (filters)
filters.delete(filter);
}
}
knownFilters.delete(filter);
« no previous file with comments | « no previous file | lib/filterClasses.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld