1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-20 12:15:07 +00:00

LibWeb: Do not use HTMLFormElement::elements to get submittable elements

HTMLFormElement::elements is not the correct filter for submittable
elements. It includes non-submittable elements (HTMLObjectElement) and
also excludes submittable elements (HTMLInputElements in the "image"
type state, "for historical reasons").
This commit is contained in:
Timothy Flynn 2024-02-18 21:52:27 -05:00 committed by Andreas Kling
parent debb5690ce
commit 986811d2aa
3 changed files with 14 additions and 27 deletions

View file

@ -51,8 +51,6 @@ WebIDL::ExceptionOr<XHR::FormDataEntry> create_entry(JS::Realm& realm, String co
// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#constructing-the-form-data-set
WebIDL::ExceptionOr<Optional<Vector<XHR::FormDataEntry>>> construct_entry_list(JS::Realm& realm, HTMLFormElement& form, JS::GCPtr<HTMLElement> submitter, Optional<String> encoding)
{
auto& vm = realm.vm();
// 1. If form's constructing entry list is true, then return null.
if (form.constructing_entry_list())
return Optional<Vector<XHR::FormDataEntry>> {};
@ -61,7 +59,7 @@ WebIDL::ExceptionOr<Optional<Vector<XHR::FormDataEntry>>> construct_entry_list(J
form.set_constructing_entry_list(true);
// 3. Let controls be a list of all the submittable elements whose form owner is form, in tree order.
auto controls = TRY_OR_THROW_OOM(vm, form.get_submittable_elements());
auto controls = form.get_submittable_elements();
// 4. Let entry list be a new empty entry list.
Vector<XHR::FormDataEntry> entry_list;