[epiphany] ephy-web-view: use SoupURI for about: check



commit a525b75a8ba54d1b296bde2a3d72748c3d6967a4
Author: Xan Lopez <xlopez igalia com>
Date:   Sun Sep 11 16:50:11 2011 +0200

    ephy-web-view: use SoupURI for about: check
    
    Turns out the stuff after about: in a SoupURI will be the path, not
    the host. Guess it makes sense.

 embed/ephy-web-view.c |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c
index 7da57a9..d181c9b 100644
--- a/embed/ephy-web-view.c
+++ b/embed/ephy-web-view.c
@@ -1887,7 +1887,9 @@ load_status_cb (WebKitWebView *web_view,
       ephy_web_view_set_security_level (EPHY_WEB_VIEW (web_view), security_level);
     }
     break;
-  case WEBKIT_LOAD_FINISHED:
+  case WEBKIT_LOAD_FINISHED: {
+    SoupURI *uri;
+
     g_free (priv->status_message);
     priv->status_message = NULL;
     g_object_notify (object, "status-message");
@@ -1905,9 +1907,9 @@ load_status_cb (WebKitWebView *web_view,
 
     /* FIXME: It sucks to do this here, but it's not really possible
      * to hook the DOM actions nicely in the about: generator. */
-    /* FIXME: it would be safer to validate this with SoupURI but
-     * 'host' is NULL for ephy-about:applications ... */
-    if (g_str_has_prefix (webkit_web_view_get_uri (web_view), "ephy-about:applications")) {
+    uri = soup_uri_new (webkit_web_view_get_uri (web_view));
+    if (!g_strcmp0 (uri->scheme, "ephy-about") &&
+        !g_strcmp0 (uri->path, "applications")) {
       WebKitDOMDocument *document;
       WebKitDOMNodeList *buttons;
       gulong buttons_n;
@@ -1925,9 +1927,12 @@ load_status_cb (WebKitWebView *web_view,
                                                     G_CALLBACK (delete_web_app_cb), false,
                                                     NULL);
       }
+
+      soup_uri_free (uri);
     }
 
     break;
+  }
   case WEBKIT_LOAD_FAILED:
     ephy_web_view_set_link_message (view, NULL);
     ephy_web_view_set_loading_title (view, NULL, FALSE);



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