1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 21:07:34 +00:00

Everywhere: Rename {Deprecated => Byte}String

This commit un-deprecates DeprecatedString, and repurposes it as a byte
string.
As the null state has already been removed, there are no other
particularly hairy blockers in repurposing this type as a byte string
(what it _really_ is).

This commit is auto-generated:
  $ xs=$(ack -l \bDeprecatedString\b\|deprecated_string AK Userland \
    Meta Ports Ladybird Tests Kernel)
  $ perl -pie 's/\bDeprecatedString\b/ByteString/g;
    s/deprecated_string/byte_string/g' $xs
  $ clang-format --style=file -i \
    $(git diff --name-only | grep \.cpp\|\.h)
  $ gn format $(git ls-files '*.gn' '*.gni')
This commit is contained in:
Ali Mohammad Pur 2023-12-16 17:49:34 +03:30 committed by Ali Mohammad Pur
parent 38d62563b3
commit 5e1499d104
1615 changed files with 10257 additions and 10257 deletions

View file

@ -6,7 +6,7 @@
#include "ALooperEventLoopImplementation.h"
#include "JNIHelpers.h"
#include <AK/DeprecatedString.h>
#include <AK/ByteString.h>
#include <AK/Format.h>
#include <AK/HashMap.h>
#include <AK/LexicalPath.h>
@ -21,7 +21,7 @@
#include <LibFileSystem/FileSystem.h>
#include <jni.h>
static ErrorOr<void> extract_tar_archive(String archive_file, DeprecatedString output_directory);
static ErrorOr<void> extract_tar_archive(String archive_file, ByteString output_directory);
JavaVM* global_vm;
static OwnPtr<Core::EventLoop> s_main_event_loop;
@ -89,29 +89,29 @@ Java_org_serenityos_ladybird_LadybirdActivity_disposeNativeCode(JNIEnv* env, job
delete &Core::EventLoopManager::the();
}
ErrorOr<void> extract_tar_archive(String archive_file, DeprecatedString output_directory)
ErrorOr<void> extract_tar_archive(String archive_file, ByteString output_directory)
{
constexpr size_t buffer_size = 4096;
auto file = TRY(Core::InputBufferedFile::create(TRY(Core::File::open(archive_file, Core::File::OpenMode::Read))));
DeprecatedString old_pwd = TRY(Core::System::getcwd());
ByteString old_pwd = TRY(Core::System::getcwd());
TRY(Core::System::chdir(output_directory));
ScopeGuard go_back = [&old_pwd] { MUST(Core::System::chdir(old_pwd)); };
auto tar_stream = TRY(Archive::TarInputStream::construct(move(file)));
HashMap<DeprecatedString, DeprecatedString> global_overrides;
HashMap<DeprecatedString, DeprecatedString> local_overrides;
HashMap<ByteString, ByteString> global_overrides;
HashMap<ByteString, ByteString> local_overrides;
auto get_override = [&](StringView key) -> Optional<DeprecatedString> {
Optional<DeprecatedString> maybe_local = local_overrides.get(key);
auto get_override = [&](StringView key) -> Optional<ByteString> {
Optional<ByteString> maybe_local = local_overrides.get(key);
if (maybe_local.has_value())
return maybe_local;
Optional<DeprecatedString> maybe_global = global_overrides.get(key);
Optional<ByteString> maybe_global = global_overrides.get(key);
if (maybe_global.has_value())
return maybe_global;
@ -163,7 +163,7 @@ ErrorOr<void> extract_tar_archive(String archive_file, DeprecatedString output_d
long_name.append(reinterpret_cast<char*>(slice.data()), slice.size());
}
local_overrides.set("path", long_name.to_deprecated_string());
local_overrides.set("path", long_name.to_byte_string());
TRY(tar_stream->advance());
continue;
}
@ -175,9 +175,9 @@ ErrorOr<void> extract_tar_archive(String archive_file, DeprecatedString output_d
LexicalPath path = LexicalPath(header.filename());
if (!header.prefix().is_empty())
path = path.prepend(header.prefix());
DeprecatedString filename = get_override("path"sv).value_or(path.string());
ByteString filename = get_override("path"sv).value_or(path.string());
DeprecatedString absolute_path = TRY(FileSystem::absolute_path(filename)).to_deprecated_string();
ByteString absolute_path = TRY(FileSystem::absolute_path(filename)).to_byte_string();
auto parent_path = LexicalPath(absolute_path).parent();
auto header_mode = TRY(header.mode());

View file

@ -122,9 +122,9 @@ ErrorOr<NonnullRefPtr<Client>> bind_service(void (*bind_method)(int, int))
static ErrorOr<void> load_content_filters()
{
auto file_or_error = Core::File::open(DeprecatedString::formatted("{}/home/anon/.config/BrowserContentFilters.txt", s_serenity_resource_root), Core::File::OpenMode::Read);
auto file_or_error = Core::File::open(ByteString::formatted("{}/home/anon/.config/BrowserContentFilters.txt", s_serenity_resource_root), Core::File::OpenMode::Read);
if (file_or_error.is_error())
file_or_error = Core::File::open(DeprecatedString::formatted("{}/res/ladybird/BrowserContentFilters.txt", s_serenity_resource_root), Core::File::OpenMode::Read);
file_or_error = Core::File::open(ByteString::formatted("{}/res/ladybird/BrowserContentFilters.txt", s_serenity_resource_root), Core::File::OpenMode::Read);
if (file_or_error.is_error())
return file_or_error.release_error();

View file

@ -474,7 +474,7 @@
[submenu addItem:[NSMenuItem separatorItem]];
auto* spoof_user_agent_menu = [[NSMenu alloc] init];
auto add_user_agent = [spoof_user_agent_menu](DeprecatedString name) {
auto add_user_agent = [spoof_user_agent_menu](ByteString name) {
[spoof_user_agent_menu addItem:[[NSMenuItem alloc] initWithTitle:Ladybird::string_to_ns_string(name)
action:@selector(setUserAgentSpoof:)
keyEquivalent:@""]];

View file

@ -27,7 +27,7 @@
- (void)onLoadStart:(URL const&)url isRedirect:(BOOL)is_redirect;
- (void)onLoadFinish:(URL const&)url;
- (void)onTitleChange:(DeprecatedString const&)title;
- (void)onTitleChange:(ByteString const&)title;
- (void)onFaviconChange:(Gfx::Bitmap const&)bitmap;
- (void)onNavigateBack;
@ -58,7 +58,7 @@
- (void)resetZoom;
- (float)zoomLevel;
- (void)debugRequest:(DeprecatedString const&)request argument:(DeprecatedString const&)argument;
- (void)debugRequest:(ByteString const&)request argument:(ByteString const&)argument;
- (void)viewSource;

View file

@ -180,7 +180,7 @@ struct HideCursor {
m_web_view_bridge->set_preferred_color_scheme(color_scheme);
}
- (void)debugRequest:(DeprecatedString const&)request argument:(DeprecatedString const&)argument
- (void)debugRequest:(ByteString const&)request argument:(ByteString const&)argument
{
m_web_view_bridge->debug_request(request, argument);
}
@ -634,7 +634,7 @@ static void copy_data_to_clipboard(StringView data, NSPasteboardType pasteboard_
return [delegate cookieJar].get_named_cookie(url, name);
};
m_web_view_bridge->on_get_cookie = [](auto const& url, auto source) -> DeprecatedString {
m_web_view_bridge->on_get_cookie = [](auto const& url, auto source) -> ByteString {
auto* delegate = (ApplicationDelegate*)[NSApp delegate];
return [delegate cookieJar].get_cookie(url, source);
};

View file

@ -4,7 +4,7 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <AK/DeprecatedString.h>
#include <AK/ByteString.h>
#include <Ladybird/Utilities.h>
#include <LibCore/Resource.h>
#include <LibGfx/Palette.h>
@ -33,7 +33,7 @@ Core::AnonymousBuffer create_system_palette()
auto theme_file = is_dark ? "Dark"sv : "Default"sv;
auto theme_ini = MUST(Core::Resource::load_from_uri(MUST(String::formatted("resource://themes/{}.ini", theme_file))));
auto theme = Gfx::load_system_theme(theme_ini->filesystem_path().to_deprecated_string()).release_value_but_fixme_should_propagate_errors();
auto theme = Gfx::load_system_theme(theme_ini->filesystem_path().to_byte_string()).release_value_but_fixme_should_propagate_errors();
auto palette_impl = Gfx::PaletteImpl::create_with_anonymous_buffer(theme);
auto palette = Gfx::Palette(move(palette_impl));

View file

@ -4,7 +4,7 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <AK/DeprecatedString.h>
#include <AK/ByteString.h>
#include <AK/String.h>
#include <AK/URL.h>
#include <Ladybird/Utilities.h>
@ -247,7 +247,7 @@ static constexpr CGFloat const WINDOW_HEIGHT = 800;
}
}
- (void)onTitleChange:(DeprecatedString const&)title
- (void)onTitleChange:(ByteString const&)title
{
[[self tabController] onTitleChange:title];

View file

@ -16,7 +16,7 @@ struct TabSettings {
BOOL scripting_enabled { YES };
BOOL block_popups { YES };
BOOL same_origin_policy_enabled { NO };
DeprecatedString user_agent_name { "Disabled"sv };
ByteString user_agent_name { "Disabled"sv };
};
@interface TabController : NSWindowController <NSWindowDelegate>
@ -27,14 +27,14 @@ struct TabSettings {
- (void)loadHTML:(StringView)html url:(URL const&)url;
- (void)onLoadStart:(URL const&)url isRedirect:(BOOL)isRedirect;
- (void)onTitleChange:(DeprecatedString const&)title;
- (void)onTitleChange:(ByteString const&)title;
- (void)navigateBack:(id)sender;
- (void)navigateForward:(id)sender;
- (void)reload:(id)sender;
- (void)clearHistory;
- (void)debugRequest:(DeprecatedString const&)request argument:(DeprecatedString const&)argument;
- (void)debugRequest:(ByteString const&)request argument:(ByteString const&)argument;
- (void)focusLocationToolbarItem;

View file

@ -54,7 +54,7 @@ enum class IsHistoryNavigation {
@interface TabController () <NSToolbarDelegate, NSSearchFieldDelegate>
{
DeprecatedString m_title;
ByteString m_title;
WebView::History m_history;
IsHistoryNavigation m_is_history_navigation;
@ -133,7 +133,7 @@ enum class IsHistoryNavigation {
[self updateNavigationButtonStates];
}
- (void)onTitleChange:(DeprecatedString const&)title
- (void)onTitleChange:(ByteString const&)title
{
m_title = title;
m_history.update_title(m_title);
@ -201,7 +201,7 @@ enum class IsHistoryNavigation {
[self updateNavigationButtonStates];
}
- (void)debugRequest:(DeprecatedString const&)request argument:(DeprecatedString const&)argument
- (void)debugRequest:(ByteString const&)request argument:(ByteString const&)argument
{
if (request == "dump-history") {
m_history.dump();
@ -390,8 +390,8 @@ enum class IsHistoryNavigation {
- (void)setUserAgentSpoof:(NSMenuItem*)sender
{
DeprecatedString const user_agent_name = [[sender title] UTF8String];
DeprecatedString user_agent = "";
ByteString const user_agent_name = [[sender title] UTF8String];
ByteString user_agent = "";
if (user_agent_name == "Disabled"sv) {
user_agent = Web::default_user_agent;
} else {

View file

@ -6,13 +6,13 @@
*/
#include "FontPlugin.h"
#include <AK/DeprecatedString.h>
#include <AK/ByteString.h>
#include <AK/String.h>
#include <LibCore/StandardPaths.h>
#include <LibGfx/Font/Emoji.h>
#include <LibGfx/Font/FontDatabase.h>
extern DeprecatedString s_serenity_resource_root;
extern ByteString s_serenity_resource_root;
namespace Ladybird {

View file

@ -45,7 +45,7 @@ ErrorOr<void> AutoComplete::parse_google_autocomplete(Vector<JsonValue> const& j
if (!json[0].is_string())
return Error::from_string_view("Invalid JSON, expected first element to be a string"sv);
auto query = TRY(String::from_deprecated_string(json[0].as_string()));
auto query = TRY(String::from_byte_string(json[0].as_string()));
if (!json[1].is_array())
return Error::from_string_view("Invalid JSON, expected second element to be an array"sv);
@ -55,7 +55,7 @@ ErrorOr<void> AutoComplete::parse_google_autocomplete(Vector<JsonValue> const& j
return Error::from_string_view("Invalid JSON, query does not match"sv);
for (auto& suggestion : suggestions_array) {
m_auto_complete_model->add(TRY(String::from_deprecated_string(suggestion.as_string())));
m_auto_complete_model->add(TRY(String::from_byte_string(suggestion.as_string())));
}
return {};
@ -67,7 +67,7 @@ ErrorOr<void> AutoComplete::parse_duckduckgo_autocomplete(Vector<JsonValue> cons
auto maybe_value = suggestion.as_object().get("phrase"sv);
if (!maybe_value.has_value())
continue;
m_auto_complete_model->add(TRY(String::from_deprecated_string(maybe_value->as_string())));
m_auto_complete_model->add(TRY(String::from_byte_string(maybe_value->as_string())));
}
return {};
@ -77,7 +77,7 @@ ErrorOr<void> AutoComplete::parse_yahoo_autocomplete(JsonObject const& json)
{
if (!json.get("q"sv).has_value() || !json.get("q"sv)->is_string())
return Error::from_string_view("Invalid JSON, expected \"q\" to be a string"sv);
auto query = TRY(String::from_deprecated_string(json.get("q"sv)->as_string()));
auto query = TRY(String::from_byte_string(json.get("q"sv)->as_string()));
if (!json.get("r"sv).has_value() || !json.get("r"sv)->is_array())
return Error::from_string_view("Invalid JSON, expected \"r\" to be an object"sv);
@ -94,7 +94,7 @@ ErrorOr<void> AutoComplete::parse_yahoo_autocomplete(JsonObject const& json)
if (!suggestion.get("k"sv).has_value() || !suggestion.get("k"sv)->is_string())
return Error::from_string_view("Invalid JSON, expected \"k\" to be a string"sv);
m_auto_complete_model->add(TRY(String::from_deprecated_string(suggestion.get("k"sv)->as_string())));
m_auto_complete_model->add(TRY(String::from_byte_string(suggestion.get("k"sv)->as_string())));
};
return {};
@ -105,7 +105,7 @@ ErrorOr<void> AutoComplete::got_network_response(QNetworkReply* reply)
if (reply->error() == QNetworkReply::NetworkError::OperationCanceledError)
return {};
AK::JsonParser parser(ak_deprecated_string_from_qstring(reply->readAll()));
AK::JsonParser parser(ak_byte_string_from_qstring(reply->readAll()));
auto json = TRY(parser.parse());
auto engine_name = Settings::the()->autocomplete_engine().name;

View file

@ -331,7 +331,7 @@ BrowserWindow::BrowserWindow(Vector<URL> const& initial_urls, WebView::CookieJar
auto* disable_spoofing = add_user_agent("Disabled"sv, Web::default_user_agent);
disable_spoofing->setChecked(true);
for (auto const& user_agent : WebView::user_agents)
add_user_agent(user_agent.key, user_agent.value.to_deprecated_string());
add_user_agent(user_agent.key, user_agent.value.to_byte_string());
auto* custom_user_agent_action = new QAction("Custom...", this);
custom_user_agent_action->setCheckable(true);
@ -340,7 +340,7 @@ BrowserWindow::BrowserWindow(Vector<URL> const& initial_urls, WebView::CookieJar
QObject::connect(custom_user_agent_action, &QAction::triggered, this, [this, disable_spoofing] {
auto user_agent = QInputDialog::getText(this, "Custom User Agent", "Enter User Agent:");
if (!user_agent.isEmpty()) {
debug_request("spoof-user-agent", ak_deprecated_string_from_qstring(user_agent));
debug_request("spoof-user-agent", ak_byte_string_from_qstring(user_agent));
debug_request("clear-cache"); // clear the cache to ensure requests are re-done with the new user agent
} else {
disable_spoofing->activate(QAction::Trigger);
@ -455,7 +455,7 @@ void BrowserWindow::set_current_tab(Tab* tab)
update_displayed_zoom_level();
}
void BrowserWindow::debug_request(DeprecatedString const& request, DeprecatedString const& argument)
void BrowserWindow::debug_request(ByteString const& request, ByteString const& argument)
{
if (!m_current_tab)
return;
@ -505,7 +505,7 @@ Tab& BrowserWindow::create_new_tab(Web::HTML::ActivateTab activate_tab)
};
tab->view().on_tab_open_request = [this](auto url, auto activate_tab) {
auto& tab = new_tab(qstring_from_ak_string(url.to_deprecated_string()), activate_tab);
auto& tab = new_tab(qstring_from_ak_string(url.to_byte_string()), activate_tab);
return tab.view().handle();
};
@ -533,7 +533,7 @@ Tab& BrowserWindow::create_new_tab(Web::HTML::ActivateTab activate_tab)
return m_cookie_jar.get_named_cookie(url, name);
};
tab->view().on_get_cookie = [this](auto& url, auto source) -> DeprecatedString {
tab->view().on_get_cookie = [this](auto& url, auto source) -> ByteString {
return m_cookie_jar.get_cookie(url, source);
};

View file

@ -102,7 +102,7 @@ private:
Tab& create_new_tab(Web::HTML::ActivateTab activate_tab);
void debug_request(DeprecatedString const& request, DeprecatedString const& argument = "");
void debug_request(ByteString const& request, ByteString const& argument = "");
void set_current_tab(Tab* tab);
void update_displayed_zoom_level();

View file

@ -24,7 +24,7 @@ void RequestManagerQt::reply_finished(QNetworkReply* reply)
request->did_finish();
}
RefPtr<Web::ResourceLoaderConnectorRequest> RequestManagerQt::start_request(DeprecatedString const& method, AK::URL const& url, HashMap<DeprecatedString, DeprecatedString> const& request_headers, ReadonlyBytes request_body, Core::ProxyData const& proxy)
RefPtr<Web::ResourceLoaderConnectorRequest> RequestManagerQt::start_request(ByteString const& method, AK::URL const& url, HashMap<ByteString, ByteString> const& request_headers, ReadonlyBytes request_body, Core::ProxyData const& proxy)
{
if (!url.scheme().bytes_as_string_view().is_one_of_ignoring_ascii_case("http"sv, "https"sv)) {
return nullptr;
@ -38,9 +38,9 @@ RefPtr<Web::ResourceLoaderConnectorRequest> RequestManagerQt::start_request(Depr
return request;
}
ErrorOr<NonnullRefPtr<RequestManagerQt::Request>> RequestManagerQt::Request::create(QNetworkAccessManager& qnam, DeprecatedString const& method, AK::URL const& url, HashMap<DeprecatedString, DeprecatedString> const& request_headers, ReadonlyBytes request_body, Core::ProxyData const&)
ErrorOr<NonnullRefPtr<RequestManagerQt::Request>> RequestManagerQt::Request::create(QNetworkAccessManager& qnam, ByteString const& method, AK::URL const& url, HashMap<ByteString, ByteString> const& request_headers, ReadonlyBytes request_body, Core::ProxyData const&)
{
QNetworkRequest request { QString(url.to_deprecated_string().characters()) };
QNetworkRequest request { QString(url.to_byte_string().characters()) };
request.setAttribute(QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::ManualRedirectPolicy);
request.setAttribute(QNetworkRequest::CookieLoadControlAttribute, QNetworkRequest::Manual);
request.setAttribute(QNetworkRequest::CookieSaveControlAttribute, QNetworkRequest::Manual);
@ -87,11 +87,11 @@ void RequestManagerQt::Request::did_finish()
{
auto buffer = m_reply.readAll();
auto http_status_code = m_reply.attribute(QNetworkRequest::Attribute::HttpStatusCodeAttribute).toInt();
HashMap<DeprecatedString, DeprecatedString, CaseInsensitiveStringTraits> response_headers;
Vector<DeprecatedString> set_cookie_headers;
HashMap<ByteString, ByteString, CaseInsensitiveStringTraits> response_headers;
Vector<ByteString> set_cookie_headers;
for (auto& it : m_reply.rawHeaderPairs()) {
auto name = DeprecatedString(it.first.data(), it.first.length());
auto value = DeprecatedString(it.second.data(), it.second.length());
auto name = ByteString(it.first.data(), it.first.length());
auto value = ByteString(it.second.data(), it.second.length());
if (name.equals_ignoring_ascii_case("set-cookie"sv)) {
// NOTE: Qt may have bundled multiple Set-Cookie headers into a single one.
// We have to extract the full list of cookies via QNetworkReply::header().
@ -104,7 +104,7 @@ void RequestManagerQt::Request::did_finish()
}
}
if (!set_cookie_headers.is_empty()) {
response_headers.set("set-cookie"sv, JsonArray { set_cookie_headers }.to_deprecated_string());
response_headers.set("set-cookie"sv, JsonArray { set_cookie_headers }.to_byte_string());
}
bool success = http_status_code != 0;
on_buffered_request_finish(success, buffer.length(), response_headers, http_status_code, ReadonlyBytes { buffer.data(), (size_t)buffer.size() });

View file

@ -27,7 +27,7 @@ public:
virtual void prefetch_dns(AK::URL const&) override { }
virtual void preconnect(AK::URL const&) override { }
virtual RefPtr<Web::ResourceLoaderConnectorRequest> start_request(DeprecatedString const& method, AK::URL const&, HashMap<DeprecatedString, DeprecatedString> const& request_headers, ReadonlyBytes request_body, Core::ProxyData const&) override;
virtual RefPtr<Web::ResourceLoaderConnectorRequest> start_request(ByteString const& method, AK::URL const&, HashMap<ByteString, ByteString> const& request_headers, ReadonlyBytes request_body, Core::ProxyData const&) override;
private slots:
void reply_finished(QNetworkReply*);
@ -38,7 +38,7 @@ private:
class Request
: public Web::ResourceLoaderConnectorRequest {
public:
static ErrorOr<NonnullRefPtr<Request>> create(QNetworkAccessManager& qnam, DeprecatedString const& method, AK::URL const& url, HashMap<DeprecatedString, DeprecatedString> const& request_headers, ReadonlyBytes request_body, Core::ProxyData const&);
static ErrorOr<NonnullRefPtr<Request>> create(QNetworkAccessManager& qnam, ByteString const& method, AK::URL const& url, HashMap<ByteString, ByteString> const& request_headers, ReadonlyBytes request_body, Core::ProxyData const&);
virtual ~Request() override;

View file

@ -7,7 +7,7 @@
#pragma once
#include <AK/DeprecatedString.h>
#include <AK/ByteString.h>
#include <AK/OwnPtr.h>
#include <LibWebView/SearchEngine.h>
#include <QPoint>

View file

@ -6,9 +6,9 @@
#include "StringUtils.h"
AK::DeprecatedString ak_deprecated_string_from_qstring(QString const& qstring)
AK::ByteString ak_byte_string_from_qstring(QString const& qstring)
{
return AK::DeprecatedString(qstring.toUtf8().data());
return AK::ByteString(qstring.toUtf8().data());
}
String ak_string_from_qstring(QString const& qstring)

View file

@ -6,12 +6,12 @@
#pragma once
#include <AK/DeprecatedString.h>
#include <AK/ByteString.h>
#include <AK/Error.h>
#include <AK/String.h>
#include <AK/StringView.h>
#include <QString>
AK::DeprecatedString ak_deprecated_string_from_qstring(QString const&);
AK::ByteString ak_byte_string_from_qstring(QString const&);
String ak_string_from_qstring(QString const&);
QString qstring_from_ak_string(StringView);

View file

@ -107,7 +107,7 @@ Tab::Tab(BrowserWindow* window, WebContentOptions const& web_content_options, St
};
view().on_link_hover = [this](auto const& url) {
m_hover_label->setText(qstring_from_ak_string(url.to_deprecated_string()));
m_hover_label->setText(qstring_from_ak_string(url.to_byte_string()));
update_hover_label();
m_hover_label->show();
};
@ -123,7 +123,7 @@ Tab::Tab(BrowserWindow* window, WebContentOptions const& web_content_options, St
m_history.replace_current(url, m_title.toUtf8().data());
}
m_location_edit->setText(url.to_deprecated_string().characters());
m_location_edit->setText(url.to_byte_string().characters());
m_location_edit->setCursorPosition(0);
// Don't add to history if back or forward is pressed
@ -648,7 +648,7 @@ void Tab::back()
m_is_history_navigation = true;
m_history.go_back();
view().load(m_history.current().url.to_deprecated_string());
view().load(m_history.current().url.to_byte_string());
}
void Tab::forward()
@ -658,7 +658,7 @@ void Tab::forward()
m_is_history_navigation = true;
m_history.go_forward();
view().load(m_history.current().url.to_deprecated_string());
view().load(m_history.current().url.to_byte_string());
}
void Tab::reload()
@ -667,7 +667,7 @@ void Tab::reload()
return;
m_is_history_navigation = true;
view().load(m_history.current().url.to_deprecated_string());
view().load(m_history.current().url.to_byte_string());
}
void Tab::open_link(URL const& url)
@ -703,7 +703,7 @@ int Tab::tab_index()
return m_window->tab_index(this);
}
void Tab::debug_request(DeprecatedString const& request, DeprecatedString const& argument)
void Tab::debug_request(ByteString const& request, ByteString const& argument)
{
if (request == "dump-history")
m_history.dump();

View file

@ -40,7 +40,7 @@ public:
void forward();
void reload();
void debug_request(DeprecatedString const& request, DeprecatedString const& argument);
void debug_request(ByteString const& request, ByteString const& argument);
void open_file();
void update_reset_zoom_button();

View file

@ -576,7 +576,7 @@ static Core::AnonymousBuffer make_system_theme_from_qt_palette(QWidget& widget,
auto theme_file = mode == WebContentView::PaletteMode::Default ? "Default"sv : "Dark"sv;
auto theme_ini = MUST(Core::Resource::load_from_uri(MUST(String::formatted("resource://themes/{}.ini", theme_file))));
auto theme = Gfx::load_system_theme(theme_ini->filesystem_path().to_deprecated_string()).release_value_but_fixme_should_propagate_errors();
auto theme = Gfx::load_system_theme(theme_ini->filesystem_path().to_byte_string()).release_value_but_fixme_should_propagate_errors();
auto palette_impl = Gfx::PaletteImpl::create_with_anonymous_buffer(theme);
auto palette = Gfx::Palette(move(palette_impl));
@ -752,7 +752,7 @@ bool WebContentView::event(QEvent* event)
ErrorOr<String> WebContentView::dump_layout_tree()
{
return String::from_deprecated_string(client().dump_layout_tree());
return String::from_byte_string(client().dump_layout_tree());
}
}

View file

@ -7,7 +7,7 @@
#pragma once
#include <AK/DeprecatedString.h>
#include <AK/ByteString.h>
#include <AK/Function.h>
#include <AK/HashMap.h>
#include <AK/OwnPtr.h>

View file

@ -19,7 +19,7 @@ NonnullRefPtr<WebSocketClientManagerQt> WebSocketClientManagerQt::create()
WebSocketClientManagerQt::WebSocketClientManagerQt() = default;
WebSocketClientManagerQt::~WebSocketClientManagerQt() = default;
RefPtr<Web::WebSockets::WebSocketClientSocket> WebSocketClientManagerQt::connect(AK::URL const& url, DeprecatedString const& origin, Vector<DeprecatedString> const& protocols)
RefPtr<Web::WebSockets::WebSocketClientSocket> WebSocketClientManagerQt::connect(AK::URL const& url, ByteString const& origin, Vector<ByteString> const& protocols)
{
WebSocket::ConnectionInfo connection_info(url);
connection_info.set_origin(origin);

View file

@ -19,7 +19,7 @@ public:
static NonnullRefPtr<WebSocketClientManagerQt> create();
virtual ~WebSocketClientManagerQt() override;
virtual RefPtr<Web::WebSockets::WebSocketClientSocket> connect(AK::URL const&, DeprecatedString const& origin, Vector<DeprecatedString> const& protocols) override;
virtual RefPtr<Web::WebSockets::WebSocketClientSocket> connect(AK::URL const&, ByteString const& origin, Vector<ByteString> const& protocols) override;
private:
WebSocketClientManagerQt();

View file

@ -85,13 +85,13 @@ ErrorOr<ByteBuffer> WebSocketImplQt::read(int max_size)
return buffer.slice(0, bytes_read);
}
ErrorOr<DeprecatedString> WebSocketImplQt::read_line(size_t size)
ErrorOr<ByteString> WebSocketImplQt::read_line(size_t size)
{
auto buffer = TRY(ByteBuffer::create_uninitialized(size));
auto bytes_read = m_socket->readLine(reinterpret_cast<char*>(buffer.data()), buffer.size());
if (bytes_read == -1)
return Error::from_string_literal("WebSocketImplQt::read_line(): Error reading from socket");
return DeprecatedString::copy(buffer.span().slice(0, bytes_read));
return ByteString::copy(buffer.span().slice(0, bytes_read));
}
}

View file

@ -22,7 +22,7 @@ public:
virtual void connect(WebSocket::ConnectionInfo const&) override;
virtual bool can_read_line() override;
virtual ErrorOr<DeprecatedString> read_line(size_t) override;
virtual ErrorOr<ByteString> read_line(size_t) override;
virtual ErrorOr<ByteBuffer> read(int max_size) override;
virtual bool send(ReadonlyBytes) override;
virtual bool eof() override;

View file

@ -50,7 +50,7 @@ WebSocketQt::WebSocketQt(NonnullRefPtr<WebSocket::WebSocket> underlying_socket)
}
}
};
m_websocket->on_close = [weak_this = make_weak_ptr()](u16 code, DeprecatedString reason, bool was_clean) {
m_websocket->on_close = [weak_this = make_weak_ptr()](u16 code, ByteString reason, bool was_clean) {
if (auto strong_this = weak_this.strong_ref())
if (strong_this->on_close)
strong_this->on_close(code, move(reason), was_clean);
@ -74,7 +74,7 @@ Web::WebSockets::WebSocket::ReadyState WebSocketQt::ready_state()
VERIFY_NOT_REACHED();
}
DeprecatedString WebSocketQt::subprotocol_in_use()
ByteString WebSocketQt::subprotocol_in_use()
{
return m_websocket->subprotocol_in_use();
}
@ -89,7 +89,7 @@ void WebSocketQt::send(StringView message)
m_websocket->send(WebSocket::Message(message));
}
void WebSocketQt::close(u16 code, DeprecatedString reason)
void WebSocketQt::close(u16 code, ByteString reason)
{
m_websocket->close(code, reason);
}

View file

@ -21,10 +21,10 @@ public:
virtual ~WebSocketQt() override;
virtual Web::WebSockets::WebSocket::ReadyState ready_state() override;
virtual DeprecatedString subprotocol_in_use() override;
virtual ByteString subprotocol_in_use() override;
virtual void send(ByteBuffer binary_or_text_message, bool is_text) override;
virtual void send(StringView message) override;
virtual void close(u16 code, DeprecatedString reason) override;
virtual void close(u16 code, ByteString reason) override;
private:
explicit WebSocketQt(NonnullRefPtr<WebSocket::WebSocket>);

View file

@ -4,7 +4,7 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <AK/DeprecatedString.h>
#include <AK/ByteString.h>
#include <LibCore/ArgsParser.h>
#include <LibCore/Directory.h>
#include <LibCore/EventLoop.h>
@ -17,7 +17,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
{
AK::set_rich_debug_enabled(true);
DeprecatedString pid_file;
ByteString pid_file;
Core::ArgsParser args_parser;
args_parser.add_option(pid_file, "Path to the PID file for the SQLServer singleton process", "pid-file", 'p', "pid_file");
@ -25,7 +25,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
VERIFY(!pid_file.is_empty());
auto database_path = DeprecatedString::formatted("{}/Ladybird", Core::StandardPaths::data_directory());
auto database_path = ByteString::formatted("{}/Ladybird", Core::StandardPaths::data_directory());
TRY(Core::Directory::create(database_path, Core::Directory::CreateDirectories::Yes));
Core::EventLoop loop;

View file

@ -12,13 +12,13 @@
#include <LibCore/System.h>
#include <LibFileSystem/FileSystem.h>
DeprecatedString s_serenity_resource_root;
ByteString s_serenity_resource_root;
ErrorOr<String> application_directory()
{
auto current_executable_path = TRY(Core::System::current_executable_path());
auto dirname = LexicalPath::dirname(current_executable_path);
return String::from_deprecated_string(dirname);
return String::from_byte_string(dirname);
}
void platform_init()
@ -26,14 +26,14 @@ void platform_init()
s_serenity_resource_root = [] {
auto const* source_dir = getenv("SERENITY_SOURCE_DIR");
if (source_dir) {
return DeprecatedString::formatted("{}/Base", source_dir);
return ByteString::formatted("{}/Base", source_dir);
}
auto* home = getenv("XDG_CONFIG_HOME") ?: getenv("HOME");
VERIFY(home);
auto home_lagom = DeprecatedString::formatted("{}/.lagom", home);
auto home_lagom = ByteString::formatted("{}/.lagom", home);
if (FileSystem::is_directory(home_lagom))
return home_lagom;
auto app_dir = application_directory().release_value_but_fixme_should_propagate_errors().to_deprecated_string();
auto app_dir = application_directory().release_value_but_fixme_should_propagate_errors().to_byte_string();
#ifdef AK_OS_MACOS
return LexicalPath(app_dir).parent().append("Resources"sv).string();
#else

View file

@ -7,7 +7,7 @@
#pragma once
#include <AK/DeprecatedString.h>
#include <AK/ByteString.h>
#include <AK/Error.h>
#include <AK/String.h>
#include <AK/Vector.h>
@ -16,4 +16,4 @@ void platform_init();
ErrorOr<String> application_directory();
ErrorOr<Vector<String>> get_paths_for_helper_process(StringView process_name);
extern DeprecatedString s_serenity_resource_root;
extern ByteString s_serenity_resource_root;

View file

@ -131,9 +131,9 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
static ErrorOr<void> load_content_filters()
{
auto file_or_error = Core::File::open(DeprecatedString::formatted("{}/home/anon/.config/BrowserContentFilters.txt", s_serenity_resource_root), Core::File::OpenMode::Read);
auto file_or_error = Core::File::open(ByteString::formatted("{}/home/anon/.config/BrowserContentFilters.txt", s_serenity_resource_root), Core::File::OpenMode::Read);
if (file_or_error.is_error())
file_or_error = Core::File::open(DeprecatedString::formatted("{}/res/ladybird/BrowserContentFilters.txt", s_serenity_resource_root), Core::File::OpenMode::Read);
file_or_error = Core::File::open(ByteString::formatted("{}/res/ladybird/BrowserContentFilters.txt", s_serenity_resource_root), Core::File::OpenMode::Read);
if (file_or_error.is_error())
return file_or_error.release_error();

View file

@ -30,7 +30,7 @@ static ErrorOr<pid_t> launch_process(StringView application, ReadonlySpan<char c
return result;
}
static ErrorOr<pid_t> launch_browser(DeprecatedString const& socket_path)
static ErrorOr<pid_t> launch_browser(ByteString const& socket_path)
{
return launch_process("Ladybird"sv,
Array {
@ -40,9 +40,9 @@ static ErrorOr<pid_t> launch_browser(DeprecatedString const& socket_path)
});
}
static ErrorOr<pid_t> launch_headless_browser(DeprecatedString const& socket_path)
static ErrorOr<pid_t> launch_headless_browser(ByteString const& socket_path)
{
auto resources = DeprecatedString::formatted("{}/res", s_serenity_resource_root);
auto resources = ByteString::formatted("{}/res", s_serenity_resource_root);
return launch_process("headless-browser"sv,
Array {
"--resources",
@ -78,7 +78,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
platform_init();
auto webdriver_socket_path = DeprecatedString::formatted("{}/webdriver", TRY(Core::StandardPaths::runtime_directory()));
auto webdriver_socket_path = ByteString::formatted("{}/webdriver", TRY(Core::StandardPaths::runtime_directory()));
TRY(Core::Directory::create(webdriver_socket_path, Core::Directory::CreateDirectories::Yes));
Core::EventLoop loop;