summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorIdan Horowitz <idan.horowitz@gmail.com>2021-10-01 18:21:38 +0300
committerAndreas Kling <kling@serenityos.org>2021-10-01 20:14:45 +0200
commitb53fc8ad3d4da15e1c7ec6ccd9889f261c5d160a (patch)
treebb2cc00b91df3ff7f12d97c35c412795fa667bdd /Userland
parentded8e84f32cf937bf1115f2a8dd0d19db55e212a (diff)
downloadserenity-b53fc8ad3d4da15e1c7ec6ccd9889f261c5d160a.zip
LibWeb: Change the IDL type of MessageEvent::data to any
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibWeb/HTML/MessageEvent.h12
-rw-r--r--Userland/Libraries/LibWeb/HTML/MessageEvent.idl3
-rw-r--r--Userland/Libraries/LibWeb/HTML/MessagePort.cpp2
-rw-r--r--Userland/Libraries/LibWeb/HTML/WebSocket.cpp2
4 files changed, 9 insertions, 10 deletions
diff --git a/Userland/Libraries/LibWeb/HTML/MessageEvent.h b/Userland/Libraries/LibWeb/HTML/MessageEvent.h
index 5fa92bcf4e..c639fb22b8 100644
--- a/Userland/Libraries/LibWeb/HTML/MessageEvent.h
+++ b/Userland/Libraries/LibWeb/HTML/MessageEvent.h
@@ -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;
};
diff --git a/Userland/Libraries/LibWeb/HTML/MessageEvent.idl b/Userland/Libraries/LibWeb/HTML/MessageEvent.idl
index 25ff644fdd..b78b8530ba 100644
--- a/Userland/Libraries/LibWeb/HTML/MessageEvent.idl
+++ b/Userland/Libraries/LibWeb/HTML/MessageEvent.idl
@@ -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;
};
diff --git a/Userland/Libraries/LibWeb/HTML/MessagePort.cpp b/Userland/Libraries/LibWeb/HTML/MessagePort.cpp
index 4684a726d1..9f94ba1f5e 100644
--- a/Userland/Libraries/LibWeb/HTML/MessagePort.cpp
+++ b/Userland/Libraries/LibWeb/HTML/MessagePort.cpp
@@ -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>"));
}));
}
diff --git a/Userland/Libraries/LibWeb/HTML/WebSocket.cpp b/Userland/Libraries/LibWeb/HTML/WebSocket.cpp
index c5dfca9088..a73df59177 100644
--- a/Userland/Libraries/LibWeb/HTML/WebSocket.cpp
+++ b/Userland/Libraries/LibWeb/HTML/WebSocket.cpp
@@ -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"