diff --git a/src/js/html-filtering.js b/src/js/html-filtering.js
index 0ce949d0d..6bde40b3c 100644
--- a/src/js/html-filtering.js
+++ b/src/js/html-filtering.js
@@ -30,6 +30,8 @@
filterDB = new µb.staticExtFilteringEngine.HostnameBasedDB(),
pselectors = new Map(),
duplicates = new Set(),
+ acceptedCount = 0,
+ discardedCount = 0,
docRegister, loggerRegister;
var PSelectorHasTask = function(task) {
@@ -224,6 +226,8 @@
filterDB.clear();
pselectors.clear();
duplicates.clear();
+ acceptedCount = 0;
+ discardedCount = 0;
};
api.freeze = function() {
@@ -260,8 +264,12 @@
reader.select(1002);
while ( reader.next() ) {
+ acceptedCount += 1;
var fingerprint = reader.fingerprint();
- if ( duplicates.has(fingerprint) ) { continue; }
+ if ( duplicates.has(fingerprint) ) {
+ discardedCount += 1;
+ continue;
+ }
duplicates.add(fingerprint);
var args = reader.args();
filterDB.add(args[1], {
@@ -374,6 +382,19 @@
}
};
+ Object.defineProperties(api, {
+ acceptedCount: {
+ get: function() {
+ return acceptedCount;
+ }
+ },
+ discardedCount: {
+ get: function() {
+ return discardedCount;
+ }
+ }
+ });
+
return api;
})();
diff --git a/src/js/scriptlet-filtering.js b/src/js/scriptlet-filtering.js
index b10066cf1..3ace313ff 100644
--- a/src/js/scriptlet-filtering.js
+++ b/src/js/scriptlet-filtering.js
@@ -29,6 +29,8 @@
var µb = µBlock,
scriptletDB = new µb.staticExtFilteringEngine.HostnameBasedDB(),
duplicates = new Set(),
+ acceptedCount = 0,
+ discardedCount = 0,
scriptletCache = new µb.MRUCache(32),
exceptionsRegister = new Set(),
scriptletsRegister = new Map(),
@@ -103,6 +105,8 @@
api.reset = function() {
scriptletDB.clear();
duplicates.clear();
+ acceptedCount = 0;
+ discardedCount = 0;
};
api.freeze = function() {
@@ -154,8 +158,12 @@
reader.select(1001);
while ( reader.next() ) {
+ acceptedCount += 1;
var fingerprint = reader.fingerprint();
- if ( duplicates.has(fingerprint) ) { continue; }
+ if ( duplicates.has(fingerprint) ) {
+ discardedCount += 1;
+ continue;
+ }
duplicates.add(fingerprint);
var args = reader.args();
if ( args.length < 4 ) { continue; }
@@ -264,6 +272,19 @@
scriptletDB = new µb.staticExtFilteringEngine.HostnameBasedDB(selfie);
};
+ Object.defineProperties(api, {
+ acceptedCount: {
+ get: function() {
+ return acceptedCount;
+ }
+ },
+ discardedCount: {
+ get: function() {
+ return discardedCount;
+ }
+ }
+ });
+
return api;
})();
diff --git a/src/js/static-ext-filtering.js b/src/js/static-ext-filtering.js
index 73310fc37..ec274eeaf 100644
--- a/src/js/static-ext-filtering.js
+++ b/src/js/static-ext-filtering.js
@@ -668,6 +668,23 @@
};
};
+ Object.defineProperties(api, {
+ acceptedCount: {
+ get: function() {
+ return µb.cosmeticFilteringEngine.acceptedCount +
+ µb.scriptletFilteringEngine.acceptedCount +
+ µb.htmlFilteringEngine.acceptedCount;
+ }
+ },
+ discardedCount: {
+ get: function() {
+ return µb.cosmeticFilteringEngine.discardedCount +
+ µb.scriptletFilteringEngine.discardedCount +
+ µb.htmlFilteringEngine.discardedCount;
+ }
+ }
+ });
+
api.fromSelfie = function(selfie) {
µb.cosmeticFilteringEngine.fromSelfie(selfie.cosmetic);
µb.scriptletFilteringEngine.fromSelfie(selfie.scriptlets);
diff --git a/src/js/storage.js b/src/js/storage.js
index d8dfaf1d0..f172bf172 100644
--- a/src/js/storage.js
+++ b/src/js/storage.js
@@ -562,14 +562,16 @@
var applyCompiledFilters = function(assetKey, compiled) {
var snfe = µb.staticNetFilteringEngine,
- cfe = µb.cosmeticFilteringEngine,
- acceptedCount = snfe.acceptedCount + cfe.acceptedCount,
- discardedCount = snfe.discardedCount + cfe.discardedCount;
+ sxfe = µb.staticExtFilteringEngine,
+ acceptedCount = snfe.acceptedCount + sxfe.acceptedCount,
+ discardedCount = snfe.discardedCount + sxfe.discardedCount;
µb.applyCompiledFilters(compiled, assetKey === µb.userFiltersPath);
if ( µb.availableFilterLists.hasOwnProperty(assetKey) ) {
var entry = µb.availableFilterLists[assetKey];
- entry.entryCount = snfe.acceptedCount + cfe.acceptedCount - acceptedCount;
- entry.entryUsedCount = entry.entryCount - (snfe.discardedCount + cfe.discardedCount - discardedCount);
+ entry.entryCount = snfe.acceptedCount + sxfe.acceptedCount -
+ acceptedCount;
+ entry.entryUsedCount = entry.entryCount -
+ (snfe.discardedCount + sxfe.discardedCount - discardedCount);
}
loadedListKeys.push(assetKey);
};