Add more output to logger re. scriptlets

This commit is contained in:
Raymond Hill 2024-01-28 10:27:46 -05:00
parent 54fba5270f
commit 55879e6014
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
1 changed files with 16 additions and 9 deletions

View File

@ -1602,9 +1602,6 @@ function addEventListenerDefuser(
const matchesHandler = safe.RegExp_test.call(rePattern, handler); const matchesHandler = safe.RegExp_test.call(rePattern, handler);
const matchesEither = matchesType || matchesHandler; const matchesEither = matchesType || matchesHandler;
const matchesBoth = matchesType && matchesHandler; const matchesBoth = matchesType && matchesHandler;
if ( safe.logLevel > 1 && matchesEither ) {
safe.uboLog(logPrefix, `Matched "${type}"\n${handler.trim()}`);
}
if ( debug === 1 && matchesBoth || debug === 2 && matchesEither ) { if ( debug === 1 && matchesBoth || debug === 2 && matchesEither ) {
debugger; // jshint ignore:line debugger; // jshint ignore:line
} }
@ -1613,18 +1610,20 @@ function addEventListenerDefuser(
const trapEddEventListeners = ( ) => { const trapEddEventListeners = ( ) => {
const eventListenerHandler = { const eventListenerHandler = {
apply: function(target, thisArg, args) { apply: function(target, thisArg, args) {
let type, handler; let t, h;
try { try {
type = String(args[0]); t = String(args[0]);
handler = args[1] instanceof Function h = args[1] instanceof Function
? String(safe.Function_toString(args[1])) ? String(safe.Function_toString(args[1]))
: String(args[1]); : String(args[1]);
} catch(ex) { } catch(ex) {
} }
if ( shouldPrevent(thisArg, type, handler) !== true ) { if ( type === '' && pattern === '' ) {
return Reflect.apply(target, thisArg, args); safe.uboLog(logPrefix, `Called: ${t}\n${h}`);
} else if ( shouldPrevent(thisArg, t, h) ) {
return safe.uboLog(logPrefix, `Prevented: ${t}\n${h}`);
} }
safe.uboLog(logPrefix, 'Prevented'); return Reflect.apply(target, thisArg, args);
}, },
get(target, prop, receiver) { get(target, prop, receiver) {
if ( prop === 'toString' ) { if ( prop === 'toString' ) {
@ -2328,6 +2327,10 @@ function noSetIntervalIf(
? String(safe.Function_toString(args[0])) ? String(safe.Function_toString(args[0]))
: String(args[0]); : String(args[0]);
const b = args[1]; const b = args[1];
if ( needle === '' && delay === undefined ) {
safe.uboLog(logPrefix, `Called:\n${a}\n${b}`);
return Reflect.apply(target, thisArg, args);
}
let defuse; let defuse;
if ( needle !== '' ) { if ( needle !== '' ) {
defuse = reNeedle.test(a) !== needleNot; defuse = reNeedle.test(a) !== needleNot;
@ -2387,6 +2390,10 @@ function noSetTimeoutIf(
? String(safe.Function_toString(args[0])) ? String(safe.Function_toString(args[0]))
: String(args[0]); : String(args[0]);
const b = args[1]; const b = args[1];
if ( needle === '' && delay === undefined ) {
safe.uboLog(logPrefix, `Called:\n${a}\n${b}`);
return Reflect.apply(target, thisArg, args);
}
let defuse; let defuse;
if ( needle !== '' ) { if ( needle !== '' ) {
defuse = reNeedle.test(a) !== needleNot; defuse = reNeedle.test(a) !== needleNot;