mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:57:35 +00:00
LibWeb: Re-implement HTML::Navigator using IDL
Get rid of the bespoke NavigatorObject class and use the modern IDL strategies for creating platform objects to re-implement Navigator and its associcated mixin interfaces. While we're here, implement it in a way that brings WorkerNavigator up to spec :^)
This commit is contained in:
parent
14e1513077
commit
2d5bee256e
27 changed files with 343 additions and 208 deletions
51
Userland/Libraries/LibWeb/HTML/NavigatorID.h
Normal file
51
Userland/Libraries/LibWeb/HTML/NavigatorID.h
Normal file
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* Copyright (c) 2022, Andrew Kaster <akaster@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AK/String.h>
|
||||
|
||||
namespace Web::HTML {
|
||||
|
||||
class NavigatorIDMixin {
|
||||
public:
|
||||
// WARNING: Any information in this API that varies from user to user can be used to profile the user. In fact, if
|
||||
// enough such information is available, a user can actually be uniquely identified. For this reason, user agent
|
||||
// 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
|
||||
String app_code_name() const { return "Mozilla"sv; }
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-appcodename
|
||||
String app_name() const { return "Netscape"sv; }
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-appversion
|
||||
String app_version() const;
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-platform
|
||||
String platform() const;
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-product
|
||||
String product() const { return "Gecko"sv; }
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-productsub
|
||||
String product_sub() const { return "20030107"sv; } // Compatability mode "Chrome"
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-useragent
|
||||
String user_agent() const;
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-vendor
|
||||
String vendor() const { return "Google Inc."sv; } // Compatability mode "Chrome"
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-vendorsub
|
||||
String vendor_sub() const { return ""sv; }
|
||||
|
||||
// NOTE: If the navigator compatibility mode is Gecko, then the user agent must also support the following partial interface:
|
||||
// bool taint_enabled()
|
||||
// String oscpu()
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue