Index: lib/elemHide.js |
=================================================================== |
--- a/lib/elemHide.js |
+++ b/lib/elemHide.js |
@@ -106,21 +106,21 @@ |
} |
return domain; |
} |
/** |
* Adds a filter to the lookup table of filters by domain. |
* @param {Filter} filter |
+ * @param {?Map.<string,boolean>} [domains] |
*/ |
-function addToFiltersByDomain(filter) |
+function addToFiltersByDomain(filter, domains = filter.domains) |
{ |
- let domains = filter.domains || defaultDomains; |
- for (let [domain, isIncluded] of domains) |
+ for (let [domain, isIncluded] of domains || defaultDomains) |
{ |
// There's no need to note that a filter is generically disabled. |
if (!isIncluded && domain == "") |
continue; |
let filters = filtersByDomain.get(domain); |
if (!filters) |
filtersByDomain.set(domain, filters = new Map()); |
@@ -280,29 +280,29 @@ |
*/ |
add(filter) |
{ |
if (knownFilters.has(filter)) |
return; |
commonStyleSheet = null; |
- let {selector} = filter; |
+ let {domains, selector} = filter; |
Manish Jethani
2018/10/15 15:36:59
Here we are just minimizing access to the domains
|
- if (!(filter.domains || ElemHideExceptions.hasExceptions(selector))) |
+ if (!(domains || ElemHideExceptions.hasExceptions(selector))) |
{ |
// The new filter's selector is unconditionally applied to all domains |
filterBySelector.set(selector, filter); |
unconditionalSelectors = null; |
defaultStyleSheet = null; |
} |
else |
{ |
// The new filter's selector only applies to some domains |
- addToFiltersByDomain(filter); |
+ addToFiltersByDomain(filter, domains); |
} |
knownFilters.add(filter); |
filterNotifier.emit("elemhideupdate"); |
}, |
/** |
* Removes an element hiding filter |