mirror of https://github.com/gorhill/uBlock.git
Rules with `excludedResourceTypes` must not block `main_frame`
Related issue: - https://github.com/uBlockOrigin/uBlock-issues/issues/2298
This commit is contained in:
parent
fe4cfeba2e
commit
13927fc203
|
@ -1279,15 +1279,18 @@ const FilterNotType = class {
|
||||||
|
|
||||||
static dnrFromCompiled(args, rule) {
|
static dnrFromCompiled(args, rule) {
|
||||||
rule.condition = rule.condition || {};
|
rule.condition = rule.condition || {};
|
||||||
if ( rule.condition.excludedResourceTypes === undefined ) {
|
const rc = rule.condition;
|
||||||
rule.condition.excludedResourceTypes = [];
|
if ( rc.excludedResourceTypes === undefined ) {
|
||||||
|
rc.excludedResourceTypes = [ 'main_frame' ];
|
||||||
}
|
}
|
||||||
let bits = args[1];
|
let bits = args[1];
|
||||||
for ( let i = 1; bits !== 0 && i < typeValueToTypeName.length; i++ ) {
|
for ( let i = 1; bits !== 0 && i < typeValueToTypeName.length; i++ ) {
|
||||||
const bit = 1 << (i - 1);
|
const bit = 1 << (i - 1);
|
||||||
if ( (bits & bit) === 0 ) { continue; }
|
if ( (bits & bit) === 0 ) { continue; }
|
||||||
bits &= ~bit;
|
bits &= ~bit;
|
||||||
rule.condition.excludedResourceTypes.push(`${typeValueToTypeName[i]}`);
|
const type = typeValueToTypeName[i];
|
||||||
|
if ( rc.excludedResourceTypes.includes(type) ) { continue; }
|
||||||
|
rc.excludedResourceTypes.push(type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue