summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan-Michael Brummer <jan.brummer@tabos.org>2020-02-28 23:33:03 +0100
committerMichael Catanzaro <mcatanzaro@gnome.org>2020-03-07 20:27:20 +0000
commit1c080692d65a8978ddea68f3b8ba620e48bd586a (patch)
treed65d6170f3588cddb770931d27c74350c5dfd1cd
parent9ad499a7e0630e7e5f9e6bc44e79b6e3dca32c8f (diff)
downloadepiphany-1c080692d65a8978ddea68f3b8ba620e48bd586a.tar.gz
Prevent recursive Epiphany calls for unsupported schemes
Fixes: https://gitlab.gnome.org/GNOME/epiphany/issues/1053
-rw-r--r--src/ephy-window.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/ephy-window.c b/src/ephy-window.c
index c45d6fd0e..a5b2ba31b 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -2040,15 +2040,23 @@ decide_navigation_policy (WebKitWebView *web_view,
uri = webkit_uri_request_get_uri (request);
if (!ephy_embed_utils_address_has_web_scheme (uri)) {
- GError *error = NULL;
+ g_autoptr (SoupURI) soup_uri = soup_uri_new (uri);
- gtk_show_uri_on_window (GTK_WINDOW (window), uri, GDK_CURRENT_TIME, &error);
+ if (soup_uri) {
+ g_autoptr (GAppInfo) app_info = g_app_info_get_default_for_uri_scheme (soup_uri->scheme);
- if (error) {
- LOG ("failed to handle non web scheme: %s", error->message);
- g_error_free (error);
+ if (app_info && g_str_has_prefix (g_app_info_get_id (app_info), "org.gnome.Epiphany")) {
+ g_autoptr (GError) error = NULL;
- return FALSE;
+ gtk_show_uri_on_window (GTK_WINDOW (window), uri, GDK_CURRENT_TIME, &error);
+
+ if (error) {
+ LOG ("failed to handle non web scheme: %s", error->message);
+ g_error_free (error);
+
+ return FALSE;
+ }
+ }
}
webkit_policy_decision_ignore (decision);