From 13927fc20367ea19796111dc691e899b9195a637 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Wed, 28 Sep 2022 09:37:10 -0400 Subject: [PATCH] Rules with `excludedResourceTypes` must not block `main_frame` Related issue: - https://github.com/uBlockOrigin/uBlock-issues/issues/2298 --- src/js/static-net-filtering.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/js/static-net-filtering.js b/src/js/static-net-filtering.js index 3f16c89d2..6115c81d8 100644 --- a/src/js/static-net-filtering.js +++ b/src/js/static-net-filtering.js @@ -1279,15 +1279,18 @@ const FilterNotType = class { static dnrFromCompiled(args, rule) { rule.condition = rule.condition || {}; - if ( rule.condition.excludedResourceTypes === undefined ) { - rule.condition.excludedResourceTypes = []; + const rc = rule.condition; + if ( rc.excludedResourceTypes === undefined ) { + rc.excludedResourceTypes = [ 'main_frame' ]; } let bits = args[1]; for ( let i = 1; bits !== 0 && i < typeValueToTypeName.length; i++ ) { const bit = 1 << (i - 1); if ( (bits & bit) === 0 ) { continue; } bits &= ~bit; - rule.condition.excludedResourceTypes.push(`${typeValueToTypeName[i]}`); + const type = typeValueToTypeName[i]; + if ( rc.excludedResourceTypes.includes(type) ) { continue; } + rc.excludedResourceTypes.push(type); } }