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

@ -4,35 +4,35 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <AK/String.h>
#include <AK/DeprecatedString.h>
#include <LibWeb/HTML/WorkerGlobalScope.h>
#include <LibWeb/HTML/WorkerLocation.h>
namespace Web::HTML {
// https://html.spec.whatwg.org/multipage/workers.html#dom-workerlocation-href
String WorkerLocation::href() const
DeprecatedString WorkerLocation::href() const
{
// The href getter steps are to return this's WorkerGlobalScope object's url, serialized.
return m_global_scope.url().serialize();
}
// https://html.spec.whatwg.org/multipage/workers.html#dom-workerlocation-origin
String WorkerLocation::origin() const
DeprecatedString WorkerLocation::origin() const
{
// The origin getter steps are to return the serialization of this's WorkerGlobalScope object's url's origin.
return m_global_scope.url().serialize_origin();
}
// https://html.spec.whatwg.org/multipage/workers.html#dom-workerlocation-protocol
String WorkerLocation::protocol() const
DeprecatedString WorkerLocation::protocol() const
{
// The protocol getter steps are to return this's WorkerGlobalScope object's url's scheme, followed by ":".
return String::formatted("{}:", m_global_scope.url().scheme());
return DeprecatedString::formatted("{}:", m_global_scope.url().scheme());
}
// https://html.spec.whatwg.org/multipage/workers.html#dom-workerlocation-host
String WorkerLocation::host() const
DeprecatedString WorkerLocation::host() const
{
// The host getter steps are:
// 1. Let url be this's WorkerGlobalScope object's url.
@ -47,11 +47,11 @@ String WorkerLocation::host() const
return url.host();
// 4. Return url's host, serialized, followed by ":" and url's port, serialized.
return String::formatted("{}:{}", url.host(), url.port().value());
return DeprecatedString::formatted("{}:{}", url.host(), url.port().value());
}
// https://html.spec.whatwg.org/multipage/workers.html#dom-workerlocation-hostname
String WorkerLocation::hostname() const
DeprecatedString WorkerLocation::hostname() const
{
// The hostname getter steps are:
// 1. Let host be this's WorkerGlobalScope object's url's host.
@ -66,7 +66,7 @@ String WorkerLocation::hostname() const
}
// https://html.spec.whatwg.org/multipage/workers.html#dom-workerlocation-port
String WorkerLocation::port() const
DeprecatedString WorkerLocation::port() const
{
// The port getter steps are:
// 1. Let port be this's WorkerGlobalScope object's url's port.
@ -76,18 +76,18 @@ String WorkerLocation::port() const
if (!port.has_value())
return "";
// 3. Return port, serialized.
return String::number(port.value());
return DeprecatedString::number(port.value());
}
// https://html.spec.whatwg.org/multipage/workers.html#dom-workerlocation-pathname
String WorkerLocation::pathname() const
DeprecatedString WorkerLocation::pathname() const
{
// The pathname getter steps are to return the result of URL path serializing this's WorkerGlobalScope object's url.
return m_global_scope.url().path();
}
// https://html.spec.whatwg.org/multipage/workers.html#dom-workerlocation-search
String WorkerLocation::search() const
DeprecatedString WorkerLocation::search() const
{
// The search getter steps are:
// 1. Let query be this's WorkerGlobalScope object's url's query.
@ -98,11 +98,11 @@ String WorkerLocation::search() const
return "";
// 3. Return "?", followed by query.
return String::formatted("?{}", query);
return DeprecatedString::formatted("?{}", query);
}
// https://html.spec.whatwg.org/multipage/workers.html#dom-workerlocation-hash
String WorkerLocation::hash() const
DeprecatedString WorkerLocation::hash() const
{
// The hash getter steps are:
// 1. Let fragment be this's WorkerGlobalScope object's url's fragment.
@ -113,7 +113,7 @@ String WorkerLocation::hash() const
return "";
// 3. Return "#", followed by fragment.
return String::formatted("#{}", fragment);
return DeprecatedString::formatted("#{}", fragment);
}
WorkerLocation::WorkerLocation(WorkerGlobalScope& global_scope)