 Issue 29329521:
  Issue 3222 - Expose filter type as a string property  (Closed)
    
  
    Issue 29329521:
  Issue 3222 - Expose filter type as a string property  (Closed) 
  | Index: lib/requestNotifier.js | 
| =================================================================== | 
| --- a/lib/requestNotifier.js | 
| +++ b/lib/requestNotifier.js | 
| @@ -15,17 +15,16 @@ | 
| * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | 
| */ | 
| /** | 
| * @fileOverview Stores Adblock Plus data to be attached to a window. | 
| */ | 
| let {Utils} = require("utils"); | 
| -let {BlockingFilter, WhitelistFilter, ElemHideBase, ElemHideFilter, ElemHideException} = require("filterClasses"); | 
| let nodeData = new WeakMap(); | 
| let windowStats = new WeakMap(); | 
| let windowSelection = new WeakMap(); | 
| let requestNotifierMaxId = 0; | 
| let requestEntryMaxId = 0; | 
| /** | 
| @@ -209,25 +208,26 @@ RequestNotifier.addNodeData = function(/ | 
| hidden: 0, | 
| blocked: 0, | 
| whitelisted: 0, | 
| filters: {} | 
| }); | 
| } | 
| let stats = windowStats.get(topWnd.document); | 
| - if (!filter || !(filter instanceof ElemHideBase)) | 
| + let filterType = (filter ? filter.type : null); | 
| + if (filterType != "elemhide" && filterType != "elemhideexception" && filterType != "cssproperty") | 
| 
Thomas Greiner
2015/11/03 11:32:40
Just a suggestion: What about introducing an `isEx
 
Wladimir Palant
2015/11/03 12:23:24
I think that would complicate things more than it
 | 
| stats.items++; | 
| if (filter) | 
| { | 
| - if (filter instanceof BlockingFilter) | 
| + if (filterType == "blocking") | 
| stats.blocked++; | 
| - else if (filter instanceof WhitelistFilter || filter instanceof ElemHideException) | 
| + else if (filterType == "whitelist" || filterType == "elemhideexception") | 
| stats.whitelisted++; | 
| - else if (filter instanceof ElemHideFilter) | 
| + else if (filterType == "elemhide" || filterType == "cssproperty") | 
| stats.hidden++; | 
| if (filter.text in stats.filters) | 
| stats.filters[filter.text]++; | 
| else | 
| stats.filters[filter.text] = 1; | 
| } |