mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-10 18:10:56 +09:00
LibWeb: Use correct type for MessageEventInit.ports
This didn't work previously because the IDL generator used the incorrect type for some types of sequences within dictionaries.
This commit is contained in:
parent
763b7f0e0c
commit
63246577d2
Notes:
sideshowbarker
2024-07-17 04:57:23 +09:00
Author: https://github.com/tcl3
Commit: 63246577d2
Pull-request: https://github.com/SerenityOS/serenity/pull/24338
6 changed files with 10 additions and 10 deletions
|
@ -888,7 +888,7 @@ static void generate_to_cpp(SourceGenerator& generator, ParameterType& parameter
|
||||||
)~~~");
|
)~~~");
|
||||||
} else {
|
} else {
|
||||||
sequence_generator.append(R"~~~(
|
sequence_generator.append(R"~~~(
|
||||||
@sequence.storage_type@ @cpp_name@ { global_object.heap() };
|
@sequence.storage_type@<@sequence.type@> @cpp_name@ { vm.heap() };
|
||||||
)~~~");
|
)~~~");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include <LibWeb/Bindings/Intrinsics.h>
|
#include <LibWeb/Bindings/Intrinsics.h>
|
||||||
#include <LibWeb/Bindings/MessageEventPrototype.h>
|
#include <LibWeb/Bindings/MessageEventPrototype.h>
|
||||||
#include <LibWeb/HTML/MessageEvent.h>
|
#include <LibWeb/HTML/MessageEvent.h>
|
||||||
|
#include <LibWeb/HTML/MessagePort.h>
|
||||||
|
|
||||||
namespace Web::HTML {
|
namespace Web::HTML {
|
||||||
|
|
||||||
|
@ -31,9 +32,9 @@ MessageEvent::MessageEvent(JS::Realm& realm, FlyString const& event_name, Messag
|
||||||
, m_source(event_init.source)
|
, m_source(event_init.source)
|
||||||
{
|
{
|
||||||
m_ports.ensure_capacity(event_init.ports.size());
|
m_ports.ensure_capacity(event_init.ports.size());
|
||||||
for (auto& port : event_init.ports) {
|
for (auto const& port : event_init.ports) {
|
||||||
VERIFY(port);
|
VERIFY(port);
|
||||||
m_ports.unchecked_append(*port);
|
m_ports.unchecked_append(static_cast<JS::Object&>(*port));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ struct MessageEventInit : public DOM::EventInit {
|
||||||
String origin {};
|
String origin {};
|
||||||
String last_event_id {};
|
String last_event_id {};
|
||||||
Optional<MessageEventSource> source;
|
Optional<MessageEventSource> source;
|
||||||
Vector<JS::Handle<JS::Object>> ports;
|
Vector<JS::Handle<MessagePort>> ports;
|
||||||
};
|
};
|
||||||
|
|
||||||
class MessageEvent : public DOM::Event {
|
class MessageEvent : public DOM::Event {
|
||||||
|
|
|
@ -22,6 +22,5 @@ dictionary MessageEventInit : EventInit {
|
||||||
USVString origin = "";
|
USVString origin = "";
|
||||||
DOMString lastEventId = "";
|
DOMString lastEventId = "";
|
||||||
MessageEventSource? source = null;
|
MessageEventSource? source = null;
|
||||||
// FIXME: sequence<MessagePort> ports = [];
|
sequence<MessagePort> ports = [];
|
||||||
sequence<object> ports = [];
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -372,10 +372,10 @@ void MessagePort::post_message_task_steps(SerializedTransferRecord& serialize_wi
|
||||||
|
|
||||||
// 5. Let newPorts be a new frozen array consisting of all MessagePort objects in deserializeRecord.[[TransferredValues]], if any, maintaining their relative order.
|
// 5. Let newPorts be a new frozen array consisting of all MessagePort objects in deserializeRecord.[[TransferredValues]], if any, maintaining their relative order.
|
||||||
// FIXME: Use a FrozenArray
|
// FIXME: Use a FrozenArray
|
||||||
Vector<JS::Handle<JS::Object>> new_ports;
|
Vector<JS::Handle<MessagePort>> new_ports;
|
||||||
for (auto const& object : deserialize_record.transferred_values) {
|
for (auto const& object : deserialize_record.transferred_values) {
|
||||||
if (is<HTML::MessagePort>(*object)) {
|
if (is<HTML::MessagePort>(*object)) {
|
||||||
new_ports.append(object);
|
new_ports.append(verify_cast<MessagePort>(*object));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1160,10 +1160,10 @@ WebIDL::ExceptionOr<void> Window::window_post_message_steps(JS::Value message, W
|
||||||
// 6. Let newPorts be a new frozen array consisting of all MessagePort objects in deserializeRecord.[[TransferredValues]],
|
// 6. Let newPorts be a new frozen array consisting of all MessagePort objects in deserializeRecord.[[TransferredValues]],
|
||||||
// if any, maintaining their relative order.
|
// if any, maintaining their relative order.
|
||||||
// FIXME: Use a FrozenArray
|
// FIXME: Use a FrozenArray
|
||||||
Vector<JS::Handle<JS::Object>> new_ports;
|
Vector<JS::Handle<MessagePort>> new_ports;
|
||||||
for (auto const& object : deserialize_record.transferred_values) {
|
for (auto const& object : deserialize_record.transferred_values) {
|
||||||
if (is<HTML::MessagePort>(*object)) {
|
if (is<HTML::MessagePort>(*object)) {
|
||||||
new_ports.append(object);
|
new_ports.append(verify_cast<MessagePort>(*object));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue