diff options
Diffstat (limited to 'src/bun.js/bindings/NodeVMScript.cpp')
-rw-r--r-- | src/bun.js/bindings/NodeVMScript.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/bun.js/bindings/NodeVMScript.cpp b/src/bun.js/bindings/NodeVMScript.cpp index 7fc4fc3ef..05921dd8d 100644 --- a/src/bun.js/bindings/NodeVMScript.cpp +++ b/src/bun.js/bindings/NodeVMScript.cpp @@ -447,6 +447,11 @@ JSC_DEFINE_HOST_FUNCTION(vmModule_createContext, (JSGlobalObject * globalObject, auto scope = DECLARE_THROW_SCOPE(vm); JSValue contextArg = callFrame->argument(0); + + if (contextArg.isEmpty() || contextArg.isUndefinedOrNull()) { + contextArg = JSC::constructEmptyObject(globalObject); + } + if (!contextArg.isObject()) { return throwVMTypeError(globalObject, scope, "parameter to createContext must be an object"_s); } |