From 630d436342f50006e53c76d3f3149a0a8c48eb7a Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Mon, 8 Nov 2021 09:13:58 -0500 Subject: [PATCH] Forbid usage of opening comment `/*` in query-selectable test Related issue: - https://github.com/uBlockOrigin/uBlock-issues/issues/1806 --- src/js/static-filtering-parser.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/js/static-filtering-parser.js b/src/js/static-filtering-parser.js index 6e57710a70344..98301f3dab868 100644 --- a/src/js/static-filtering-parser.js +++ b/src/js/static-filtering-parser.js @@ -333,7 +333,7 @@ const Parser = class { if ( this.selectorCompiler.compile( selector, - hasBits(this.flavorBits, BITFlavorExtStrong), + hasBits(this.flavorBits, BITFlavorExtStrong | BITFlavorExtStyle), this.result ) === false ) { @@ -1450,11 +1450,15 @@ Parser.prototype.SelectorCompiler = class { return true; } + // https://github.com/uBlockOrigin/uBlock-issues/issues/1806 + // Forbid instances of: + // - opening comment `/*` querySelectable(s) { if ( this.reSimpleSelector.test(s) ) { return true; } if ( this.div === null ) { return true; } try { this.div.querySelector(`${s},${s}:not(#foo)`); + if ( s.includes('/*') ) { return false; } } catch (ex) { return false; }