Improve loggger output of prevent-fetch scriptlet

Related feedback:
https://github.com/uBlockOrigin/uBlock-issues/discussions/3115
This commit is contained in:
Raymond Hill 2024-02-13 16:12:11 -05:00
parent 246ae91c79
commit 6551cab525
No known key found for this signature in database
GPG key ID: 25E1490B761470C2

View file

@ -1997,10 +1997,6 @@ function noFetchIf(
const details = args[0] instanceof self.Request const details = args[0] instanceof self.Request
? args[0] ? args[0]
: Object.assign({ url: args[0] }, args[1]); : Object.assign({ url: args[0] }, args[1]);
if ( propsToMatch === '' && responseBody === '' ) {
safe.uboLog(logPrefix, `Called: ${safe.JSON_stringify(details, null, 2)}`);
return Reflect.apply(target, thisArg, args);
}
let proceed = true; let proceed = true;
try { try {
const props = new Map(); const props = new Map();
@ -2013,6 +2009,11 @@ function noFetchIf(
if ( typeof v !== 'string' ) { continue; } if ( typeof v !== 'string' ) { continue; }
props.set(prop, v); props.set(prop, v);
} }
if ( propsToMatch === '' && responseBody === '' ) {
const out = Array.from(props).map(a => `${a[0]}:${a[1]}`);
safe.uboLog(logPrefix, `Called: ${out.join('\n')}`);
return Reflect.apply(target, thisArg, args);
}
proceed = needles.length === 0; proceed = needles.length === 0;
for ( const { key, re } of needles ) { for ( const { key, re } of needles ) {
if ( if (