From 23678b6f95ea496370fbf5df0d118719e27e403a Mon Sep 17 00:00:00 2001 From: Marco Peereboom Date: Tue, 23 Aug 2011 17:47:33 +0000 Subject: [PATCH] Sites like flickr REQUIRE HTML5 local storage for the JS popup menus to work. This strikes me as insane for anyone who likes some sort of security. Then again if one chooses to use sites like flickr chances are that one doesn't care the least bit. So to work around this enable local storage for domains that are in the cookie white list. This leaves a sour taste in my mouth but what else can one do? Fixes FS#137 --- xxxterm.1 | 5 ++++- xxxterm.c | 27 +++++++++++++++++++++++++-- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/xxxterm.1 b/xxxterm.1 index a5d0230..6f96f91 100644 --- a/xxxterm.1 +++ b/xxxterm.1 @@ -834,8 +834,11 @@ This directory must exist and validates that during startup. .It Cm enable_cookie_whitelist When enabled all cookies must be in the whitelist or they are rejected. +Additionally whitelisted cookies also enable HTML5 local storage for the +domain. .It Cm enable_js_whitelist -When enabled all domains must be in the js whitelist in order to run Java Script. +When enabled all domains must be in the js whitelist in order to run Java +Script. NOTE: Make sure .Cm enable_scripts is set to 0. diff --git a/xxxterm.c b/xxxterm.c index 433a996..56dd3a8 100644 --- a/xxxterm.c +++ b/xxxterm.c @@ -5925,6 +5925,28 @@ activate_search_entry_cb(GtkWidget* entry, struct tab *t) } void +check_and_set_cookie(const gchar *uri, struct tab *t) +{ + struct domain *d = NULL; + int es = 0; + + if (uri == NULL || t == NULL) + return; + + if ((d = wl_find_uri(uri, &c_wl)) == NULL) + es = 0; + else + es = 1; + + DNPRINTF(XT_D_COOKIE, "check_and_set_cookie: %s %s\n", + es ? "enable" : "disable", uri); + + g_object_set(G_OBJECT(t->settings), + "enable-html5-local-storage", es, (char *)NULL); + webkit_web_view_set_settings(t->wv, t->settings); +} + +void check_and_set_js(const gchar *uri, struct tab *t) { struct domain *d = NULL; @@ -6366,9 +6388,10 @@ notify_load_status_cb(WebKitWebView* wview, GParamSpec* pspec, struct tab *t) set_status(t, (char *)uri, XT_STATUS_LOADING); /* check if js white listing is enabled */ - if (enable_js_whitelist) { + if (enable_cookie_whitelist) + check_and_set_cookie(uri, t); + if (enable_js_whitelist) check_and_set_js(uri, t); - } if (t->styled) apply_style(t); -- 2.11.4.GIT