mirror of
https://github.com/oven-sh/bun
synced 2026-02-16 05:42:43 +00:00
Fix some missing exception checks in Zig::GlobalObject
This commit is contained in:
@@ -3463,6 +3463,7 @@ JSValue GlobalObject_getGlobalThis(VM& vm, JSObject* globalObject)
|
||||
|
||||
void GlobalObject::addBuiltinGlobals(JSC::VM& vm)
|
||||
{
|
||||
auto scope = DECLARE_CATCH_SCOPE(vm);
|
||||
m_builtinInternalFunctions.initialize(*this);
|
||||
|
||||
auto clientData = WebCore::clientData(vm);
|
||||
@@ -3579,6 +3580,8 @@ void GlobalObject::addBuiltinGlobals(JSC::VM& vm)
|
||||
consoleObject->putDirectCustomAccessor(vm, Identifier::fromString(vm, "Console"_s), CustomGetterSetter::create(vm, getConsoleConstructor, nullptr), PropertyAttribute::CustomValue | 0);
|
||||
consoleObject->putDirectCustomAccessor(vm, Identifier::fromString(vm, "_stdout"_s), CustomGetterSetter::create(vm, getConsoleStdout, nullptr), PropertyAttribute::DontEnum | PropertyAttribute::CustomValue | 0);
|
||||
consoleObject->putDirectCustomAccessor(vm, Identifier::fromString(vm, "_stderr"_s), CustomGetterSetter::create(vm, getConsoleStderr, nullptr), PropertyAttribute::DontEnum | PropertyAttribute::CustomValue | 0);
|
||||
|
||||
scope.assertNoException();
|
||||
}
|
||||
|
||||
extern "C" bool JSC__JSGlobalObject__startRemoteInspector(JSC__JSGlobalObject* globalObject, unsigned char* host, uint16_t arg1)
|
||||
@@ -4071,8 +4074,7 @@ JSC::JSInternalPromise* GlobalObject::moduleLoaderFetch(JSGlobalObject* globalOb
|
||||
auto scope = DECLARE_THROW_SCOPE(vm);
|
||||
|
||||
auto moduleKey = key.toWTFString(globalObject);
|
||||
if (UNLIKELY(scope.exception()))
|
||||
return rejectedInternalPromise(globalObject, scope.exception()->value());
|
||||
RETURN_IF_EXCEPTION(scope, rejectedInternalPromise(globalObject, scope.exception()->value()));
|
||||
|
||||
if (moduleKey.endsWith(".node"_s)) {
|
||||
return rejectedInternalPromise(globalObject, createTypeError(globalObject, "To load Node-API modules, use require() or process.dlopen instead of import."_s));
|
||||
@@ -4108,6 +4110,7 @@ JSC::JSInternalPromise* GlobalObject::moduleLoaderFetch(JSGlobalObject* globalOb
|
||||
&moduleKeyBun,
|
||||
&source,
|
||||
typeAttributeString.isEmpty() ? nullptr : &typeAttribute);
|
||||
RETURN_IF_EXCEPTION(scope, rejectedInternalPromise(globalObject, scope.exception()->value()));
|
||||
|
||||
if (auto* internalPromise = JSC::jsDynamicCast<JSC::JSInternalPromise*>(result)) {
|
||||
return internalPromise;
|
||||
|
||||
Reference in New Issue
Block a user