mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-23 09:46:04 -05:00
LibWeb: Update PromiseRejectionEvent's promise field to be object
This change was made in the HTML spec to address a comment from the
Gecko team for the Streams API in
a20ca78975
It also opens the door for some more Promise related refactors.
This commit is contained in:
parent
352a66390f
commit
52c449293a
Notes:
github-actions[bot]
2024-10-25 20:05:29 +00:00
Author: https://github.com/ADKaster Commit: https://github.com/LadybirdBrowser/ladybird/commit/52c449293a8 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1966 Reviewed-by: https://github.com/trflynn89 ✅
3 changed files with 8 additions and 8 deletions
|
@ -24,7 +24,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<PromiseRejectionEvent>> PromiseRejectionEve
|
|||
|
||||
PromiseRejectionEvent::PromiseRejectionEvent(JS::Realm& realm, FlyString const& event_name, PromiseRejectionEventInit const& event_init)
|
||||
: DOM::Event(realm, event_name, event_init)
|
||||
, m_promise(const_cast<JS::Promise*>(event_init.promise.cell()))
|
||||
, m_promise(*event_init.promise)
|
||||
, m_reason(event_init.reason)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
namespace Web::HTML {
|
||||
|
||||
struct PromiseRejectionEventInit : public DOM::EventInit {
|
||||
JS::Handle<JS::Promise> promise;
|
||||
JS::Handle<JS::Object> promise;
|
||||
JS::Value reason;
|
||||
};
|
||||
|
||||
|
@ -31,7 +31,7 @@ public:
|
|||
virtual ~PromiseRejectionEvent() override;
|
||||
|
||||
// Needs to return a pointer for the generated JS bindings to work.
|
||||
JS::Promise const* promise() const { return m_promise; }
|
||||
JS::Object const* promise() const { return m_promise; }
|
||||
JS::Value reason() const { return m_reason; }
|
||||
|
||||
private:
|
||||
|
@ -40,7 +40,7 @@ private:
|
|||
virtual void initialize(JS::Realm&) override;
|
||||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
|
||||
JS::GCPtr<JS::Promise> m_promise;
|
||||
JS::NonnullGCPtr<JS::Object> m_promise;
|
||||
JS::Value m_reason;
|
||||
};
|
||||
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
#import <DOM/Event.idl>
|
||||
|
||||
// https://html.spec.whatwg.org/#promiserejectionevent
|
||||
[Exposed=(Window,Worker)]
|
||||
// https://html.spec.whatwg.org/multipage/webappapis.html#promiserejectionevent
|
||||
[Exposed=*]
|
||||
interface PromiseRejectionEvent : Event {
|
||||
constructor(DOMString type, PromiseRejectionEventInit eventInitDict);
|
||||
|
||||
readonly attribute Promise<any> promise;
|
||||
readonly attribute object promise;
|
||||
readonly attribute any reason;
|
||||
};
|
||||
|
||||
dictionary PromiseRejectionEventInit : EventInit {
|
||||
required Promise<any> promise;
|
||||
required object promise;
|
||||
any reason;
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue