Honor site data policy when requesting HTML5 databases

See: https://bugs.launchpad.net/midori/+bug/767442
This commit is contained in:
Christian Dywan 2012-02-26 00:01:55 +01:00
parent 6fd666aa9f
commit 7c7be5644d

View file

@ -1288,6 +1288,21 @@ midori_view_web_view_database_quota_exceeded_cb (WebKitWebView* web_view,
MidoriView* view) MidoriView* view)
{ {
const gchar* uri = webkit_web_frame_get_uri (web_frame); const gchar* uri = webkit_web_frame_get_uri (web_frame);
MidoriSiteDataPolicy policy = midori_web_settings_get_site_data_policy (view->settings, uri);
switch (policy)
{
case MIDORI_SITE_DATA_BLOCK:
{
WebKitSecurityOrigin* origin = webkit_web_database_get_security_origin (database);
webkit_security_origin_set_web_database_quota (origin, 0);
webkit_web_database_remove (database);
}
case MIDORI_SITE_DATA_ACCEPT:
case MIDORI_SITE_DATA_PRESERVE:
return;
case MIDORI_SITE_DATA_UNDETERMINED:
{
gchar* hostname = midori_uri_parse_hostname (uri, NULL); gchar* hostname = midori_uri_parse_hostname (uri, NULL);
gchar* message = g_strdup_printf (_("%s wants to save an HTML5 database."), gchar* message = g_strdup_printf (_("%s wants to save an HTML5 database."),
hostname && *hostname ? hostname : uri); hostname && *hostname ? hostname : uri);
@ -1297,6 +1312,8 @@ midori_view_web_view_database_quota_exceeded_cb (WebKitWebView* web_view,
NULL); NULL);
g_free (hostname); g_free (hostname);
g_free (message); g_free (message);
}
}
} }
#if WEBKIT_CHECK_VERSION (1, 1, 23) #if WEBKIT_CHECK_VERSION (1, 1, 23)