From 36e681e39b0a7562db527b3c325fa87e19837aff Mon Sep 17 00:00:00 2001 From: gorhill Date: Thu, 17 Mar 2016 13:56:21 -0400 Subject: [PATCH] this fixes #1484 --- src/js/background.js | 2 +- src/js/cosmetic-filtering.js | 12 +++++++----- src/js/static-net-filtering.js | 12 ++++++------ src/js/storage.js | 8 ++++---- 4 files changed, 18 insertions(+), 16 deletions(-) diff --git a/src/js/background.js b/src/js/background.js index e7e630ca6..c8de8f409 100644 --- a/src/js/background.js +++ b/src/js/background.js @@ -94,7 +94,7 @@ return { // read-only systemSettings: { compiledMagic: 'nytangedtvcz', - selfieMagic: 'xtsldiywhvgc' + selfieMagic: 'emzolxctioww' }, restoreBackupSettings: { diff --git a/src/js/cosmetic-filtering.js b/src/js/cosmetic-filtering.js index ebd827759..8bf7e8e44 100644 --- a/src/js/cosmetic-filtering.js +++ b/src/js/cosmetic-filtering.js @@ -634,7 +634,7 @@ FilterContainer.prototype.reset = function() { this.µburi = µb.URI; this.frozen = false; this.acceptedCount = 0; - this.duplicateCount = 0; + this.discardedCount = 0; this.duplicateBuster = {}; this.selectorCache = {}; @@ -921,7 +921,7 @@ FilterContainer.prototype.fromCompiledContent = function(text, lineBeg, skip) { this.acceptedCount += 1; if ( this.duplicateBuster.hasOwnProperty(line) ) { - this.duplicateCount += 1; + this.discardedCount += 1; continue; } this.duplicateBuster[line] = true; @@ -1029,6 +1029,8 @@ FilterContainer.prototype.skipCompiledContent = function(text, lineBeg) { if ( lineEnd === -1 ) { lineEnd = textEnd; } + this.acceptedCount += 1; + this.discardedCount += 1; lineBeg = lineEnd + 1; } return textEnd; @@ -1187,7 +1189,7 @@ FilterContainer.prototype.toSelfie = function() { return { acceptedCount: this.acceptedCount, - duplicateCount: this.duplicateCount, + discardedCount: this.discardedCount, hostnameSpecificFilters: selfieFromDict(this.hostnameFilters), entitySpecificFilters: this.entityFilters, lowGenericHide: selfieFromDict(this.lowGenericHide), @@ -1251,7 +1253,7 @@ FilterContainer.prototype.fromSelfie = function(selfie) { }; this.acceptedCount = selfie.acceptedCount; - this.duplicateCount = selfie.duplicateCount; + this.discardedCount = selfie.discardedCount; this.hostnameFilters = dictFromSelfie(selfie.hostnameSpecificFilters); this.entityFilters = selfie.entitySpecificFilters; this.lowGenericHide = dictFromSelfie(selfie.lowGenericHide); @@ -1496,7 +1498,7 @@ FilterContainer.prototype.retrieveDomainSelectors = function(request) { /******************************************************************************/ FilterContainer.prototype.getFilterCount = function() { - return this.acceptedCount - this.duplicateCount; + return this.acceptedCount - this.discardedCount; }; /******************************************************************************/ diff --git a/src/js/static-net-filtering.js b/src/js/static-net-filtering.js index c8b432321..f5e5242ce 100644 --- a/src/js/static-net-filtering.js +++ b/src/js/static-net-filtering.js @@ -1686,7 +1686,7 @@ FilterContainer.prototype.reset = function() { this.rejectedCount = 0; this.allowFilterCount = 0; this.blockFilterCount = 0; - this.duplicateCount = 0; + this.discardedCount = 0; this.duplicateBuster = {}; this.categories = Object.create(null); this.filterParser.reset(); @@ -1782,7 +1782,7 @@ FilterContainer.prototype.toSelfie = function() { rejectedCount: this.rejectedCount, allowFilterCount: this.allowFilterCount, blockFilterCount: this.blockFilterCount, - duplicateCount: this.duplicateCount, + discardedCount: this.discardedCount, categories: categoriesToSelfie(this.categories) }; }; @@ -1796,7 +1796,7 @@ FilterContainer.prototype.fromSelfie = function(selfie) { this.rejectedCount = selfie.rejectedCount; this.allowFilterCount = selfie.allowFilterCount; this.blockFilterCount = selfie.blockFilterCount; - this.duplicateCount = selfie.duplicateCount; + this.discardedCount = selfie.discardedCount; var catKey, tokenKey; var dict = this.categories, subdict; @@ -2086,13 +2086,13 @@ FilterContainer.prototype.fromCompiledContent = function(text, lineBeg) { entry = bucket['.'] = new FilterHostnameDict(); } if ( entry.add(fields[2]) === false ) { - this.duplicateCount += 1; + this.discardedCount += 1; } continue; } if ( this.duplicateBuster.hasOwnProperty(line) ) { - this.duplicateCount += 1; + this.discardedCount += 1; continue; } this.duplicateBuster[line] = true; @@ -2569,7 +2569,7 @@ FilterContainer.prototype.toResultString = function(verbose) { /******************************************************************************/ FilterContainer.prototype.getFilterCount = function() { - return this.acceptedCount - this.duplicateCount; + return this.acceptedCount - this.discardedCount; }; /******************************************************************************/ diff --git a/src/js/storage.js b/src/js/storage.js index f402b5584..96b0e5d03 100644 --- a/src/js/storage.js +++ b/src/js/storage.js @@ -180,11 +180,11 @@ var snfe = µb.staticNetFilteringEngine; var cfe = µb.cosmeticFilteringEngine; var acceptedCount = snfe.acceptedCount + cfe.acceptedCount; - var duplicateCount = snfe.duplicateCount + cfe.duplicateCount; + var discardedCount = snfe.discardedCount + cfe.discardedCount; µb.applyCompiledFilters(compiledFilters, true); var entry = µb.remoteBlacklists[µb.userFiltersPath]; 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.entryUsedCount += deltaEntryUsedCount; vAPI.storage.set({ 'remoteBlacklists': µb.remoteBlacklists }); @@ -417,12 +417,12 @@ var snfe = µb.staticNetFilteringEngine; var cfe = µb.cosmeticFilteringEngine; var acceptedCount = snfe.acceptedCount + cfe.acceptedCount; - var duplicateCount = snfe.duplicateCount + cfe.duplicateCount; + var discardedCount = snfe.discardedCount + cfe.discardedCount; µb.applyCompiledFilters(compiled, path === µb.userFiltersPath); if ( µb.remoteBlacklists.hasOwnProperty(path) ) { var entry = µb.remoteBlacklists[path]; 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); } };