diff --git a/Userland/Libraries/LibWeb/Fetch/Body.cpp b/Userland/Libraries/LibWeb/Fetch/Body.cpp index 5c8c259e5d0..36118545ef3 100644 --- a/Userland/Libraries/LibWeb/Fetch/Body.cpp +++ b/Userland/Libraries/LibWeb/Fetch/Body.cpp @@ -112,7 +112,7 @@ WebIDL::ExceptionOr package_data(JS::Realm& realm, ByteBuffer bytes, case PackageDataType::Blob: { // Return a Blob whose contents are bytes and type attribute is mimeType. // NOTE: If extracting the mime type returns failure, other browsers set it to an empty string - not sure if that's spec'd. - auto mime_type_string = mime_type.has_value() ? TRY_OR_THROW_OOM(vm, mime_type->serialized()) : String {}; + auto mime_type_string = mime_type.has_value() ? MUST(mime_type->serialized()) : String {}; return FileAPI::Blob::create(realm, move(bytes), move(mime_type_string)); } case PackageDataType::FormData: @@ -142,7 +142,7 @@ WebIDL::ExceptionOr package_data(JS::Realm& realm, ByteBuffer bytes, auto decoder = TextCodec::decoder_for("UTF-8"sv); VERIFY(decoder.has_value()); - auto utf8_text = TRY_OR_THROW_OOM(vm, TextCodec::convert_input_to_utf8_using_given_decoder_unless_there_is_a_byte_order_mark(*decoder, bytes)); + auto utf8_text = MUST(TextCodec::convert_input_to_utf8_using_given_decoder_unless_there_is_a_byte_order_mark(*decoder, bytes)); return JS::PrimitiveString::create(vm, move(utf8_text)); } default: @@ -181,7 +181,7 @@ WebIDL::ExceptionOr> consume_body(JS::Realm& realm HTML::TemporaryExecutionContext execution_context { Bindings::host_defined_environment_settings_object(realm) }; auto value_or_error = Bindings::throw_dom_exception_if_needed(vm, [&]() -> WebIDL::ExceptionOr { - return package_data(realm, data, type, TRY_OR_THROW_OOM(vm, object.mime_type_impl())); + return package_data(realm, data, type, object.mime_type_impl()); }); if (value_or_error.is_error()) { diff --git a/Userland/Libraries/LibWeb/Fetch/Body.h b/Userland/Libraries/LibWeb/Fetch/Body.h index 4ad3445cc3f..dc072f44176 100644 --- a/Userland/Libraries/LibWeb/Fetch/Body.h +++ b/Userland/Libraries/LibWeb/Fetch/Body.h @@ -26,7 +26,7 @@ class BodyMixin { public: virtual ~BodyMixin(); - virtual ErrorOr> mime_type_impl() const = 0; + virtual Optional mime_type_impl() const = 0; virtual JS::GCPtr body_impl() = 0; virtual JS::GCPtr body_impl() const = 0; virtual Bindings::PlatformObject& as_platform_object() = 0; diff --git a/Userland/Libraries/LibWeb/Fetch/Request.cpp b/Userland/Libraries/LibWeb/Fetch/Request.cpp index 199877e359e..7cc571cd2ec 100644 --- a/Userland/Libraries/LibWeb/Fetch/Request.cpp +++ b/Userland/Libraries/LibWeb/Fetch/Request.cpp @@ -47,7 +47,7 @@ void Request::visit_edges(Cell::Visitor& visitor) // https://fetch.spec.whatwg.org/#concept-body-mime-type // https://fetch.spec.whatwg.org/#ref-for-concept-body-mime-type%E2%91%A0 -ErrorOr> Request::mime_type_impl() const +Optional Request::mime_type_impl() const { // Objects including the Body interface mixin need to define an associated MIME type algorithm which takes no arguments and returns failure or a MIME type. // A Request object’s MIME type is to return the result of extracting a MIME type from its request’s header list. diff --git a/Userland/Libraries/LibWeb/Fetch/Request.h b/Userland/Libraries/LibWeb/Fetch/Request.h index 45281777c38..07cdeede151 100644 --- a/Userland/Libraries/LibWeb/Fetch/Request.h +++ b/Userland/Libraries/LibWeb/Fetch/Request.h @@ -73,7 +73,7 @@ public: virtual ~Request() override; // ^BodyMixin - virtual ErrorOr> mime_type_impl() const override; + virtual Optional mime_type_impl() const override; virtual JS::GCPtr body_impl() override; virtual JS::GCPtr body_impl() const override; virtual Bindings::PlatformObject& as_platform_object() override { return *this; } diff --git a/Userland/Libraries/LibWeb/Fetch/Response.cpp b/Userland/Libraries/LibWeb/Fetch/Response.cpp index 29d0b63cd8c..db2e3890d01 100644 --- a/Userland/Libraries/LibWeb/Fetch/Response.cpp +++ b/Userland/Libraries/LibWeb/Fetch/Response.cpp @@ -44,7 +44,7 @@ void Response::visit_edges(Cell::Visitor& visitor) // https://fetch.spec.whatwg.org/#concept-body-mime-type // https://fetch.spec.whatwg.org/#ref-for-concept-header-extract-mime-type%E2%91%A7 -ErrorOr> Response::mime_type_impl() const +Optional Response::mime_type_impl() const { // Objects including the Body interface mixin need to define an associated MIME type algorithm which takes no arguments and returns failure or a MIME type. // A Response object’s MIME type is to return the result of extracting a MIME type from its response’s header list. diff --git a/Userland/Libraries/LibWeb/Fetch/Response.h b/Userland/Libraries/LibWeb/Fetch/Response.h index bce68a53cf4..f0c986a2256 100644 --- a/Userland/Libraries/LibWeb/Fetch/Response.h +++ b/Userland/Libraries/LibWeb/Fetch/Response.h @@ -40,7 +40,7 @@ public: virtual ~Response() override; // ^BodyMixin - virtual ErrorOr> mime_type_impl() const override; + virtual Optional mime_type_impl() const override; virtual JS::GCPtr body_impl() override; virtual JS::GCPtr body_impl() const override; virtual Bindings::PlatformObject& as_platform_object() override { return *this; }