fix regression from cabb0d36b6 regarding filter used count per list

This commit is contained in:
Raymond Hill 2018-10-24 06:55:04 -03:00
parent aabd4004c0
commit 3a85158dbb
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
1 changed files with 17 additions and 14 deletions

View File

@ -1976,7 +1976,10 @@ FilterContainer.prototype.freeze = function() {
unserialize = µb.CompiledLineIO.unserialize; unserialize = µb.CompiledLineIO.unserialize;
for ( let line of this.goodFilters ) { for ( let line of this.goodFilters ) {
if ( this.badFilters.has(line) ) { continue; } if ( this.badFilters.has(line) ) {
this.discardedCount += 1;
continue;
}
let args = unserialize(line); let args = unserialize(line);
let bits = args[0]; let bits = args[0];
@ -2263,12 +2266,12 @@ FilterContainer.prototype.fromCompiledContent = function(reader) {
// 0 = network filters // 0 = network filters
reader.select(0); reader.select(0);
while ( reader.next() ) { while ( reader.next() ) {
this.acceptedCount += 1;
if ( this.goodFilters.has(reader.line) ) { if ( this.goodFilters.has(reader.line) ) {
this.discardedCount += 1; this.discardedCount += 1;
continue; } else {
this.goodFilters.add(reader.line);
} }
this.goodFilters.add(reader.line);
this.acceptedCount += 1;
} }
// 1 = network filters: bad filters // 1 = network filters: bad filters
@ -2278,12 +2281,12 @@ FilterContainer.prototype.fromCompiledContent = function(reader) {
// incrementally add filters (through "Block element" for example). // incrementally add filters (through "Block element" for example).
reader.select(1); reader.select(1);
while ( reader.next() ) { while ( reader.next() ) {
this.acceptedCount += 1;
if ( this.badFilters.has(reader.line) ) { if ( this.badFilters.has(reader.line) ) {
this.discardedCount += 1; this.discardedCount += 1;
continue; } else {
this.badFilters.add(µb.orphanizeString(reader.line));
} }
this.badFilters.add(µb.orphanizeString(reader.line));
this.acceptedCount += 1;
} }
}; };
@ -2467,20 +2470,20 @@ FilterContainer.prototype.matchStringExactType = function(context, requestURL, r
if ( requestType === 'generichide' ) { if ( requestType === 'generichide' ) {
return this.matchStringGenericHide(requestURL); return this.matchStringGenericHide(requestURL);
} }
var type = typeNameToTypeValue[requestType]; let type = typeNameToTypeValue[requestType];
if ( type === undefined ) { if ( type === undefined ) { return 0; }
return 0;
}
// Prime tokenizer: we get a normalized URL in return. // Prime tokenizer: we get a normalized URL in return.
var url = this.urlTokenizer.setURL(requestURL); let url = this.urlTokenizer.setURL(requestURL);
// These registers will be used by various filters // These registers will be used by various filters
pageHostnameRegister = context.pageHostname || ''; pageHostnameRegister = context.pageHostname || '';
requestHostnameRegister = µb.URI.hostnameFromURI(url); requestHostnameRegister = µb.URI.hostnameFromURI(url);
var party = isFirstParty(context.pageDomain, requestHostnameRegister) ? FirstParty : ThirdParty, let party = isFirstParty(context.pageDomain, requestHostnameRegister)
categories = this.categories, ? FirstParty
: ThirdParty;
let categories = this.categories,
catBits, bucket; catBits, bucket;
this.fRegister = null; this.fRegister = null;