mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 01:58:12 +00:00
LibWeb: Change the IDL type of MessageEvent::data to any
This commit is contained in:
parent
ded8e84f32
commit
b53fc8ad3d
4 changed files with 9 additions and 10 deletions
|
@ -14,25 +14,25 @@ class MessageEvent : public DOM::Event {
|
|||
public:
|
||||
using WrapperType = Bindings::MessageEventWrapper;
|
||||
|
||||
static NonnullRefPtr<MessageEvent> create(const FlyString& event_name, const String& data, const String& origin)
|
||||
static NonnullRefPtr<MessageEvent> create(const FlyString& event_name, JS::Value data, String const& origin)
|
||||
{
|
||||
return adopt_ref(*new MessageEvent(event_name, data, origin));
|
||||
}
|
||||
|
||||
virtual ~MessageEvent() override = default;
|
||||
|
||||
const String& data() const { return m_data; }
|
||||
const String& origin() const { return m_origin; }
|
||||
JS::Value data() const { return m_data; }
|
||||
String const& origin() const { return m_origin; }
|
||||
|
||||
protected:
|
||||
MessageEvent(const FlyString& event_name, const String& data, const String& origin)
|
||||
MessageEvent(const FlyString& event_name, JS::Value data, String origin)
|
||||
: DOM::Event(event_name)
|
||||
, m_data(data)
|
||||
, m_origin(origin)
|
||||
, m_origin(move(origin))
|
||||
{
|
||||
}
|
||||
|
||||
String m_data;
|
||||
JS::Value m_data;
|
||||
String m_origin;
|
||||
};
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
interface MessageEvent : Event {
|
||||
|
||||
// FIXME: This should be of type "any" instead of "USVString"
|
||||
readonly attribute USVString data;
|
||||
readonly attribute any data;
|
||||
readonly attribute USVString origin;
|
||||
|
||||
};
|
||||
|
|
|
@ -80,7 +80,7 @@ void MessagePort::post_message(JS::Value message)
|
|||
// FIXME: This is an ad-hoc hack implementation instead, since we don't currently
|
||||
// have serialization and deserialization of messages.
|
||||
main_thread_event_loop().task_queue().add(HTML::Task::create(HTML::Task::Source::PostedMessage, nullptr, [strong_port = NonnullRefPtr { *target_port }, message]() mutable {
|
||||
strong_port->dispatch_event(MessageEvent::create(HTML::EventNames::message, message.to_string_without_side_effects(), "<origin>"));
|
||||
strong_port->dispatch_event(MessageEvent::create(HTML::EventNames::message, message, "<origin>"));
|
||||
}));
|
||||
}
|
||||
|
||||
|
|
|
@ -203,7 +203,7 @@ void WebSocket::on_message(ByteBuffer message, bool is_text)
|
|||
return;
|
||||
if (is_text) {
|
||||
auto text_message = String(ReadonlyBytes(message));
|
||||
dispatch_event(MessageEvent::create(EventNames::message, text_message, url()));
|
||||
dispatch_event(MessageEvent::create(EventNames::message, JS::js_string(wrapper()->vm(), text_message), url()));
|
||||
return;
|
||||
}
|
||||
// type indicates that the data is Binary and binaryType is "blob"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue