1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 15:47:44 +00:00

LibWeb: Add FormDataIterator implementation

This adds the FormDataIterator implementation so we can iterate over
FormData.{keys(),values(),entries()}.
This commit is contained in:
Kenneth Myhra 2023-03-05 17:29:11 +01:00 committed by Linus Groh
parent 680e970597
commit be52e7171a
8 changed files with 133 additions and 2 deletions

View file

@ -171,4 +171,14 @@ WebIDL::ExceptionOr<void> FormData::set_impl(String const& name, Variant<JS::Non
return {};
}
JS::ThrowCompletionOr<void> FormData::for_each(ForEachCallback callback)
{
for (auto i = 0u; i < m_entry_list.size(); ++i) {
auto& entry = m_entry_list[i];
TRY(callback(entry.name, entry.value));
}
return {};
}
}