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

LibWeb: Add the missing MessageEvent IDL constructor

This commit is contained in:
Idan Horowitz 2021-10-01 18:39:03 +03:00 committed by Andreas Kling
parent 9863de4609
commit d44857d34d
4 changed files with 36 additions and 8 deletions

View file

@ -203,7 +203,10 @@ 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, JS::js_string(wrapper()->vm(), text_message), url()));
MessageEventInit event_init {};
event_init.data = JS::js_string(wrapper()->vm(), text_message);
event_init.origin = url();
dispatch_event(MessageEvent::create(EventNames::message, event_init));
return;
}
// type indicates that the data is Binary and binaryType is "blob"