From 6fd666aa9fac694df1019fab36ef97b222a55f46 Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Sun, 26 Feb 2012 00:01:26 +0100 Subject: [PATCH] Honor site data policy when clearing web cookies --- midori/main.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/midori/main.c b/midori/main.c index f0efec49..f1249088 100644 --- a/midori/main.c +++ b/midori/main.c @@ -996,6 +996,7 @@ static gboolean midori_load_soup_session (gpointer settings) { SoupSession* session = webkit_get_default_session (); + g_object_set_data (G_OBJECT (session), "midori-settings", settings); #if defined (HAVE_LIBSOUP_2_37_1) g_object_set (session, @@ -1724,6 +1725,7 @@ static void midori_clear_web_cookies_cb (void) { SoupSession* session = webkit_get_default_session (); + MidoriWebSettings* settings = g_object_get_data (G_OBJECT (session), "midori-settings"); SoupSessionFeature* jar = soup_session_get_feature (session, SOUP_TYPE_COOKIE_JAR); GSList* cookies = soup_cookie_jar_all_cookies (SOUP_COOKIE_JAR (jar)); SoupSessionFeature* feature; @@ -1731,7 +1733,13 @@ midori_clear_web_cookies_cb (void) /* HTTP Cookies/ Web Cookies */ for (; cookies != NULL; cookies = g_slist_next (cookies)) + { + const gchar* domain = ((SoupCookie*)cookies->data)->domain; + if (midori_web_settings_get_site_data_policy (settings, domain) + == MIDORI_SITE_DATA_PRESERVE) + continue; soup_cookie_jar_delete_cookie ((SoupCookieJar*)jar, cookies->data); + } soup_cookies_free (cookies); /* Removing KatzeHttpCookies makes it save outstanding changes */ if ((feature = soup_session_get_feature (session, KATZE_TYPE_HTTP_COOKIES))) -- 2.39.5