mirror of
https://github.com/RGBCube/serenity
synced 2025-05-25 22:25:08 +00:00
LibWeb: Add MessageEvent.source
This commit is contained in:
parent
eaa3b85864
commit
1607b2c978
3 changed files with 21 additions and 2 deletions
|
@ -24,6 +24,7 @@ MessageEvent::MessageEvent(JS::Realm& realm, FlyString const& event_name, Messag
|
|||
, m_data(event_init.data)
|
||||
, m_origin(event_init.origin)
|
||||
, m_last_event_id(event_init.last_event_id)
|
||||
, m_source(event_init.source)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -41,4 +42,12 @@ void MessageEvent::visit_edges(Cell::Visitor& visitor)
|
|||
visitor.visit(m_data);
|
||||
}
|
||||
|
||||
Variant<JS::Handle<WindowProxy>, JS::Handle<MessagePort>, Empty> MessageEvent::source() const
|
||||
{
|
||||
if (!m_source.has_value())
|
||||
return Empty {};
|
||||
|
||||
return m_source.value().downcast<JS::Handle<WindowProxy>, JS::Handle<MessagePort>>();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue