mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 20:29:18 +00:00
LibWeb: Implement Navigator.doNotTrack
This commit is contained in:
parent
e34254298a
commit
61e616c974
Notes:
sideshowbarker
2024-07-17 08:36:27 +09:00
Author: https://github.com/jamierocks
Commit: 61e616c974
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/373
Reviewed-by: https://github.com/trflynn89
3 changed files with 18 additions and 0 deletions
|
@ -13,6 +13,7 @@
|
|||
#include <LibWeb/HTML/Navigator.h>
|
||||
#include <LibWeb/HTML/Scripting/Environments.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
#include <LibWeb/Loader/ResourceLoader.h>
|
||||
#include <LibWeb/Page/Page.h>
|
||||
|
||||
namespace Web::HTML {
|
||||
|
@ -100,4 +101,16 @@ WebIDL::Long Navigator::max_touch_points()
|
|||
return 0;
|
||||
}
|
||||
|
||||
// https://www.w3.org/TR/tracking-dnt/#dom-navigator-donottrack
|
||||
Optional<FlyString> Navigator::do_not_track() const
|
||||
{
|
||||
// The value is null if no DNT header field would be sent (e.g., because a tracking preference is not
|
||||
// enabled and no user-granted exception is applicable); otherwise, the value is a string beginning with
|
||||
// "0" or "1", possibly followed by DNT-extension characters.
|
||||
if (ResourceLoader::the().enable_do_not_track())
|
||||
return "1"_fly_string;
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue