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

LibWeb: Port SubmitEvent to new String

This commit is contained in:
Kenneth Myhra 2023-03-05 10:58:45 +01:00 committed by Linus Groh
parent dd2d029952
commit cec1cda8b0
4 changed files with 9 additions and 9 deletions

View file

@ -83,7 +83,7 @@ ErrorOr<void> HTMLFormElement::submit_form(JS::GCPtr<HTMLElement> submitter, boo
SubmitEventInit event_init {};
event_init.submitter = submitter_button;
auto submit_event = SubmitEvent::create(realm(), EventNames::submit, event_init).release_value_but_fixme_should_propagate_errors();
auto submit_event = SubmitEvent::create(realm(), String::from_deprecated_string(EventNames::submit).release_value_but_fixme_should_propagate_errors(), event_init).release_value_but_fixme_should_propagate_errors();
submit_event->set_bubbles(true);
submit_event->set_cancelable(true);
bool continue_ = dispatch_event(*submit_event);

View file

@ -9,18 +9,18 @@
namespace Web::HTML {
WebIDL::ExceptionOr<JS::NonnullGCPtr<SubmitEvent>> SubmitEvent::create(JS::Realm& realm, DeprecatedFlyString const& event_name, SubmitEventInit const& event_init)
WebIDL::ExceptionOr<JS::NonnullGCPtr<SubmitEvent>> SubmitEvent::create(JS::Realm& realm, FlyString const& event_name, SubmitEventInit const& event_init)
{
return MUST_OR_THROW_OOM(realm.heap().allocate<SubmitEvent>(realm, realm, event_name, event_init));
}
WebIDL::ExceptionOr<JS::NonnullGCPtr<SubmitEvent>> SubmitEvent::construct_impl(JS::Realm& realm, DeprecatedFlyString const& event_name, SubmitEventInit const& event_init)
WebIDL::ExceptionOr<JS::NonnullGCPtr<SubmitEvent>> SubmitEvent::construct_impl(JS::Realm& realm, FlyString const& event_name, SubmitEventInit const& event_init)
{
return create(realm, event_name, event_init);
}
SubmitEvent::SubmitEvent(JS::Realm& realm, DeprecatedFlyString const& event_name, SubmitEventInit const& event_init)
: DOM::Event(realm, event_name, event_init)
SubmitEvent::SubmitEvent(JS::Realm& realm, FlyString const& event_name, SubmitEventInit const& event_init)
: DOM::Event(realm, event_name.to_deprecated_fly_string(), event_init)
, m_submitter(event_init.submitter)
{
}

View file

@ -19,15 +19,15 @@ class SubmitEvent final : public DOM::Event {
WEB_PLATFORM_OBJECT(SubmitEvent, DOM::Event);
public:
static WebIDL::ExceptionOr<JS::NonnullGCPtr<SubmitEvent>> create(JS::Realm&, DeprecatedFlyString const& event_name, SubmitEventInit const& event_init);
static WebIDL::ExceptionOr<JS::NonnullGCPtr<SubmitEvent>> construct_impl(JS::Realm&, DeprecatedFlyString const& event_name, SubmitEventInit const& event_init);
static WebIDL::ExceptionOr<JS::NonnullGCPtr<SubmitEvent>> create(JS::Realm&, FlyString const& event_name, SubmitEventInit const& event_init);
static WebIDL::ExceptionOr<JS::NonnullGCPtr<SubmitEvent>> construct_impl(JS::Realm&, FlyString const& event_name, SubmitEventInit const& event_init);
virtual ~SubmitEvent() override;
JS::GCPtr<HTMLElement> submitter() const { return m_submitter; }
private:
SubmitEvent(JS::Realm&, DeprecatedFlyString const& event_name, SubmitEventInit const& event_init);
SubmitEvent(JS::Realm&, FlyString const& event_name, SubmitEventInit const& event_init);
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
virtual void visit_edges(Cell::Visitor&) override;

View file

@ -2,7 +2,7 @@
#import <HTML/HTMLElement.idl>
// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#submitevent
[Exposed=Window]
[Exposed=Window, UseNewAKString]
interface SubmitEvent : Event {
constructor(DOMString type, optional SubmitEventInit eventInitDict = {});