From f9ce06977d57bd579db0549149a4b8bf4d0141c3 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Mon, 18 Nov 2024 14:05:19 -0500 Subject: [PATCH] [mv3] Fix `removeparam` potentially causing invalid DNR rules --- src/js/static-net-filtering.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/js/static-net-filtering.js b/src/js/static-net-filtering.js index bc14d71db..7e7e8bd5f 100644 --- a/src/js/static-net-filtering.js +++ b/src/js/static-net-filtering.js @@ -4652,11 +4652,13 @@ StaticNetFilteringEngine.prototype.dnrFromCompiled = function(op, context, ...ar }; } if ( rule.condition.resourceTypes === undefined ) { - rule.condition.resourceTypes = [ - 'main_frame', - 'sub_frame', - 'xmlhttprequest', - ]; + if ( rule.condition.excludedResourceTypes === undefined ) { + rule.condition.resourceTypes = [ + 'main_frame', + 'sub_frame', + 'xmlhttprequest', + ]; + } } // https://github.com/uBlockOrigin/uBOL-home/issues/140 // Mitigate until DNR API flaw is addressed by browser vendors