1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 04:37: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

@ -81,7 +81,7 @@ CookieJar::CookieJar(TransientStorage storage)
{
}
DeprecatedString CookieJar::get_cookie(const URL& url, Web::Cookie::Source source)
ByteString CookieJar::get_cookie(const URL& url, Web::Cookie::Source source)
{
purge_expired_cookies();
@ -101,7 +101,7 @@ DeprecatedString CookieJar::get_cookie(const URL& url, Web::Cookie::Source sourc
builder.appendff("{}={}", cookie.name, cookie.value);
}
return builder.to_deprecated_string();
return builder.to_byte_string();
}
void CookieJar::set_cookie(const URL& url, Web::Cookie::ParsedCookie const& parsed_cookie, Web::Cookie::Source source)
@ -163,7 +163,7 @@ void CookieJar::dump_cookies()
builder.appendff("\t{}SameSite{} = {:s}\n", attribute_color, no_color, Web::Cookie::same_site_to_string(cookie.same_site));
});
dbgln("{} cookies stored\n{}", total_cookies, builder.to_deprecated_string());
dbgln("{} cookies stored\n{}", total_cookies, builder.to_byte_string());
}
Vector<Web::Cookie::Cookie> CookieJar::get_all_cookies()
@ -187,7 +187,7 @@ Vector<Web::Cookie::Cookie> CookieJar::get_all_cookies(URL const& url)
return get_matching_cookies(url, domain.value(), Web::Cookie::Source::Http, MatchingCookiesSpecMode::WebDriver);
}
Optional<Web::Cookie::Cookie> CookieJar::get_named_cookie(URL const& url, DeprecatedString const& name)
Optional<Web::Cookie::Cookie> CookieJar::get_named_cookie(URL const& url, ByteString const& name)
{
auto domain = canonicalize_domain(url);
if (!domain.has_value())
@ -203,7 +203,7 @@ Optional<Web::Cookie::Cookie> CookieJar::get_named_cookie(URL const& url, Deprec
return {};
}
Optional<DeprecatedString> CookieJar::canonicalize_domain(const URL& url)
Optional<ByteString> CookieJar::canonicalize_domain(const URL& url)
{
// https://tools.ietf.org/html/rfc6265#section-5.1.2
if (!url.is_valid())
@ -213,10 +213,10 @@ Optional<DeprecatedString> CookieJar::canonicalize_domain(const URL& url)
if (url.host().has<Empty>())
return {};
return url.serialized_host().release_value_but_fixme_should_propagate_errors().to_deprecated_string().to_lowercase();
return url.serialized_host().release_value_but_fixme_should_propagate_errors().to_byte_string().to_lowercase();
}
bool CookieJar::domain_matches(DeprecatedString const& string, DeprecatedString const& domain_string)
bool CookieJar::domain_matches(ByteString const& string, ByteString const& domain_string)
{
// https://tools.ietf.org/html/rfc6265#section-5.1.3
@ -240,7 +240,7 @@ bool CookieJar::domain_matches(DeprecatedString const& string, DeprecatedString
return true;
}
bool CookieJar::path_matches(DeprecatedString const& request_path, DeprecatedString const& cookie_path)
bool CookieJar::path_matches(ByteString const& request_path, ByteString const& cookie_path)
{
// https://tools.ietf.org/html/rfc6265#section-5.1.4
@ -263,12 +263,12 @@ bool CookieJar::path_matches(DeprecatedString const& request_path, DeprecatedStr
return false;
}
DeprecatedString CookieJar::default_path(const URL& url)
ByteString CookieJar::default_path(const URL& url)
{
// https://tools.ietf.org/html/rfc6265#section-5.1.4
// 1. Let uri-path be the path portion of the request-uri if such a portion exists (and empty otherwise).
DeprecatedString uri_path = url.serialize_path();
ByteString uri_path = url.serialize_path();
// 2. If the uri-path is empty or if the first character of the uri-path is not a %x2F ("/") character, output %x2F ("/") and skip the remaining steps.
if (uri_path.is_empty() || (uri_path[0] != '/'))
@ -285,7 +285,7 @@ DeprecatedString CookieJar::default_path(const URL& url)
return uri_path.substring(0, last_separator);
}
void CookieJar::store_cookie(Web::Cookie::ParsedCookie const& parsed_cookie, const URL& url, DeprecatedString canonicalized_domain, Web::Cookie::Source source)
void CookieJar::store_cookie(Web::Cookie::ParsedCookie const& parsed_cookie, const URL& url, ByteString canonicalized_domain, Web::Cookie::Source source)
{
// https://tools.ietf.org/html/rfc6265#section-5.3
@ -333,7 +333,7 @@ void CookieJar::store_cookie(Web::Cookie::ParsedCookie const& parsed_cookie, con
// 6. If the domain-attribute is non-empty:
if (!cookie.domain.is_empty()) {
// If the canonicalized request-host does not domain-match the domain-attribute: Ignore the cookie entirely and abort these steps.
if (!domain_matches(canonicalized_domain, cookie.domain.to_deprecated_string()))
if (!domain_matches(canonicalized_domain, cookie.domain.to_byte_string()))
return;
// Set the cookie's host-only-flag to false. Set the cookie's domain to the domain-attribute.
@ -341,7 +341,7 @@ void CookieJar::store_cookie(Web::Cookie::ParsedCookie const& parsed_cookie, con
} else {
// Set the cookie's host-only-flag to true. Set the cookie's domain to the canonicalized request-host.
cookie.host_only = true;
cookie.domain = MUST(String::from_deprecated_string(canonicalized_domain));
cookie.domain = MUST(String::from_byte_string(canonicalized_domain));
}
// 7. If the cookie-attribute-list contains an attribute with an attribute-name of "Path":
@ -349,7 +349,7 @@ void CookieJar::store_cookie(Web::Cookie::ParsedCookie const& parsed_cookie, con
// Set the cookie's path to attribute-value of the last attribute in the cookie-attribute-list with an attribute-name of "Path".
cookie.path = parsed_cookie.path.value();
} else {
cookie.path = MUST(String::from_deprecated_string(default_path(url)));
cookie.path = MUST(String::from_byte_string(default_path(url)));
}
// 8. If the cookie-attribute-list contains an attribute with an attribute-name of "Secure", set the cookie's secure-only-flag to true.
@ -393,7 +393,7 @@ void CookieJar::store_cookie(Web::Cookie::ParsedCookie const& parsed_cookie, con
MUST(sync_promise->await());
}
Vector<Web::Cookie::Cookie> CookieJar::get_matching_cookies(const URL& url, DeprecatedString const& canonicalized_domain, Web::Cookie::Source source, MatchingCookiesSpecMode mode)
Vector<Web::Cookie::Cookie> CookieJar::get_matching_cookies(const URL& url, ByteString const& canonicalized_domain, Web::Cookie::Source source, MatchingCookiesSpecMode mode)
{
// https://tools.ietf.org/html/rfc6265#section-5.4
@ -404,12 +404,12 @@ Vector<Web::Cookie::Cookie> CookieJar::get_matching_cookies(const URL& url, Depr
// Either: The cookie's host-only-flag is true and the canonicalized request-host is identical to the cookie's domain.
// Or: The cookie's host-only-flag is false and the canonicalized request-host domain-matches the cookie's domain.
bool is_host_only_and_has_identical_domain = cookie.host_only && (canonicalized_domain.view() == cookie.domain);
bool is_not_host_only_and_domain_matches = !cookie.host_only && domain_matches(canonicalized_domain, cookie.domain.to_deprecated_string());
bool is_not_host_only_and_domain_matches = !cookie.host_only && domain_matches(canonicalized_domain, cookie.domain.to_byte_string());
if (!is_host_only_and_has_identical_domain && !is_not_host_only_and_domain_matches)
return;
// The request-uri's path path-matches the cookie's path.
if (!path_matches(url.serialize_path(), cookie.path.to_deprecated_string()))
if (!path_matches(url.serialize_path(), cookie.path.to_byte_string()))
return;
// If the cookie's secure-only-flag is true, then the request-uri's scheme must denote a "secure" protocol.
@ -466,7 +466,7 @@ static ErrorOr<Web::Cookie::Cookie> parse_cookie(ReadonlySpan<SQL::Value> row)
if (value.type() != SQL::SQLType::Text)
return Error::from_string_view(name);
field = MUST(String::from_deprecated_string(value.to_deprecated_string()));
field = MUST(String::from_byte_string(value.to_byte_string()));
return {};
};
@ -525,21 +525,21 @@ void CookieJar::insert_cookie_into_database(Web::Cookie::Cookie const& cookie)
[&](PersistedStorage& storage) {
storage.database.execute_statement(
storage.statements.insert_cookie, {}, [this]() { purge_expired_cookies(); }, {},
cookie.name.to_deprecated_string(),
cookie.value.to_deprecated_string(),
cookie.name.to_byte_string(),
cookie.value.to_byte_string(),
to_underlying(cookie.same_site),
cookie.creation_time.seconds_since_epoch(),
cookie.last_access_time.seconds_since_epoch(),
cookie.expiry_time.seconds_since_epoch(),
cookie.domain.to_deprecated_string(),
cookie.path.to_deprecated_string(),
cookie.domain.to_byte_string(),
cookie.path.to_byte_string(),
cookie.secure,
cookie.http_only,
cookie.host_only,
cookie.persistent);
},
[&](TransientStorage& storage) {
CookieStorageKey key { cookie.name.to_deprecated_string(), cookie.domain.to_deprecated_string(), cookie.path.to_deprecated_string() };
CookieStorageKey key { cookie.name.to_byte_string(), cookie.domain.to_byte_string(), cookie.path.to_byte_string() };
storage.set(key, cookie);
});
}
@ -550,7 +550,7 @@ void CookieJar::update_cookie_in_database(Web::Cookie::Cookie const& cookie)
[&](PersistedStorage& storage) {
storage.database.execute_statement(
storage.statements.update_cookie, {}, [this]() { purge_expired_cookies(); }, {},
cookie.value.to_deprecated_string(),
cookie.value.to_byte_string(),
to_underlying(cookie.same_site),
cookie.creation_time.seconds_since_epoch(),
cookie.last_access_time.seconds_since_epoch(),
@ -559,12 +559,12 @@ void CookieJar::update_cookie_in_database(Web::Cookie::Cookie const& cookie)
cookie.http_only,
cookie.host_only,
cookie.persistent,
cookie.name.to_deprecated_string(),
cookie.domain.to_deprecated_string(),
cookie.path.to_deprecated_string());
cookie.name.to_byte_string(),
cookie.domain.to_byte_string(),
cookie.path.to_byte_string());
},
[&](TransientStorage& storage) {
CookieStorageKey key { cookie.name.to_deprecated_string(), cookie.domain.to_deprecated_string(), cookie.path.to_deprecated_string() };
CookieStorageKey key { cookie.name.to_byte_string(), cookie.domain.to_byte_string(), cookie.path.to_byte_string() };
storage.set(key, cookie);
});
}
@ -601,12 +601,12 @@ void CookieJar::select_cookie_from_database(Web::Cookie::Cookie cookie, OnCookie
on_complete_without_results(move(wrapped_cookie->cookie));
},
{},
wrapped_cookie->cookie.name.to_deprecated_string(),
wrapped_cookie->cookie.domain.to_deprecated_string(),
wrapped_cookie->cookie.path.to_deprecated_string());
wrapped_cookie->cookie.name.to_byte_string(),
wrapped_cookie->cookie.domain.to_byte_string(),
wrapped_cookie->cookie.path.to_byte_string());
},
[&](TransientStorage& storage) {
CookieStorageKey key { cookie.name.to_deprecated_string(), cookie.domain.to_deprecated_string(), cookie.path.to_deprecated_string() };
CookieStorageKey key { cookie.name.to_byte_string(), cookie.domain.to_byte_string(), cookie.path.to_byte_string() };
if (auto it = storage.find(key); it != storage.end())
on_result(cookie, it->value);

View file

@ -6,7 +6,7 @@
#pragma once
#include <AK/DeprecatedString.h>
#include <AK/ByteString.h>
#include <AK/Function.h>
#include <AK/HashMap.h>
#include <AK/Optional.h>
@ -22,9 +22,9 @@ namespace WebView {
struct CookieStorageKey {
bool operator==(CookieStorageKey const&) const = default;
DeprecatedString name;
DeprecatedString domain;
DeprecatedString path;
ByteString name;
ByteString domain;
ByteString path;
};
class CookieJar {
@ -48,30 +48,30 @@ public:
static ErrorOr<CookieJar> create(Database&);
static CookieJar create();
DeprecatedString get_cookie(const URL& url, Web::Cookie::Source source);
ByteString get_cookie(const URL& url, Web::Cookie::Source source);
void set_cookie(const URL& url, Web::Cookie::ParsedCookie const& parsed_cookie, Web::Cookie::Source source);
void update_cookie(Web::Cookie::Cookie);
void dump_cookies();
Vector<Web::Cookie::Cookie> get_all_cookies();
Vector<Web::Cookie::Cookie> get_all_cookies(URL const& url);
Optional<Web::Cookie::Cookie> get_named_cookie(URL const& url, DeprecatedString const& name);
Optional<Web::Cookie::Cookie> get_named_cookie(URL const& url, ByteString const& name);
private:
explicit CookieJar(PersistedStorage);
explicit CookieJar(TransientStorage);
static Optional<DeprecatedString> canonicalize_domain(const URL& url);
static bool domain_matches(DeprecatedString const& string, DeprecatedString const& domain_string);
static bool path_matches(DeprecatedString const& request_path, DeprecatedString const& cookie_path);
static DeprecatedString default_path(const URL& url);
static Optional<ByteString> canonicalize_domain(const URL& url);
static bool domain_matches(ByteString const& string, ByteString const& domain_string);
static bool path_matches(ByteString const& request_path, ByteString const& cookie_path);
static ByteString default_path(const URL& url);
enum class MatchingCookiesSpecMode {
RFC6265,
WebDriver,
};
void store_cookie(Web::Cookie::ParsedCookie const& parsed_cookie, const URL& url, DeprecatedString canonicalized_domain, Web::Cookie::Source source);
Vector<Web::Cookie::Cookie> get_matching_cookies(const URL& url, DeprecatedString const& canonicalized_domain, Web::Cookie::Source source, MatchingCookiesSpecMode mode = MatchingCookiesSpecMode::RFC6265);
void store_cookie(Web::Cookie::ParsedCookie const& parsed_cookie, const URL& url, ByteString canonicalized_domain, Web::Cookie::Source source);
Vector<Web::Cookie::Cookie> get_matching_cookies(const URL& url, ByteString const& canonicalized_domain, Web::Cookie::Source source, MatchingCookiesSpecMode mode = MatchingCookiesSpecMode::RFC6265);
void insert_cookie_into_database(Web::Cookie::Cookie const& cookie);
void update_cookie_in_database(Web::Cookie::Cookie const& cookie);

View file

@ -23,7 +23,7 @@ Vector<History::URLTitlePair> History::get_all_history_entries()
return m_items;
}
void History::push(const URL& url, DeprecatedString const& title)
void History::push(const URL& url, ByteString const& title)
{
if (!m_items.is_empty() && m_items[m_current].url == url)
return;
@ -35,7 +35,7 @@ void History::push(const URL& url, DeprecatedString const& title)
m_current++;
}
void History::replace_current(const URL& url, DeprecatedString const& title)
void History::replace_current(const URL& url, ByteString const& title)
{
if (m_current == -1)
return;
@ -70,7 +70,7 @@ void History::clear()
m_current = -1;
}
void History::update_title(DeprecatedString const& title)
void History::update_title(ByteString const& title)
{
if (m_current == -1)
return;

View file

@ -15,14 +15,14 @@ class History {
public:
struct URLTitlePair {
URL url;
DeprecatedString title;
ByteString title;
};
void dump() const;
Vector<URLTitlePair> get_all_history_entries();
void push(const URL& url, DeprecatedString const& title);
void replace_current(const URL& url, DeprecatedString const& title);
void update_title(DeprecatedString const& title);
void push(const URL& url, ByteString const& title);
void replace_current(const URL& url, ByteString const& title);
void update_title(ByteString const& title);
URLTitlePair current() const;
Vector<StringView> const get_back_title_history();

View file

@ -158,7 +158,7 @@ InspectorClient::InspectorClient(ViewImplementation& content_web_view, ViewImple
m_inspector_web_view.on_inspector_executed_console_script = [this](auto const& script) {
append_console_source(script);
m_content_web_view.js_console_input(script.to_deprecated_string());
m_content_web_view.js_console_input(script.to_byte_string());
};
load_inspector();
@ -442,7 +442,7 @@ template<typename Generator>
static void generate_tree(StringBuilder& builder, JsonObject const& node, Generator&& generator)
{
if (auto children = node.get_array("children"sv); children.has_value() && !children->is_empty()) {
auto name = node.get_deprecated_string("name"sv).value_or({});
auto name = node.get_byte_string("name"sv).value_or({});
builder.append("<details>"sv);
builder.append("<summary>"sv);
@ -466,8 +466,8 @@ String InspectorClient::generate_dom_tree(JsonObject const& dom_tree)
StringBuilder builder;
generate_tree(builder, dom_tree, [&](JsonObject const& node) {
auto type = node.get_deprecated_string("type"sv).value_or("unknown"sv);
auto name = node.get_deprecated_string("name"sv).value_or({});
auto type = node.get_byte_string("type"sv).value_or("unknown"sv);
auto name = node.get_byte_string("name"sv).value_or({});
StringBuilder data_attributes;
auto append_data_attribute = [&](auto name, auto value) {
@ -484,7 +484,7 @@ String InspectorClient::generate_dom_tree(JsonObject const& dom_tree)
}
if (type == "text"sv) {
auto deprecated_text = node.get_deprecated_string("text"sv).release_value();
auto deprecated_text = node.get_byte_string("text"sv).release_value();
deprecated_text = escape_html_entities(deprecated_text);
auto text = MUST(Web::Infra::strip_and_collapse_whitespace(deprecated_text));
@ -500,7 +500,7 @@ String InspectorClient::generate_dom_tree(JsonObject const& dom_tree)
}
if (type == "comment"sv) {
auto comment = node.get_deprecated_string("data"sv).release_value();
auto comment = node.get_byte_string("data"sv).release_value();
comment = escape_html_entities(comment);
builder.appendff("<span class=\"hoverable comment\" {}>", data_attributes.string_view());
@ -512,7 +512,7 @@ String InspectorClient::generate_dom_tree(JsonObject const& dom_tree)
}
if (type == "shadow-root"sv) {
auto mode = node.get_deprecated_string("mode"sv).release_value();
auto mode = node.get_byte_string("mode"sv).release_value();
builder.appendff("<span class=\"hoverable internal\" {}>", data_attributes.string_view());
builder.appendff("{} ({})", name, mode);
@ -559,11 +559,11 @@ String InspectorClient::generate_accessibility_tree(JsonObject const& accessibil
StringBuilder builder;
generate_tree(builder, accessibility_tree, [&](JsonObject const& node) {
auto type = node.get_deprecated_string("type"sv).value_or("unknown"sv);
auto role = node.get_deprecated_string("role"sv).value_or({});
auto type = node.get_byte_string("type"sv).value_or("unknown"sv);
auto role = node.get_byte_string("role"sv).value_or({});
if (type == "text"sv) {
auto text = node.get_deprecated_string("text"sv).release_value();
auto text = node.get_byte_string("text"sv).release_value();
text = escape_html_entities(text);
builder.appendff("<span class=\"hoverable\">");
@ -579,8 +579,8 @@ String InspectorClient::generate_accessibility_tree(JsonObject const& accessibil
return;
}
auto name = node.get_deprecated_string("name"sv).value_or({});
auto description = node.get_deprecated_string("description"sv).value_or({});
auto name = node.get_byte_string("name"sv).value_or({});
auto description = node.get_byte_string("description"sv).value_or({});
builder.appendff("<span class=\"hoverable\">");
builder.append(role.to_lowercase());
@ -616,7 +616,7 @@ void InspectorClient::handle_console_message(i32 message_index)
request_console_messages();
}
void InspectorClient::handle_console_messages(i32 start_index, ReadonlySpan<DeprecatedString> message_types, ReadonlySpan<DeprecatedString> messages)
void InspectorClient::handle_console_messages(i32 start_index, ReadonlySpan<ByteString> message_types, ReadonlySpan<ByteString> messages)
{
auto end_index = start_index + static_cast<i32>(message_types.size()) - 1;
if (end_index <= m_highest_received_message_index) {

View file

@ -50,7 +50,7 @@ private:
void request_console_messages();
void handle_console_message(i32 message_index);
void handle_console_messages(i32 start_index, ReadonlySpan<DeprecatedString> message_types, ReadonlySpan<DeprecatedString> messages);
void handle_console_messages(i32 start_index, ReadonlySpan<ByteString> message_types, ReadonlySpan<ByteString> messages);
void append_console_source(StringView);
void append_console_message(StringView);

View file

@ -6,7 +6,7 @@
#include "OutOfProcessWebView.h"
#include "WebContentClient.h"
#include <AK/DeprecatedString.h>
#include <AK/ByteString.h>
#include <LibFileSystemAccessClient/Client.h>
#include <LibGUI/Application.h>
#include <LibGUI/Desktop.h>
@ -65,7 +65,7 @@ OutOfProcessWebView::OutOfProcessWebView()
};
on_enter_tooltip_area = [](auto, auto tooltip) {
GUI::Application::the()->show_tooltip(MUST(String::from_deprecated_string(tooltip)), nullptr);
GUI::Application::the()->show_tooltip(MUST(String::from_byte_string(tooltip)), nullptr);
};
on_leave_tooltip_area = []() {
@ -228,7 +228,7 @@ void OutOfProcessWebView::did_scroll()
request_repaint();
}
DeprecatedString OutOfProcessWebView::dump_layout_tree()
ByteString OutOfProcessWebView::dump_layout_tree()
{
return client().dump_layout_tree();
}
@ -258,12 +258,12 @@ void OutOfProcessWebView::set_autoplay_allowlist(Vector<String> allowlist)
client().async_set_autoplay_allowlist(move(allowlist));
}
void OutOfProcessWebView::set_proxy_mappings(Vector<DeprecatedString> proxies, HashMap<DeprecatedString, size_t> mappings)
void OutOfProcessWebView::set_proxy_mappings(Vector<ByteString> proxies, HashMap<ByteString, size_t> mappings)
{
client().async_set_proxy_mappings(move(proxies), move(mappings));
}
void OutOfProcessWebView::connect_to_webdriver(DeprecatedString const& webdriver_ipc_path)
void OutOfProcessWebView::connect_to_webdriver(ByteString const& webdriver_ipc_path)
{
client().async_connect_to_webdriver(webdriver_ipc_path);
}

View file

@ -34,7 +34,7 @@ class OutOfProcessWebView final
public:
virtual ~OutOfProcessWebView() override;
DeprecatedString dump_layout_tree();
ByteString dump_layout_tree();
OrderedHashMap<String, String> get_local_storage_entries();
OrderedHashMap<String, String> get_session_storage_entries();
@ -42,8 +42,8 @@ public:
void set_content_filters(Vector<String>);
void set_autoplay_allowed_on_all_websites();
void set_autoplay_allowlist(Vector<String>);
void set_proxy_mappings(Vector<DeprecatedString> proxies, HashMap<DeprecatedString, size_t> mappings);
void connect_to_webdriver(DeprecatedString const& webdriver_ipc_path);
void set_proxy_mappings(Vector<ByteString> proxies, HashMap<ByteString, size_t> mappings);
void connect_to_webdriver(ByteString const& webdriver_ipc_path);
void set_window_position(Gfx::IntPoint);
void set_window_size(Gfx::IntSize);

View file

@ -86,7 +86,7 @@ RequestServerAdapter::RequestServerAdapter(NonnullRefPtr<Protocol::RequestClient
RequestServerAdapter::~RequestServerAdapter() = default;
RefPtr<Web::ResourceLoaderConnectorRequest> RequestServerAdapter::start_request(DeprecatedString const& method, URL const& url, HashMap<DeprecatedString, DeprecatedString> const& headers, ReadonlyBytes body, Core::ProxyData const& proxy)
RefPtr<Web::ResourceLoaderConnectorRequest> RequestServerAdapter::start_request(ByteString const& method, URL const& url, HashMap<ByteString, ByteString> const& headers, ReadonlyBytes body, Core::ProxyData const& proxy)
{
auto protocol_request = m_protocol_client->start_request(method, url, headers, body, proxy);
if (!protocol_request)

View file

@ -45,7 +45,7 @@ public:
virtual void prefetch_dns(AK::URL const& url) override;
virtual void preconnect(AK::URL const& url) override;
virtual RefPtr<Web::ResourceLoaderConnectorRequest> start_request(DeprecatedString const& method, URL const&, HashMap<DeprecatedString, DeprecatedString> const& request_headers = {}, ReadonlyBytes request_body = {}, Core::ProxyData const& = {}) override;
virtual RefPtr<Web::ResourceLoaderConnectorRequest> start_request(ByteString const& method, URL const&, HashMap<ByteString, ByteString> const& request_headers = {}, ReadonlyBytes request_body = {}, Core::ProxyData const& = {}) override;
private:
RefPtr<Protocol::RequestClient> m_protocol_client;

View file

@ -24,7 +24,7 @@ static Optional<URL> create_url_with_url_or_path(String const& url_or_path)
if (!url.is_error() && url.value().is_valid())
return url.release_value();
auto path = LexicalPath::canonicalized_path(url_or_path.to_deprecated_string());
auto path = LexicalPath::canonicalized_path(url_or_path.to_byte_string());
auto url_from_path = URL::create_with_file_scheme(path);
if (url_from_path.is_valid())
return url_from_path;
@ -88,7 +88,7 @@ Optional<URL> sanitize_url(StringView url, Optional<StringView> search_engine, A
if (path.is_error())
return {};
return URL::create_with_file_scheme(path.value().to_deprecated_string());
return URL::create_with_file_scheme(path.value().to_byte_string());
}
auto format_search_engine = [&]() -> Optional<URL> {

View file

@ -123,7 +123,7 @@ void ViewImplementation::set_preferred_color_scheme(Web::CSS::PreferredColorSche
client().async_set_preferred_color_scheme(color_scheme);
}
DeprecatedString ViewImplementation::selected_text()
ByteString ViewImplementation::selected_text()
{
return client().get_selected_text();
}
@ -162,11 +162,11 @@ ErrorOr<ViewImplementation::DOMNodeProperties> ViewImplementation::inspect_dom_n
if (!response.has_style())
return Error::from_string_view("Inspected node returned no style"sv);
return DOMNodeProperties {
.computed_style_json = TRY(String::from_deprecated_string(response.take_computed_style())),
.resolved_style_json = TRY(String::from_deprecated_string(response.take_resolved_style())),
.custom_properties_json = TRY(String::from_deprecated_string(response.take_custom_properties())),
.node_box_sizing_json = TRY(String::from_deprecated_string(response.take_node_box_sizing())),
.aria_properties_state_json = TRY(String::from_deprecated_string(response.take_aria_properties_state())),
.computed_style_json = TRY(String::from_byte_string(response.take_computed_style())),
.resolved_style_json = TRY(String::from_byte_string(response.take_resolved_style())),
.custom_properties_json = TRY(String::from_byte_string(response.take_custom_properties())),
.node_box_sizing_json = TRY(String::from_byte_string(response.take_node_box_sizing())),
.aria_properties_state_json = TRY(String::from_byte_string(response.take_aria_properties_state())),
};
}
@ -225,7 +225,7 @@ Optional<String> ViewImplementation::get_dom_node_html(i32 node_id)
return client().get_dom_node_html(node_id);
}
void ViewImplementation::debug_request(DeprecatedString const& request, DeprecatedString const& argument)
void ViewImplementation::debug_request(ByteString const& request, ByteString const& argument)
{
client().async_debug_request(request, argument);
}
@ -235,7 +235,7 @@ void ViewImplementation::run_javascript(StringView js_source)
client().async_run_javascript(js_source);
}
void ViewImplementation::js_console_input(DeprecatedString const& js_source)
void ViewImplementation::js_console_input(ByteString const& js_source)
{
client().async_js_console_input(js_source);
}
@ -380,17 +380,17 @@ void ViewImplementation::handle_web_content_process_crash()
handle_resize();
StringBuilder builder;
builder.append("<html><head><title>Crashed: "sv);
builder.append(escape_html_entities(m_url.to_deprecated_string()));
builder.append(escape_html_entities(m_url.to_byte_string()));
builder.append("</title></head><body>"sv);
builder.append("<h1>Web page crashed"sv);
if (!m_url.host().has<Empty>()) {
builder.appendff(" on {}", escape_html_entities(m_url.serialized_host().release_value_but_fixme_should_propagate_errors()));
}
builder.append("</h1>"sv);
auto escaped_url = escape_html_entities(m_url.to_deprecated_string());
auto escaped_url = escape_html_entities(m_url.to_byte_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_deprecated_string());
load_html(builder.to_byte_string());
}
static ErrorOr<LexicalPath> save_screenshot(Gfx::ShareableBitmap const& bitmap)

View file

@ -54,7 +54,7 @@ public:
void set_preferred_color_scheme(Web::CSS::PreferredColorScheme);
DeprecatedString selected_text();
ByteString selected_text();
Optional<String> selected_text_with_whitespace_collapsed();
void select_all();
@ -76,10 +76,10 @@ public:
void remove_dom_node(i32 node_id);
Optional<String> get_dom_node_html(i32 node_id);
void debug_request(DeprecatedString const& request, DeprecatedString const& argument = {});
void debug_request(ByteString const& request, ByteString const& argument = {});
void run_javascript(StringView);
void js_console_input(DeprecatedString const& js_source);
void js_console_input(ByteString const& js_source);
void js_console_request_messages(i32 start_index);
void alert_closed();
@ -120,12 +120,12 @@ public:
Function<void(Gfx::IntPoint screen_position, Web::Page::MediaContextMenu const&)> on_media_context_menu_request;
Function<void(const AK::URL&)> on_link_hover;
Function<void()> on_link_unhover;
Function<void(const AK::URL&, DeprecatedString const& target, unsigned modifiers)> on_link_click;
Function<void(const AK::URL&, DeprecatedString const& target, unsigned modifiers)> on_link_middle_click;
Function<void(DeprecatedString const&)> on_title_change;
Function<void(const AK::URL&, ByteString const& target, unsigned modifiers)> on_link_click;
Function<void(const AK::URL&, ByteString const& target, unsigned modifiers)> on_link_middle_click;
Function<void(ByteString const&)> on_title_change;
Function<void(const AK::URL&, bool)> on_load_start;
Function<void(const AK::URL&)> on_load_finish;
Function<void(DeprecatedString const& path, i32)> on_request_file;
Function<void(ByteString const& path, i32)> on_request_file;
Function<void()> on_navigate_back;
Function<void()> on_navigate_forward;
Function<void()> on_refresh;
@ -134,7 +134,7 @@ public:
Function<void(Gfx::IntPoint)> on_scroll_to_point;
Function<void(Gfx::IntRect)> on_scroll_into_view;
Function<void(Gfx::StandardCursor)> on_cursor_change;
Function<void(Gfx::IntPoint, DeprecatedString const&)> on_enter_tooltip_area;
Function<void(Gfx::IntPoint, ByteString const&)> on_enter_tooltip_area;
Function<void()> on_leave_tooltip_area;
Function<void(String const& message)> on_request_alert;
Function<void(String const& message)> on_request_confirm;
@ -142,14 +142,14 @@ public:
Function<void(String const& message)> on_request_set_prompt_text;
Function<void()> on_request_accept_dialog;
Function<void()> on_request_dismiss_dialog;
Function<void(const AK::URL&, DeprecatedString const&)> on_received_source;
Function<void(DeprecatedString const&)> on_received_dom_tree;
Function<void(DeprecatedString const&)> on_received_accessibility_tree;
Function<void(const AK::URL&, ByteString const&)> on_received_source;
Function<void(ByteString const&)> on_received_dom_tree;
Function<void(ByteString const&)> on_received_accessibility_tree;
Function<void(i32 message_id)> on_received_console_message;
Function<void(i32 start_index, Vector<DeprecatedString> const& message_types, Vector<DeprecatedString> const& messages)> on_received_console_messages;
Function<void(i32 start_index, Vector<ByteString> const& message_types, Vector<ByteString> const& messages)> on_received_console_messages;
Function<Vector<Web::Cookie::Cookie>(AK::URL const& url)> on_get_all_cookies;
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<Optional<Web::Cookie::Cookie>(AK::URL const& url, ByteString const& name)> on_get_named_cookie;
Function<ByteString(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(Web::Cookie::Cookie const& cookie)> on_update_cookie;
Function<void(i32 count_waiting)> on_resource_status_change;

View file

@ -100,7 +100,7 @@ void WebContentClient::did_layout(Gfx::IntSize content_size)
m_view.on_did_layout(content_size);
}
void WebContentClient::did_change_title(DeprecatedString const& title)
void WebContentClient::did_change_title(ByteString const& title)
{
dbgln_if(SPAM_DEBUG, "handle: WebContentClient::DidChangeTitle! title={}", title);
@ -108,7 +108,7 @@ void WebContentClient::did_change_title(DeprecatedString const& title)
return;
if (title.is_empty())
m_view.on_title_change(m_view.url().to_deprecated_string());
m_view.on_title_change(m_view.url().to_byte_string());
else
m_view.on_title_change(title);
}
@ -132,7 +132,7 @@ void WebContentClient::did_request_scroll_into_view(Gfx::IntRect const& rect)
m_view.on_scroll_into_view(rect);
}
void WebContentClient::did_enter_tooltip_area(Gfx::IntPoint content_position, DeprecatedString const& title)
void WebContentClient::did_enter_tooltip_area(Gfx::IntPoint content_position, ByteString const& title)
{
if (m_view.on_enter_tooltip_area)
m_view.on_enter_tooltip_area(m_view.to_widget_position(content_position), title);
@ -160,13 +160,13 @@ void WebContentClient::did_unhover_link()
m_view.on_link_unhover();
}
void WebContentClient::did_click_link(AK::URL const& url, DeprecatedString const& target, unsigned modifiers)
void WebContentClient::did_click_link(AK::URL const& url, ByteString const& target, unsigned modifiers)
{
if (m_view.on_link_click)
m_view.on_link_click(url, target, modifiers);
}
void WebContentClient::did_middle_click_link(AK::URL const& url, DeprecatedString const& target, unsigned modifiers)
void WebContentClient::did_middle_click_link(AK::URL const& url, ByteString const& target, unsigned modifiers)
{
if (m_view.on_link_middle_click)
m_view.on_link_middle_click(url, target, modifiers);
@ -178,37 +178,37 @@ void WebContentClient::did_request_context_menu(Gfx::IntPoint content_position)
m_view.on_context_menu_request(m_view.to_widget_position(content_position));
}
void WebContentClient::did_request_link_context_menu(Gfx::IntPoint content_position, AK::URL const& url, DeprecatedString const&, unsigned)
void WebContentClient::did_request_link_context_menu(Gfx::IntPoint content_position, AK::URL const& url, ByteString const&, unsigned)
{
if (m_view.on_link_context_menu_request)
m_view.on_link_context_menu_request(url, m_view.to_widget_position(content_position));
}
void WebContentClient::did_request_image_context_menu(Gfx::IntPoint content_position, AK::URL const& url, DeprecatedString const&, unsigned, Gfx::ShareableBitmap const& bitmap)
void WebContentClient::did_request_image_context_menu(Gfx::IntPoint content_position, AK::URL const& url, ByteString const&, unsigned, Gfx::ShareableBitmap const& bitmap)
{
if (m_view.on_image_context_menu_request)
m_view.on_image_context_menu_request(url, m_view.to_widget_position(content_position), bitmap);
}
void WebContentClient::did_request_media_context_menu(Gfx::IntPoint content_position, DeprecatedString const&, unsigned, Web::Page::MediaContextMenu const& menu)
void WebContentClient::did_request_media_context_menu(Gfx::IntPoint content_position, ByteString const&, unsigned, Web::Page::MediaContextMenu const& menu)
{
if (m_view.on_media_context_menu_request)
m_view.on_media_context_menu_request(m_view.to_widget_position(content_position), menu);
}
void WebContentClient::did_get_source(AK::URL const& url, DeprecatedString const& source)
void WebContentClient::did_get_source(AK::URL const& url, ByteString const& source)
{
if (m_view.on_received_source)
m_view.on_received_source(url, source);
}
void WebContentClient::did_get_dom_tree(DeprecatedString const& dom_tree)
void WebContentClient::did_get_dom_tree(ByteString const& dom_tree)
{
if (m_view.on_received_dom_tree)
m_view.on_received_dom_tree(dom_tree);
}
void WebContentClient::did_get_accessibility_tree(DeprecatedString const& accessibility_tree)
void WebContentClient::did_get_accessibility_tree(ByteString const& accessibility_tree)
{
if (m_view.on_received_accessibility_tree)
m_view.on_received_accessibility_tree(accessibility_tree);
@ -220,7 +220,7 @@ void WebContentClient::did_output_js_console_message(i32 message_index)
m_view.on_received_console_message(message_index);
}
void WebContentClient::did_get_js_console_messages(i32 start_index, Vector<DeprecatedString> const& message_types, Vector<DeprecatedString> const& messages)
void WebContentClient::did_get_js_console_messages(i32 start_index, Vector<ByteString> const& message_types, Vector<ByteString> const& messages)
{
if (m_view.on_received_console_messages)
m_view.on_received_console_messages(start_index, message_types, messages);
@ -280,7 +280,7 @@ Messages::WebContentClient::DidRequestAllCookiesResponse WebContentClient::did_r
return Vector<Web::Cookie::Cookie> {};
}
Messages::WebContentClient::DidRequestNamedCookieResponse WebContentClient::did_request_named_cookie(AK::URL const& url, DeprecatedString const& name)
Messages::WebContentClient::DidRequestNamedCookieResponse WebContentClient::did_request_named_cookie(AK::URL const& url, ByteString const& name)
{
if (m_view.on_get_named_cookie)
return m_view.on_get_named_cookie(url, name);
@ -291,7 +291,7 @@ Messages::WebContentClient::DidRequestCookieResponse WebContentClient::did_reque
{
if (m_view.on_get_cookie)
return m_view.on_get_cookie(url, static_cast<Web::Cookie::Source>(source));
return DeprecatedString {};
return ByteString {};
}
void WebContentClient::did_set_cookie(AK::URL const& url, Web::Cookie::ParsedCookie const& cookie, u8 source)
@ -372,7 +372,7 @@ Messages::WebContentClient::DidRequestFullscreenWindowResponse WebContentClient:
return Gfx::IntRect {};
}
void WebContentClient::did_request_file(DeprecatedString const& path, i32 request_id)
void WebContentClient::did_request_file(ByteString const& path, i32 request_id)
{
if (m_view.on_request_file)
m_view.on_request_file(path, request_id);

View file

@ -39,26 +39,26 @@ private:
virtual void did_change_selection() override;
virtual void did_request_cursor_change(i32) override;
virtual void did_layout(Gfx::IntSize) override;
virtual void did_change_title(DeprecatedString const&) override;
virtual void did_change_title(ByteString const&) override;
virtual void did_request_scroll(i32, i32) override;
virtual void did_request_scroll_to(Gfx::IntPoint) override;
virtual void did_request_scroll_into_view(Gfx::IntRect const&) override;
virtual void did_enter_tooltip_area(Gfx::IntPoint, DeprecatedString const&) override;
virtual void did_enter_tooltip_area(Gfx::IntPoint, ByteString const&) override;
virtual void did_leave_tooltip_area() override;
virtual void did_hover_link(AK::URL const&) override;
virtual void did_unhover_link() override;
virtual void did_click_link(AK::URL const&, DeprecatedString const&, unsigned) override;
virtual void did_middle_click_link(AK::URL const&, DeprecatedString const&, unsigned) override;
virtual void did_click_link(AK::URL const&, ByteString const&, unsigned) override;
virtual void did_middle_click_link(AK::URL const&, ByteString const&, unsigned) override;
virtual void did_start_loading(AK::URL const&, bool) override;
virtual void did_request_context_menu(Gfx::IntPoint) override;
virtual void did_request_link_context_menu(Gfx::IntPoint, AK::URL const&, DeprecatedString const&, unsigned) override;
virtual void did_request_image_context_menu(Gfx::IntPoint, AK::URL const&, DeprecatedString const&, unsigned, Gfx::ShareableBitmap const&) override;
virtual void did_request_media_context_menu(Gfx::IntPoint, DeprecatedString const&, unsigned, Web::Page::MediaContextMenu const&) override;
virtual void did_get_source(AK::URL const&, DeprecatedString const&) override;
virtual void did_get_dom_tree(DeprecatedString const&) override;
virtual void did_get_accessibility_tree(DeprecatedString const&) override;
virtual void did_request_link_context_menu(Gfx::IntPoint, AK::URL const&, ByteString const&, unsigned) override;
virtual void did_request_image_context_menu(Gfx::IntPoint, AK::URL const&, ByteString const&, unsigned, Gfx::ShareableBitmap const&) override;
virtual void did_request_media_context_menu(Gfx::IntPoint, ByteString const&, unsigned, Web::Page::MediaContextMenu const&) override;
virtual void did_get_source(AK::URL const&, ByteString const&) override;
virtual void did_get_dom_tree(ByteString const&) override;
virtual void did_get_accessibility_tree(ByteString const&) override;
virtual void did_output_js_console_message(i32 message_index) override;
virtual void did_get_js_console_messages(i32 start_index, Vector<DeprecatedString> const& message_types, Vector<DeprecatedString> const& messages) override;
virtual void did_get_js_console_messages(i32 start_index, Vector<ByteString> const& message_types, Vector<ByteString> const& messages) override;
virtual void did_change_favicon(Gfx::ShareableBitmap const&) override;
virtual void did_request_alert(String const&) override;
virtual void did_request_confirm(String const&) override;
@ -67,7 +67,7 @@ private:
virtual void did_request_accept_dialog() override;
virtual void did_request_dismiss_dialog() override;
virtual Messages::WebContentClient::DidRequestAllCookiesResponse did_request_all_cookies(AK::URL const&) override;
virtual Messages::WebContentClient::DidRequestNamedCookieResponse did_request_named_cookie(AK::URL const&, DeprecatedString const&) override;
virtual Messages::WebContentClient::DidRequestNamedCookieResponse did_request_named_cookie(AK::URL const&, ByteString const&) override;
virtual Messages::WebContentClient::DidRequestCookieResponse did_request_cookie(AK::URL const&, u8) override;
virtual void did_set_cookie(AK::URL const&, Web::Cookie::ParsedCookie const&, u8) override;
virtual void did_update_cookie(Web::Cookie::Cookie const&) override;
@ -81,7 +81,7 @@ private:
virtual Messages::WebContentClient::DidRequestMaximizeWindowResponse did_request_maximize_window() override;
virtual Messages::WebContentClient::DidRequestMinimizeWindowResponse did_request_minimize_window() override;
virtual Messages::WebContentClient::DidRequestFullscreenWindowResponse did_request_fullscreen_window() override;
virtual void did_request_file(DeprecatedString const& path, i32) override;
virtual void did_request_file(ByteString const& path, i32) override;
virtual void did_request_color_picker(Color const& current_color) override;
virtual void did_request_select_dropdown(Gfx::IntPoint content_position, i32 minimum_width, Vector<Web::HTML::SelectItem> const& items) override;
virtual void did_finish_handling_input_event(bool event_was_accepted) override;

View file

@ -51,7 +51,7 @@ WebSocketClientSocketAdapter::WebSocketClientSocketAdapter(NonnullRefPtr<Protoco
}
}
};
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);
@ -87,7 +87,7 @@ Web::WebSockets::WebSocket::ReadyState WebSocketClientSocketAdapter::ready_state
VERIFY_NOT_REACHED();
}
DeprecatedString WebSocketClientSocketAdapter::subprotocol_in_use()
ByteString WebSocketClientSocketAdapter::subprotocol_in_use()
{
return m_websocket->subprotocol_in_use();
}
@ -102,7 +102,7 @@ void WebSocketClientSocketAdapter::send(StringView text_message)
m_websocket->send(text_message);
}
void WebSocketClientSocketAdapter::close(u16 code, DeprecatedString reason)
void WebSocketClientSocketAdapter::close(u16 code, ByteString reason)
{
m_websocket->close(code, reason);
}
@ -125,7 +125,7 @@ WebSocketClientManagerAdapter::WebSocketClientManagerAdapter(NonnullRefPtr<Proto
WebSocketClientManagerAdapter::~WebSocketClientManagerAdapter() = default;
RefPtr<Web::WebSockets::WebSocketClientSocket> WebSocketClientManagerAdapter::connect(const AK::URL& url, DeprecatedString const& origin, Vector<DeprecatedString> const& protocols)
RefPtr<Web::WebSockets::WebSocketClientSocket> WebSocketClientManagerAdapter::connect(const AK::URL& url, ByteString const& origin, Vector<ByteString> const& protocols)
{
auto underlying_websocket = m_websocket_client->connect(url, origin, protocols);
if (!underlying_websocket)

View file

@ -26,11 +26,11 @@ public:
virtual ~WebSocketClientSocketAdapter() 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 text_message) override;
virtual void close(u16 code = 1005, DeprecatedString reason = {}) override;
virtual void close(u16 code = 1005, ByteString reason = {}) override;
private:
WebSocketClientSocketAdapter(NonnullRefPtr<Protocol::WebSocket>);
@ -45,7 +45,7 @@ public:
virtual ~WebSocketClientManagerAdapter() override;
virtual RefPtr<Web::WebSockets::WebSocketClientSocket> connect(const AK::URL&, DeprecatedString const& origin, Vector<DeprecatedString> const& protocols) override;
virtual RefPtr<Web::WebSockets::WebSocketClientSocket> connect(const AK::URL&, ByteString const& origin, Vector<ByteString> const& protocols) override;
private:
WebSocketClientManagerAdapter(NonnullRefPtr<Protocol::WebSocketClient>);