Skip to content

Commit

Permalink
Forbid usage of opening comment /* in query-selectable test
Browse files Browse the repository at this point in the history
  • Loading branch information
gorhill committed Nov 8, 2021
1 parent d8fea7f commit 630d436
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/js/static-filtering-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ const Parser = class {
if (
this.selectorCompiler.compile(
selector,
hasBits(this.flavorBits, BITFlavorExtStrong),
hasBits(this.flavorBits, BITFlavorExtStrong | BITFlavorExtStyle),
this.result
) === false
) {
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 630d436

Please sign in to comment.