add scramdbg heavy arg filterer

This commit is contained in:
velzie 2024-07-30 07:21:07 -04:00
parent 881492ffff
commit b9f4eba034
No known key found for this signature in database
GPG key ID: 048413F95F0DDE1F
2 changed files with 31 additions and 6 deletions

View file

@ -75,15 +75,33 @@ export default function (client: ScramjetClient, self: typeof globalThis) {
function argdbg(arg) {
switch (typeof arg) {
case "string":
if (arg.includes("scramjet")) debugger;
if (arg.includes("scramjet") && !arg.includes("\n")) debugger;
break;
case "object":
for (let ar of arg) argdbg(ar);
if (arg instanceof Location) debugger;
if (
arg &&
arg[Symbol.iterator] &&
typeof arg[Symbol.iterator] === "function"
)
for (let ar of arg) argdbg(ar);
break;
}
}
client.Trap("Error.prototype.stack", {
get(ctx) {
debugger;
},
});
window.$scramerr = function scramerr(e) {
console.error("CAUGHT ERROR", e);
// console.error("CAUGHT ERROR", e);
};
window.$scramdbg = function scramdbg(args, t) {
if (args && typeof args === "object" && args.length > 0) argdbg(args);
argdbg(t);
return t;
};
}