LibWeb: Add ports attribute to MessageEvent and MessageEventInit

Still some FIXMEs left though, as the IDL generator doesn't know what
a FrozenArray is, nor how to properly create a sequence of a Platform
Object.
This commit is contained in:
Andrew Kaster 2023-12-12 13:28:38 -07:00 committed by Andrew Kaster
commit 73697058b0
Notes: sideshowbarker 2024-07-17 14:36:19 +09:00
3 changed files with 21 additions and 0 deletions

View file

@ -20,6 +20,7 @@ struct MessageEventInit : public DOM::EventInit {
String origin {};
String last_event_id {};
Optional<MessageEventSource> source;
Vector<JS::Handle<JS::Object>> ports;
};
class MessageEvent : public DOM::Event {
@ -36,6 +37,7 @@ public:
JS::Value data() const { return m_data; }
String const& origin() const { return m_origin; }
String const& last_event_id() const { return m_last_event_id; }
JS::NonnullGCPtr<JS::Object> ports() const;
Variant<JS::Handle<WindowProxy>, JS::Handle<MessagePort>, Empty> source() const;
private:
@ -46,6 +48,8 @@ private:
String m_origin;
String m_last_event_id;
Optional<MessageEventSource> m_source;
Vector<JS::Handle<JS::Object>> m_ports;
mutable JS::GCPtr<JS::Array> m_ports_array;
};
}