1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 07:58:11 +00:00

LibWeb: Add missing visits in MessageEvent

Also change a Vector<Handle> to a Vector<NonnullGCPtr> while we're
here, since there's no need to use handles for members of a cell.

Fixes an ASAN error on the HTML/Window-postMessage.html test.
This commit is contained in:
Andreas Kling 2024-01-24 08:56:59 +01:00
parent 413eb19579
commit b84056c05b
2 changed files with 9 additions and 2 deletions

View file

@ -28,8 +28,12 @@ MessageEvent::MessageEvent(JS::Realm& realm, FlyString const& event_name, Messag
, m_origin(event_init.origin)
, m_last_event_id(event_init.last_event_id)
, m_source(event_init.source)
, m_ports(event_init.ports)
{
m_ports.ensure_capacity(event_init.ports.size());
for (auto& port : event_init.ports) {
VERIFY(port);
m_ports.unchecked_append(*port);
}
}
MessageEvent::~MessageEvent() = default;
@ -44,6 +48,9 @@ void MessageEvent::visit_edges(Cell::Visitor& visitor)
{
Base::visit_edges(visitor);
visitor.visit(m_data);
visitor.visit(m_ports_array);
for (auto& port : m_ports)
visitor.visit(port);
}
Variant<JS::Handle<WindowProxy>, JS::Handle<MessagePort>, Empty> MessageEvent::source() const