Test for unsupported pseudo operators after normalization

Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2356
This commit is contained in:
Raymond Hill 2022-11-10 10:32:22 -05:00
parent 2e134a0c46
commit b1a14794bf
No known key found for this signature in database
GPG key ID: 25E1490B761470C2

View file

@ -1549,15 +1549,14 @@ Parser.prototype.SelectorCompiler = class {
// Post-analysis // Post-analysis
// Mind https://w3c.github.io/csswg-drafts/selectors-4/#has-pseudo // Mind https://w3c.github.io/csswg-drafts/selectors-4/#has-pseudo
if ( data.name.startsWith('-abp-') ) {
data.type = 'Error';
return;
}
data.name = this.normalizedOperators.get(data.name) || data.name; data.name = this.normalizedOperators.get(data.name) || data.name;
if ( this.proceduralOperatorNames.has(data.name) ) { if ( this.proceduralOperatorNames.has(data.name) ) {
data.type = 'ProceduralSelector'; data.type = 'ProceduralSelector';
} else if ( this.proceduralActionNames.has(data.name) ) { } else if ( this.proceduralActionNames.has(data.name) ) {
data.type = 'ActionSelector'; data.type = 'ActionSelector';
} else if ( data.name.startsWith('-abp-') ) {
data.type = 'Error';
return;
} }
if ( this.maybeProceduralOperatorNames.has(data.name) ) { if ( this.maybeProceduralOperatorNames.has(data.name) ) {
if ( this.astHasType(args, 'ProceduralSelector') ) { if ( this.astHasType(args, 'ProceduralSelector') ) {