mirror of
https://github.com/RGBCube/serenity
synced 2025-07-23 04:17:34 +00:00
LibWeb: Make factory method of IdleDeadline fallible
This commit is contained in:
parent
ff2a991e19
commit
f0fd1cae3d
3 changed files with 4 additions and 4 deletions
|
@ -988,7 +988,7 @@ void Window::invoke_idle_callbacks()
|
||||||
// 1. Pop the top callback from window's list of runnable idle callbacks.
|
// 1. Pop the top callback from window's list of runnable idle callbacks.
|
||||||
auto callback = m_runnable_idle_callbacks.take_first();
|
auto callback = m_runnable_idle_callbacks.take_first();
|
||||||
// 2. Let deadlineArg be a new IdleDeadline whose [get deadline time algorithm] is getDeadline.
|
// 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.
|
// 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);
|
auto result = callback->invoke(deadline_arg);
|
||||||
if (result.is_error())
|
if (result.is_error())
|
||||||
|
|
|
@ -12,9 +12,9 @@
|
||||||
|
|
||||||
namespace Web::RequestIdleCallback {
|
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)
|
IdleDeadline::IdleDeadline(JS::Realm& realm, bool did_timeout)
|
||||||
|
|
|
@ -15,7 +15,7 @@ class IdleDeadline final : public Bindings::PlatformObject {
|
||||||
WEB_PLATFORM_OBJECT(IdleDeadline, Bindings::PlatformObject);
|
WEB_PLATFORM_OBJECT(IdleDeadline, Bindings::PlatformObject);
|
||||||
|
|
||||||
public:
|
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;
|
virtual ~IdleDeadline() override;
|
||||||
|
|
||||||
double time_remaining() const;
|
double time_remaining() const;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue