| Index: lib/matcher.js |
| =================================================================== |
| --- a/lib/matcher.js |
| +++ b/lib/matcher.js |
| @@ -44,18 +44,18 @@ Matcher.prototype = { |
| */ |
| keywordByFilter: null, |
| /** |
| * Removes all known filters |
| */ |
| clear: function() |
| { |
| - this.filterByKeyword = {__proto__: null}; |
| - this.keywordByFilter = {__proto__: null}; |
| + this.filterByKeyword = Object.create(null); |
| + this.keywordByFilter = Object.create(null); |
| }, |
| /** |
| * Adds a filter to the matcher |
| * @param {RegExpFilter} filter |
| */ |
| add: function(filter) |
| { |
| @@ -210,18 +210,18 @@ Matcher.prototype = { |
| * Combines a matcher for blocking and exception rules, automatically sorts |
| * rules into two Matcher instances. |
| * @constructor |
| */ |
| function CombinedMatcher() |
| { |
| this.blacklist = new Matcher(); |
| this.whitelist = new Matcher(); |
| - this.keys = {__proto__: null}; |
| - this.resultCache = {__proto__: null}; |
| + this.keys = Object.create(null); |
| + this.resultCache = Object.create(null); |
| } |
| exports.CombinedMatcher = CombinedMatcher; |
| /** |
| * Maximal number of matching cache entries to be kept |
| * @type Number |
| */ |
| CombinedMatcher.maxCacheEntries = 1000; |
| @@ -260,18 +260,18 @@ CombinedMatcher.prototype = |
| /** |
| * @see Matcher#clear |
| */ |
| clear: function() |
| { |
| this.blacklist.clear(); |
| this.whitelist.clear(); |
| - this.keys = {__proto__: null}; |
| - this.resultCache = {__proto__: null}; |
| + this.keys = Object.create(null); |
| + this.resultCache = Object.create(null); |
| this.cacheEntries = 0; |
| }, |
| /** |
| * @see Matcher#add |
| */ |
| add: function(filter) |
| { |
| @@ -285,17 +285,17 @@ CombinedMatcher.prototype = |
| else |
| this.whitelist.add(filter); |
| } |
| else |
| this.blacklist.add(filter); |
| if (this.cacheEntries > 0) |
| { |
| - this.resultCache = {__proto__: null}; |
| + this.resultCache = Object.create(null); |
| this.cacheEntries = 0; |
| } |
| }, |
| /** |
| * @see Matcher#remove |
| */ |
| remove: function(filter) |
| @@ -310,17 +310,17 @@ CombinedMatcher.prototype = |
| else |
| this.whitelist.remove(filter); |
| } |
| else |
| this.blacklist.remove(filter); |
| if (this.cacheEntries > 0) |
| { |
| - this.resultCache = {__proto__: null}; |
| + this.resultCache = Object.create(null); |
| this.cacheEntries = 0; |
| } |
| }, |
| /** |
| * @see Matcher#findKeyword |
| */ |
| findKeyword: function(filter) |
| @@ -401,17 +401,17 @@ CombinedMatcher.prototype = |
| let key = location + " " + contentType + " " + docDomain + " " + thirdParty; |
| if (key in this.resultCache) |
| return this.resultCache[key]; |
| let result = this.matchesAnyInternal(location, contentType, docDomain, thirdParty); |
| if (this.cacheEntries >= CombinedMatcher.maxCacheEntries) |
| { |
| - this.resultCache = {__proto__: null}; |
| + this.resultCache = Object.create(null); |
| this.cacheEntries = 0; |
| } |
| this.resultCache[key] = result; |
| this.cacheEntries++; |
| return result; |
| }, |