summaryrefslogtreecommitdiff
path: root/Userland/Services
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/Services
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/Services')
-rw-r--r--Userland/Services/WebContent/ConsoleGlobalEnvironmentExtensions.cpp6
-rw-r--r--Userland/Services/WebContent/ConsoleGlobalEnvironmentExtensions.h2
2 files changed, 5 insertions, 3 deletions
diff --git a/Userland/Services/WebContent/ConsoleGlobalEnvironmentExtensions.cpp b/Userland/Services/WebContent/ConsoleGlobalEnvironmentExtensions.cpp
index e9c1e63a8f..33a82dbc8c 100644
--- a/Userland/Services/WebContent/ConsoleGlobalEnvironmentExtensions.cpp
+++ b/Userland/Services/WebContent/ConsoleGlobalEnvironmentExtensions.cpp
@@ -21,14 +21,16 @@ ConsoleGlobalEnvironmentExtensions::ConsoleGlobalEnvironmentExtensions(JS::Realm
{
}
-void ConsoleGlobalEnvironmentExtensions::initialize(JS::Realm& realm)
+JS::ThrowCompletionOr<void> ConsoleGlobalEnvironmentExtensions::initialize(JS::Realm& realm)
{
- Base::initialize(realm);
+ MUST_OR_THROW_OOM(Base::initialize(realm));
define_native_accessor(realm, "$0", $0_getter, nullptr, 0);
define_native_accessor(realm, "$_", $__getter, nullptr, 0);
define_native_function(realm, "$", $_function, 2, JS::default_attributes);
define_native_function(realm, "$$", $$_function, 2, JS::default_attributes);
+
+ return {};
}
void ConsoleGlobalEnvironmentExtensions::visit_edges(Visitor& visitor)
diff --git a/Userland/Services/WebContent/ConsoleGlobalEnvironmentExtensions.h b/Userland/Services/WebContent/ConsoleGlobalEnvironmentExtensions.h
index 476000ad85..fc9d5e74b9 100644
--- a/Userland/Services/WebContent/ConsoleGlobalEnvironmentExtensions.h
+++ b/Userland/Services/WebContent/ConsoleGlobalEnvironmentExtensions.h
@@ -18,7 +18,7 @@ class ConsoleGlobalEnvironmentExtensions final : public JS::Object {
public:
ConsoleGlobalEnvironmentExtensions(JS::Realm&, Web::HTML::Window&);
- virtual void initialize(JS::Realm&) override;
+ virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
virtual ~ConsoleGlobalEnvironmentExtensions() override = default;
void set_most_recent_result(JS::Value result) { m_most_recent_result = move(result); }