LibWeb: Support Gecko and WebKit navigator compatibility modes

This will log a debug message when calls are made to the
NavigatorIDMixin that make decisions based on the compatibility mode.
This commit is contained in:
Jamie Mansfield 2024-07-02 01:04:40 +01:00 committed by Andreas Kling
commit 1128375dff
Notes: sideshowbarker 2024-07-17 07:35:03 +09:00
5 changed files with 105 additions and 11 deletions

View file

@ -16,6 +16,7 @@
#include <LibProtocol/Request.h>
#include <LibURL/URL.h>
#include <LibWeb/Loader/Resource.h>
#include <LibWeb/Loader/UserAgent.h>
#include <LibWeb/Page/Page.h>
namespace Web {
@ -99,6 +100,9 @@ public:
String const& platform() const { return m_platform; }
void set_platform(String platform) { m_platform = move(platform); }
NavigatorCompatibilityMode navigator_compatibility_mode() { return m_navigator_compatibility_mode; }
void set_navigator_compatibility_mode(NavigatorCompatibilityMode mode) { m_navigator_compatibility_mode = mode; }
bool enable_do_not_track() const { return m_enable_do_not_track; }
void set_enable_do_not_track(bool enable) { m_enable_do_not_track = enable; }
@ -119,6 +123,7 @@ private:
NonnullRefPtr<ResourceLoaderConnector> m_connector;
String m_user_agent;
String m_platform;
NavigatorCompatibilityMode m_navigator_compatibility_mode;
bool m_enable_do_not_track { false };
Optional<JS::GCPtr<Page>> m_page {};
};