From b22cf24bd52db5bb2e7976f5cb67e3f543d8ebc1 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Mon, 14 Dec 2020 11:22:08 -0500 Subject: [PATCH] Fix look-up of specific-generic filters entity-less hostnames Related feedback: - https://github.com/uBlockOrigin/uBlock-issues/issues/688#issuecomment-743755956 --- src/js/html-filtering.js | 14 ++++++++------ src/js/scriptlet-filtering.js | 10 ++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/js/html-filtering.js b/src/js/html-filtering.js index 4ca03ce50..3d0f03cc9 100644 --- a/src/js/html-filtering.js +++ b/src/js/html-filtering.js @@ -368,12 +368,14 @@ hostname, [ plains, exceptions, procedurals, exceptions ] ); - if ( details.entity !== '' ) { - filterDB.retrieve( - `${hostname.slice(0, -details.domain.length)}${details.entity}`, - [ plains, exceptions, procedurals, exceptions ] - ); - } + const entity = details.entity !== '' + ? `${hostname.slice(0, -details.domain.length)}${details.entity}` + : '*'; + filterDB.retrieve( + entity, + [ plains, exceptions, procedurals, exceptions ], + 1 + ); if ( plains.size === 0 && procedurals.size === 0 ) { return; } diff --git a/src/js/scriptlet-filtering.js b/src/js/scriptlet-filtering.js index f348b0ee3..a03e4a04f 100644 --- a/src/js/scriptlet-filtering.js +++ b/src/js/scriptlet-filtering.js @@ -318,12 +318,10 @@ sessionScriptletDB.retrieve([ null, $exceptions ]); } scriptletDB.retrieve(hostname, [ $scriptlets, $exceptions ]); - if ( request.entity !== '' ) { - scriptletDB.retrieve( - `${hostname.slice(0, -request.domain.length)}${request.entity}`, - [ $scriptlets, $exceptions ] - ); - } + const entity = request.entity !== '' + ? `${hostname.slice(0, -request.domain.length)}${request.entity}` + : '*'; + scriptletDB.retrieve(entity, [ $scriptlets, $exceptions ], 1); if ( $scriptlets.size === 0 ) { return; } const loggerEnabled = µb.logger.enabled;