mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 09:38:11 +00:00
LibWeb/Fetch: Propagate OOM errors from HeaderList::extract_mime_type()
This commit is contained in:
parent
2d7ce38ee2
commit
ad4b4046f4
14 changed files with 36 additions and 36 deletions
|
@ -164,7 +164,7 @@ JS::NonnullGCPtr<JS::Promise> consume_body(JS::Realm& realm, BodyMixin const& ob
|
||||||
auto steps = [&vm, &realm, &object, type](JS::Value value) -> WebIDL::ExceptionOr<JS::Value> {
|
auto steps = [&vm, &realm, &object, type](JS::Value value) -> WebIDL::ExceptionOr<JS::Value> {
|
||||||
VERIFY(value.is_string());
|
VERIFY(value.is_string());
|
||||||
auto bytes = TRY_OR_THROW_OOM(vm, ByteBuffer::copy(TRY(value.as_string().deprecated_string()).bytes()));
|
auto bytes = TRY_OR_THROW_OOM(vm, ByteBuffer::copy(TRY(value.as_string().deprecated_string()).bytes()));
|
||||||
return package_data(realm, move(bytes), type, object.mime_type_impl());
|
return package_data(realm, move(bytes), type, object.mime_type_impl().release_value_but_fixme_should_propagate_errors());
|
||||||
};
|
};
|
||||||
|
|
||||||
// 5. Return the result of upon fulfillment of promise given steps.
|
// 5. Return the result of upon fulfillment of promise given steps.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2022, Linus Groh <linusg@serenityos.org>
|
* Copyright (c) 2022-2023, Linus Groh <linusg@serenityos.org>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -26,7 +26,7 @@ class BodyMixin {
|
||||||
public:
|
public:
|
||||||
virtual ~BodyMixin();
|
virtual ~BodyMixin();
|
||||||
|
|
||||||
virtual Optional<MimeSniff::MimeType> mime_type_impl() const = 0;
|
virtual ErrorOr<Optional<MimeSniff::MimeType>> mime_type_impl() const = 0;
|
||||||
virtual Optional<Infrastructure::Body&> body_impl() = 0;
|
virtual Optional<Infrastructure::Body&> body_impl() = 0;
|
||||||
virtual Optional<Infrastructure::Body const&> body_impl() const = 0;
|
virtual Optional<Infrastructure::Body const&> body_impl() const = 0;
|
||||||
|
|
||||||
|
|
|
@ -447,7 +447,7 @@ WebIDL::ExceptionOr<Optional<JS::NonnullGCPtr<PendingResponse>>> main_fetch(JS::
|
||||||
// FIXME: - should internalResponse to request be blocked by Content Security Policy
|
// FIXME: - should internalResponse to request be blocked by Content Security Policy
|
||||||
|| false
|
|| false
|
||||||
// - should internalResponse to request be blocked due to its MIME type
|
// - should internalResponse to request be blocked due to its MIME type
|
||||||
|| Infrastructure::should_response_to_request_be_blocked_due_to_its_mime_type(internal_response, request) == Infrastructure::RequestOrResponseBlocking::Blocked
|
|| TRY_OR_IGNORE(Infrastructure::should_response_to_request_be_blocked_due_to_its_mime_type(internal_response, request)) == Infrastructure::RequestOrResponseBlocking::Blocked
|
||||||
// - should internalResponse to request be blocked due to nosniff
|
// - should internalResponse to request be blocked due to nosniff
|
||||||
|| TRY_OR_IGNORE(Infrastructure::should_response_to_request_be_blocked_due_to_nosniff(internal_response, request)) == Infrastructure::RequestOrResponseBlocking::Blocked)) {
|
|| TRY_OR_IGNORE(Infrastructure::should_response_to_request_be_blocked_due_to_nosniff(internal_response, request)) == Infrastructure::RequestOrResponseBlocking::Blocked)) {
|
||||||
// then set response and internalResponse to a network error.
|
// then set response and internalResponse to a network error.
|
||||||
|
|
|
@ -298,7 +298,7 @@ ErrorOr<Vector<Header>> HeaderList::sort_and_combine() const
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://fetch.spec.whatwg.org/#concept-header-extract-mime-type
|
// https://fetch.spec.whatwg.org/#concept-header-extract-mime-type
|
||||||
Optional<MimeSniff::MimeType> HeaderList::extract_mime_type() const
|
ErrorOr<Optional<MimeSniff::MimeType>> HeaderList::extract_mime_type() const
|
||||||
{
|
{
|
||||||
// 1. Let charset be null.
|
// 1. Let charset be null.
|
||||||
Optional<String> charset;
|
Optional<String> charset;
|
||||||
|
@ -312,17 +312,17 @@ Optional<MimeSniff::MimeType> HeaderList::extract_mime_type() const
|
||||||
// 4. Let values be the result of getting, decoding, and splitting `Content-Type` from headers.
|
// 4. Let values be the result of getting, decoding, and splitting `Content-Type` from headers.
|
||||||
auto values_or_error = get_decode_and_split("Content-Type"sv.bytes());
|
auto values_or_error = get_decode_and_split("Content-Type"sv.bytes());
|
||||||
if (values_or_error.is_error())
|
if (values_or_error.is_error())
|
||||||
return {};
|
return OptionalNone {};
|
||||||
auto values = values_or_error.release_value();
|
auto values = values_or_error.release_value();
|
||||||
|
|
||||||
// 5. If values is null, then return failure.
|
// 5. If values is null, then return failure.
|
||||||
if (!values.has_value())
|
if (!values.has_value())
|
||||||
return {};
|
return OptionalNone {};
|
||||||
|
|
||||||
// 6. For each value of values:
|
// 6. For each value of values:
|
||||||
for (auto const& value : *values) {
|
for (auto const& value : *values) {
|
||||||
// 1. Let temporaryMimeType be the result of parsing value.
|
// 1. Let temporaryMimeType be the result of parsing value.
|
||||||
auto temporary_mime_type = MimeSniff::MimeType::parse(value).release_value_but_fixme_should_propagate_errors();
|
auto temporary_mime_type = TRY(MimeSniff::MimeType::parse(value));
|
||||||
|
|
||||||
// 2. If temporaryMimeType is failure or its essence is "*/*", then continue.
|
// 2. If temporaryMimeType is failure or its essence is "*/*", then continue.
|
||||||
if (!temporary_mime_type.has_value() || temporary_mime_type->essence() == "*/*"sv)
|
if (!temporary_mime_type.has_value() || temporary_mime_type->essence() == "*/*"sv)
|
||||||
|
@ -346,7 +346,7 @@ Optional<MimeSniff::MimeType> HeaderList::extract_mime_type() const
|
||||||
}
|
}
|
||||||
// 5. Otherwise, if mimeType’s parameters["charset"] does not exist, and charset is non-null, set mimeType’s parameters["charset"] to charset.
|
// 5. Otherwise, if mimeType’s parameters["charset"] does not exist, and charset is non-null, set mimeType’s parameters["charset"] to charset.
|
||||||
else if (!mime_type->parameters().contains("charset"sv) && charset.has_value()) {
|
else if (!mime_type->parameters().contains("charset"sv) && charset.has_value()) {
|
||||||
mime_type->set_parameter("charset"_string.release_value_but_fixme_should_propagate_errors(), charset.release_value()).release_value_but_fixme_should_propagate_errors();
|
TRY(mime_type->set_parameter(TRY("charset"_string), charset.release_value()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ public:
|
||||||
[[nodiscard]] ErrorOr<void> set(Header);
|
[[nodiscard]] ErrorOr<void> set(Header);
|
||||||
[[nodiscard]] ErrorOr<void> combine(Header);
|
[[nodiscard]] ErrorOr<void> combine(Header);
|
||||||
[[nodiscard]] ErrorOr<Vector<Header>> sort_and_combine() const;
|
[[nodiscard]] ErrorOr<Vector<Header>> sort_and_combine() const;
|
||||||
[[nodiscard]] Optional<MimeSniff::MimeType> extract_mime_type() const;
|
[[nodiscard]] ErrorOr<Optional<MimeSniff::MimeType>> extract_mime_type() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct RangeHeaderValue {
|
struct RangeHeaderValue {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2022, Linus Groh <linusg@serenityos.org>
|
* Copyright (c) 2022-2023, Linus Groh <linusg@serenityos.org>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -11,10 +11,10 @@
|
||||||
namespace Web::Fetch::Infrastructure {
|
namespace Web::Fetch::Infrastructure {
|
||||||
|
|
||||||
// https://fetch.spec.whatwg.org/#ref-for-should-response-to-request-be-blocked-due-to-mime-type?
|
// https://fetch.spec.whatwg.org/#ref-for-should-response-to-request-be-blocked-due-to-mime-type?
|
||||||
RequestOrResponseBlocking should_response_to_request_be_blocked_due_to_its_mime_type(Response const& response, Request const& request)
|
ErrorOr<RequestOrResponseBlocking> should_response_to_request_be_blocked_due_to_its_mime_type(Response const& response, Request const& request)
|
||||||
{
|
{
|
||||||
// 1. Let mimeType be the result of extracting a MIME type from response’s header list.
|
// 1. Let mimeType be the result of extracting a MIME type from response’s header list.
|
||||||
auto mime_type = response.header_list()->extract_mime_type();
|
auto mime_type = TRY(response.header_list()->extract_mime_type());
|
||||||
|
|
||||||
// 2. If mimeType is failure, then return allowed.
|
// 2. If mimeType is failure, then return allowed.
|
||||||
if (!mime_type.has_value())
|
if (!mime_type.has_value())
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2022, Linus Groh <linusg@serenityos.org>
|
* Copyright (c) 2022-2023, Linus Groh <linusg@serenityos.org>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -11,6 +11,6 @@
|
||||||
|
|
||||||
namespace Web::Fetch::Infrastructure {
|
namespace Web::Fetch::Infrastructure {
|
||||||
|
|
||||||
[[nodiscard]] RequestOrResponseBlocking should_response_to_request_be_blocked_due_to_its_mime_type(Response const&, Request const&);
|
ErrorOr<RequestOrResponseBlocking> should_response_to_request_be_blocked_due_to_its_mime_type(Response const&, Request const&);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2022, Linus Groh <linusg@serenityos.org>
|
* Copyright (c) 2022-2023, Linus Groh <linusg@serenityos.org>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -38,7 +38,7 @@ ErrorOr<RequestOrResponseBlocking> should_response_to_request_be_blocked_due_to_
|
||||||
return RequestOrResponseBlocking::Allowed;
|
return RequestOrResponseBlocking::Allowed;
|
||||||
|
|
||||||
// 2. Let mimeType be the result of extracting a MIME type from response’s header list.
|
// 2. Let mimeType be the result of extracting a MIME type from response’s header list.
|
||||||
auto mime_type = response.header_list()->extract_mime_type();
|
auto mime_type = TRY(response.header_list()->extract_mime_type());
|
||||||
|
|
||||||
// 3. Let destination be request’s destination.
|
// 3. Let destination be request’s destination.
|
||||||
auto const& destination = request.destination();
|
auto const& destination = request.destination();
|
||||||
|
|
|
@ -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/#concept-body-mime-type
|
||||||
// https://fetch.spec.whatwg.org/#ref-for-concept-body-mime-type%E2%91%A0
|
// https://fetch.spec.whatwg.org/#ref-for-concept-body-mime-type%E2%91%A0
|
||||||
Optional<MimeSniff::MimeType> Request::mime_type_impl() const
|
ErrorOr<Optional<MimeSniff::MimeType>> 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.
|
// 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.
|
// A Request object’s MIME type is to return the result of extracting a MIME type from its request’s header list.
|
||||||
|
|
|
@ -71,7 +71,7 @@ public:
|
||||||
virtual ~Request() override;
|
virtual ~Request() override;
|
||||||
|
|
||||||
// ^BodyMixin
|
// ^BodyMixin
|
||||||
virtual Optional<MimeSniff::MimeType> mime_type_impl() const override;
|
virtual ErrorOr<Optional<MimeSniff::MimeType>> mime_type_impl() const override;
|
||||||
virtual Optional<Infrastructure::Body&> body_impl() override;
|
virtual Optional<Infrastructure::Body&> body_impl() override;
|
||||||
virtual Optional<Infrastructure::Body const&> body_impl() const override;
|
virtual Optional<Infrastructure::Body const&> body_impl() const override;
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ void Response::visit_edges(Cell::Visitor& visitor)
|
||||||
|
|
||||||
// https://fetch.spec.whatwg.org/#concept-body-mime-type
|
// https://fetch.spec.whatwg.org/#concept-body-mime-type
|
||||||
// https://fetch.spec.whatwg.org/#ref-for-concept-header-extract-mime-type%E2%91%A7
|
// https://fetch.spec.whatwg.org/#ref-for-concept-header-extract-mime-type%E2%91%A7
|
||||||
Optional<MimeSniff::MimeType> Response::mime_type_impl() const
|
ErrorOr<Optional<MimeSniff::MimeType>> 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.
|
// 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.
|
// A Response object’s MIME type is to return the result of extracting a MIME type from its response’s header list.
|
||||||
|
|
|
@ -38,7 +38,7 @@ public:
|
||||||
virtual ~Response() override;
|
virtual ~Response() override;
|
||||||
|
|
||||||
// ^BodyMixin
|
// ^BodyMixin
|
||||||
virtual Optional<MimeSniff::MimeType> mime_type_impl() const override;
|
virtual ErrorOr<Optional<MimeSniff::MimeType>> mime_type_impl() const override;
|
||||||
virtual Optional<Infrastructure::Body&> body_impl() override;
|
virtual Optional<Infrastructure::Body&> body_impl() override;
|
||||||
virtual Optional<Infrastructure::Body const&> body_impl() const override;
|
virtual Optional<Infrastructure::Body const&> body_impl() const override;
|
||||||
|
|
||||||
|
|
|
@ -161,7 +161,7 @@ WebIDL::ExceptionOr<JS::Value> XMLHttpRequest::response()
|
||||||
}
|
}
|
||||||
// 6. Otherwise, if this’s response type is "blob", set this’s response object to a new Blob object representing this’s received bytes with type set to the result of get a final MIME type for this.
|
// 6. Otherwise, if this’s response type is "blob", set this’s response object to a new Blob object representing this’s received bytes with type set to the result of get a final MIME type for this.
|
||||||
else if (m_response_type == Bindings::XMLHttpRequestResponseType::Blob) {
|
else if (m_response_type == Bindings::XMLHttpRequestResponseType::Blob) {
|
||||||
auto mime_type_as_string = TRY_OR_THROW_OOM(vm, get_final_mime_type().serialized());
|
auto mime_type_as_string = TRY_OR_THROW_OOM(vm, TRY_OR_THROW_OOM(vm, get_final_mime_type()).serialized());
|
||||||
auto blob_part = TRY(FileAPI::Blob::create(realm(), m_received_bytes, move(mime_type_as_string)));
|
auto blob_part = TRY(FileAPI::Blob::create(realm(), m_received_bytes, move(mime_type_as_string)));
|
||||||
auto blob = TRY(FileAPI::Blob::create(realm(), Vector<FileAPI::BlobPart> { JS::make_handle(*blob_part) }));
|
auto blob = TRY(FileAPI::Blob::create(realm(), Vector<FileAPI::BlobPart> { JS::make_handle(*blob_part) }));
|
||||||
m_response_object = JS::Value(blob.ptr());
|
m_response_object = JS::Value(blob.ptr());
|
||||||
|
@ -200,7 +200,7 @@ DeprecatedString XMLHttpRequest::get_text_response() const
|
||||||
// FIXME: 1. If xhr’s response’s body is null, then return the empty string.
|
// FIXME: 1. If xhr’s response’s body is null, then return the empty string.
|
||||||
|
|
||||||
// 2. Let charset be the result of get a final encoding for xhr.
|
// 2. Let charset be the result of get a final encoding for xhr.
|
||||||
auto charset = get_final_encoding();
|
auto charset = get_final_encoding().release_value_but_fixme_should_propagate_errors();
|
||||||
|
|
||||||
auto is_xml_mime_type = [](MimeSniff::MimeType const& mime_type) {
|
auto is_xml_mime_type = [](MimeSniff::MimeType const& mime_type) {
|
||||||
// An XML MIME type is any MIME type whose subtype ends in "+xml" or whose essence is "text/xml" or "application/xml". [RFC7303]
|
// An XML MIME type is any MIME type whose subtype ends in "+xml" or whose essence is "text/xml" or "application/xml". [RFC7303]
|
||||||
|
@ -211,7 +211,7 @@ DeprecatedString XMLHttpRequest::get_text_response() const
|
||||||
};
|
};
|
||||||
|
|
||||||
// 3. If xhr’s response type is the empty string, charset is null, and the result of get a final MIME type for xhr is an XML MIME type,
|
// 3. If xhr’s response type is the empty string, charset is null, and the result of get a final MIME type for xhr is an XML MIME type,
|
||||||
if (m_response_type == Bindings::XMLHttpRequestResponseType::Empty && !charset.has_value() && is_xml_mime_type(get_final_mime_type())) {
|
if (m_response_type == Bindings::XMLHttpRequestResponseType::Empty && !charset.has_value() && is_xml_mime_type(get_final_mime_type().release_value_but_fixme_should_propagate_errors())) {
|
||||||
// FIXME: then use the rules set forth in the XML specifications to determine the encoding. Let charset be the determined encoding. [XML] [XML-NAMES]
|
// FIXME: then use the rules set forth in the XML specifications to determine the encoding. Let charset be the determined encoding. [XML] [XML-NAMES]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -229,7 +229,7 @@ DeprecatedString XMLHttpRequest::get_text_response() const
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://xhr.spec.whatwg.org/#final-mime-type
|
// https://xhr.spec.whatwg.org/#final-mime-type
|
||||||
MimeSniff::MimeType XMLHttpRequest::get_final_mime_type() const
|
ErrorOr<MimeSniff::MimeType> XMLHttpRequest::get_final_mime_type() const
|
||||||
{
|
{
|
||||||
// 1. If xhr’s override MIME type is null, return the result of get a response MIME type for xhr.
|
// 1. If xhr’s override MIME type is null, return the result of get a response MIME type for xhr.
|
||||||
if (!m_override_mime_type.has_value())
|
if (!m_override_mime_type.has_value())
|
||||||
|
@ -240,36 +240,36 @@ MimeSniff::MimeType XMLHttpRequest::get_final_mime_type() const
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://xhr.spec.whatwg.org/#response-mime-type
|
// https://xhr.spec.whatwg.org/#response-mime-type
|
||||||
MimeSniff::MimeType XMLHttpRequest::get_response_mime_type() const
|
ErrorOr<MimeSniff::MimeType> XMLHttpRequest::get_response_mime_type() const
|
||||||
{
|
{
|
||||||
auto& vm = this->vm();
|
auto& vm = this->vm();
|
||||||
|
|
||||||
// FIXME: Use an actual HeaderList for XHR headers.
|
// FIXME: Use an actual HeaderList for XHR headers.
|
||||||
auto header_list = Fetch::Infrastructure::HeaderList::create(vm);
|
auto header_list = Fetch::Infrastructure::HeaderList::create(vm);
|
||||||
for (auto const& entry : m_response_headers) {
|
for (auto const& entry : m_response_headers) {
|
||||||
auto header = Fetch::Infrastructure::Header::from_string_pair(entry.key, entry.value).release_value_but_fixme_should_propagate_errors();
|
auto header = TRY(Fetch::Infrastructure::Header::from_string_pair(entry.key, entry.value));
|
||||||
header_list->append(move(header)).release_value_but_fixme_should_propagate_errors();
|
TRY(header_list->append(move(header)));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 1. Let mimeType be the result of extracting a MIME type from xhr’s response’s header list.
|
// 1. Let mimeType be the result of extracting a MIME type from xhr’s response’s header list.
|
||||||
auto mime_type = header_list->extract_mime_type();
|
auto mime_type = TRY(header_list->extract_mime_type());
|
||||||
|
|
||||||
// 2. If mimeType is failure, then set mimeType to text/xml.
|
// 2. If mimeType is failure, then set mimeType to text/xml.
|
||||||
if (!mime_type.has_value())
|
if (!mime_type.has_value())
|
||||||
return MimeSniff::MimeType::create("text"_string.release_value_but_fixme_should_propagate_errors(), "xml"_short_string).release_value_but_fixme_should_propagate_errors();
|
return MimeSniff::MimeType::create(TRY("text"_string), "xml"_short_string);
|
||||||
|
|
||||||
// 3. Return mimeType.
|
// 3. Return mimeType.
|
||||||
return mime_type.release_value();
|
return mime_type.release_value();
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://xhr.spec.whatwg.org/#final-charset
|
// https://xhr.spec.whatwg.org/#final-charset
|
||||||
Optional<StringView> XMLHttpRequest::get_final_encoding() const
|
ErrorOr<Optional<StringView>> XMLHttpRequest::get_final_encoding() const
|
||||||
{
|
{
|
||||||
// 1. Let label be null.
|
// 1. Let label be null.
|
||||||
Optional<DeprecatedString> label;
|
Optional<DeprecatedString> label;
|
||||||
|
|
||||||
// 2. Let responseMIME be the result of get a response MIME type for xhr.
|
// 2. Let responseMIME be the result of get a response MIME type for xhr.
|
||||||
auto response_mime = get_response_mime_type();
|
auto response_mime = TRY(get_response_mime_type());
|
||||||
|
|
||||||
// 3. If responseMIME’s parameters["charset"] exists, then set label to it.
|
// 3. If responseMIME’s parameters["charset"] exists, then set label to it.
|
||||||
auto response_mime_charset_it = response_mime.parameters().find("charset"sv);
|
auto response_mime_charset_it = response_mime.parameters().find("charset"sv);
|
||||||
|
@ -285,7 +285,7 @@ Optional<StringView> XMLHttpRequest::get_final_encoding() const
|
||||||
|
|
||||||
// 5. If label is null, then return null.
|
// 5. If label is null, then return null.
|
||||||
if (!label.has_value())
|
if (!label.has_value())
|
||||||
return {};
|
return OptionalNone {};
|
||||||
|
|
||||||
// 6. Let encoding be the result of getting an encoding from label.
|
// 6. Let encoding be the result of getting an encoding from label.
|
||||||
auto encoding = TextCodec::get_standardized_encoding(label.value());
|
auto encoding = TextCodec::get_standardized_encoding(label.value());
|
||||||
|
|
|
@ -79,9 +79,9 @@ private:
|
||||||
void set_status(Fetch::Infrastructure::Status status) { m_status = status; }
|
void set_status(Fetch::Infrastructure::Status status) { m_status = status; }
|
||||||
void fire_progress_event(DeprecatedString const&, u64, u64);
|
void fire_progress_event(DeprecatedString const&, u64, u64);
|
||||||
|
|
||||||
MimeSniff::MimeType get_response_mime_type() const;
|
ErrorOr<MimeSniff::MimeType> get_response_mime_type() const;
|
||||||
Optional<StringView> get_final_encoding() const;
|
ErrorOr<Optional<StringView>> get_final_encoding() const;
|
||||||
MimeSniff::MimeType get_final_mime_type() const;
|
ErrorOr<MimeSniff::MimeType> get_final_mime_type() const;
|
||||||
|
|
||||||
DeprecatedString get_text_response() const;
|
DeprecatedString get_text_response() const;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue