From 2692db869963ed10947b05f13eade5fcbd5951dc Mon Sep 17 00:00:00 2001 From: Timothy Flynn Date: Sat, 28 Jan 2023 12:33:35 -0500 Subject: LibJS+Everywhere: Allow Cell::initialize overrides to throw OOM errors Note that as of this commit, there aren't any such throwers, and the call site in Heap::allocate will drop exceptions on the floor. This commit only serves to change the declaration of the overrides, make sure they return an empty value, and to propagate OOM errors frm their base initialize invocations. --- Userland/Libraries/LibJS/Runtime/WeakRefConstructor.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'Userland/Libraries/LibJS/Runtime/WeakRefConstructor.cpp') diff --git a/Userland/Libraries/LibJS/Runtime/WeakRefConstructor.cpp b/Userland/Libraries/LibJS/Runtime/WeakRefConstructor.cpp index 1379313c05..5be04068ea 100644 --- a/Userland/Libraries/LibJS/Runtime/WeakRefConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/WeakRefConstructor.cpp @@ -17,15 +17,17 @@ WeakRefConstructor::WeakRefConstructor(Realm& realm) { } -void WeakRefConstructor::initialize(Realm& realm) +ThrowCompletionOr WeakRefConstructor::initialize(Realm& realm) { auto& vm = this->vm(); - NativeFunction::initialize(realm); + MUST_OR_THROW_OOM(NativeFunction::initialize(realm)); // 26.1.2.1 WeakRef.prototype, https://tc39.es/ecma262/#sec-weak-ref.prototype define_direct_property(vm.names.prototype, realm.intrinsics().weak_ref_prototype(), 0); define_direct_property(vm.names.length, Value(1), Attribute::Configurable); + + return {}; } // 26.1.1.1 WeakRef ( target ), https://tc39.es/ecma262/#sec-weak-ref-target -- cgit v1.2.3