From 2dcf7b797454b3caa3427bda36a0285bf4bd45f0 Mon Sep 17 00:00:00 2001 From: gorhill Date: Mon, 20 Mar 2017 15:54:41 -0400 Subject: [PATCH] fix #2464 --- src/js/static-net-filtering.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/js/static-net-filtering.js b/src/js/static-net-filtering.js index f1e0e1a82..ab7a4a8e8 100644 --- a/src/js/static-net-filtering.js +++ b/src/js/static-net-filtering.js @@ -978,6 +978,12 @@ var FilterHostnameDict = function() { this.dict = new Set(); }; +Object.defineProperty(FilterHostnameDict.prototype, 'size', { + get: function() { + return this.dict.size; + } +}); + FilterHostnameDict.prototype.add = function(hn) { if ( this.dict.has(hn) ) { return false; @@ -986,6 +992,10 @@ FilterHostnameDict.prototype.add = function(hn) { return true; }; +FilterHostnameDict.prototype.remove = function(hn) { + return this.dict.delete(hn); +}; + FilterHostnameDict.prototype.match = function() { // TODO: mind IP addresses var pos, @@ -2097,8 +2107,8 @@ FilterContainer.prototype.removeBadFilters = function() { continue; } if ( entry instanceof FilterHostnameDict ) { - entry.delete(fclass); // 'fclass' is hostname - if ( entry.dict.size === 0 ) { + entry.remove(fclass); // 'fclass' is hostname + if ( entry.size === 0 ) { this.categories.delete(hash); } continue;