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") |
sergei
2018/05/28 09:22:07
Will the refactoring of that `typeof DOMAINS == "s
kzar
2018/06/05 16:51:30
Agreed, if possible (without messing up performanc
|
+ 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); |