Copy context over, ignoring functions.
This commit is contained in:
parent
407f36eeb3
commit
6be7814e55
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue