Skip to content

Commit

Permalink
Rules with excludedResourceTypes must not block main_frame
Browse files Browse the repository at this point in the history
  • Loading branch information
gorhill committed Sep 28, 2022
1 parent fe4cfeb commit 13927fc
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/js/static-net-filtering.js
Expand Up @@ -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);
}
}

Expand Down

0 comments on commit 13927fc

Please sign in to comment.