LibWeb: Port FormDataEvent to new String

This commit is contained in:
Kenneth Myhra 2023-03-05 10:53:19 +01:00 committed by Linus Groh
parent eed69e5093
commit bb7ae423d5
Notes: sideshowbarker 2024-07-17 03:19:14 +09:00
4 changed files with 7 additions and 7 deletions

View File

@ -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.
FormDataEventInit init {};
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.dispatch_event(form_data_event);

View File

@ -10,13 +10,13 @@
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));
}
FormDataEvent::FormDataEvent(JS::Realm& realm, DeprecatedString const& event_name, FormDataEventInit const& event_init)
: DOM::Event(realm, event_name, event_init)
FormDataEvent::FormDataEvent(JS::Realm& realm, FlyString const& event_name, FormDataEventInit const& event_init)
: DOM::Event(realm, event_name.to_deprecated_fly_string(), event_init)
, m_form_data(event_init.form_data)
{
}

View File

@ -19,14 +19,14 @@ class FormDataEvent final : public DOM::Event {
WEB_PLATFORM_OBJECT(FormDataEvent, DOM::Event);
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;
JS::GCPtr<XHR::FormData> form_data() const { return m_form_data; }
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;

View File

@ -2,7 +2,7 @@
#import <XHR/FormData.idl>
// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#the-formdataevent-interface
[Exposed=Window]
[Exposed=Window, UseNewAKString]
interface FormDataEvent : Event {
constructor(DOMString type, FormDataEventInit eventInitDict);