mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-03 22:59:33 +00:00
LibWeb: Add MessageEvent.source
This commit is contained in:
parent
eaa3b85864
commit
1607b2c978
Notes:
sideshowbarker
2024-07-17 03:16:02 +09:00
Author: https://github.com/Lubrsi
Commit: 1607b2c978
Pull-request: https://github.com/SerenityOS/serenity/pull/21823
Reviewed-by: https://github.com/ADKaster
Reviewed-by: https://github.com/shannonbooth
Reviewed-by: https://github.com/trflynn89
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