Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: lib/requestNotifier.js

Issue 29329521: Issue 3222 - Expose filter type as a string property (Closed)
Patch Set: Created Oct. 29, 2015, 7:41 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/filterClasses.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « lib/filterClasses.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld