mirror of https://github.com/gorhill/uBlock.git
Add more output to logger re. scriptlets
This commit is contained in:
parent
55879e6014
commit
6cfba082f9
|
@ -1167,7 +1167,7 @@ function matchObjectProperties(propNeedles, ...objs) {
|
||||||
let value = haystack[prop];
|
let value = haystack[prop];
|
||||||
if ( value === undefined ) { continue; }
|
if ( value === undefined ) { continue; }
|
||||||
if ( typeof value !== 'string' ) {
|
if ( typeof value !== 'string' ) {
|
||||||
try { value = JSON.stringify(value); }
|
try { value = safe.JSON_stringify(value); }
|
||||||
catch(ex) { }
|
catch(ex) { }
|
||||||
if ( typeof value !== 'string' ) { continue; }
|
if ( typeof value !== 'string' ) { continue; }
|
||||||
}
|
}
|
||||||
|
@ -1665,7 +1665,7 @@ function jsonPrune(
|
||||||
apply: function(target, thisArg, args) {
|
apply: function(target, thisArg, args) {
|
||||||
const objBefore = Reflect.apply(target, thisArg, args);
|
const objBefore = Reflect.apply(target, thisArg, args);
|
||||||
if ( rawPrunePaths === '' ) {
|
if ( rawPrunePaths === '' ) {
|
||||||
safe.uboLog(logPrefix, JSON.stringify(objBefore, null, 1));
|
safe.uboLog(logPrefix, safe.JSON_stringify(objBefore, null, 2));
|
||||||
}
|
}
|
||||||
const objAfter = objectPruneFn(
|
const objAfter = objectPruneFn(
|
||||||
objBefore,
|
objBefore,
|
||||||
|
@ -1677,7 +1677,7 @@ function jsonPrune(
|
||||||
if ( objAfter === undefined ) { return objBefore; }
|
if ( objAfter === undefined ) { return objBefore; }
|
||||||
safe.uboLog(logPrefix, 'Pruned');
|
safe.uboLog(logPrefix, 'Pruned');
|
||||||
if ( safe.logLevel > 1 ) {
|
if ( safe.logLevel > 1 ) {
|
||||||
safe.uboLog(logPrefix, `After pruning:\n${JSON.stringify(objAfter, null, 1)}`);
|
safe.uboLog(logPrefix, `After pruning:\n${safe.JSON_stringify(objAfter, null, 2)}`);
|
||||||
}
|
}
|
||||||
return objAfter;
|
return objAfter;
|
||||||
},
|
},
|
||||||
|
@ -1997,13 +1997,16 @@ 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 === '' ) {
|
||||||
|
return safe.uboLog(logPrefix, `Called: ${safe.JSON_stringify(details, null, 2)}`);
|
||||||
|
}
|
||||||
let proceed = true;
|
let proceed = true;
|
||||||
try {
|
try {
|
||||||
const props = new Map();
|
const props = new Map();
|
||||||
for ( const prop in details ) {
|
for ( const prop in details ) {
|
||||||
let v = details[prop];
|
let v = details[prop];
|
||||||
if ( typeof v !== 'string' ) {
|
if ( typeof v !== 'string' ) {
|
||||||
try { v = JSON.stringify(v); }
|
try { v = safe.JSON_stringify(v); }
|
||||||
catch(ex) { }
|
catch(ex) { }
|
||||||
}
|
}
|
||||||
if ( typeof v !== 'string' ) { continue; }
|
if ( typeof v !== 'string' ) { continue; }
|
||||||
|
@ -2524,6 +2527,9 @@ function noXhrIf(
|
||||||
if ( matchObjectProperties(propNeedles, haystack) ) {
|
if ( matchObjectProperties(propNeedles, haystack) ) {
|
||||||
xhrInstances.set(this, haystack);
|
xhrInstances.set(this, haystack);
|
||||||
}
|
}
|
||||||
|
if ( propsToMatch === '' && directive === '' ) {
|
||||||
|
return safe.uboLog(logPrefix, `Called: ${safe.JSON_stringify(haystack, null, 2)}`);
|
||||||
|
}
|
||||||
haystack.headers = Object.assign({}, headers);
|
haystack.headers = Object.assign({}, headers);
|
||||||
return super.open(method, url, ...args);
|
return super.open(method, url, ...args);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue