aboutsummaryrefslogtreecommitdiffstats
path: root/src/ephy-window.c
diff options
context:
space:
mode:
authorCarlos Garcia Campos <cgarcia@igalia.com>2012-09-22 00:42:12 +0800
committerCarlos Garcia Campos <cgarcia@igalia.com>2013-01-11 16:54:05 +0800
commitf256d7fc2dac4f1a3abbcc594be51f62b6f13496 (patch)
tree9fe4f720f9cff3b1adf72b2b42fbfb9dc7afdf9b /src/ephy-window.c
parent148238b49a703b0b3c971a3ae7d430d44a20693a (diff)
downloadgsoc2013-epiphany-f256d7fc2dac4f1a3abbcc594be51f62b6f13496.tar
gsoc2013-epiphany-f256d7fc2dac4f1a3abbcc594be51f62b6f13496.tar.gz
gsoc2013-epiphany-f256d7fc2dac4f1a3abbcc594be51f62b6f13496.tar.bz2
gsoc2013-epiphany-f256d7fc2dac4f1a3abbcc594be51f62b6f13496.tar.lz
gsoc2013-epiphany-f256d7fc2dac4f1a3abbcc594be51f62b6f13496.tar.xz
gsoc2013-epiphany-f256d7fc2dac4f1a3abbcc594be51f62b6f13496.tar.zst
gsoc2013-epiphany-f256d7fc2dac4f1a3abbcc594be51f62b6f13496.zip
Don't use DOM bindings to delete a web application from about:applications
Use a different form for every web application with a hidden value containing the application id. Then use the policy client to ignore any form submission from about:applications and delete the application instead, reloading the about:applications page. This solution will work for WebKit2 too.
Diffstat (limited to 'src/ephy-window.c')
-rw-r--r--src/ephy-window.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/ephy-window.c b/src/ephy-window.c
index 3fcd3eed0..5b309a09c 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -54,6 +54,7 @@
#include "ephy-shell.h"
#include "ephy-toolbar.h"
#include "ephy-type-builtins.h"
+#include "ephy-web-app-utils.h"
#include "ephy-web-view.h"
#include "ephy-zoom-action.h"
#include "ephy-zoom.h"
@@ -2466,6 +2467,28 @@ create_web_view_cb (WebKitWebView *web_view,
return new_web_view;
}
+static void
+delete_web_app (const char *request_uri)
+{
+ SoupURI *uri = soup_uri_new (request_uri);
+
+ if (uri->query)
+ {
+ GHashTable *form;
+ const char *app_id;
+
+ form = soup_form_decode (uri->query);
+ app_id = g_hash_table_lookup (form, "app_id");
+ if (app_id)
+ {
+ ephy_web_application_delete (app_id);
+ }
+ g_hash_table_destroy (form);
+ }
+
+ soup_uri_free (uri);
+}
+
#ifdef HAVE_WEBKIT2
static gboolean
decide_policy_cb (WebKitWebView *web_view,
@@ -2737,6 +2760,15 @@ policy_decision_required_cb (WebKitWebView *web_view,
return TRUE;
}
+ if (reason == WEBKIT_WEB_NAVIGATION_REASON_FORM_SUBMITTED && uri &&
+ g_str_has_prefix (uri, "ephy-about:applications"))
+ {
+ delete_web_app (uri);
+ webkit_web_policy_decision_use (decision);
+
+ return TRUE;
+ }
+
return FALSE;
}
#endif