This commit is contained in:
gorhill 2016-03-17 13:56:21 -04:00
parent 47b0ea83f7
commit 36e681e39b
4 changed files with 18 additions and 16 deletions

View File

@ -94,7 +94,7 @@ return {
// read-only // read-only
systemSettings: { systemSettings: {
compiledMagic: 'nytangedtvcz', compiledMagic: 'nytangedtvcz',
selfieMagic: 'xtsldiywhvgc' selfieMagic: 'emzolxctioww'
}, },
restoreBackupSettings: { restoreBackupSettings: {

View File

@ -634,7 +634,7 @@ FilterContainer.prototype.reset = function() {
this.µburi = µb.URI; this.µburi = µb.URI;
this.frozen = false; this.frozen = false;
this.acceptedCount = 0; this.acceptedCount = 0;
this.duplicateCount = 0; this.discardedCount = 0;
this.duplicateBuster = {}; this.duplicateBuster = {};
this.selectorCache = {}; this.selectorCache = {};
@ -921,7 +921,7 @@ FilterContainer.prototype.fromCompiledContent = function(text, lineBeg, skip) {
this.acceptedCount += 1; this.acceptedCount += 1;
if ( this.duplicateBuster.hasOwnProperty(line) ) { if ( this.duplicateBuster.hasOwnProperty(line) ) {
this.duplicateCount += 1; this.discardedCount += 1;
continue; continue;
} }
this.duplicateBuster[line] = true; this.duplicateBuster[line] = true;
@ -1029,6 +1029,8 @@ FilterContainer.prototype.skipCompiledContent = function(text, lineBeg) {
if ( lineEnd === -1 ) { if ( lineEnd === -1 ) {
lineEnd = textEnd; lineEnd = textEnd;
} }
this.acceptedCount += 1;
this.discardedCount += 1;
lineBeg = lineEnd + 1; lineBeg = lineEnd + 1;
} }
return textEnd; return textEnd;
@ -1187,7 +1189,7 @@ FilterContainer.prototype.toSelfie = function() {
return { return {
acceptedCount: this.acceptedCount, acceptedCount: this.acceptedCount,
duplicateCount: this.duplicateCount, discardedCount: this.discardedCount,
hostnameSpecificFilters: selfieFromDict(this.hostnameFilters), hostnameSpecificFilters: selfieFromDict(this.hostnameFilters),
entitySpecificFilters: this.entityFilters, entitySpecificFilters: this.entityFilters,
lowGenericHide: selfieFromDict(this.lowGenericHide), lowGenericHide: selfieFromDict(this.lowGenericHide),
@ -1251,7 +1253,7 @@ FilterContainer.prototype.fromSelfie = function(selfie) {
}; };
this.acceptedCount = selfie.acceptedCount; this.acceptedCount = selfie.acceptedCount;
this.duplicateCount = selfie.duplicateCount; this.discardedCount = selfie.discardedCount;
this.hostnameFilters = dictFromSelfie(selfie.hostnameSpecificFilters); this.hostnameFilters = dictFromSelfie(selfie.hostnameSpecificFilters);
this.entityFilters = selfie.entitySpecificFilters; this.entityFilters = selfie.entitySpecificFilters;
this.lowGenericHide = dictFromSelfie(selfie.lowGenericHide); this.lowGenericHide = dictFromSelfie(selfie.lowGenericHide);
@ -1496,7 +1498,7 @@ FilterContainer.prototype.retrieveDomainSelectors = function(request) {
/******************************************************************************/ /******************************************************************************/
FilterContainer.prototype.getFilterCount = function() { FilterContainer.prototype.getFilterCount = function() {
return this.acceptedCount - this.duplicateCount; return this.acceptedCount - this.discardedCount;
}; };
/******************************************************************************/ /******************************************************************************/

View File

@ -1686,7 +1686,7 @@ FilterContainer.prototype.reset = function() {
this.rejectedCount = 0; this.rejectedCount = 0;
this.allowFilterCount = 0; this.allowFilterCount = 0;
this.blockFilterCount = 0; this.blockFilterCount = 0;
this.duplicateCount = 0; this.discardedCount = 0;
this.duplicateBuster = {}; this.duplicateBuster = {};
this.categories = Object.create(null); this.categories = Object.create(null);
this.filterParser.reset(); this.filterParser.reset();
@ -1782,7 +1782,7 @@ FilterContainer.prototype.toSelfie = function() {
rejectedCount: this.rejectedCount, rejectedCount: this.rejectedCount,
allowFilterCount: this.allowFilterCount, allowFilterCount: this.allowFilterCount,
blockFilterCount: this.blockFilterCount, blockFilterCount: this.blockFilterCount,
duplicateCount: this.duplicateCount, discardedCount: this.discardedCount,
categories: categoriesToSelfie(this.categories) categories: categoriesToSelfie(this.categories)
}; };
}; };
@ -1796,7 +1796,7 @@ FilterContainer.prototype.fromSelfie = function(selfie) {
this.rejectedCount = selfie.rejectedCount; this.rejectedCount = selfie.rejectedCount;
this.allowFilterCount = selfie.allowFilterCount; this.allowFilterCount = selfie.allowFilterCount;
this.blockFilterCount = selfie.blockFilterCount; this.blockFilterCount = selfie.blockFilterCount;
this.duplicateCount = selfie.duplicateCount; this.discardedCount = selfie.discardedCount;
var catKey, tokenKey; var catKey, tokenKey;
var dict = this.categories, subdict; var dict = this.categories, subdict;
@ -2086,13 +2086,13 @@ FilterContainer.prototype.fromCompiledContent = function(text, lineBeg) {
entry = bucket['.'] = new FilterHostnameDict(); entry = bucket['.'] = new FilterHostnameDict();
} }
if ( entry.add(fields[2]) === false ) { if ( entry.add(fields[2]) === false ) {
this.duplicateCount += 1; this.discardedCount += 1;
} }
continue; continue;
} }
if ( this.duplicateBuster.hasOwnProperty(line) ) { if ( this.duplicateBuster.hasOwnProperty(line) ) {
this.duplicateCount += 1; this.discardedCount += 1;
continue; continue;
} }
this.duplicateBuster[line] = true; this.duplicateBuster[line] = true;
@ -2569,7 +2569,7 @@ FilterContainer.prototype.toResultString = function(verbose) {
/******************************************************************************/ /******************************************************************************/
FilterContainer.prototype.getFilterCount = function() { FilterContainer.prototype.getFilterCount = function() {
return this.acceptedCount - this.duplicateCount; return this.acceptedCount - this.discardedCount;
}; };
/******************************************************************************/ /******************************************************************************/

View File

@ -180,11 +180,11 @@
var snfe = µb.staticNetFilteringEngine; var snfe = µb.staticNetFilteringEngine;
var cfe = µb.cosmeticFilteringEngine; var cfe = µb.cosmeticFilteringEngine;
var acceptedCount = snfe.acceptedCount + cfe.acceptedCount; var acceptedCount = snfe.acceptedCount + cfe.acceptedCount;
var duplicateCount = snfe.duplicateCount + cfe.duplicateCount; var discardedCount = snfe.discardedCount + cfe.discardedCount;
µb.applyCompiledFilters(compiledFilters, true); µb.applyCompiledFilters(compiledFilters, true);
var entry = µb.remoteBlacklists[µb.userFiltersPath]; var entry = µb.remoteBlacklists[µb.userFiltersPath];
var deltaEntryCount = snfe.acceptedCount + cfe.acceptedCount - acceptedCount; var deltaEntryCount = snfe.acceptedCount + cfe.acceptedCount - acceptedCount;
var deltaEntryUsedCount = deltaEntryCount - (snfe.duplicateCount + cfe.duplicateCount - duplicateCount); var deltaEntryUsedCount = deltaEntryCount - (snfe.discardedCount + cfe.discardedCount - discardedCount);
entry.entryCount += deltaEntryCount; entry.entryCount += deltaEntryCount;
entry.entryUsedCount += deltaEntryUsedCount; entry.entryUsedCount += deltaEntryUsedCount;
vAPI.storage.set({ 'remoteBlacklists': µb.remoteBlacklists }); vAPI.storage.set({ 'remoteBlacklists': µb.remoteBlacklists });
@ -417,12 +417,12 @@
var snfe = µb.staticNetFilteringEngine; var snfe = µb.staticNetFilteringEngine;
var cfe = µb.cosmeticFilteringEngine; var cfe = µb.cosmeticFilteringEngine;
var acceptedCount = snfe.acceptedCount + cfe.acceptedCount; var acceptedCount = snfe.acceptedCount + cfe.acceptedCount;
var duplicateCount = snfe.duplicateCount + cfe.duplicateCount; var discardedCount = snfe.discardedCount + cfe.discardedCount;
µb.applyCompiledFilters(compiled, path === µb.userFiltersPath); µb.applyCompiledFilters(compiled, path === µb.userFiltersPath);
if ( µb.remoteBlacklists.hasOwnProperty(path) ) { if ( µb.remoteBlacklists.hasOwnProperty(path) ) {
var entry = µb.remoteBlacklists[path]; var entry = µb.remoteBlacklists[path];
entry.entryCount = snfe.acceptedCount + cfe.acceptedCount - acceptedCount; entry.entryCount = snfe.acceptedCount + cfe.acceptedCount - acceptedCount;
entry.entryUsedCount = entry.entryCount - (snfe.duplicateCount + cfe.duplicateCount - duplicateCount); entry.entryUsedCount = entry.entryCount - (snfe.discardedCount + cfe.discardedCount - discardedCount);
} }
}; };