commit 49493c7f2bd7a1d9df99f6fa4343f64d202aea17
parent df1b4288031f4133974fb2d17c47ae110166c901
Author: Christoph Lohmann <20h@r-36.net>
Date: Fri, 21 Apr 2017 21:29:42 +0200
Allow true disabling of unsafe non-HTTPS content.
Diffstat:
2 files changed, 26 insertions(+), 3 deletions(-)
diff --git a/config.def.h b/config.def.h
@@ -159,6 +159,7 @@ static Key keys[] = {
{ MODKEY, GDK_minus, zoom, { .i = -1 } },
{ MODKEY, GDK_plus, zoom, { .i = +1 } },
+ { MODKEY|GDK_SHIFT_MASK,GDK_l, toggleinsecurecontent, { 0 } },
{ MODKEY, GDK_l, navigate, { .i = +1 } },
{ MODKEY, GDK_h, navigate, { .i = -1 } },
@@ -185,7 +186,6 @@ static Key keys[] = {
{ MODKEY|GDK_SHIFT_MASK,GDK_i, toggle, { .v = "auto-load-images" } },
{ MODKEY|GDK_SHIFT_MASK,GDK_s, toggle, { .v = "enable-scripts" } },
{ MODKEY|GDK_SHIFT_MASK,GDK_v, toggle, { .v = "enable-plugins" } },
- { MODKEY|GDK_SHIFT_MASK,GDK_l, toggle, { .v = "enable-display-of-insecure-content" } },
{ MODKEY|GDK_SHIFT_MASK,GDK_t, togglesoup, { .v = "ssl-strict" } },
{ MODKEY|GDK_SHIFT_MASK,GDK_w, toggle, { .v = "enable-private-browsing" } },
{ MODKEY|GDK_SHIFT_MASK,GDK_a, togglecookiepolicy, { 0 } },
diff --git a/surf.c b/surf.c
@@ -212,7 +212,9 @@ static void stop(Client *c, const Arg *arg);
static void titlechange(WebKitWebView *view, GParamSpec *pspec, Client *c);
static void titlechangeleave(void *a, void *b, Client *c);
static void toggle(Client *c, const Arg *arg);
+static void togglehelper(Client *c, const Arg *arg, int reload);
static void togglecookiepolicy(Client *c, const Arg *arg);
+static void toggleinsecurecontent(Client *c, const Arg *arg);
static void togglegeolocation(Client *c, const Arg *arg);
static void toggleproxy(Client *c, const Arg *arg);
static void togglescrollbars(Client *c, const Arg *arg);
@@ -1105,6 +1107,9 @@ newclient(void)
"enable-display-of-insecure-content", insecureresources,
NULL);
g_object_set(G_OBJECT(settings),
+ "enable-running-of-insecure-content", insecureresources,
+ NULL);
+ g_object_set(G_OBJECT(settings),
"enable-html5-database", enablehtml5db, NULL);
g_object_set(G_OBJECT(settings),
"enable-html5-local-storage", enablehtml5local, NULL);
@@ -1642,7 +1647,7 @@ titlechangeleave(void *a, void *b, Client *c)
}
void
-toggle(Client *c, const Arg *arg)
+togglehelper(Client *c, const Arg *arg, int doreload)
{
WebKitWebSettings *settings;
char *name = (char *)arg->v;
@@ -1653,7 +1658,14 @@ toggle(Client *c, const Arg *arg)
g_object_get(G_OBJECT(settings), name, &value, NULL);
g_object_set(G_OBJECT(settings), name, !value, NULL);
- reload(c, &a);
+ if (doreload)
+ reload(c, &a);
+}
+
+void
+toggle(Client *c, const Arg *arg)
+{
+ togglehelper(c, arg, 1);
}
void
@@ -1678,6 +1690,17 @@ togglecookiepolicy(Client *c, const Arg *arg)
}
void
+toggleinsecurecontent(Client *c, const Arg *arg)
+{
+ Arg a;
+
+ a.v = "enable-running-of-insecure-content";
+ togglehelper(c, &a, 0);
+ a.v = "enable-display-of-insecure-content";
+ togglehelper(c, &a, 1);
+}
+
+void
togglegeolocation(Client *c, const Arg *arg)
{
Arg a = { .b = FALSE };