summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorKenneth Myhra <kennethmyhra@gmail.com>2023-02-19 18:49:48 +0100
committerAndreas Kling <kling@serenityos.org>2023-02-22 09:55:33 +0100
commitf0fd1cae3dbf27467fa8eda35943d6b0129f8586 (patch)
treed02125f134eedd245da5db96dd7898a181fee6f3 /Userland
parentff2a991e197bafcff5a68e85ab06016cf80be5c6 (diff)
downloadserenity-f0fd1cae3dbf27467fa8eda35943d6b0129f8586.zip
LibWeb: Make factory method of IdleDeadline fallible
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibWeb/HTML/Window.cpp2
-rw-r--r--Userland/Libraries/LibWeb/RequestIdleCallback/IdleDeadline.cpp4
-rw-r--r--Userland/Libraries/LibWeb/RequestIdleCallback/IdleDeadline.h2
3 files changed, 4 insertions, 4 deletions
diff --git a/Userland/Libraries/LibWeb/HTML/Window.cpp b/Userland/Libraries/LibWeb/HTML/Window.cpp
index c03b9e7425..b21314182e 100644
--- a/Userland/Libraries/LibWeb/HTML/Window.cpp
+++ b/Userland/Libraries/LibWeb/HTML/Window.cpp
@@ -988,7 +988,7 @@ void Window::invoke_idle_callbacks()
// 1. Pop the top callback from window's list of runnable idle callbacks.
auto callback = m_runnable_idle_callbacks.take_first();
// 2. Let deadlineArg be a new IdleDeadline whose [get deadline time algorithm] is getDeadline.
- auto deadline_arg = RequestIdleCallback::IdleDeadline::create(realm());
+ auto deadline_arg = RequestIdleCallback::IdleDeadline::create(realm()).release_value_but_fixme_should_propagate_errors();
// 3. Call callback with deadlineArg as its argument. If an uncaught runtime script error occurs, then report the exception.
auto result = callback->invoke(deadline_arg);
if (result.is_error())
diff --git a/Userland/Libraries/LibWeb/RequestIdleCallback/IdleDeadline.cpp b/Userland/Libraries/LibWeb/RequestIdleCallback/IdleDeadline.cpp
index 62f2234ee6..72a2ec19a2 100644
--- a/Userland/Libraries/LibWeb/RequestIdleCallback/IdleDeadline.cpp
+++ b/Userland/Libraries/LibWeb/RequestIdleCallback/IdleDeadline.cpp
@@ -12,9 +12,9 @@
namespace Web::RequestIdleCallback {
-JS::NonnullGCPtr<IdleDeadline> IdleDeadline::create(JS::Realm& realm, bool did_timeout)
+WebIDL::ExceptionOr<JS::NonnullGCPtr<IdleDeadline>> IdleDeadline::create(JS::Realm& realm, bool did_timeout)
{
- return realm.heap().allocate<IdleDeadline>(realm, realm, did_timeout).release_allocated_value_but_fixme_should_propagate_errors();
+ return MUST_OR_THROW_OOM(realm.heap().allocate<IdleDeadline>(realm, realm, did_timeout));
}
IdleDeadline::IdleDeadline(JS::Realm& realm, bool did_timeout)
diff --git a/Userland/Libraries/LibWeb/RequestIdleCallback/IdleDeadline.h b/Userland/Libraries/LibWeb/RequestIdleCallback/IdleDeadline.h
index d977fffb97..661dc0a4c1 100644
--- a/Userland/Libraries/LibWeb/RequestIdleCallback/IdleDeadline.h
+++ b/Userland/Libraries/LibWeb/RequestIdleCallback/IdleDeadline.h
@@ -15,7 +15,7 @@ class IdleDeadline final : public Bindings::PlatformObject {
WEB_PLATFORM_OBJECT(IdleDeadline, Bindings::PlatformObject);
public:
- static JS::NonnullGCPtr<IdleDeadline> create(JS::Realm&, bool did_timeout = false);
+ static WebIDL::ExceptionOr<JS::NonnullGCPtr<IdleDeadline>> create(JS::Realm&, bool did_timeout = false);
virtual ~IdleDeadline() override;
double time_remaining() const;