Skip to content

Instantly share code, notes, and snippets.

@hotsphink
Created March 3, 2025 18:31
Show Gist options
  • Save hotsphink/97b932af72d8642e3e34871248f7ca94 to your computer and use it in GitHub Desktop.
Save hotsphink/97b932af72d8642e3e34871248f7ca94 to your computer and use it in GitHub Desktop.
mkgist-created gist
g = newGlobal({ newCompartment: true });
dbg = new Debugger();
dbg.addDebuggee(g);
dbg.onNewScript = (script) => {
const src = script.source;
const h = Object.create(null);
for (const prop of Object.getOwnPropertyNames(src.__proto__)) {
Math.sin(src);
try {
h[prop] = src[prop];
} catch (e) {}
}
print(JSON.stringify(h));
};
g.eval(`function f() { return "♬"; }`);
g.eval(`function f2() { return "x"; }`);
print(g.f);
print(g.f2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment