1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 15:48:12 +00:00

AK+Everywhere: Rename String to DeprecatedString

We have a new, improved string type coming up in AK (OOM aware, no null
state), and while it's going to use UTF-8, the name UTF8String is a
mouthful - so let's free up the String name by renaming the existing
class.
Making the old one have an annoying name will hopefully also help with
quick adoption :^)
This commit is contained in:
Linus Groh 2022-12-04 18:02:33 +00:00 committed by Andreas Kling
parent f74251606d
commit 6e19ab2bbc
2006 changed files with 11635 additions and 11636 deletions

View file

@ -69,7 +69,7 @@ void XMLHttpRequest::visit_edges(Cell::Visitor& visitor)
visitor.visit(*value);
}
void XMLHttpRequest::fire_progress_event(String const& event_name, u64 transmitted, u64 length)
void XMLHttpRequest::fire_progress_event(DeprecatedString const& event_name, u64 transmitted, u64 length)
{
ProgressEventInit event_init {};
event_init.length_computable = true;
@ -79,7 +79,7 @@ void XMLHttpRequest::fire_progress_event(String const& event_name, u64 transmitt
}
// https://xhr.spec.whatwg.org/#dom-xmlhttprequest-responsetext
WebIDL::ExceptionOr<String> XMLHttpRequest::response_text() const
WebIDL::ExceptionOr<DeprecatedString> XMLHttpRequest::response_text() const
{
// 1. If thiss response type is not the empty string or "text", then throw an "InvalidStateError" DOMException.
if (m_response_type != Bindings::XMLHttpRequestResponseType::Empty && m_response_type != Bindings::XMLHttpRequestResponseType::Text)
@ -87,7 +87,7 @@ WebIDL::ExceptionOr<String> XMLHttpRequest::response_text() const
// 2. If thiss state is not loading or done, then return the empty string.
if (m_state != State::Loading && m_state != State::Done)
return String::empty();
return DeprecatedString::empty();
return get_text_response();
}
@ -186,7 +186,7 @@ WebIDL::ExceptionOr<JS::Value> XMLHttpRequest::response()
}
// https://xhr.spec.whatwg.org/#text-response
String XMLHttpRequest::get_text_response() const
DeprecatedString XMLHttpRequest::get_text_response() const
{
// FIXME: 1. If xhrs responses body is null, then return the empty string.
@ -257,7 +257,7 @@ MimeSniff::MimeType XMLHttpRequest::get_response_mime_type() const
Optional<StringView> XMLHttpRequest::get_final_encoding() const
{
// 1. Let label be null.
Optional<String> label;
Optional<DeprecatedString> label;
// 2. Let responseMIME be the result of get a response MIME type for xhr.
auto response_mime = get_response_mime_type();
@ -287,7 +287,7 @@ Optional<StringView> XMLHttpRequest::get_final_encoding() const
}
// https://xhr.spec.whatwg.org/#dom-xmlhttprequest-setrequestheader
WebIDL::ExceptionOr<void> XMLHttpRequest::set_request_header(String const& name_string, String const& value_string)
WebIDL::ExceptionOr<void> XMLHttpRequest::set_request_header(DeprecatedString const& name_string, DeprecatedString const& value_string)
{
auto& realm = this->realm();
auto name = name_string.to_byte_buffer();
@ -325,13 +325,13 @@ WebIDL::ExceptionOr<void> XMLHttpRequest::set_request_header(String const& name_
}
// https://xhr.spec.whatwg.org/#dom-xmlhttprequest-open
WebIDL::ExceptionOr<void> XMLHttpRequest::open(String const& method_string, String const& url)
WebIDL::ExceptionOr<void> XMLHttpRequest::open(DeprecatedString const& method_string, DeprecatedString const& url)
{
// 8. If the async argument is omitted, set async to true, and set username and password to null.
return open(method_string, url, true, {}, {});
}
WebIDL::ExceptionOr<void> XMLHttpRequest::open(String const& method_string, String const& url, bool async, String const& username, String const& password)
WebIDL::ExceptionOr<void> XMLHttpRequest::open(DeprecatedString const& method_string, DeprecatedString const& url, bool async, DeprecatedString const& username, DeprecatedString const& password)
{
auto method = method_string.to_byte_buffer();
@ -431,7 +431,7 @@ WebIDL::ExceptionOr<void> XMLHttpRequest::send(Optional<DocumentOrXMLHttpRequest
body = {};
Optional<Fetch::Infrastructure::BodyWithType> body_with_type {};
Optional<String> serialized_document {};
Optional<DeprecatedString> serialized_document {};
if (body.has_value()) {
if (body->has<JS::Handle<DOM::Document>>())
serialized_document = TRY(body->get<JS::Handle<DOM::Document>>().cell()->serialize_fragment(DOMParsing::RequireWellFormed::No));
@ -481,13 +481,13 @@ WebIDL::ExceptionOr<void> XMLHttpRequest::send(Optional<DocumentOrXMLHttpRequest
// If thiss headerss header list does not contain `Content-Type`, then append (`Content-Type`, type) to thiss headers.
if (!m_author_request_headers->contains("Content-Type"sv.bytes())) {
if (body_with_type.has_value() && body_with_type->type.has_value()) {
request.set_header("Content-Type", String { body_with_type->type->span() });
request.set_header("Content-Type", DeprecatedString { body_with_type->type->span() });
} else if (body.has_value() && body->has<JS::Handle<DOM::Document>>()) {
request.set_header("Content-Type", "text/html;charset=UTF-8");
}
}
for (auto& it : *m_author_request_headers)
request.set_header(String::copy(it.name), String::copy(it.value));
request.set_header(DeprecatedString::copy(it.name), DeprecatedString::copy(it.value));
m_upload_complete = false;
m_timed_out = false;
@ -573,7 +573,7 @@ void XMLHttpRequest::set_onreadystatechange(WebIDL::CallbackType* value)
}
// https://xhr.spec.whatwg.org/#the-getallresponseheaders()-method
String XMLHttpRequest::get_all_response_headers() const
DeprecatedString XMLHttpRequest::get_all_response_headers() const
{
// FIXME: Implement the spec-compliant sort order.
@ -591,7 +591,7 @@ String XMLHttpRequest::get_all_response_headers() const
}
// https://xhr.spec.whatwg.org/#dom-xmlhttprequest-overridemimetype
WebIDL::ExceptionOr<void> XMLHttpRequest::override_mime_type(String const& mime)
WebIDL::ExceptionOr<void> XMLHttpRequest::override_mime_type(DeprecatedString const& mime)
{
// 1. If thiss state is loading or done, then throw an "InvalidStateError" DOMException.
if (m_state == State::Loading || m_state == State::Done)