LibWeb: Remove exception handling from safely extracting response bodies

The entire purpose of this AO is to avoid handling exceptions, which we
can do now that the underlying AOs do not throw exceptions on OOM.
This commit is contained in:
Timothy Flynn 2024-11-04 16:06:01 +01:00 committed by Andrew Kaster
parent 49ff5eb4d8
commit 953fe75271
Notes: github-actions[bot] 2024-12-10 03:04:18 +00:00
8 changed files with 33 additions and 34 deletions

View file

@ -574,15 +574,15 @@ WebIDL::ExceptionOr<void> XMLHttpRequest::send(Optional<DocumentOrXMLHttpRequest
// 2. If body is a Document, then set thiss request body to body, serialized, converted, and UTF-8 encoded.
if (body->has<GC::Root<DOM::Document>>()) {
auto string_serialized_document = TRY(body->get<GC::Root<DOM::Document>>().cell()->serialize_fragment(DOMParsing::RequireWellFormed::No));
m_request_body = TRY(Fetch::Infrastructure::byte_sequence_as_body(realm, string_serialized_document.bytes()));
m_request_body = Fetch::Infrastructure::byte_sequence_as_body(realm, string_serialized_document.bytes());
}
// 3. Otherwise:
else {
// 1. Let bodyWithType be the result of safely extracting body.
auto body_with_type = TRY(Fetch::safely_extract_body(realm, body->downcast<Fetch::BodyInitOrReadableBytes>()));
auto body_with_type = Fetch::safely_extract_body(realm, body->downcast<Fetch::BodyInitOrReadableBytes>());
// 2. Set thiss request body to bodyWithTypes body.
m_request_body = move(body_with_type.body);
m_request_body = body_with_type.body;
// 3. Set extractedContentType to bodyWithTypes type.
extracted_content_type = move(body_with_type.type);