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. --- Tests/LibWasm/test-wasm.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'Tests/LibWasm/test-wasm.cpp') diff --git a/Tests/LibWasm/test-wasm.cpp b/Tests/LibWasm/test-wasm.cpp index d7566c4853..80832141aa 100644 --- a/Tests/LibWasm/test-wasm.cpp +++ b/Tests/LibWasm/test-wasm.cpp @@ -65,7 +65,7 @@ public: instance->m_module_instance = result.release_value(); return instance.ptr(); } - void initialize(JS::Realm&) override; + JS::ThrowCompletionOr initialize(JS::Realm&) override; ~WebAssemblyModule() override = default; @@ -143,11 +143,13 @@ TESTJS_GLOBAL_FUNCTION(compare_typed_arrays, compareTypedArrays) return JS::Value(lhs_array.viewed_array_buffer()->buffer() == rhs_array.viewed_array_buffer()->buffer()); } -void WebAssemblyModule::initialize(JS::Realm& realm) +JS::ThrowCompletionOr WebAssemblyModule::initialize(JS::Realm& realm) { - Base::initialize(realm); + MUST_OR_THROW_OOM(Base::initialize(realm)); define_native_function(realm, "getExport", get_export, 1, JS::default_attributes); define_native_function(realm, "invoke", wasm_invoke, 1, JS::default_attributes); + + return {}; } JS_DEFINE_NATIVE_FUNCTION(WebAssemblyModule::get_export) -- cgit v1.2.3