aboutsummaryrefslogtreecommitdiffstats
path: root/src/ephy-window.c
diff options
context:
space:
mode:
authorXan Lopez <xlopez@igalia.com>2011-08-29 20:32:07 +0800
committerXan Lopez <xlopez@igalia.com>2011-08-29 20:41:30 +0800
commit207f5b355abbaf2b91e9b684f3cc45387b5119cb (patch)
treeef4f630fb5500b8622f4b35fd74a3060f543d056 /src/ephy-window.c
parent58c91ceba8dc3a5a12a80afd58062a5d94e96644 (diff)
downloadgsoc2013-epiphany-207f5b355abbaf2b91e9b684f3cc45387b5119cb.tar
gsoc2013-epiphany-207f5b355abbaf2b91e9b684f3cc45387b5119cb.tar.gz
gsoc2013-epiphany-207f5b355abbaf2b91e9b684f3cc45387b5119cb.tar.bz2
gsoc2013-epiphany-207f5b355abbaf2b91e9b684f3cc45387b5119cb.tar.lz
gsoc2013-epiphany-207f5b355abbaf2b91e9b684f3cc45387b5119cb.tar.xz
gsoc2013-epiphany-207f5b355abbaf2b91e9b684f3cc45387b5119cb.tar.zst
gsoc2013-epiphany-207f5b355abbaf2b91e9b684f3cc45387b5119cb.zip
ephy-window: sandbox app-mode instances to the app domain
If the user tries to navigate to other domain spawn a new process with "gvfs-open" and the requested URI.
Diffstat (limited to 'src/ephy-window.c')
-rw-r--r--src/ephy-window.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/ephy-window.c b/src/ephy-window.c
index a54ee25ff..f6ce48d1b 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -2606,6 +2606,45 @@ policy_decision_required_cb (WebKitWebView *web_view,
return TRUE;
}
+ if (reason == WEBKIT_WEB_NAVIGATION_REASON_LINK_CLICKED &&
+ ephy_embed_shell_get_mode (embed_shell) == EPHY_EMBED_SHELL_MODE_APPLICATION)
+ {
+ /* The only thing we allow here is to either navigate
+ * in the same window and tab to the current domain,
+ * or launch a new (non app mode) epiphany instance
+ * for all the other cases. */
+ gboolean return_value;
+ SoupURI *soup_uri = soup_uri_new (uri);
+ SoupURI *current_soup_uri = soup_uri_new (webkit_web_view_get_uri (web_view));
+
+ if (g_str_equal (soup_uri->host, current_soup_uri->host))
+ {
+ return_value = FALSE;
+ }
+ else
+ {
+ char *command_line;
+ GError *error = NULL;
+
+ return_value = TRUE;
+ command_line = g_strdup_printf ("gvfs-open %s", uri);
+ g_spawn_command_line_async (command_line, &error);
+
+ if (error)
+ {
+ g_debug ("Error opening %s: %s", uri, error->message);
+ g_error_free (error);
+ }
+
+ g_free (command_line);
+ }
+
+ soup_uri_free (soup_uri);
+ soup_uri_free (current_soup_uri);
+
+ return return_value;
+ }
+
if (reason == WEBKIT_WEB_NAVIGATION_REASON_LINK_CLICKED) {
EphyEmbed *embed;
EphyNewTabFlags flags;