From a8946c8d73efdb4365c0b5522262c934f2641e80 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Sat, 27 Apr 2019 07:04:43 -0400 Subject: [PATCH] Fix list lookup of multi-hostname `domain=` filters in logger Related commit: - https://github.com/gorhill/uBlock/commit/3f3a1543ea7fa51d700157a7f6bf0da08dd7a32b The regression was preventing uBO to find from which list a filter originated. This affected only filters for which the `domain=` option had multiple hostnames. --- src/js/static-net-filtering.js | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/src/js/static-net-filtering.js b/src/js/static-net-filtering.js index f01d4fad7..7a8e72db8 100644 --- a/src/js/static-net-filtering.js +++ b/src/js/static-net-filtering.js @@ -946,11 +946,9 @@ const filterOrigin = new (class { return FilterOriginMixedSet.compile(domainOpt, wrapped); } - logData(f, arg1, arg2) { - const out = f.wrapped.logData(); - out.compiled = [ f.fid, arg1, out.compiled ]; + logData(out, domainOpt) { if ( out.opts !== undefined ) { out.opts += ','; } - out.opts = `domain=${arg2 || arg1}`; + out.opts = `domain=${domainOpt}`; return out; } @@ -1000,7 +998,9 @@ const FilterOriginHit = class { } logData() { - return filterOrigin.logData(this, this.hostname); + const out = this.wrapped.logData(); + out.compiled = [ this.fid, this.hostname, out.compiled ]; + return filterOrigin.logData(out, this.hostname); } compile() { @@ -1041,7 +1041,9 @@ const FilterOriginMiss = class { } logData() { - return filterOrigin.logData(this, this.hostname, `~${this.hostname}`); + const out = this.wrapped.logData(); + out.compiled = [ this.fid, this.hostname, out.compiled ]; + return filterOrigin.logData(out, `~${this.hostname}`); } compile() { @@ -1086,7 +1088,9 @@ const FilterOriginHitSet = class { } logData() { - return filterOrigin.logData(this, this.domainOpt); + const out = this.wrapped.logData(); + out.compiled = [ this.fid, this.domainOpt, null, out.compiled ]; + return filterOrigin.logData(out, this.domainOpt); } compile() { @@ -1139,7 +1143,9 @@ const FilterOriginMissSet = class { } logData() { - return filterOrigin.logData(this, this.domainOpt); + const out = this.wrapped.logData(); + out.compiled = [ this.fid, this.domainOpt, null, out.compiled ]; + return filterOrigin.logData(out, this.domainOpt); } compile() { @@ -1206,7 +1212,9 @@ const FilterOriginMixedSet = class { } logData() { - return filterOrigin.logData(this, this.domainOpt); + const out = this.wrapped.logData(); + out.compiled = [ this.fid, this.domainOpt, null, null, out.compiled ]; + return filterOrigin.logData(out, this.domainOpt); } compile() {