[epiphany] Prevent recursive Epiphany calls for unsupported schemes



commit 1c080692d65a8978ddea68f3b8ba620e48bd586a
Author: Jan-Michael Brummer <jan brummer tabos org>
Date:   Fri Feb 28 23:33:03 2020 +0100

    Prevent recursive Epiphany calls for unsupported schemes
    
    Fixes: https://gitlab.gnome.org/GNOME/epiphany/issues/1053

 src/ephy-window.c | 20 ++++++++++++++------
 1 file 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);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]