This commit is contained in:
Avad3 2024-07-14 15:38:21 -04:00
parent 212a9510d5
commit ba42d3083e
2 changed files with 22 additions and 8 deletions

View file

@ -10,7 +10,7 @@ const FunctionProxy = new Proxy(Function, {
},
apply(target, thisArg, argArray) {
if (argArray.length === 1) {
return Reflect.apply(target, undefined, rewriteJs(argArray[0]));
return Reflect.apply(target, undefined, [rewriteJs(argArray[0])]);
} else {
return Reflect.apply(target, undefined, [...argArray.map((x, index) => index === argArray.length - 1), rewriteJs(argArray[argArray.length - 1])])
}
@ -21,8 +21,8 @@ delete window.Function;
window.Function = FunctionProxy;
delete window.eval;
// since the function proxy is already rewriting the js we can just reuse it for the eval proxy
window.eval = (str: string) => window.Function(str);
window.eval = new Proxy(window.eval, {
apply(target, thisArg, argArray) {
return Reflect.apply(target, thisArg, [rewriteJs(argArray[0])]);
},
})