mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-05 06:32:30 +02:00
LibWeb: Add MessageEvent.source
This commit is contained in:
committed by
Andreas Kling
parent
eaa3b85864
commit
1607b2c978
Notes:
sideshowbarker
2024-07-17 03:16:02 +09:00
Author: https://github.com/Lubrsi Commit: https://github.com/SerenityOS/serenity/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
@@ -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>>();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user