diff --git a/Userland/Libraries/LibWeb/HTML/NavigatorID.cpp b/Userland/Libraries/LibWeb/HTML/NavigatorID.cpp
index c757f86bf75..74bcefa5fd9 100644
--- a/Userland/Libraries/LibWeb/HTML/NavigatorID.cpp
+++ b/Userland/Libraries/LibWeb/HTML/NavigatorID.cpp
@@ -11,14 +11,14 @@
namespace Web::HTML {
// https://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-appversion
-DeprecatedString NavigatorIDMixin::app_version() const
+String NavigatorIDMixin::app_version() const
{
// Must return the appropriate string that starts with "5.0 (", as follows:
// Let trail be the substring of default `User-Agent` value that follows the "Mozilla/" prefix.
auto user_agent_string = ResourceLoader::the().user_agent();
- auto trail = user_agent_string.substring_view(strlen("Mozilla/"), user_agent_string.length() - strlen("Mozilla/"));
+ auto trail = MUST(user_agent_string.substring_from_byte_offset(strlen("Mozilla/"), user_agent_string.bytes().size() - strlen("Mozilla/")));
// If the navigator compatibility mode is Chrome or WebKit
// NOTE: We are using Chrome for now. Make sure to update all APIs if you add a toggle for this.
@@ -33,7 +33,7 @@ DeprecatedString NavigatorIDMixin::app_version() const
}
// https://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-platform
-DeprecatedString NavigatorIDMixin::platform() const
+String NavigatorIDMixin::platform() const
{
// Must return a string representing the platform on which the browser is executing (e.g. "MacIntel", "Win32",
// "Linux x86_64", "Linux armv81") or, for privacy and compatibility, a string that is commonly returned on another
@@ -44,7 +44,7 @@ DeprecatedString NavigatorIDMixin::platform() const
}
// https://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-useragent
-DeprecatedString NavigatorIDMixin::user_agent() const
+String NavigatorIDMixin::user_agent() const
{
// Must return the default `User-Agent` value.
return ResourceLoader::the().user_agent();
diff --git a/Userland/Libraries/LibWeb/HTML/NavigatorID.h b/Userland/Libraries/LibWeb/HTML/NavigatorID.h
index 31cf0568f99..93ff9981cd6 100644
--- a/Userland/Libraries/LibWeb/HTML/NavigatorID.h
+++ b/Userland/Libraries/LibWeb/HTML/NavigatorID.h
@@ -6,7 +6,7 @@
#pragma once
-#include
+#include
namespace Web::HTML {
@@ -17,31 +17,31 @@ public:
// implementers are strongly urged to include as little information in this API as possible.
// https://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-appcodename
- DeprecatedString app_code_name() const { return "Mozilla"sv; }
+ String app_code_name() const { return "Mozilla"_string; }
// https://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-appcodename
- DeprecatedString app_name() const { return "Netscape"sv; }
+ String app_name() const { return "Netscape"_string; }
// https://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-appversion
- DeprecatedString app_version() const;
+ String app_version() const;
// https://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-platform
- DeprecatedString platform() const;
+ String platform() const;
// https://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-product
- DeprecatedString product() const { return "Gecko"sv; }
+ String product() const { return "Gecko"_string; }
// https://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-productsub
- DeprecatedString product_sub() const { return "20030107"sv; } // Compatibility mode "Chrome"
+ String product_sub() const { return "20030107"_string; } // Compatibility mode "Chrome"
// https://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-useragent
- DeprecatedString user_agent() const;
+ String user_agent() const;
// https://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-vendor
- DeprecatedString vendor() const { return "Google Inc."sv; } // Compatibility mode "Chrome"
+ String vendor() const { return "Google Inc."_string; } // Compatibility mode "Chrome"
// https://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-vendorsub
- DeprecatedString vendor_sub() const { return ""sv; }
+ String vendor_sub() const { return String {}; }
// NOTE: If the navigator compatibility mode is Gecko, then the user agent must also support the following partial interface:
// bool taint_enabled()
diff --git a/Userland/Libraries/LibWeb/Loader/ResourceLoader.cpp b/Userland/Libraries/LibWeb/Loader/ResourceLoader.cpp
index 74f0893dba7..352aa62fecc 100644
--- a/Userland/Libraries/LibWeb/Loader/ResourceLoader.cpp
+++ b/Userland/Libraries/LibWeb/Loader/ResourceLoader.cpp
@@ -59,8 +59,8 @@ ErrorOr> ResourceLoader::try_create(NonnullRefPtr<
ResourceLoader::ResourceLoader(NonnullRefPtr connector)
: m_connector(move(connector))
- , m_user_agent(default_user_agent)
- , m_platform(default_platform)
+ , m_user_agent(MUST(String::from_utf8(default_user_agent)))
+ , m_platform(MUST(String::from_utf8(default_platform)))
{
}
@@ -315,7 +315,7 @@ void ResourceLoader::load(LoadRequest& request, SuccessCallback success_callback
auto proxy = ProxyMappings::the().proxy_for_url(url);
HashMap headers;
- headers.set("User-Agent", m_user_agent);
+ headers.set("User-Agent", m_user_agent.to_deprecated_string());
headers.set("Accept-Encoding", "gzip, deflate, br");
for (auto& it : request.headers()) {
diff --git a/Userland/Libraries/LibWeb/Loader/ResourceLoader.h b/Userland/Libraries/LibWeb/Loader/ResourceLoader.h
index 25e21e22242..85e99726727 100644
--- a/Userland/Libraries/LibWeb/Loader/ResourceLoader.h
+++ b/Userland/Libraries/LibWeb/Loader/ResourceLoader.h
@@ -123,11 +123,11 @@ public:
int pending_loads() const { return m_pending_loads; }
- DeprecatedString const& user_agent() const { return m_user_agent; }
- void set_user_agent(DeprecatedString const& user_agent) { m_user_agent = user_agent; }
+ String const& user_agent() const { return m_user_agent; }
+ void set_user_agent(String user_agent) { m_user_agent = move(user_agent); }
- DeprecatedString const& platform() const { return m_platform; }
- void set_platform(DeprecatedString const& platform) { m_platform = platform; }
+ String const& platform() const { return m_platform; }
+ void set_platform(String platform) { m_platform = move(platform); }
void clear_cache();
void evict_from_cache(LoadRequest const&);
@@ -142,8 +142,8 @@ private:
HashTable> m_active_requests;
NonnullRefPtr m_connector;
- DeprecatedString m_user_agent;
- DeprecatedString m_platform;
+ String m_user_agent;
+ String m_platform;
Optional m_page {};
};
diff --git a/Userland/Services/WebContent/ConnectionFromClient.cpp b/Userland/Services/WebContent/ConnectionFromClient.cpp
index 5a0f35c72bb..3af096a0680 100644
--- a/Userland/Services/WebContent/ConnectionFromClient.cpp
+++ b/Userland/Services/WebContent/ConnectionFromClient.cpp
@@ -451,7 +451,7 @@ void ConnectionFromClient::debug_request(DeprecatedString const& request, Deprec
}
if (request == "spoof-user-agent") {
- Web::ResourceLoader::the().set_user_agent(argument);
+ Web::ResourceLoader::the().set_user_agent(MUST(String::from_deprecated_string(argument)));
return;
}