1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-11-05 18:32:30 +01:00

Forbid usage of opening comment /* in query-selectable test

Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1806
This commit is contained in:
Raymond Hill 2021-11-08 09:13:58 -05:00
parent d8fea7f568
commit 630d436342
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2

View File

@ -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;
}