summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibTest
diff options
context:
space:
mode:
authorTimothy Flynn <trflynn89@pm.me>2023-01-28 12:33:35 -0500
committerLinus Groh <mail@linusgroh.de>2023-01-29 00:02:45 +0000
commit2692db869963ed10947b05f13eade5fcbd5951dc (patch)
treeef12b9e76ff4edb64571819643a92d8e6c33a2fe /Userland/Libraries/LibTest
parent1c1b902a6a0c1c7017fdc6d9748018317a554c9b (diff)
downloadserenity-2692db869963ed10947b05f13eade5fcbd5951dc.zip
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.
Diffstat (limited to 'Userland/Libraries/LibTest')
-rw-r--r--Userland/Libraries/LibTest/JavaScriptTestRunner.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/Userland/Libraries/LibTest/JavaScriptTestRunner.h b/Userland/Libraries/LibTest/JavaScriptTestRunner.h
index baa0e99da7..9f39623e74 100644
--- a/Userland/Libraries/LibTest/JavaScriptTestRunner.h
+++ b/Userland/Libraries/LibTest/JavaScriptTestRunner.h
@@ -194,13 +194,13 @@ public:
: JS::GlobalObject(realm)
{
}
- virtual void initialize(JS::Realm&) override;
+ virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
virtual ~TestRunnerGlobalObject() override = default;
};
-inline void TestRunnerGlobalObject::initialize(JS::Realm& realm)
+inline JS::ThrowCompletionOr<void> TestRunnerGlobalObject::initialize(JS::Realm& realm)
{
- Base::initialize(realm);
+ MUST_OR_THROW_OOM(Base::initialize(realm));
define_direct_property("global", this, JS::Attribute::Enumerable);
for (auto& entry : s_exposed_global_functions) {
@@ -211,6 +211,8 @@ inline void TestRunnerGlobalObject::initialize(JS::Realm& realm)
},
entry.value.length, JS::default_attributes);
}
+
+ return {};
}
inline ByteBuffer load_entire_file(StringView path)