mirror of
https://github.com/RGBCube/serenity
synced 2025-07-24 21:37:34 +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:
parent
413eb19579
commit
b84056c05b
2 changed files with 9 additions and 2 deletions
|
@ -28,8 +28,12 @@ MessageEvent::MessageEvent(JS::Realm& realm, FlyString const& event_name, Messag
|
||||||
, m_origin(event_init.origin)
|
, m_origin(event_init.origin)
|
||||||
, m_last_event_id(event_init.last_event_id)
|
, m_last_event_id(event_init.last_event_id)
|
||||||
, m_source(event_init.source)
|
, 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;
|
MessageEvent::~MessageEvent() = default;
|
||||||
|
@ -44,6 +48,9 @@ void MessageEvent::visit_edges(Cell::Visitor& visitor)
|
||||||
{
|
{
|
||||||
Base::visit_edges(visitor);
|
Base::visit_edges(visitor);
|
||||||
visitor.visit(m_data);
|
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
|
Variant<JS::Handle<WindowProxy>, JS::Handle<MessagePort>, Empty> MessageEvent::source() const
|
||||||
|
|
|
@ -48,7 +48,7 @@ private:
|
||||||
String m_origin;
|
String m_origin;
|
||||||
String m_last_event_id;
|
String m_last_event_id;
|
||||||
Optional<MessageEventSource> m_source;
|
Optional<MessageEventSource> m_source;
|
||||||
Vector<JS::Handle<JS::Object>> m_ports;
|
Vector<JS::NonnullGCPtr<JS::Object>> m_ports;
|
||||||
mutable JS::GCPtr<JS::Array> m_ports_array;
|
mutable JS::GCPtr<JS::Array> m_ports_array;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue