1
0
Fork 0
mirror of synced 2024-09-08 13:41:09 +12:00

Copy context over, ignoring functions.

This commit is contained in:
Sam Rose 2024-01-12 15:22:49 +00:00
parent 407f36eeb3
commit 6be7814e55
No known key found for this signature in database

View file

@ -33,6 +33,15 @@ export function init() {
}
}
const global = bbCtx.jsContext.global
for (const [key, value] of Object.entries(ctx)) {
if (typeof value === "function") {
// Can't copy functions into the isolate, so we just ignore them
continue
}
global.setSync(key, new ivm.ExternalCopy(value).copyInto())
}
const script = bbCtx.jsIsolate.compileScriptSync(js)
return script.runSync(bbCtx.jsContext, {
timeout: env.JS_PER_EXECUTION_TIME_LIMIT_MS,