Skip to content

Truly independent web browser

LibWeb: Hold the values of FormData.getAll() conservatively

Shannon Booth565a9a3902a7
diff --git a/Libraries/LibWeb/XHR/FormData.cpp b/Libraries/LibWeb/XHR/FormData.cpp
index f0b3c2334f5..6758f8629bd 100644
--- a/Libraries/LibWeb/XHR/FormData.cpp
+++ b/Libraries/LibWeb/XHR/FormData.cpp
@@ -150,11 +150,11 @@ Variant<GC::Ref<FileAPI::File>, Utf16String, Empty> FormData::get(Utf16String co
}
// https://xhr.spec.whatwg.org/#dom-formdata-getall
-WebIDL::ExceptionOr<Vector<FormDataEntryValue>> FormData::get_all(Utf16String const& name)
+WebIDL::ExceptionOr<GC::ConservativeVector<FormDataEntryValue>> FormData::get_all(Utf16String const& name)
{
// 1. If there is no entry whose name is name in this’s entry list, then return the empty list.
// 2. Return the values of all entries whose name is name, in order, from this’s entry list.
- Vector<FormDataEntryValue> values;
+ GC::ConservativeVector<FormDataEntryValue> values;
for (auto const& entry : m_entry_list) {
if (entry.name == name)
TRY_OR_THROW_OOM(JS::VM::the(), values.try_append(form_data_entry_value_for_bindings(entry.value)));
diff --git a/Libraries/LibWeb/XHR/FormData.h b/Libraries/LibWeb/XHR/FormData.h
index f80c1704e1c..268a4717faf 100644
--- a/Libraries/LibWeb/XHR/FormData.h
+++ b/Libraries/LibWeb/XHR/FormData.h
@@ -35,7 +35,7 @@ public:
WebIDL::ExceptionOr<void> append(Utf16String const& name, GC::Ref<FileAPI::Blob> const& blob_value, Optional<Utf16String> const& filename = {});
void delete_(Utf16String const& name);
Variant<GC::Ref<FileAPI::File>, Utf16String, Empty> get(Utf16String const& name);
- WebIDL::ExceptionOr<Vector<FormDataEntryValue>> get_all(Utf16String const& name);
+ WebIDL::ExceptionOr<GC::ConservativeVector<FormDataEntryValue>> get_all(Utf16String const& name);
bool has(Utf16String const& name);
WebIDL::ExceptionOr<void> set(Utf16String const& name, Utf16String const& value);
WebIDL::ExceptionOr<void> set(Utf16String const& name, GC::Ref<FileAPI::Blob> const& blob_value, Optional<Utf16String> const& filename = {});