1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:38:11 +00:00

LibWeb: Port NavigatorID from DeprecatedString to String

This commit is contained in:
Shannon Booth 2023-11-20 13:44:27 +13:00 committed by Andreas Kling
parent 0a4586d510
commit 6aff55d655
5 changed files with 24 additions and 24 deletions

View file

@ -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();