From af118f2a679a7f21ca9389d1e2ae79f33fbf896a Mon Sep 17 00:00:00 2001 From: Luke Wilde Date: Mon, 27 Feb 2023 22:41:47 +0000 Subject: [PATCH] LibJS: Add missing error propagation to global object initializations --- Userland/Libraries/LibJS/Contrib/Test262/$262Object.cpp | 2 +- Userland/Libraries/LibJS/Runtime/Realm.cpp | 2 +- Userland/Libraries/LibJS/Runtime/ShadowRealmConstructor.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Userland/Libraries/LibJS/Contrib/Test262/$262Object.cpp b/Userland/Libraries/LibJS/Contrib/Test262/$262Object.cpp index 0c066502e8..26dd2266f3 100644 --- a/Userland/Libraries/LibJS/Contrib/Test262/$262Object.cpp +++ b/Userland/Libraries/LibJS/Contrib/Test262/$262Object.cpp @@ -65,7 +65,7 @@ JS_DEFINE_NATIVE_FUNCTION($262Object::create_realm) VERIFY(realm_global_object); realm->set_global_object(realm_global_object, nullptr); set_default_global_bindings(*realm); - realm_global_object->initialize(*realm); + MUST_OR_THROW_OOM(realm_global_object->initialize(*realm)); return Value(realm_global_object->$262()); } diff --git a/Userland/Libraries/LibJS/Runtime/Realm.cpp b/Userland/Libraries/LibJS/Runtime/Realm.cpp index a75aec04e4..e5c3bf0ea3 100644 --- a/Userland/Libraries/LibJS/Runtime/Realm.cpp +++ b/Userland/Libraries/LibJS/Runtime/Realm.cpp @@ -75,7 +75,7 @@ ThrowCompletionOr> Realm::initialize_host_define auto& global_object = set_default_global_bindings(*realm); // 11. Create any host-defined global object properties on globalObj. - global_object.initialize(*realm); + MUST_OR_THROW_OOM(global_object.initialize(*realm)); // 12. Return unused. return new_context; diff --git a/Userland/Libraries/LibJS/Runtime/ShadowRealmConstructor.cpp b/Userland/Libraries/LibJS/Runtime/ShadowRealmConstructor.cpp index 9d9d45ae05..e4a9f65319 100644 --- a/Userland/Libraries/LibJS/Runtime/ShadowRealmConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/ShadowRealmConstructor.cpp @@ -70,7 +70,7 @@ ThrowCompletionOr> ShadowRealmConstructor::construct(Functi auto& global_object = set_default_global_bindings(object->shadow_realm()); // FIXME: 12. Perform ? HostInitializeShadowRealm(O.[[ShadowRealm]]). - global_object.initialize(object->shadow_realm()); + MUST_OR_THROW_OOM(global_object.initialize(object->shadow_realm())); // 13. Return O. return object;