Fix reverse lookup of generic cosmetic exception filters

Reported internally.
This commit is contained in:
Raymond Hill 2020-06-11 07:18:45 -04:00
parent 89fcdc6a11
commit 681bd70116
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
2 changed files with 16 additions and 22 deletions

View File

@ -510,7 +510,7 @@ FilterContainer.prototype.compileGenericUnhideSelector = function(
// hostnames). No distinction is made between declarative and // hostnames). No distinction is made between declarative and
// procedural selectors, since they really exist only to cancel // procedural selectors, since they really exist only to cancel
// out other cosmetic filters. // out other cosmetic filters.
writer.push([ 8, '', 0b01, compiled ]); writer.push([ 8, '', 0b001, compiled ]);
}; };
/******************************************************************************/ /******************************************************************************/

View File

@ -186,38 +186,32 @@ const fromCosmeticFilter = function(details) {
switch ( filterType ) { switch ( filterType ) {
// Lowly generic cosmetic filters // Lowly generic cosmetic filters
case 0: // simple id-based case 0: // simple id-based
if ( if ( exception ) { break; }
exception === false && if ( fargs[1] !== selector.slice(1) ) { break; }
fargs[1] === selector.slice(1) && if ( selector.charAt(0) !== '#' ) { break; }
selector.charAt(0) === '#' found = prefix + selector;
) {
found = prefix + selector;
}
break; break;
case 2: // simple class-based case 2: // simple class-based
if ( if ( exception ) { break; }
exception === false && if ( fargs[1] !== selector.slice(1) ) { break; }
fargs[1] === selector.slice(1) && if ( selector.charAt(0) !== '.' ) { break; }
selector.charAt(0) === '.' found = prefix + selector;
) {
found = prefix + selector;
}
break; break;
case 1: // complex id-based case 1: // complex id-based
case 3: // complex class-based case 3: // complex class-based
if ( exception === false && fargs[2] === selector ) { if ( exception ) { break; }
found = prefix + selector; if ( fargs[2] !== selector ) { break; }
} found = prefix + selector;
break; break;
// Highly generic cosmetic filters // Highly generic cosmetic filters
case 4: // simple highly generic case 4: // simple highly generic
case 5: // complex highly generic case 5: // complex highly generic
case 7: // generic exception if ( exception ) { break; }
if ( fargs[1] === selector ) { if ( fargs[1] !== selector ) { break; }
found = prefix + selector; found = prefix + selector;
}
break; break;
// Specific cosmetic filtering // Specific cosmetic filtering
// Generic exception
case 8: case 8:
// HTML filtering // HTML filtering
case 64: case 64: