Skip to content

Commit

Permalink
fix regression from 29926ee regarding filter used count per list
Browse files Browse the repository at this point in the history
  • Loading branch information
gorhill authored and JustOff committed Sep 3, 2020
1 parent dd34b0c commit eda5aad
Showing 1 changed file with 17 additions and 14 deletions.
31 changes: 17 additions & 14 deletions src/js/static-net-filtering.js
Original file line number Diff line number Diff line change
Expand Up @@ -1987,7 +1987,10 @@ FilterContainer.prototype.freeze = function() {
unserialize = µb.CompiledLineIO.unserialize;

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 bits = args[0];
Expand Down Expand Up @@ -2296,12 +2299,12 @@ FilterContainer.prototype.fromCompiledContent = function(reader) {
// 0 = network filters
reader.select(0);
while ( reader.next() ) {
this.acceptedCount += 1;
if ( this.goodFilters.has(reader.line) ) {
this.discardedCount += 1;
continue;
} else {
this.goodFilters.add(reader.line);
}
this.goodFilters.add(reader.line);
this.acceptedCount += 1;
}

// 1 = network filters: bad filters
Expand All @@ -2311,12 +2314,12 @@ FilterContainer.prototype.fromCompiledContent = function(reader) {
// incrementally add filters (through "Block element" for example).
reader.select(1);
while ( reader.next() ) {
this.acceptedCount += 1;
if ( this.badFilters.has(reader.line) ) {
this.discardedCount += 1;
continue;
} else {
this.badFilters.add(µb.orphanizeString(reader.line));
}
this.badFilters.add(µb.orphanizeString(reader.line));
this.acceptedCount += 1;
}
};

Expand Down Expand Up @@ -2500,20 +2503,20 @@ FilterContainer.prototype.matchStringExactType = function(context, requestURL, r
if ( requestType === 'generichide' ) {
return this.matchStringGenericHide(context, requestURL);
}
var type = typeNameToTypeValue[requestType];
if ( type === undefined ) {
return 0;
}
let type = typeNameToTypeValue[requestType];
if ( type === undefined ) { return 0; }

// 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
pageHostnameRegister = context.pageHostname || '';
requestHostnameRegister = µb.URI.hostnameFromURI(url);

var party = isFirstParty(context.pageDomain, requestHostnameRegister) ? FirstParty : ThirdParty,
categories = this.categories,
let party = isFirstParty(context.pageDomain, requestHostnameRegister)
? FirstParty
: ThirdParty;
let categories = this.categories,
catBits, bucket;

this.fRegister = null;
Expand Down

1 comment on commit eda5aad

@JustOff
Copy link
Collaborator

@JustOff JustOff commented on eda5aad Sep 3, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tag #258.

Please sign in to comment.