From 537271f26bcb99577ab978f4ebff5592593c4e32 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Sat, 20 Apr 2019 17:25:32 -0400 Subject: [PATCH] Fix how `*$`, `|https://`, `http://` filters are reported in logger This was a regression introduced in https://github.com/gorhill/uBlock/commit/3f3a1543ea7fa51d700157a7f6bf0da08dd7a32b Reported in issue: - https://github.com/uBlockOrigin/uBlock-issues/issues/528#issuecomment-485163348 --- src/js/static-net-filtering.js | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/src/js/static-net-filtering.js b/src/js/static-net-filtering.js index 3c2f19a57..5356bc1fe 100644 --- a/src/js/static-net-filtering.js +++ b/src/js/static-net-filtering.js @@ -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 });