diff options
author | 2023-05-19 18:21:42 -0700 | |
---|---|---|
committer | 2023-05-19 18:21:42 -0700 | |
commit | 12d841a3f5d227e6ab19bf4defc2a8e63e8ba1b6 (patch) | |
tree | 82e2721b949d44531b5ed1b8a36c250b291424ad | |
parent | deeccb0dc4a1919d96e06228c7f612208a6c7796 (diff) | |
download | bun-12d841a3f5d227e6ab19bf4defc2a8e63e8ba1b6.tar.gz bun-12d841a3f5d227e6ab19bf4defc2a8e63e8ba1b6.tar.zst bun-12d841a3f5d227e6ab19bf4defc2a8e63e8ba1b6.zip |
[node:vm] Fix crash in syntax error in `runinThisContext`
-rw-r--r-- | src/bun.js/bindings/NodeVMScript.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/bun.js/bindings/NodeVMScript.cpp b/src/bun.js/bindings/NodeVMScript.cpp index e4d14265b..62de103fe 100644 --- a/src/bun.js/bindings/NodeVMScript.cpp +++ b/src/bun.js/bindings/NodeVMScript.cpp @@ -342,12 +342,12 @@ JSC_DEFINE_HOST_FUNCTION(vmModuleRunInThisContext, (JSGlobalObject * globalObjec proxy->setTarget(vm, globalObject); context->setPrototypeDirect(vm, proxy); - JSScope* contextScope = JSWithScope::create(vm, globalObject, globalObject->globalScope(), context); - auto* executable = JSC::DirectEvalExecutable::create( globalObject, source, DerivedContextType::None, NeedsClassFieldInitializer::No, PrivateBrandRequirement::None, false, false, EvalContextType::None, nullptr, nullptr, ECMAMode::sloppy()); + RETURN_IF_EXCEPTION(throwScope, {}); + JSScope* contextScope = JSWithScope::create(vm, globalObject, globalObject->globalScope(), context); auto catchScope = DECLARE_CATCH_SCOPE(vm); JSValue result = vm.interpreter.executeEval(executable, globalObject, contextScope); if (UNLIKELY(catchScope.exception())) { |