mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-10 13:00:29 +03:00
LibWeb: Port FormDataEvent to new String
This commit is contained in:
parent
eed69e5093
commit
bb7ae423d5
Notes:
sideshowbarker
2024-07-17 03:19:14 +09:00
Author: https://github.com/kennethmyhra Commit: https://github.com/SerenityOS/serenity/commit/bb7ae423d5 Pull-request: https://github.com/SerenityOS/serenity/pull/17722 Reviewed-by: https://github.com/linusg ✅
@ -164,7 +164,7 @@ WebIDL::ExceptionOr<Optional<Vector<XHR::FormDataEntry>>> construct_entry_list(J
|
|||||||
// 7. Fire an event named formdata at form using FormDataEvent, with the formData attribute initialized to form data and the bubbles attribute initialized to true.
|
// 7. Fire an event named formdata at form using FormDataEvent, with the formData attribute initialized to form data and the bubbles attribute initialized to true.
|
||||||
FormDataEventInit init {};
|
FormDataEventInit init {};
|
||||||
init.form_data = form_data;
|
init.form_data = form_data;
|
||||||
auto form_data_event = TRY(FormDataEvent::construct_impl(realm, HTML::EventNames::formdata, init));
|
auto form_data_event = TRY(FormDataEvent::construct_impl(realm, String::from_deprecated_string(HTML::EventNames::formdata).release_value_but_fixme_should_propagate_errors(), init));
|
||||||
form_data_event->set_bubbles(true);
|
form_data_event->set_bubbles(true);
|
||||||
form.dispatch_event(form_data_event);
|
form.dispatch_event(form_data_event);
|
||||||
|
|
||||||
|
@ -10,13 +10,13 @@
|
|||||||
|
|
||||||
namespace Web::HTML {
|
namespace Web::HTML {
|
||||||
|
|
||||||
WebIDL::ExceptionOr<JS::NonnullGCPtr<FormDataEvent>> FormDataEvent::construct_impl(JS::Realm& realm, DeprecatedString const& event_name, FormDataEventInit const& event_init)
|
WebIDL::ExceptionOr<JS::NonnullGCPtr<FormDataEvent>> FormDataEvent::construct_impl(JS::Realm& realm, FlyString const& event_name, FormDataEventInit const& event_init)
|
||||||
{
|
{
|
||||||
return MUST_OR_THROW_OOM(realm.heap().allocate<FormDataEvent>(realm, realm, event_name, event_init));
|
return MUST_OR_THROW_OOM(realm.heap().allocate<FormDataEvent>(realm, realm, event_name, event_init));
|
||||||
}
|
}
|
||||||
|
|
||||||
FormDataEvent::FormDataEvent(JS::Realm& realm, DeprecatedString const& event_name, FormDataEventInit const& event_init)
|
FormDataEvent::FormDataEvent(JS::Realm& realm, FlyString const& event_name, FormDataEventInit const& event_init)
|
||||||
: DOM::Event(realm, event_name, event_init)
|
: DOM::Event(realm, event_name.to_deprecated_fly_string(), event_init)
|
||||||
, m_form_data(event_init.form_data)
|
, m_form_data(event_init.form_data)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -19,14 +19,14 @@ class FormDataEvent final : public DOM::Event {
|
|||||||
WEB_PLATFORM_OBJECT(FormDataEvent, DOM::Event);
|
WEB_PLATFORM_OBJECT(FormDataEvent, DOM::Event);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static WebIDL::ExceptionOr<JS::NonnullGCPtr<FormDataEvent>> construct_impl(JS::Realm&, DeprecatedString const& event_name, FormDataEventInit const& event_init);
|
static WebIDL::ExceptionOr<JS::NonnullGCPtr<FormDataEvent>> construct_impl(JS::Realm&, FlyString const& event_name, FormDataEventInit const& event_init);
|
||||||
|
|
||||||
virtual ~FormDataEvent() override;
|
virtual ~FormDataEvent() override;
|
||||||
|
|
||||||
JS::GCPtr<XHR::FormData> form_data() const { return m_form_data; }
|
JS::GCPtr<XHR::FormData> form_data() const { return m_form_data; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
FormDataEvent(JS::Realm&, DeprecatedString const& event_name, FormDataEventInit const& event_init);
|
FormDataEvent(JS::Realm&, FlyString const& event_name, FormDataEventInit const& event_init);
|
||||||
|
|
||||||
JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#import <XHR/FormData.idl>
|
#import <XHR/FormData.idl>
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#the-formdataevent-interface
|
// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#the-formdataevent-interface
|
||||||
[Exposed=Window]
|
[Exposed=Window, UseNewAKString]
|
||||||
interface FormDataEvent : Event {
|
interface FormDataEvent : Event {
|
||||||
constructor(DOMString type, FormDataEventInit eventInitDict);
|
constructor(DOMString type, FormDataEventInit eventInitDict);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user