Rules with `excludedResourceTypes` must not block `main_frame`

Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2298
This commit is contained in:
Raymond Hill 2022-09-28 09:37:10 -04:00
parent fe4cfeba2e
commit 13927fc203
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
1 changed files with 6 additions and 3 deletions

View File

@ -1279,15 +1279,18 @@ const FilterNotType = class {
static dnrFromCompiled(args, rule) {
rule.condition = rule.condition || {};
if ( rule.condition.excludedResourceTypes === undefined ) {
rule.condition.excludedResourceTypes = [];
const rc = rule.condition;
if ( rc.excludedResourceTypes === undefined ) {
rc.excludedResourceTypes = [ 'main_frame' ];
}
let bits = args[1];
for ( let i = 1; bits !== 0 && i < typeValueToTypeName.length; i++ ) {
const bit = 1 << (i - 1);
if ( (bits & bit) === 0 ) { continue; }
bits &= ~bit;
rule.condition.excludedResourceTypes.push(`${typeValueToTypeName[i]}`);
const type = typeValueToTypeName[i];
if ( rc.excludedResourceTypes.includes(type) ) { continue; }
rc.excludedResourceTypes.push(type);
}
}