mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-06 03:02:55 +00:00
LibWeb: Don't propogate small OOMs from URLSearchParams
Made easier now that URL percent encode after encoding is also not throwing any errors. This simplfies a bunch of error handling.
This commit is contained in:
parent
4bb211ba88
commit
df4739d7ce
Notes:
github-actions[bot]
2024-08-12 22:02:35 +00:00
Author: https://github.com/shannonbooth
Commit: df4739d7ce
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1033
Reviewed-by: https://github.com/tcl3 ✅
7 changed files with 59 additions and 77 deletions
|
@ -731,7 +731,7 @@ ErrorOr<void> HTMLFormElement::mutate_action_url(URL::URL parsed_action, Vector<
|
|||
auto pairs = TRY(convert_to_list_of_name_value_pairs(entry_list));
|
||||
|
||||
// 2. Let query be the result of running the application/x-www-form-urlencoded serializer with pairs and encoding.
|
||||
auto query = TRY(url_encode(pairs, encoding));
|
||||
auto query = url_encode(pairs, encoding);
|
||||
|
||||
// 3. Set parsed action's query component to query.
|
||||
parsed_action.set_query(query);
|
||||
|
@ -757,7 +757,7 @@ ErrorOr<void> HTMLFormElement::submit_as_entity_body(URL::URL parsed_action, Vec
|
|||
auto pairs = TRY(convert_to_list_of_name_value_pairs(entry_list));
|
||||
|
||||
// 2. Let body be the result of running the application/x-www-form-urlencoded serializer with pairs and encoding.
|
||||
body = TRY(ByteBuffer::copy(TRY(url_encode(pairs, encoding)).bytes()));
|
||||
body = TRY(ByteBuffer::copy(url_encode(pairs, encoding).bytes()));
|
||||
|
||||
// 3. Set body to the result of encoding body.
|
||||
// NOTE: `encoding` refers to `UTF-8 encode`, which body already is encoded as because it uses AK::String.
|
||||
|
@ -815,7 +815,7 @@ ErrorOr<void> HTMLFormElement::mail_with_headers(URL::URL parsed_action, Vector<
|
|||
auto pairs = TRY(convert_to_list_of_name_value_pairs(entry_list));
|
||||
|
||||
// 2. Let headers be the result of running the application/x-www-form-urlencoded serializer with pairs and encoding.
|
||||
auto headers = TRY(url_encode(pairs, encoding));
|
||||
auto headers = url_encode(pairs, encoding);
|
||||
|
||||
// 3. Replace occurrences of U+002B PLUS SIGN characters (+) in headers with the string "%20".
|
||||
TRY(headers.replace("+"sv, "%20"sv, ReplaceMode::All));
|
||||
|
@ -851,7 +851,7 @@ ErrorOr<void> HTMLFormElement::mail_as_body(URL::URL parsed_action, Vector<XHR::
|
|||
default:
|
||||
// -> Otherwise
|
||||
// Let body be the result of running the application/x-www-form-urlencoded serializer with pairs and encoding.
|
||||
body = TRY(url_encode(pairs, encoding));
|
||||
body = url_encode(pairs, encoding);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue