feat: add proxy and trapping checks

This commit is contained in:
Percs 2024-10-27 03:11:32 -05:00
parent e0a88ad87c
commit 2b9afa1068

View file

@ -237,6 +237,7 @@ export class ScramjetClient {
const split = name.split("."); const split = name.split(".");
const prop = split.pop(); const prop = split.pop();
const target = split.reduce((a, b) => a?.[b], this.global); const target = split.reduce((a, b) => a?.[b], this.global);
if (!target) return;
const original = Reflect.get(target, prop); const original = Reflect.get(target, prop);
this.natives[name] = original; this.natives[name] = original;
@ -362,6 +363,7 @@ export class ScramjetClient {
const split = name.split("."); const split = name.split(".");
const prop = split.pop(); const prop = split.pop();
const target = split.reduce((a, b) => a?.[b], this.global); const target = split.reduce((a, b) => a?.[b], this.global);
if (!target) return;
const original = nativeGetOwnPropertyDescriptor(target, prop); const original = nativeGetOwnPropertyDescriptor(target, prop);
this.descriptors[name] = original; this.descriptors[name] = original;