From 72dabcac6680decddf30b98e8d9d93f34f3b7025 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Sun, 1 Jan 2023 09:20:32 -0500 Subject: [PATCH] Disallow `-abp-...` filters if not using `#?#` Related feedback: - https://github.com/uBlockOrigin/uBlock-issues/issues/2435#issuecomment-1367805459 --- src/js/static-filtering-parser.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/js/static-filtering-parser.js b/src/js/static-filtering-parser.js index 8353d17df..d29fc9088 100644 --- a/src/js/static-filtering-parser.js +++ b/src/js/static-filtering-parser.js @@ -1536,7 +1536,6 @@ Parser.prototype.SelectorCompiler = class { default: break; } - if ( head ) { if ( args ) { this.astFlatten(head.data, args); @@ -1548,7 +1547,9 @@ Parser.prototype.SelectorCompiler = class { } } if ( data.type !== 'PseudoClassSelector' ) { return; } - + if ( data.name.startsWith('-abp-') && this.asProcedural === false ) { + return; + } // Post-analysis, mind: // - https://w3c.github.io/csswg-drafts/selectors-4/#has-pseudo // - https://w3c.github.io/csswg-drafts/selectors-4/#negation