Fix how `*$`, `|https://`, `http://` filters are reported in logger

This was a regression introduced in
3f3a1543ea

Reported in issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/528#issuecomment-485163348
This commit is contained in:
Raymond Hill 2019-04-20 17:25:32 -04:00
parent a52b07ff6e
commit 537271f26b
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
1 changed files with 15 additions and 13 deletions

View File

@ -1190,7 +1190,8 @@ const FilterJustOrigin = class {
return {
raw: '*',
regex: '^',
compiled: this.h
compiled: this.h,
opts: `domain=${this.h}`,
};
}
@ -1213,11 +1214,10 @@ const FilterHTTPSJustOrigin = class extends FilterJustOrigin {
}
logData() {
return {
raw: '|https://',
regex: '^https://',
compiled: this.h
};
const out = super.logData();
out.raw = '|https://';
out.regex = '^https://';
return out;
}
static load(args) {
@ -1235,11 +1235,10 @@ const FilterHTTPJustOrigin = class extends FilterJustOrigin {
}
logData() {
return {
raw: '|http://',
regex: '^http://',
compiled: this.h
};
const out = super.logData();
out.raw = '|https://';
out.regex = '^https://';
return out;
}
static load(args) {
@ -1258,8 +1257,6 @@ const FilterPair = class {
}
get size() {
if ( this.f1 === undefined && this.f2 === undefined ) { return 0; }
if ( this.f1 === undefined || this.f2 === undefined ) { return 1; }
return 2;
}
@ -2928,6 +2925,11 @@ FilterContainer.prototype.bucketHistogram = function() {
const results = [];
for ( const [ bits, category ] of this.categories ) {
for ( const [ th, f ] of category ) {
if ( f instanceof FilterPair ) {
const token = µBlock.urlTokenizer.stringFromTokenHash(th);
results.push({ bits: bits.toString(16), token, size: f.size, f });
continue;
}
if ( f instanceof FilterBucket ) {
const token = µBlock.urlTokenizer.stringFromTokenHash(th);
results.push({ bits: bits.toString(16), token, size: f.size, f });