diff --git a/Libraries/LibWeb/HTML/FormControlInfrastructure.cpp b/Libraries/LibWeb/HTML/FormControlInfrastructure.cpp
index 848621e9e62..ddbd17b00b6 100644
--- a/Libraries/LibWeb/HTML/FormControlInfrastructure.cpp
+++ b/Libraries/LibWeb/HTML/FormControlInfrastructure.cpp
@@ -201,7 +201,7 @@ WebIDL::ExceptionOr>> construct_entry_list(J
}
}
// 6. Let form data be a new FormData object associated with entry list.
- auto form_data = TRY(XHR::FormData::construct_impl(realm, entry_list));
+ auto form_data = TRY(XHR::FormData::construct_impl(realm, move(entry_list)));
// 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 {};
@@ -214,7 +214,7 @@ WebIDL::ExceptionOr>> construct_entry_list(J
form.set_constructing_entry_list(false);
// 9. Return a clone of entry list.
- return entry_list;
+ return form_data->entry_list();
}
ErrorOr normalize_line_breaks(StringView value)
diff --git a/Tests/LibWeb/Text/expected/HTML/form-add-dynamic-formdata.txt b/Tests/LibWeb/Text/expected/HTML/form-add-dynamic-formdata.txt
new file mode 100644
index 00000000000..8447c6d8dcb
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/HTML/form-add-dynamic-formdata.txt
@@ -0,0 +1,2 @@
+formData.get('field1') === 'value1': true
+formData.get('field2') === 'value2': true
diff --git a/Tests/LibWeb/Text/input/HTML/form-add-dynamic-formdata.html b/Tests/LibWeb/Text/input/HTML/form-add-dynamic-formdata.html
new file mode 100644
index 00000000000..e808ca226fe
--- /dev/null
+++ b/Tests/LibWeb/Text/input/HTML/form-add-dynamic-formdata.html
@@ -0,0 +1,19 @@
+
+
+
+