1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 12:38: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

@ -111,9 +111,9 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<Request>> Request::construct_impl(JS::Realm
DOM::AbortSignal const* input_signal = nullptr;
// 5. If input is a string, then:
if (input.has<String>()) {
if (input.has<DeprecatedString>()) {
// 1. Let parsedURL be the result of parsing input with baseURL.
auto parsed_url = URLParser::parse(input.get<String>(), &base_url);
auto parsed_url = URLParser::parse(input.get<DeprecatedString>(), &base_url);
// 2. If parsedURL is failure, then throw a TypeError.
if (!parsed_url.is_valid())
@ -416,7 +416,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<Request>> Request::construct_impl(JS::Realm
// 4. If headers is a Headers object, then for each header in its header list, append (headers name, headers value) to thiss headers.
if (auto* header_list = headers.get_pointer<JS::NonnullGCPtr<Infrastructure::HeaderList>>()) {
for (auto& header : *header_list->ptr())
TRY(request_object->headers()->append(String::copy(header.name), String::copy(header.value)));
TRY(request_object->headers()->append(DeprecatedString::copy(header.name), DeprecatedString::copy(header.value)));
}
// 5. Otherwise, fill thiss headers with headers.
else {
@ -449,7 +449,7 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<Request>> Request::construct_impl(JS::Realm
// 4. If type is non-null and thiss headerss header list does not contain `Content-Type`, then append (`Content-Type`, type) to thiss headers.
if (type.has_value() && !request_object->headers()->header_list()->contains("Content-Type"sv.bytes()))
TRY(request_object->headers()->append("Content-Type"sv, String::copy(type->span())));
TRY(request_object->headers()->append("Content-Type"sv, DeprecatedString::copy(type->span())));
}
// 37. Let inputOrInitBody be initBody if it is non-null; otherwise inputBody.
@ -492,14 +492,14 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<Request>> Request::construct_impl(JS::Realm
}
// https://fetch.spec.whatwg.org/#dom-request-method
String Request::method() const
DeprecatedString Request::method() const
{
// The method getter steps are to return thiss requests method.
return String::copy(m_request->method());
return DeprecatedString::copy(m_request->method());
}
// https://fetch.spec.whatwg.org/#dom-request-url
String Request::url() const
DeprecatedString Request::url() const
{
// The url getter steps are to return thiss requests URL, serialized.
return m_request->url().serialize();
@ -520,17 +520,17 @@ Bindings::RequestDestination Request::destination() const
}
// https://fetch.spec.whatwg.org/#dom-request-referrer
String Request::referrer() const
DeprecatedString Request::referrer() const
{
return m_request->referrer().visit(
[&](Infrastructure::Request::Referrer const& referrer) {
switch (referrer) {
// 1. If thiss requests referrer is "no-referrer", then return the empty string.
case Infrastructure::Request::Referrer::NoReferrer:
return String::empty();
return DeprecatedString::empty();
// 2. If thiss requests referrer is "client", then return "about:client".
case Infrastructure::Request::Referrer::Client:
return String { "about:client"sv };
return DeprecatedString { "about:client"sv };
default:
VERIFY_NOT_REACHED();
}
@ -577,7 +577,7 @@ Bindings::RequestRedirect Request::redirect() const
}
// https://fetch.spec.whatwg.org/#dom-request-integrity
String Request::integrity() const
DeprecatedString Request::integrity() const
{
// The integrity getter steps are to return thiss requests integrity metadata.
return m_request->integrity_metadata();