aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-05-19 18:21:42 -0700
committerGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-05-19 18:21:42 -0700
commit12d841a3f5d227e6ab19bf4defc2a8e63e8ba1b6 (patch)
tree82e2721b949d44531b5ed1b8a36c250b291424ad /src/bun.js
parentdeeccb0dc4a1919d96e06228c7f612208a6c7796 (diff)
downloadbun-12d841a3f5d227e6ab19bf4defc2a8e63e8ba1b6.tar.gz
bun-12d841a3f5d227e6ab19bf4defc2a8e63e8ba1b6.tar.zst
bun-12d841a3f5d227e6ab19bf4defc2a8e63e8ba1b6.zip
[node:vm] Fix crash in syntax error in `runinThisContext`
Diffstat (limited to 'src/bun.js')
-rw-r--r--src/bun.js/bindings/NodeVMScript.cpp4
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())) {