mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 18:27:35 +00:00
LibWeb: Convert all generated bindings to ThrowCompletionOr
This also required converting URLSearchParams::for_each and the callback function it invokes to ThrowCompletionOr. With this, the ReturnType enum used by WrapperGenerator is removed as all callers would be using ReturnType::Completion.
This commit is contained in:
parent
19ac19eae1
commit
c19c306744
3 changed files with 120 additions and 220 deletions
|
@ -207,13 +207,14 @@ String URLSearchParams::to_string()
|
|||
return url_encode(m_list, AK::URL::PercentEncodeSet::ApplicationXWWWFormUrlencoded);
|
||||
}
|
||||
|
||||
void URLSearchParams::for_each(Function<IterationDecision(String const&, String const&)> callback)
|
||||
JS::ThrowCompletionOr<void> URLSearchParams::for_each(ForEachCallback callback)
|
||||
{
|
||||
for (auto i = 0u; i < m_list.size(); ++i) {
|
||||
auto& query_param = m_list[i]; // We are explicitly iterating over the indices here as the callback might delete items from the list
|
||||
if (callback(query_param.name, query_param.value) == IterationDecision::Break)
|
||||
break;
|
||||
TRY(callback(query_param.name, query_param.value));
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue