Ladybird: Update for AK::{String => DeprecatedString} rename

This commit is contained in:
Linus Groh 2022-12-04 18:43:54 +00:00 committed by Andrew Kaster
parent 97dd5a085f
commit 5a5c4f079b
Notes: sideshowbarker 2024-07-17 02:38:44 +09:00
29 changed files with 172 additions and 172 deletions

View File

@ -6,10 +6,10 @@
#define AK_DONT_REPLACE_STD
#include <AK/DeprecatedString.h>
#include <AK/LexicalPath.h>
#include <AK/Platform.h>
#include <AK/ScopeGuard.h>
#include <AK/String.h>
#include <LibArchive/Tar.h>
#include <LibArchive/TarStream.h>
#include <LibCore/Directory.h>
@ -31,11 +31,11 @@
// nor include it in libladybird_<arch>.so
#include <LibMain/Main.cpp> // NOLINT(bugprone-suspicious-include)
extern String s_serenity_resource_root;
extern DeprecatedString s_serenity_resource_root;
void android_platform_init();
static void extract_ladybird_resources();
static ErrorOr<void> extract_tar_archive(String archive_file, String output_directory);
static ErrorOr<void> extract_tar_archive(DeprecatedString archive_file, DeprecatedString output_directory);
void android_platform_init()
{
@ -53,24 +53,24 @@ void android_platform_init()
void extract_ladybird_resources()
{
qDebug() << "serenity resource root is " << s_serenity_resource_root.characters();
auto file_or_error = Core::System::open(String::formatted("{}/res/icons/16x16/app-browser.png", s_serenity_resource_root), O_RDONLY);
auto file_or_error = Core::System::open(DeprecatedString::formatted("{}/res/icons/16x16/app-browser.png", s_serenity_resource_root), O_RDONLY);
if (file_or_error.is_error()) {
qDebug() << "Unable to open test file file as expected, extracting asssets...";
MUST(extract_tar_archive(String::formatted("{}/ladybird-assets.tar", s_serenity_resource_root), s_serenity_resource_root));
MUST(extract_tar_archive(DeprecatedString::formatted("{}/ladybird-assets.tar", s_serenity_resource_root), s_serenity_resource_root));
} else {
qDebug() << "Opened app-browser.png test file, good to go!";
qDebug() << "Hopefully no developer changed the asset files and expected them to be re-extracted!";
}
}
ErrorOr<void> extract_tar_archive(String archive_file, String output_directory)
ErrorOr<void> extract_tar_archive(DeprecatedString archive_file, DeprecatedString output_directory)
{
constexpr size_t buffer_size = 4096;
auto file = TRY(Core::File::open(archive_file, Core::OpenMode::ReadOnly));
String old_pwd = TRY(Core::System::getcwd());
DeprecatedString old_pwd = TRY(Core::System::getcwd());
TRY(Core::System::chdir(output_directory));
ScopeGuard go_back = [&old_pwd] { MUST(Core::System::chdir(old_pwd)); };
@ -83,16 +83,16 @@ ErrorOr<void> extract_tar_archive(String archive_file, String output_directory)
return Error::from_errno(EINVAL);
}
HashMap<String, String> global_overrides;
HashMap<String, String> local_overrides;
HashMap<DeprecatedString, DeprecatedString> global_overrides;
HashMap<DeprecatedString, DeprecatedString> local_overrides;
auto get_override = [&](StringView key) -> Optional<String> {
Optional<String> maybe_local = local_overrides.get(key);
auto get_override = [&](StringView key) -> Optional<DeprecatedString> {
Optional<DeprecatedString> maybe_local = local_overrides.get(key);
if (maybe_local.has_value())
return maybe_local;
Optional<String> maybe_global = global_overrides.get(key);
Optional<DeprecatedString> maybe_global = global_overrides.get(key);
if (maybe_global.has_value())
return maybe_global;
@ -142,7 +142,7 @@ ErrorOr<void> extract_tar_archive(String archive_file, String output_directory)
while ((bytes_read = file_stream.read(buffer)) > 0)
long_name.append(reinterpret_cast<char*>(buffer.data()), bytes_read);
local_overrides.set("path", long_name.to_string());
local_overrides.set("path", long_name.to_deprecated_string());
continue;
}
default:
@ -153,9 +153,9 @@ ErrorOr<void> extract_tar_archive(String archive_file, String output_directory)
LexicalPath path = LexicalPath(header.filename());
if (!header.prefix().is_empty())
path = path.prepend(header.prefix());
String filename = get_override("path"sv).value_or(path.string());
DeprecatedString filename = get_override("path"sv).value_or(path.string());
String absolute_path = Core::File::absolute_path(filename);
DeprecatedString absolute_path = Core::File::absolute_path(filename);
auto parent_path = LexicalPath(absolute_path).parent();
switch (header.type_flag()) {

View File

@ -18,7 +18,7 @@
#include <QInputDialog>
#include <QPlainTextEdit>
extern String s_serenity_resource_root;
extern DeprecatedString s_serenity_resource_root;
extern Browser::Settings* s_settings;
BrowserWindow::BrowserWindow(int webdriver_fd_passing_socket)
@ -230,7 +230,7 @@ BrowserWindow::BrowserWindow(int webdriver_fd_passing_socket)
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", akstring_from_qstring(user_agent));
debug_request("spoof-user-agent", ak_deprecated_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);
@ -283,7 +283,7 @@ BrowserWindow::BrowserWindow(int webdriver_fd_passing_socket)
setCentralWidget(m_tabs_container);
}
void BrowserWindow::debug_request(String const& request, String const& argument)
void BrowserWindow::debug_request(DeprecatedString const& request, DeprecatedString const& argument)
{
if (!m_current_tab)
return;
@ -314,7 +314,7 @@ void BrowserWindow::new_tab()
return m_cookie_jar.get_named_cookie(url, name);
};
tab_ptr->view().on_get_cookie = [this](auto& url, auto source) -> String {
tab_ptr->view().on_get_cookie = [this](auto& url, auto source) -> DeprecatedString {
return m_cookie_jar.get_cookie(url, source);
};

View File

@ -41,7 +41,7 @@ public slots:
void enable_dark_color_scheme();
private:
void debug_request(String const& request, String const& argument = "");
void debug_request(DeprecatedString const& request, DeprecatedString const& argument = "");
QTabWidget* m_tabs_container { nullptr };
NonnullOwnPtrVector<Tab> m_tabs;

View File

@ -40,7 +40,7 @@ ConsoleClient::ConsoleClient(JS::Console& console, JS::Realm& realm, SimpleWebVi
m_console_global_object = JS::make_handle(console_global_object);
}
void ConsoleClient::handle_input(String const& js_source)
void ConsoleClient::handle_input(DeprecatedString const& js_source)
{
if (!m_realm)
return;
@ -69,7 +69,7 @@ void ConsoleClient::handle_input(String const& js_source)
print_html(JS::MarkupGenerator::html_from_value(*result.value()));
}
void ConsoleClient::print_html(String const& line)
void ConsoleClient::print_html(DeprecatedString const& line)
{
m_message_log.append({ .type = ConsoleOutput::Type::HTML, .data = line });
m_view.did_output_js_console_message(m_message_log.size() - 1);
@ -81,7 +81,7 @@ void ConsoleClient::clear_output()
m_view.did_output_js_console_message(m_message_log.size() - 1);
}
void ConsoleClient::begin_group(String const& label, bool start_expanded)
void ConsoleClient::begin_group(DeprecatedString const& label, bool start_expanded)
{
m_message_log.append({ .type = start_expanded ? ConsoleOutput::Type::BeginGroup : ConsoleOutput::Type::BeginGroupCollapsed, .data = label });
m_view.did_output_js_console_message(m_message_log.size() - 1);
@ -105,8 +105,8 @@ void ConsoleClient::send_messages(i32 start_index)
}
// FIXME: Replace with a single Vector of message structs
Vector<String> message_types;
Vector<String> messages;
Vector<DeprecatedString> message_types;
Vector<DeprecatedString> messages;
message_types.ensure_capacity(messages_to_send);
messages.ensure_capacity(messages_to_send);
@ -164,11 +164,11 @@ JS::ThrowCompletionOr<JS::Value> ConsoleClient::printer(JS::Console::LogLevel lo
if (log_level == JS::Console::LogLevel::Group || log_level == JS::Console::LogLevel::GroupCollapsed) {
auto group = arguments.get<JS::Console::Group>();
begin_group(String::formatted("<span style='{}'>{}</span>", styling, escape_html_entities(group.label)), log_level == JS::Console::LogLevel::Group);
begin_group(DeprecatedString::formatted("<span style='{}'>{}</span>", styling, escape_html_entities(group.label)), log_level == JS::Console::LogLevel::Group);
return JS::js_undefined();
}
auto output = String::join(' ', arguments.get<JS::MarkedVector<JS::Value>>());
auto output = DeprecatedString::join(' ', arguments.get<JS::MarkedVector<JS::Value>>());
m_console.output_debug_message(log_level, output);
StringBuilder html;

View File

@ -25,7 +25,7 @@ class ConsoleClient final : public JS::ConsoleClient {
public:
ConsoleClient(JS::Console&, JS::Realm&, SimpleWebView&);
void handle_input(String const& js_source);
void handle_input(DeprecatedString const& js_source);
void send_messages(i32 start_index);
private:
@ -44,8 +44,8 @@ private:
JS::Handle<ConsoleGlobalObject> m_console_global_object;
void clear_output();
void print_html(String const& line);
void begin_group(String const& label, bool start_expanded);
void print_html(DeprecatedString const& line);
void begin_group(DeprecatedString const& label, bool start_expanded);
virtual void end_group() override;
struct ConsoleOutput {
@ -57,7 +57,7 @@ private:
EndGroup,
};
Type type;
String data;
DeprecatedString data;
};
Vector<ConsoleOutput> m_message_log;

View File

@ -40,7 +40,7 @@ ConsoleWidget::ConsoleWidget()
bottom_container->layout()->addWidget(m_input);
QObject::connect(m_input, &QLineEdit::returnPressed, [this] {
auto js_source = akstring_from_qstring(m_input->text());
auto js_source = ak_deprecated_string_from_qstring(m_input->text());
if (js_source.is_whitespace())
return;
@ -91,7 +91,7 @@ void ConsoleWidget::notify_about_new_console_message(i32 message_index)
request_console_messages();
}
void ConsoleWidget::handle_console_messages(i32 start_index, Vector<String> const& message_types, Vector<String> const& messages)
void ConsoleWidget::handle_console_messages(i32 start_index, Vector<DeprecatedString> const& message_types, Vector<DeprecatedString> const& messages)
{
i32 end_index = start_index + message_types.size() - 1;
if (end_index <= m_highest_received_message_index) {

View File

@ -9,8 +9,8 @@
#pragma once
#include <AK/DeprecatedString.h>
#include <AK/Function.h>
#include <AK/String.h>
#include <AK/Vector.h>
#include <QWidget>
@ -26,12 +26,12 @@ public:
virtual ~ConsoleWidget() = default;
void notify_about_new_console_message(i32 message_index);
void handle_console_messages(i32 start_index, Vector<String> const& message_types, Vector<String> const& messages);
void handle_console_messages(i32 start_index, Vector<DeprecatedString> const& message_types, Vector<DeprecatedString> const& messages);
void print_source_line(StringView);
void print_html(StringView);
void reset();
Function<void(String const&)> on_js_input;
Function<void(DeprecatedString const&)> on_js_input;
Function<void(i32)> on_request_messages;
private:

View File

@ -7,19 +7,19 @@
#define AK_DONT_REPLACE_STD
#include "FontPluginQt.h"
#include <AK/String.h>
#include <AK/DeprecatedString.h>
#include <LibGfx/Font/FontDatabase.h>
#include <QFont>
#include <QFontInfo>
extern String s_serenity_resource_root;
extern DeprecatedString s_serenity_resource_root;
namespace Ladybird {
FontPluginQt::FontPluginQt()
{
// Load the default SerenityOS fonts...
Gfx::FontDatabase::set_default_fonts_lookup_path(String::formatted("{}/res/fonts", s_serenity_resource_root));
Gfx::FontDatabase::set_default_fonts_lookup_path(DeprecatedString::formatted("{}/res/fonts", s_serenity_resource_root));
// ...and also anything we can find in /usr/share/fonts
Gfx::FontDatabase::the().load_all_fonts_from_path("/usr/share/fonts");
@ -63,7 +63,7 @@ void FontPluginQt::update_generic_fonts()
m_generic_font_names.resize(static_cast<size_t>(Web::Platform::GenericFont::__Count));
auto update_mapping = [&](Web::Platform::GenericFont generic_font, QFont::StyleHint qfont_style_hint, Vector<String> fallbacks = {}) {
auto update_mapping = [&](Web::Platform::GenericFont generic_font, QFont::StyleHint qfont_style_hint, Vector<DeprecatedString> fallbacks = {}) {
QFont qt_font;
qt_font.setStyleHint(qfont_style_hint);
QFontInfo qt_info(qt_font);
@ -90,11 +90,11 @@ void FontPluginQt::update_generic_fonts()
// Fallback fonts to look for if Gfx::Font can't load the font suggested by Qt.
// The lists are basically arbitrary, taken from https://www.w3.org/Style/Examples/007/fonts.en.html
Vector<String> cursive_fallbacks { "Comic Sans MS", "Comic Sans", "Apple Chancery", "Bradley Hand", "Brush Script MT", "Snell Roundhand", "URW Chancery L" };
Vector<String> fantasy_fallbacks { "Impact", "Luminari", "Chalkduster", "Jazz LET", "Blippo", "Stencil Std", "Marker Felt", "Trattatello" };
Vector<String> monospace_fallbacks { "Andale Mono", "Courier New", "Courier", "FreeMono", "OCR A Std", "DejaVu Sans Mono", "Liberation Mono", "Csilla" };
Vector<String> sans_serif_fallbacks { "Arial", "Helvetica", "Verdana", "Trebuchet MS", "Gill Sans", "Noto Sans", "Avantgarde", "Optima", "Arial Narrow", "Liberation Sans", "Katica" };
Vector<String> serif_fallbacks { "Times", "Times New Roman", "Didot", "Georgia", "Palatino", "Bookman", "New Century Schoolbook", "American Typewriter", "Liberation Serif", "Roman" };
Vector<DeprecatedString> cursive_fallbacks { "Comic Sans MS", "Comic Sans", "Apple Chancery", "Bradley Hand", "Brush Script MT", "Snell Roundhand", "URW Chancery L" };
Vector<DeprecatedString> fantasy_fallbacks { "Impact", "Luminari", "Chalkduster", "Jazz LET", "Blippo", "Stencil Std", "Marker Felt", "Trattatello" };
Vector<DeprecatedString> monospace_fallbacks { "Andale Mono", "Courier New", "Courier", "FreeMono", "OCR A Std", "DejaVu Sans Mono", "Liberation Mono", "Csilla" };
Vector<DeprecatedString> sans_serif_fallbacks { "Arial", "Helvetica", "Verdana", "Trebuchet MS", "Gill Sans", "Noto Sans", "Avantgarde", "Optima", "Arial Narrow", "Liberation Sans", "Katica" };
Vector<DeprecatedString> serif_fallbacks { "Times", "Times New Roman", "Didot", "Georgia", "Palatino", "Bookman", "New Century Schoolbook", "American Typewriter", "Liberation Serif", "Roman" };
update_mapping(Web::Platform::GenericFont::Cursive, QFont::StyleHint::Cursive, cursive_fallbacks);
update_mapping(Web::Platform::GenericFont::Fantasy, QFont::StyleHint::Fantasy, fantasy_fallbacks);
@ -107,7 +107,7 @@ void FontPluginQt::update_generic_fonts()
update_mapping(Web::Platform::GenericFont::UiSerif, QFont::StyleHint::Serif, serif_fallbacks);
}
String FontPluginQt::generic_font_name(Web::Platform::GenericFont generic_font)
DeprecatedString FontPluginQt::generic_font_name(Web::Platform::GenericFont generic_font)
{
return m_generic_font_names[static_cast<size_t>(generic_font)];
}

View File

@ -19,12 +19,12 @@ public:
virtual Gfx::Font& default_font() override;
virtual Gfx::Font& default_fixed_width_font() override;
virtual String generic_font_name(Web::Platform::GenericFont) override;
virtual DeprecatedString generic_font_name(Web::Platform::GenericFont) override;
void update_generic_fonts();
private:
Vector<String> m_generic_font_names;
Vector<DeprecatedString> m_generic_font_names;
RefPtr<Gfx::Font> m_default_font;
RefPtr<Gfx::Font> m_default_fixed_width_font;
};

View File

@ -32,7 +32,7 @@ int ModelTranslator::rowCount(QModelIndex const& parent) const
static QVariant convert_variant(GUI::Variant const& value)
{
if (value.is_string())
return qstring_from_akstring(value.as_string());
return qstring_from_ak_deprecated_string(value.as_string());
if (value.is_icon()) {
auto const& gui_icon = value.as_icon();
auto bitmap = gui_icon.bitmap_for_size(16);

View File

@ -22,7 +22,7 @@ void RequestManagerQt::reply_finished(QNetworkReply* reply)
request->did_finish();
}
RefPtr<Web::ResourceLoaderConnectorRequest> RequestManagerQt::start_request(String const& method, AK::URL const& url, HashMap<String, String> const& request_headers, ReadonlyBytes request_body, Core::ProxyData const& proxy)
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)
{
if (!url.scheme().is_one_of_ignoring_case("http"sv, "https"sv)) {
return nullptr;
@ -36,9 +36,9 @@ RefPtr<Web::ResourceLoaderConnectorRequest> RequestManagerQt::start_request(Stri
return request;
}
ErrorOr<NonnullRefPtr<RequestManagerQt::Request>> RequestManagerQt::Request::create(QNetworkAccessManager& qnam, String const& method, AK::URL const& url, HashMap<String, String> const& request_headers, ReadonlyBytes request_body, Core::ProxyData const&)
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&)
{
QNetworkRequest request { QString(url.to_string().characters()) };
QNetworkRequest request { QString(url.to_deprecated_string().characters()) };
request.setAttribute(QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::ManualRedirectPolicy);
request.setAttribute(QNetworkRequest::HttpPipeliningAllowedAttribute, true);
@ -79,11 +79,11 @@ void RequestManagerQt::Request::did_finish()
bool success = m_reply.error() == QNetworkReply::NetworkError::NoError;
auto buffer = m_reply.readAll();
auto http_status_code = m_reply.attribute(QNetworkRequest::Attribute::HttpStatusCodeAttribute).toInt();
HashMap<String, String, CaseInsensitiveStringTraits> response_headers;
Vector<String> set_cookie_headers;
HashMap<DeprecatedString, DeprecatedString, CaseInsensitiveStringTraits> response_headers;
Vector<DeprecatedString> set_cookie_headers;
for (auto& it : m_reply.rawHeaderPairs()) {
auto name = String(it.first.data(), it.first.length());
auto value = String(it.second.data(), it.second.length());
auto name = DeprecatedString(it.first.data(), it.first.length());
auto value = DeprecatedString(it.second.data(), it.second.length());
if (name.equals_ignoring_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().
@ -96,7 +96,7 @@ void RequestManagerQt::Request::did_finish()
}
}
if (!set_cookie_headers.is_empty()) {
response_headers.set("set-cookie"sv, JsonArray { set_cookie_headers }.to_string());
response_headers.set("set-cookie"sv, JsonArray { set_cookie_headers }.to_deprecated_string());
}
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(String const& method, AK::URL const&, HashMap<String, String> const& request_headers, ReadonlyBytes request_body, Core::ProxyData 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;
private slots:
void reply_finished(QNetworkReply*);
@ -38,7 +38,7 @@ private:
class Request
: public Web::ResourceLoaderConnectorRequest {
public:
static ErrorOr<NonnullRefPtr<Request>> create(QNetworkAccessManager& qnam, String const& method, AK::URL const& url, HashMap<String, String> const& request_headers, ReadonlyBytes request_body, Core::ProxyData const&);
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&);
virtual ~Request() override;

View File

@ -8,7 +8,7 @@
#define AK_DONT_REPLACE_STD
#include <AK/String.h>
#include <AK/DeprecatedString.h>
#include <QSettings>
namespace Browser {

View File

@ -17,7 +17,7 @@
#include <QPoint>
#include <QResizeEvent>
extern String s_serenity_resource_root;
extern DeprecatedString s_serenity_resource_root;
extern Browser::Settings* s_settings;
Tab::Tab(BrowserWindow* window, int webdriver_fd_passing_socket)
@ -88,7 +88,7 @@ Tab::Tab(BrowserWindow* window, int webdriver_fd_passing_socket)
m_history.replace_current(url, m_title.toUtf8().data());
}
m_location_edit->setText(url.to_string().characters());
m_location_edit->setText(url.to_deprecated_string().characters());
// Don't add to history if back or forward is pressed
if (!m_is_history_navigation) {
@ -167,7 +167,7 @@ void Tab::navigate(QString url)
{
if (!url.startsWith("http://", Qt::CaseInsensitive) && !url.startsWith("https://", Qt::CaseInsensitive) && !url.startsWith("file://", Qt::CaseInsensitive))
url = "http://" + url;
view().load(akstring_from_qstring(url));
view().load(ak_deprecated_string_from_qstring(url));
}
void Tab::back()
@ -177,7 +177,7 @@ void Tab::back()
m_is_history_navigation = true;
m_history.go_back();
view().load(m_history.current().url.to_string());
view().load(m_history.current().url.to_deprecated_string());
}
void Tab::forward()
@ -187,7 +187,7 @@ void Tab::forward()
m_is_history_navigation = true;
m_history.go_forward();
view().load(m_history.current().url.to_string());
view().load(m_history.current().url.to_deprecated_string());
}
void Tab::home()
@ -198,7 +198,7 @@ void Tab::home()
void Tab::reload()
{
m_is_history_navigation = true;
view().load(m_history.current().url.to_string());
view().load(m_history.current().url.to_deprecated_string());
}
void Tab::location_edit_return_pressed()
@ -209,7 +209,7 @@ void Tab::location_edit_return_pressed()
void Tab::page_title_changed(QString title)
{
m_title = title;
m_history.update_title(akstring_from_qstring(m_title));
m_history.update_title(ak_deprecated_string_from_qstring(m_title));
emit title_changed(tab_index(), std::move(title));
}
@ -223,7 +223,7 @@ int Tab::tab_index()
return m_window->tab_index(this);
}
void Tab::debug_request(String const& request, String const& argument)
void Tab::debug_request(DeprecatedString const& request, DeprecatedString const& argument)
{
if (request == "dump-history")
m_history.dump();

View File

@ -28,7 +28,7 @@ public:
void navigate(QString);
void debug_request(String const& request, String const& argument);
void debug_request(DeprecatedString const& request, DeprecatedString const& argument);
public slots:
void focus_location_editor();

View File

@ -12,16 +12,16 @@
#include <LibCore/File.h>
#include <QCoreApplication>
String s_serenity_resource_root;
DeprecatedString s_serenity_resource_root;
AK::String akstring_from_qstring(QString const& qstring)
AK::DeprecatedString ak_deprecated_string_from_qstring(QString const& qstring)
{
return AK::String(qstring.toUtf8().data());
return AK::DeprecatedString(qstring.toUtf8().data());
}
QString qstring_from_akstring(AK::String const& akstring)
QString qstring_from_ak_deprecated_string(AK::DeprecatedString const& ak_deprecated_string)
{
return QString::fromUtf8(akstring.characters(), akstring.length());
return QString::fromUtf8(ak_deprecated_string.characters(), ak_deprecated_string.length());
}
void platform_init()
@ -33,14 +33,14 @@ void platform_init()
s_serenity_resource_root = [] {
auto const* source_dir = getenv("SERENITY_SOURCE_DIR");
if (source_dir) {
return String::formatted("{}/Base", source_dir);
return DeprecatedString::formatted("{}/Base", source_dir);
}
auto* home = getenv("XDG_CONFIG_HOME") ?: getenv("HOME");
VERIFY(home);
auto home_lagom = String::formatted("{}/.lagom", home);
auto home_lagom = DeprecatedString::formatted("{}/.lagom", home);
if (Core::File::is_directory(home_lagom))
return home_lagom;
auto app_dir = akstring_from_qstring(QCoreApplication::applicationDirPath());
auto app_dir = ak_deprecated_string_from_qstring(QCoreApplication::applicationDirPath());
return LexicalPath(app_dir).parent().append("share"sv).string();
}();
#endif

View File

@ -6,11 +6,11 @@
#pragma once
#include <AK/String.h>
#include <AK/DeprecatedString.h>
#include <QString>
AK::String akstring_from_qstring(QString const&);
QString qstring_from_akstring(AK::String const&);
AK::DeprecatedString ak_deprecated_string_from_qstring(QString const&);
QString qstring_from_ak_deprecated_string(AK::DeprecatedString const&);
void platform_init();
extern String s_serenity_resource_root;
extern DeprecatedString s_serenity_resource_root;

View File

@ -34,7 +34,7 @@
static ErrorOr<void> load_content_filters();
extern String s_serenity_resource_root;
extern DeprecatedString s_serenity_resource_root;
struct DeferredInvokerQt final : IPC::DeferredInvoker {
virtual ~DeferredInvokerQt() = default;
@ -80,11 +80,11 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
Web::ResourceLoader::initialize(RequestManagerQt::create());
Web::WebSockets::WebSocketClientManager::initialize(Ladybird::WebSocketClientManagerLadybird::create());
Web::FrameLoader::set_default_favicon_path(String::formatted("{}/res/icons/16x16/app-browser.png", s_serenity_resource_root));
Web::FrameLoader::set_default_favicon_path(DeprecatedString::formatted("{}/res/icons/16x16/app-browser.png", s_serenity_resource_root));
Web::Platform::FontPlugin::install(*new Ladybird::FontPluginQt);
Web::FrameLoader::set_error_page_url(String::formatted("file://{}/res/html/error.html", s_serenity_resource_root));
Web::FrameLoader::set_error_page_url(DeprecatedString::formatted("file://{}/res/html/error.html", s_serenity_resource_root));
auto maybe_content_filter_error = load_content_filters();
if (maybe_content_filter_error.is_error())
@ -111,9 +111,9 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
static ErrorOr<void> load_content_filters()
{
auto file_or_error = Core::Stream::File::open(String::formatted("{}/home/anon/.config/BrowserContentFilters.txt", s_serenity_resource_root), Core::Stream::OpenMode::Read);
auto file_or_error = Core::Stream::File::open(DeprecatedString::formatted("{}/home/anon/.config/BrowserContentFilters.txt", s_serenity_resource_root), Core::Stream::OpenMode::Read);
if (file_or_error.is_error())
file_or_error = Core::Stream::File::open(String::formatted("{}/res/ladybird/BrowserContentFilters.txt", s_serenity_resource_root), Core::Stream::OpenMode::Read);
file_or_error = Core::Stream::File::open(DeprecatedString::formatted("{}/res/ladybird/BrowserContentFilters.txt", s_serenity_resource_root), Core::Stream::OpenMode::Read);
if (file_or_error.is_error())
return file_or_error.release_error();
auto file = file_or_error.release_value();

View File

@ -457,12 +457,12 @@ void WebContentView::update_viewport_rect()
request_repaint();
}
void WebContentView::debug_request(String const& request, String const& argument)
void WebContentView::debug_request(DeprecatedString const& request, DeprecatedString const& argument)
{
client().async_debug_request(request, argument);
}
void WebContentView::run_javascript(String const& js_source)
void WebContentView::run_javascript(DeprecatedString const& js_source)
{
client().async_run_javascript(js_source);
}
@ -473,7 +473,7 @@ void WebContentView::did_output_js_console_message(i32 message_index)
m_console_widget->notify_about_new_console_message(message_index);
}
void WebContentView::did_get_js_console_messages(i32 start_index, Vector<String> message_types, Vector<String> messages)
void WebContentView::did_get_js_console_messages(i32 start_index, Vector<DeprecatedString> message_types, Vector<DeprecatedString> messages)
{
if (m_console_widget)
m_console_widget->handle_console_messages(start_index, message_types, messages);
@ -588,15 +588,15 @@ void WebContentView::create_client()
MUST(Core::System::close(ui_fd_passing_fd));
MUST(Core::System::close(ui_fd));
String takeover_string;
DeprecatedString takeover_string;
if (auto* socket_takeover = getenv("SOCKET_TAKEOVER"))
takeover_string = String::formatted("{} WebContent:{}", socket_takeover, wc_fd);
takeover_string = DeprecatedString::formatted("{} WebContent:{}", socket_takeover, wc_fd);
else
takeover_string = String::formatted("WebContent:{}", wc_fd);
takeover_string = DeprecatedString::formatted("WebContent:{}", wc_fd);
MUST(Core::System::setenv("SOCKET_TAKEOVER"sv, takeover_string, true));
auto webcontent_fd_passing_socket_string = String::number(wc_fd_passing_fd);
auto webdriver_fd_passing_socket_string = String::number(m_webdriver_fd_passing_socket);
auto webcontent_fd_passing_socket_string = DeprecatedString::number(wc_fd_passing_fd);
auto webdriver_fd_passing_socket_string = DeprecatedString::number(m_webdriver_fd_passing_socket);
char const* argv[] = {
"WebContent",
@ -647,7 +647,7 @@ void WebContentView::create_client()
});
};
client().async_update_system_theme(Gfx::load_system_theme(String::formatted("{}/res/themes/Default.ini", s_serenity_resource_root)));
client().async_update_system_theme(Gfx::load_system_theme(DeprecatedString::formatted("{}/res/themes/Default.ini", s_serenity_resource_root)));
client().async_update_system_fonts(Gfx::FontDatabase::default_font_query(), Gfx::FontDatabase::fixed_width_font_query(), Gfx::FontDatabase::window_title_font_query());
// FIXME: Get the screen rect.
@ -666,17 +666,17 @@ void WebContentView::handle_web_content_process_crash()
handle_resize();
StringBuilder builder;
builder.append("<html><head><title>Crashed: "sv);
builder.append(escape_html_entities(m_url.to_string()));
builder.append(escape_html_entities(m_url.to_deprecated_string()));
builder.append("</title></head><body>"sv);
builder.append("<h1>Web page crashed"sv);
if (!m_url.host().is_empty()) {
builder.appendff(" on {}", escape_html_entities(m_url.host()));
}
builder.append("</h1>"sv);
auto escaped_url = escape_html_entities(m_url.to_string());
auto escaped_url = escape_html_entities(m_url.to_deprecated_string());
builder.appendff("The web page <a href=\"{}\">{}</a> has crashed.<br><br>You can reload the page to try again.", escaped_url, escaped_url);
builder.append("</body></html>"sv);
load_html(builder.to_string(), m_url);
load_html(builder.to_deprecated_string(), m_url);
}
void WebContentView::notify_server_did_paint(Badge<WebContentClient>, i32 bitmap_id)
@ -732,9 +732,9 @@ void WebContentView::notify_server_did_layout(Badge<WebContentClient>, Gfx::IntS
horizontalScrollBar()->setPageStep(m_viewport_rect.width());
}
void WebContentView::notify_server_did_change_title(Badge<WebContentClient>, String const& title)
void WebContentView::notify_server_did_change_title(Badge<WebContentClient>, DeprecatedString const& title)
{
emit title_changed(qstring_from_akstring(title));
emit title_changed(qstring_from_ak_deprecated_string(title));
}
void WebContentView::notify_server_did_request_scroll(Badge<WebContentClient>, i32 x_delta, i32 y_delta)
@ -761,12 +761,12 @@ void WebContentView::notify_server_did_request_scroll_into_view(Badge<WebContent
}
}
void WebContentView::notify_server_did_enter_tooltip_area(Badge<WebContentClient>, Gfx::IntPoint const& content_position, String const& tooltip)
void WebContentView::notify_server_did_enter_tooltip_area(Badge<WebContentClient>, Gfx::IntPoint const& content_position, DeprecatedString const& tooltip)
{
auto widget_position = to_widget(content_position);
QToolTip::showText(
mapToGlobal(QPoint(widget_position.x(), widget_position.y())),
qstring_from_akstring(tooltip),
qstring_from_ak_deprecated_string(tooltip),
this);
}
@ -777,7 +777,7 @@ void WebContentView::notify_server_did_leave_tooltip_area(Badge<WebContentClient
void WebContentView::notify_server_did_hover_link(Badge<WebContentClient>, AK::URL const& url)
{
emit link_hovered(qstring_from_akstring(url.to_string()));
emit link_hovered(qstring_from_ak_deprecated_string(url.to_deprecated_string()));
}
void WebContentView::notify_server_did_unhover_link(Badge<WebContentClient>)
@ -785,7 +785,7 @@ void WebContentView::notify_server_did_unhover_link(Badge<WebContentClient>)
emit link_unhovered();
}
void WebContentView::notify_server_did_click_link(Badge<WebContentClient>, AK::URL const& url, String const& target, unsigned int modifiers)
void WebContentView::notify_server_did_click_link(Badge<WebContentClient>, AK::URL const& url, DeprecatedString const& target, unsigned int modifiers)
{
// FIXME
(void)url;
@ -795,7 +795,7 @@ void WebContentView::notify_server_did_click_link(Badge<WebContentClient>, AK::U
// on_link_click(url, target, modifiers);
}
void WebContentView::notify_server_did_middle_click_link(Badge<WebContentClient>, AK::URL const& url, String const& target, unsigned int modifiers)
void WebContentView::notify_server_did_middle_click_link(Badge<WebContentClient>, AK::URL const& url, DeprecatedString const& target, unsigned int modifiers)
{
(void)url;
(void)target;
@ -834,14 +834,14 @@ void WebContentView::notify_server_did_request_context_menu(Badge<WebContentClie
(void)content_position;
}
void WebContentView::notify_server_did_request_link_context_menu(Badge<WebContentClient>, Gfx::IntPoint const& content_position, AK::URL const& url, String const&, unsigned)
void WebContentView::notify_server_did_request_link_context_menu(Badge<WebContentClient>, Gfx::IntPoint const& content_position, AK::URL const& url, DeprecatedString const&, unsigned)
{
// FIXME
(void)content_position;
(void)url;
}
void WebContentView::notify_server_did_request_image_context_menu(Badge<WebContentClient>, Gfx::IntPoint const& content_position, AK::URL const& url, String const&, unsigned, Gfx::ShareableBitmap const& bitmap)
void WebContentView::notify_server_did_request_image_context_menu(Badge<WebContentClient>, Gfx::IntPoint const& content_position, AK::URL const& url, DeprecatedString const&, unsigned, Gfx::ShareableBitmap const& bitmap)
{
// FIXME
(void)content_position;
@ -849,45 +849,45 @@ void WebContentView::notify_server_did_request_image_context_menu(Badge<WebConte
(void)bitmap;
}
void WebContentView::notify_server_did_request_alert(Badge<WebContentClient>, String const& message)
void WebContentView::notify_server_did_request_alert(Badge<WebContentClient>, DeprecatedString const& message)
{
m_dialog = new QMessageBox(QMessageBox::Icon::Warning, "Ladybird", qstring_from_akstring(message), QMessageBox::StandardButton::Ok, this);
m_dialog = new QMessageBox(QMessageBox::Icon::Warning, "Ladybird", qstring_from_ak_deprecated_string(message), QMessageBox::StandardButton::Ok, this);
m_dialog->exec();
client().async_alert_closed();
m_dialog = nullptr;
}
void WebContentView::notify_server_did_request_confirm(Badge<WebContentClient>, String const& message)
void WebContentView::notify_server_did_request_confirm(Badge<WebContentClient>, DeprecatedString const& message)
{
m_dialog = new QMessageBox(QMessageBox::Icon::Question, "Ladybird", qstring_from_akstring(message), QMessageBox::StandardButton::Ok | QMessageBox::StandardButton::Cancel, this);
m_dialog = new QMessageBox(QMessageBox::Icon::Question, "Ladybird", qstring_from_ak_deprecated_string(message), QMessageBox::StandardButton::Ok | QMessageBox::StandardButton::Cancel, this);
auto result = m_dialog->exec();
client().async_confirm_closed(result == QMessageBox::StandardButton::Ok || result == QDialog::Accepted);
m_dialog = nullptr;
}
void WebContentView::notify_server_did_request_prompt(Badge<WebContentClient>, String const& message, String const& default_)
void WebContentView::notify_server_did_request_prompt(Badge<WebContentClient>, DeprecatedString const& message, DeprecatedString const& default_)
{
m_dialog = new QInputDialog(this);
auto& dialog = static_cast<QInputDialog&>(*m_dialog);
dialog.setWindowTitle("Ladybird");
dialog.setLabelText(qstring_from_akstring(message));
dialog.setTextValue(qstring_from_akstring(default_));
dialog.setLabelText(qstring_from_ak_deprecated_string(message));
dialog.setTextValue(qstring_from_ak_deprecated_string(default_));
if (dialog.exec() == QDialog::Accepted)
client().async_prompt_closed(akstring_from_qstring(dialog.textValue()));
client().async_prompt_closed(ak_deprecated_string_from_qstring(dialog.textValue()));
else
client().async_prompt_closed({});
m_dialog = nullptr;
}
void WebContentView::notify_server_did_request_set_prompt_text(Badge<WebContentClient>, String const& message)
void WebContentView::notify_server_did_request_set_prompt_text(Badge<WebContentClient>, DeprecatedString const& message)
{
if (m_dialog && is<QInputDialog>(*m_dialog))
static_cast<QInputDialog&>(*m_dialog).setTextValue(qstring_from_akstring(message));
static_cast<QInputDialog&>(*m_dialog).setTextValue(qstring_from_ak_deprecated_string(message));
}
void WebContentView::notify_server_did_request_accept_dialog(Badge<WebContentClient>)
@ -907,18 +907,18 @@ void WebContentView::get_source()
client().async_get_source();
}
void WebContentView::notify_server_did_get_source(AK::URL const& url, String const& source)
void WebContentView::notify_server_did_get_source(AK::URL const& url, DeprecatedString const& source)
{
emit got_source(url, qstring_from_akstring(source));
emit got_source(url, qstring_from_ak_deprecated_string(source));
}
void WebContentView::notify_server_did_get_dom_tree(String const& dom_tree)
void WebContentView::notify_server_did_get_dom_tree(DeprecatedString const& dom_tree)
{
if (on_get_dom_tree)
on_get_dom_tree(dom_tree);
}
void WebContentView::notify_server_did_get_dom_node_properties(i32 node_id, String const& specified_style, String const& computed_style, String const& custom_properties, String const& node_box_sizing)
void WebContentView::notify_server_did_get_dom_node_properties(i32 node_id, DeprecatedString const& specified_style, DeprecatedString const& computed_style, DeprecatedString const& custom_properties, DeprecatedString const& node_box_sizing)
{
if (on_get_dom_node_properties)
on_get_dom_node_properties(node_id, specified_style, computed_style, custom_properties, node_box_sizing);
@ -930,7 +930,7 @@ void WebContentView::notify_server_did_output_js_console_message(i32 message_ind
m_console_widget->notify_about_new_console_message(message_index);
}
void WebContentView::notify_server_did_get_js_console_messages(i32 start_index, Vector<String> const& message_types, Vector<String> const& messages)
void WebContentView::notify_server_did_get_js_console_messages(i32 start_index, Vector<DeprecatedString> const& message_types, Vector<DeprecatedString> const& messages)
{
if (m_console_widget)
m_console_widget->handle_console_messages(start_index, message_types, messages);
@ -954,14 +954,14 @@ Vector<Web::Cookie::Cookie> WebContentView::notify_server_did_request_all_cookie
return {};
}
Optional<Web::Cookie::Cookie> WebContentView::notify_server_did_request_named_cookie(Badge<WebContentClient>, AK::URL const& url, String const& name)
Optional<Web::Cookie::Cookie> WebContentView::notify_server_did_request_named_cookie(Badge<WebContentClient>, AK::URL const& url, DeprecatedString const& name)
{
if (on_get_named_cookie)
return on_get_named_cookie(url, name);
return {};
}
String WebContentView::notify_server_did_request_cookie(Badge<WebContentClient>, AK::URL const& url, Web::Cookie::Source source)
DeprecatedString WebContentView::notify_server_did_request_cookie(Badge<WebContentClient>, AK::URL const& url, Web::Cookie::Source source)
{
if (on_get_cookie)
return on_get_cookie(url, source);
@ -1016,7 +1016,7 @@ Gfx::IntRect WebContentView::notify_server_did_request_fullscreen_window()
return emit fullscreen_window();
}
void WebContentView::notify_server_did_request_file(Badge<WebContentClient>, String const& path, i32 request_id)
void WebContentView::notify_server_did_request_file(Badge<WebContentClient>, DeprecatedString const& path, i32 request_id)
{
auto file = Core::File::open(path, Core::OpenMode::ReadOnly);
if (file.is_error())

View File

@ -8,10 +8,10 @@
#define AK_DONT_REPLACE_STD
#include <AK/DeprecatedString.h>
#include <AK/Function.h>
#include <AK/HashMap.h>
#include <AK/OwnPtr.h>
#include <AK/String.h>
#include <AK/URL.h>
#include <LibGfx/Forward.h>
#include <LibGfx/Rect.h>
@ -55,25 +55,25 @@ public:
void load_html(StringView html, AK::URL const&);
Function<void(Gfx::IntPoint const& screen_position)> on_context_menu_request;
Function<void(const AK::URL&, String const& target, unsigned modifiers)> on_link_click;
Function<void(const AK::URL&, DeprecatedString const& target, unsigned modifiers)> on_link_click;
Function<void(const AK::URL&, Gfx::IntPoint const& screen_position)> on_link_context_menu_request;
Function<void(const AK::URL&, Gfx::IntPoint const& screen_position, Gfx::ShareableBitmap const&)> on_image_context_menu_request;
Function<void(const AK::URL&, String const& target, unsigned modifiers)> on_link_middle_click;
Function<void(const AK::URL&, DeprecatedString const& target, unsigned modifiers)> on_link_middle_click;
Function<void(const AK::URL&)> on_link_hover;
Function<void(String const&)> on_title_change;
Function<void(DeprecatedString const&)> on_title_change;
Function<void(const AK::URL&)> on_load_start;
Function<void(const AK::URL&)> on_load_finish;
Function<void(Gfx::Bitmap const&)> on_favicon_change;
Function<void(const AK::URL&)> on_url_drop;
Function<void(Web::DOM::Document*)> on_set_document;
Function<void(const AK::URL&, String const&)> on_get_source;
Function<void(String const&)> on_get_dom_tree;
Function<void(i32 node_id, String const& specified_style, String const& computed_style, String const& custom_properties, String const& node_box_sizing)> on_get_dom_node_properties;
Function<void(const AK::URL&, DeprecatedString const&)> on_get_source;
Function<void(DeprecatedString const&)> on_get_dom_tree;
Function<void(i32 node_id, DeprecatedString const& specified_style, DeprecatedString const& computed_style, DeprecatedString const& custom_properties, DeprecatedString const& node_box_sizing)> on_get_dom_node_properties;
Function<void(i32 message_id)> on_js_console_new_message;
Function<void(i32 start_index, Vector<String> const& message_types, Vector<String> const& messages)> on_get_js_console_messages;
Function<void(i32 start_index, Vector<DeprecatedString> const& message_types, Vector<DeprecatedString> const& messages)> on_get_js_console_messages;
Function<Vector<Web::Cookie::Cookie>(AK::URL const& url)> on_get_all_cookies;
Function<Optional<Web::Cookie::Cookie>(AK::URL const& url, String const& name)> on_get_named_cookie;
Function<String(const AK::URL& url, Web::Cookie::Source source)> on_get_cookie;
Function<Optional<Web::Cookie::Cookie>(AK::URL const& url, DeprecatedString const& name)> on_get_named_cookie;
Function<DeprecatedString(const AK::URL& url, Web::Cookie::Source source)> on_get_cookie;
Function<void(const AK::URL& url, Web::Cookie::ParsedCookie const& cookie, Web::Cookie::Source source)> on_set_cookie;
Function<void(AK::URL const& url, Web::Cookie::Cookie const& cookie)> on_update_cookie;
Function<void(i32 count_waiting)> on_resource_status_change;
@ -91,14 +91,14 @@ public:
virtual void focusOutEvent(QFocusEvent*) override;
virtual bool event(QEvent*) override;
void debug_request(String const& request, String const& argument);
void debug_request(DeprecatedString const& request, DeprecatedString const& argument);
void get_source();
void run_javascript(String const& js_source);
void run_javascript(DeprecatedString const& js_source);
void did_output_js_console_message(i32 message_index);
void did_get_js_console_messages(i32 start_index, Vector<String> message_types, Vector<String> messages);
void did_get_js_console_messages(i32 start_index, Vector<DeprecatedString> message_types, Vector<DeprecatedString> messages);
void show_js_console();
void show_inspector();
@ -113,39 +113,39 @@ public:
virtual void notify_server_did_invalidate_content_rect(Badge<WebContentClient>, Gfx::IntRect const&) override;
virtual void notify_server_did_change_selection(Badge<WebContentClient>) override;
virtual void notify_server_did_request_cursor_change(Badge<WebContentClient>, Gfx::StandardCursor cursor) override;
virtual void notify_server_did_change_title(Badge<WebContentClient>, String const&) override;
virtual void notify_server_did_change_title(Badge<WebContentClient>, DeprecatedString const&) override;
virtual void notify_server_did_request_scroll(Badge<WebContentClient>, i32, i32) override;
virtual void notify_server_did_request_scroll_to(Badge<WebContentClient>, Gfx::IntPoint const&) override;
virtual void notify_server_did_request_scroll_into_view(Badge<WebContentClient>, Gfx::IntRect const&) override;
virtual void notify_server_did_enter_tooltip_area(Badge<WebContentClient>, Gfx::IntPoint const&, String const&) override;
virtual void notify_server_did_enter_tooltip_area(Badge<WebContentClient>, Gfx::IntPoint const&, DeprecatedString const&) override;
virtual void notify_server_did_leave_tooltip_area(Badge<WebContentClient>) override;
virtual void notify_server_did_hover_link(Badge<WebContentClient>, const AK::URL&) override;
virtual void notify_server_did_unhover_link(Badge<WebContentClient>) override;
virtual void notify_server_did_click_link(Badge<WebContentClient>, const AK::URL&, String const& target, unsigned modifiers) override;
virtual void notify_server_did_middle_click_link(Badge<WebContentClient>, const AK::URL&, String const& target, unsigned modifiers) override;
virtual void notify_server_did_click_link(Badge<WebContentClient>, const AK::URL&, DeprecatedString const& target, unsigned modifiers) override;
virtual void notify_server_did_middle_click_link(Badge<WebContentClient>, const AK::URL&, DeprecatedString const& target, unsigned modifiers) override;
virtual void notify_server_did_start_loading(Badge<WebContentClient>, const AK::URL&, bool) override;
virtual void notify_server_did_finish_loading(Badge<WebContentClient>, const AK::URL&) override;
virtual void notify_server_did_request_navigate_back(Badge<WebContentClient>) override;
virtual void notify_server_did_request_navigate_forward(Badge<WebContentClient>) override;
virtual void notify_server_did_request_refresh(Badge<WebContentClient>) override;
virtual void notify_server_did_request_context_menu(Badge<WebContentClient>, Gfx::IntPoint const&) override;
virtual void notify_server_did_request_link_context_menu(Badge<WebContentClient>, Gfx::IntPoint const&, const AK::URL&, String const& target, unsigned modifiers) override;
virtual void notify_server_did_request_image_context_menu(Badge<WebContentClient>, Gfx::IntPoint const&, const AK::URL&, String const& target, unsigned modifiers, Gfx::ShareableBitmap const&) override;
virtual void notify_server_did_request_alert(Badge<WebContentClient>, String const& message) override;
virtual void notify_server_did_request_confirm(Badge<WebContentClient>, String const& message) override;
virtual void notify_server_did_request_prompt(Badge<WebContentClient>, String const& message, String const& default_) override;
virtual void notify_server_did_request_set_prompt_text(Badge<WebContentClient>, String const& message) override;
virtual void notify_server_did_request_link_context_menu(Badge<WebContentClient>, Gfx::IntPoint const&, const AK::URL&, DeprecatedString const& target, unsigned modifiers) override;
virtual void notify_server_did_request_image_context_menu(Badge<WebContentClient>, Gfx::IntPoint const&, const AK::URL&, DeprecatedString const& target, unsigned modifiers, Gfx::ShareableBitmap const&) override;
virtual void notify_server_did_request_alert(Badge<WebContentClient>, DeprecatedString const& message) override;
virtual void notify_server_did_request_confirm(Badge<WebContentClient>, DeprecatedString const& message) override;
virtual void notify_server_did_request_prompt(Badge<WebContentClient>, DeprecatedString const& message, DeprecatedString const& default_) override;
virtual void notify_server_did_request_set_prompt_text(Badge<WebContentClient>, DeprecatedString const& message) override;
virtual void notify_server_did_request_accept_dialog(Badge<WebContentClient>) override;
virtual void notify_server_did_request_dismiss_dialog(Badge<WebContentClient>) override;
virtual void notify_server_did_get_source(const AK::URL& url, String const& source) override;
virtual void notify_server_did_get_dom_tree(String const& dom_tree) override;
virtual void notify_server_did_get_dom_node_properties(i32 node_id, String const& specified_style, String const& computed_style, String const& custom_properties, String const& node_box_sizing) override;
virtual void notify_server_did_get_source(const AK::URL& url, DeprecatedString const& source) override;
virtual void notify_server_did_get_dom_tree(DeprecatedString const& dom_tree) override;
virtual void notify_server_did_get_dom_node_properties(i32 node_id, DeprecatedString const& specified_style, DeprecatedString const& computed_style, DeprecatedString const& custom_properties, DeprecatedString const& node_box_sizing) override;
virtual void notify_server_did_output_js_console_message(i32 message_index) override;
virtual void notify_server_did_get_js_console_messages(i32 start_index, Vector<String> const& message_types, Vector<String> const& messages) override;
virtual void notify_server_did_get_js_console_messages(i32 start_index, Vector<DeprecatedString> const& message_types, Vector<DeprecatedString> const& messages) override;
virtual void notify_server_did_change_favicon(Gfx::Bitmap const& favicon) override;
virtual Vector<Web::Cookie::Cookie> notify_server_did_request_all_cookies(Badge<WebContentClient>, AK::URL const& url) override;
virtual Optional<Web::Cookie::Cookie> notify_server_did_request_named_cookie(Badge<WebContentClient>, AK::URL const& url, String const& name) override;
virtual String notify_server_did_request_cookie(Badge<WebContentClient>, const AK::URL& url, Web::Cookie::Source source) override;
virtual Optional<Web::Cookie::Cookie> notify_server_did_request_named_cookie(Badge<WebContentClient>, AK::URL const& url, DeprecatedString const& name) override;
virtual DeprecatedString notify_server_did_request_cookie(Badge<WebContentClient>, const AK::URL& url, Web::Cookie::Source source) override;
virtual void notify_server_did_set_cookie(Badge<WebContentClient>, const AK::URL& url, Web::Cookie::ParsedCookie const& cookie, Web::Cookie::Source source) override;
virtual void notify_server_did_update_cookie(Badge<WebContentClient>, AK::URL const& url, Web::Cookie::Cookie const& cookie) override;
virtual void notify_server_did_update_resource_count(i32 count_waiting) override;
@ -155,7 +155,7 @@ public:
virtual Gfx::IntRect notify_server_did_request_maximize_window() override;
virtual Gfx::IntRect notify_server_did_request_minimize_window() override;
virtual Gfx::IntRect notify_server_did_request_fullscreen_window() override;
virtual void notify_server_did_request_file(Badge<WebContentClient>, String const& path, i32) override;
virtual void notify_server_did_request_file(Badge<WebContentClient>, DeprecatedString const& path, i32) override;
virtual void notify_server_did_finish_handling_input_event(bool event_was_accepted) override;
signals:

View File

@ -48,15 +48,15 @@ ErrorOr<void> Session::start()
TRY(Core::System::close(webdriver_fd_passing_fd));
TRY(Core::System::close(webdriver_fd));
auto takeover_string = String::formatted("WebDriver:{}", webcontent_fd);
auto takeover_string = DeprecatedString::formatted("WebDriver:{}", webcontent_fd);
TRY(Core::System::setenv("SOCKET_TAKEOVER"sv, takeover_string, true));
auto fd_passing_socket_string = String::number(webcontent_fd_passing_fd);
auto fd_passing_socket_string = DeprecatedString::number(webcontent_fd_passing_fd);
if (m_options.headless) {
auto resouces = String::formatted("{}/res", s_serenity_resource_root);
auto error_page = String::formatted("{}/res/html/error.html", s_serenity_resource_root);
auto certs = String::formatted("{}/etc/ca_certs.ini", s_serenity_resource_root);
auto resouces = DeprecatedString::formatted("{}/res", s_serenity_resource_root);
auto error_page = DeprecatedString::formatted("{}/res/html/error.html", s_serenity_resource_root);
auto certs = DeprecatedString::formatted("{}/etc/ca_certs.ini", s_serenity_resource_root);
char const* argv[] = {
"headless-browser",

View File

@ -14,7 +14,7 @@
#include <LibMain/Main.h>
#include <WebDriver/Client.h>
extern String s_serenity_resource_root;
extern DeprecatedString s_serenity_resource_root;
ErrorOr<int> serenity_main(Main::Arguments arguments)
{

View File

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

View File

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

View File

@ -55,7 +55,7 @@ void WebSocketImplQt::connect(WebSocket::ConnectionInfo const& connection_info)
if (connection_info.is_secure()) {
auto ssl_socket = make<QSslSocket>();
ssl_socket->connectToHostEncrypted(
qstring_from_akstring(connection_info.url().host()),
qstring_from_ak_deprecated_string(connection_info.url().host()),
connection_info.url().port_or_default());
QObject::connect(ssl_socket.ptr(), &QSslSocket::alertReceived, [this](QSsl::AlertLevel level, QSsl::AlertType, QString const&) {
if (level == QSsl::AlertLevel::Fatal)
@ -65,7 +65,7 @@ void WebSocketImplQt::connect(WebSocket::ConnectionInfo const& connection_info)
} else {
m_socket = make<QTcpSocket>();
m_socket->connectToHost(
qstring_from_akstring(connection_info.url().host()),
qstring_from_ak_deprecated_string(connection_info.url().host()),
connection_info.url().port_or_default());
}
@ -87,13 +87,13 @@ ErrorOr<ByteBuffer> WebSocketImplQt::read(int max_size)
return buffer.slice(0, bytes_read);
}
ErrorOr<String> WebSocketImplQt::read_line(size_t size)
ErrorOr<DeprecatedString> 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 String::copy(buffer.span().slice(0, bytes_read));
return DeprecatedString::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<String> read_line(size_t) override;
virtual ErrorOr<DeprecatedString> 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 @@ WebSocketLadybird::WebSocketLadybird(NonnullRefPtr<WebSocket::WebSocket> underly
}
}
};
m_websocket->on_close = [weak_this = make_weak_ptr()](u16 code, String reason, bool was_clean) {
m_websocket->on_close = [weak_this = make_weak_ptr()](u16 code, DeprecatedString 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);
@ -84,7 +84,7 @@ void WebSocketLadybird::send(StringView message)
m_websocket->send(WebSocket::Message(message));
}
void WebSocketLadybird::close(u16 code, String reason)
void WebSocketLadybird::close(u16 code, DeprecatedString reason)
{
m_websocket->close(code, reason);
}

View File

@ -23,7 +23,7 @@ public:
virtual Web::WebSockets::WebSocket::ReadyState ready_state() override;
virtual void send(ByteBuffer binary_or_text_message, bool is_text) override;
virtual void send(StringView message) override;
virtual void close(u16 code, String reason) override;
virtual void close(u16 code, DeprecatedString reason) override;
private:
explicit WebSocketLadybird(NonnullRefPtr<WebSocket::WebSocket>);

View File

@ -79,7 +79,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
if (Core::File::exists(raw_url))
url = URL::create_with_file_scheme(Core::File::real_path_for(raw_url));
else if (!url.is_valid())
url = String::formatted("http://{}", raw_url);
url = DeprecatedString::formatted("http://{}", raw_url);
if (url.is_valid())
window.view().load(url);