Index: lib/elemHideEmulation.js |
=================================================================== |
--- a/lib/elemHideEmulation.js |
+++ b/lib/elemHideEmulation.js |
@@ -19,61 +19,60 @@ |
/** |
* @fileOverview Element hiding emulation implementation. |
*/ |
const {ElemHide} = require("./elemHide"); |
const {Filter} = require("./filterClasses"); |
-let filters = Object.create(null); |
+let filters = new Set(); |
/** |
* Container for element hiding emulation filters |
* @class |
*/ |
let ElemHideEmulation = { |
/** |
* Removes all known filters |
*/ |
clear() |
{ |
- filters = Object.create(null); |
+ filters.clear(); |
}, |
/** |
* Add a new element hiding emulation filter |
* @param {ElemHideEmulationFilter} filter |
*/ |
add(filter) |
{ |
- filters[filter.text] = true; |
+ filters.add(filter.text); |
}, |
/** |
* Removes an element hiding emulation filter |
* @param {ElemHideEmulationFilter} filter |
*/ |
remove(filter) |
{ |
- delete filters[filter.text]; |
+ filters.delete(filter.text); |
}, |
/** |
* Returns a list of all rules active on a particular domain |
* @param {string} domain |
* @return {ElemHideEmulationFilter[]} |
*/ |
getRulesForDomain(domain) |
{ |
let result = []; |
- let keys = Object.getOwnPropertyNames(filters); |
- for (let key of keys) |
+ for (let text of filters.values()) |
{ |
- let filter = Filter.fromText(key); |
+ let filter = Filter.fromText(text); |
if (filter.isActiveOnDomain(domain) && |
!ElemHide.getException(filter, domain)) |
{ |
result.push(filter); |
} |
} |
return result; |
} |