1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-11-01 16:33:06 +01:00

Force prodecural cosmetic filtering when explicitly stated

Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2228

Using `#?#` (instead of `##` for a procedural cosmetic filter will
prevent uBO from trying to convert the filter into a declarative
one.
This commit is contained in:
Raymond Hill 2022-08-31 13:57:39 -04:00
parent b9aa791901
commit 79451e5899
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2

View File

@ -1453,7 +1453,7 @@ Parser.prototype.SelectorCompiler = class {
}
// Procedural selector?
const compiled = this.compileProceduralSelector(raw);
const compiled = this.compileProceduralSelector(raw, asProcedural);
if ( compiled === undefined ) { return false; }
out.compiled =
@ -1531,8 +1531,8 @@ Parser.prototype.SelectorCompiler = class {
return true;
}
compileProceduralSelector(raw) {
const compiled = this.compileProcedural(raw, true);
compileProceduralSelector(raw, asProcedural = false) {
const compiled = this.compileProcedural(raw, true, asProcedural);
if ( compiled !== undefined ) {
compiled.raw = this.decompileProcedural(compiled);
}
@ -1757,7 +1757,7 @@ Parser.prototype.SelectorCompiler = class {
return raw.join('');
}
compileProcedural(raw, root = false) {
compileProcedural(raw, root = false, asProcedural = false) {
if ( raw === '' ) { return; }
const tasks = [];
@ -1813,6 +1813,7 @@ Parser.prototype.SelectorCompiler = class {
// "forgiving", we also need to validate that the argument itself
// is also a valid CSS selector.
if (
asProcedural === false &&
this.querySelectable(raw.slice(opNameBeg, i)) &&
this.querySelectable(oparg)
) {