1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 16:57:35 +00:00

LibWeb: Port MessageEvent to new String

This commit is contained in:
Kenneth Myhra 2023-03-05 10:33:56 +01:00 committed by Linus Groh
parent 84997ab0ee
commit eed69e5093
8 changed files with 26 additions and 25 deletions

View file

@ -7,37 +7,38 @@
#pragma once
#include <AK/FlyString.h>
#include <LibWeb/DOM/Event.h>
namespace Web::HTML {
struct MessageEventInit : public DOM::EventInit {
JS::Value data { JS::js_null() };
DeprecatedString origin { "" };
DeprecatedString last_event_id { "" };
String origin;
String last_event_id;
};
class MessageEvent : public DOM::Event {
WEB_PLATFORM_OBJECT(MessageEvent, DOM::Event);
public:
static WebIDL::ExceptionOr<JS::NonnullGCPtr<MessageEvent>> create(JS::Realm&, DeprecatedFlyString const& event_name, MessageEventInit const& event_init = {});
static WebIDL::ExceptionOr<JS::NonnullGCPtr<MessageEvent>> construct_impl(JS::Realm&, DeprecatedFlyString const& event_name, MessageEventInit const& event_init);
static WebIDL::ExceptionOr<JS::NonnullGCPtr<MessageEvent>> create(JS::Realm&, FlyString const& event_name, MessageEventInit const& event_init = {});
static WebIDL::ExceptionOr<JS::NonnullGCPtr<MessageEvent>> construct_impl(JS::Realm&, FlyString const& event_name, MessageEventInit const& event_init);
MessageEvent(JS::Realm&, DeprecatedFlyString const& event_name, MessageEventInit const& event_init);
MessageEvent(JS::Realm&, FlyString const& event_name, MessageEventInit const& event_init);
virtual ~MessageEvent() override;
JS::Value data() const { return m_data; }
DeprecatedString const& origin() const { return m_origin; }
DeprecatedString const& last_event_id() const { return m_last_event_id; }
String const& origin() const { return m_origin; }
String const& last_event_id() const { return m_last_event_id; }
private:
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
virtual void visit_edges(Cell::Visitor&) override;
JS::Value m_data;
DeprecatedString m_origin;
DeprecatedString m_last_event_id;
String m_origin;
String m_last_event_id;
};
}