mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 05:37:34 +00:00
parent
64040c136e
commit
1a5bf15b4d
3 changed files with 19 additions and 0 deletions
|
@ -73,6 +73,22 @@ HTML::EventHandler AbortSignal::onabort()
|
||||||
return event_handler_attribute(HTML::EventNames::abort);
|
return event_handler_attribute(HTML::EventNames::abort);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://dom.spec.whatwg.org/#dom-abortsignal-throwifaborted
|
||||||
|
JS::ThrowCompletionOr<void> AbortSignal::throw_if_aborted() const
|
||||||
|
{
|
||||||
|
auto& global_object = wrapper()->global_object();
|
||||||
|
auto& vm = global_object.vm();
|
||||||
|
|
||||||
|
// The throwIfAborted() method steps are to throw this’s abort reason, if this is aborted.
|
||||||
|
if (!aborted())
|
||||||
|
return {};
|
||||||
|
|
||||||
|
// FIXME: Remove this once VM::exception() has been removed.
|
||||||
|
vm.throw_exception(global_object, m_abort_reason);
|
||||||
|
|
||||||
|
return JS::throw_completion(m_abort_reason);
|
||||||
|
}
|
||||||
|
|
||||||
void AbortSignal::visit_edges(JS::Cell::Visitor& visitor)
|
void AbortSignal::visit_edges(JS::Cell::Visitor& visitor)
|
||||||
{
|
{
|
||||||
visitor.visit(m_abort_reason);
|
visitor.visit(m_abort_reason);
|
||||||
|
|
|
@ -53,6 +53,8 @@ public:
|
||||||
// https://dom.spec.whatwg.org/#dom-abortsignal-reason
|
// https://dom.spec.whatwg.org/#dom-abortsignal-reason
|
||||||
JS::Value reason() const { return m_abort_reason; }
|
JS::Value reason() const { return m_abort_reason; }
|
||||||
|
|
||||||
|
JS::ThrowCompletionOr<void> throw_if_aborted() const;
|
||||||
|
|
||||||
void visit_edges(JS::Cell::Visitor&);
|
void visit_edges(JS::Cell::Visitor&);
|
||||||
|
|
||||||
// ^EventTarget
|
// ^EventTarget
|
||||||
|
|
|
@ -4,6 +4,7 @@ interface AbortSignal : EventTarget {
|
||||||
|
|
||||||
readonly attribute boolean aborted;
|
readonly attribute boolean aborted;
|
||||||
readonly attribute any reason;
|
readonly attribute any reason;
|
||||||
|
undefined throwIfAborted();
|
||||||
|
|
||||||
attribute EventHandler onabort;
|
attribute EventHandler onabort;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue