Honor site data policy when requesting HTML5 databases
See: https://bugs.launchpad.net/midori/+bug/767442
This commit is contained in:
parent
6fd666aa9f
commit
7c7be5644d
1 changed files with 26 additions and 9 deletions
|
@ -1288,15 +1288,32 @@ 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);
|
||||||
gchar* hostname = midori_uri_parse_hostname (uri, NULL);
|
MidoriSiteDataPolicy policy = midori_web_settings_get_site_data_policy (view->settings, uri);
|
||||||
gchar* message = g_strdup_printf (_("%s wants to save an HTML5 database."),
|
|
||||||
hostname && *hostname ? hostname : uri);
|
switch (policy)
|
||||||
midori_view_add_info_bar (view, GTK_MESSAGE_QUESTION, message,
|
{
|
||||||
G_CALLBACK (midori_view_database_response_cb), database,
|
case MIDORI_SITE_DATA_BLOCK:
|
||||||
_("_Deny"), GTK_RESPONSE_REJECT, _("_Allow"), GTK_RESPONSE_ACCEPT,
|
{
|
||||||
NULL);
|
WebKitSecurityOrigin* origin = webkit_web_database_get_security_origin (database);
|
||||||
g_free (hostname);
|
webkit_security_origin_set_web_database_quota (origin, 0);
|
||||||
g_free (message);
|
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* message = g_strdup_printf (_("%s wants to save an HTML5 database."),
|
||||||
|
hostname && *hostname ? hostname : uri);
|
||||||
|
midori_view_add_info_bar (view, GTK_MESSAGE_QUESTION, message,
|
||||||
|
G_CALLBACK (midori_view_database_response_cb), database,
|
||||||
|
_("_Deny"), GTK_RESPONSE_REJECT, _("_Allow"), GTK_RESPONSE_ACCEPT,
|
||||||
|
NULL);
|
||||||
|
g_free (hostname);
|
||||||
|
g_free (message);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if WEBKIT_CHECK_VERSION (1, 1, 23)
|
#if WEBKIT_CHECK_VERSION (1, 1, 23)
|
||||||
|
|
Loading…
Reference in a new issue