mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-10 09:07:54 +01:00
Fix logging of sub_frame types
Related feedback: - https://github.com/uBlockOrigin/uBlock-issues/discussions/2302
This commit is contained in:
parent
13927fc203
commit
de0f45581c
1 changed files with 21 additions and 4 deletions
|
@ -142,8 +142,8 @@ const typeValueToTypeName = [
|
||||||
'image',
|
'image',
|
||||||
'object',
|
'object',
|
||||||
'script',
|
'script',
|
||||||
'xmlhttprequest',
|
'xhr',
|
||||||
'sub_frame',
|
'frame',
|
||||||
'font',
|
'font',
|
||||||
'media',
|
'media',
|
||||||
'websocket',
|
'websocket',
|
||||||
|
@ -163,6 +163,22 @@ const typeValueToTypeName = [
|
||||||
'unsupported',
|
'unsupported',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const typeValueToDNRTypeName = [
|
||||||
|
'',
|
||||||
|
'stylesheet',
|
||||||
|
'image',
|
||||||
|
'object',
|
||||||
|
'script',
|
||||||
|
'xmlhttprequest',
|
||||||
|
'sub_frame',
|
||||||
|
'font',
|
||||||
|
'media',
|
||||||
|
'websocket',
|
||||||
|
'ping',
|
||||||
|
'other',
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
//const typeValueFromCatBits = catBits => (catBits >>> TypeBitsOffset) & 0b11111;
|
//const typeValueFromCatBits = catBits => (catBits >>> TypeBitsOffset) & 0b11111;
|
||||||
|
|
||||||
const MAX_TOKEN_LENGTH = 7;
|
const MAX_TOKEN_LENGTH = 7;
|
||||||
|
@ -1284,11 +1300,12 @@ const FilterNotType = class {
|
||||||
rc.excludedResourceTypes = [ 'main_frame' ];
|
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 < typeValueToDNRTypeName.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;
|
||||||
const type = typeValueToTypeName[i];
|
const type = typeValueToDNRTypeName[i];
|
||||||
|
if ( type === undefined ) { continue; }
|
||||||
if ( rc.excludedResourceTypes.includes(type) ) { continue; }
|
if ( rc.excludedResourceTypes.includes(type) ) { continue; }
|
||||||
rc.excludedResourceTypes.push(type);
|
rc.excludedResourceTypes.push(type);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue