summaryrefslogtreecommitdiff
path: root/src/setting.c
diff options
context:
space:
mode:
authorugla <ugla@u8.is>2021-12-14 23:00:35 +0100
committerrafa_99 <raroma09@gmail.com>2022-01-01 20:30:22 +0000
commit95afb316ab196d09ef68d79d4a74223636906246 (patch)
treef8b5231b8f93f5e671788e9d8cb8f4aa32782247 /src/setting.c
parent9e19cec2637e5a333e3111185dedc4993a0e7327 (diff)
Add option for WebKit Intelligent Tracking Prevention
Diffstat (limited to 'src/setting.c')
-rw-r--r--src/setting.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/setting.c b/src/setting.c
index b347e9b..12d7704 100644
--- a/src/setting.c
+++ b/src/setting.c
@@ -61,6 +61,7 @@ static int input_autohide(Client *c, const char *name, DataType type, void *valu
static int internal(Client *c, const char *name, DataType type, void *value, void *data);
static int notification(Client *c, const char *name, DataType type, void *value, void *data);
static int headers(Client *c, const char *name, DataType type, void *value, void *data);
+static int intelligent_tracking_prevention(Client *c, const char *name, DataType type, void *value, void *data);
static int user_scripts(Client *c, const char *name, DataType type, void *value, void *data);
static int user_style(Client *c, const char *name, DataType type, void *value, void *data);
static int statusbar(Client *c, const char *name, DataType type, void *value, void *data);
@@ -107,6 +108,7 @@ void setting_init(Client *c)
setting_add(c, "html5-local-storage", TYPE_BOOLEAN, &on, webkit, 0, "enable-html5-local-storage");
setting_add(c, "hyperlink-auditing", TYPE_BOOLEAN, &off, webkit, 0, "enable-hyperlink-auditing");
setting_add(c, "images", TYPE_BOOLEAN, &on, webkit, 0, "auto-load-images");
+ setting_add(c, "intelligent-tracking-prevention", TYPE_BOOLEAN, &off, intelligent_tracking_prevention, 0, NULL);
setting_add(c, "javascript-can-access-clipboard", TYPE_BOOLEAN, &off, webkit, 0, "javascript-can-access-clipboard");
setting_add(c, "javascript-can-open-windows-automatically", TYPE_BOOLEAN, &off, webkit, 0, "javascript-can-open-windows-automatically");
#if WEBKIT_CHECK_VERSION(2, 24, 0)
@@ -566,6 +568,14 @@ static int geolocation(Client *c, const char *name, DataType type, void *value,
return CMD_SUCCESS;
}
+static int intelligent_tracking_prevention(Client *c, const char *name, DataType type, void *value, void *data)
+{
+ WebKitWebContext *ctx = webkit_web_view_get_context(c->webview);
+ WebKitWebsiteDataManager *manager = webkit_web_context_get_website_data_manager(ctx);
+ webkit_website_data_manager_set_itp_enabled(manager, *(gboolean*)value);
+ return CMD_SUCCESS;
+}
+
/* This needs to be called before the window is shown for the best chance of
* success, but it may be called at any time.
* Currently the setting file is read after the window has been shown, which