[epiphany] Move URL normalization out of embed, to a higher level



commit 0ce6fe842a2fc4c3155452f69247cdda97ab09d1
Author: Gustavo Noronha Silva <gns gnome org>
Date:   Sat Dec 27 16:33:40 2008 -0200

    Move URL normalization out of embed, to a higher level
    
    We need this because not all code that loads URLs goes through embed
    now.
---
 embed/webkit/webkit-embed.c |   14 +-------------
 src/ephy-link.c             |   19 ++++++++++++++++++-
 2 files changed, 19 insertions(+), 14 deletions(-)

diff --git a/embed/webkit/webkit-embed.c b/embed/webkit/webkit-embed.c
index 778106a..27a7205 100644
--- a/embed/webkit/webkit-embed.c
+++ b/embed/webkit/webkit-embed.c
@@ -795,20 +795,8 @@ impl_load (EphyEmbed *embed,
            EphyEmbed *preview_embed)
 {
   WebKitEmbed *wembed = WEBKIT_EMBED (embed);
-  char *effective_url = NULL;
 
-  /* WebKit cannot handle URLs without a protocol */
-  if (ephy_embed_utils_address_has_web_scheme (url) == FALSE)
-    effective_url = g_strconcat ("http://";, url, NULL);
-  else
-    effective_url = g_strdup (url);
-
-  g_free (wembed->priv->loading_uri);
-  wembed->priv->loading_uri = g_strdup (effective_url);
-
-  webkit_web_view_open (wembed->priv->web_view, effective_url);
-
-  g_free (effective_url);
+  webkit_web_view_open (wembed->priv->web_view, url);
 }
 
 static gboolean
diff --git a/src/ephy-link.c b/src/ephy-link.c
index b74ed2b..7845dfb 100644
--- a/src/ephy-link.c
+++ b/src/ephy-link.c
@@ -21,6 +21,7 @@
 
 #include "ephy-link.h"
 
+#include "ephy-embed-utils.h"
 #include "ephy-type-builtins.h"
 #include "ephy-marshal.h"
 #include "ephy-signal-accumulator.h"
@@ -88,13 +89,29 @@ ephy_link_open (EphyLink *link,
 		EphyLinkFlags flags)
 {
 	EphyEmbed *new_embed = NULL;
+	char *effective_url = NULL;
+
+	/*
+	 * WebKit does not normalize URI's by itself, so we need to
+	 * handle this ourselves
+	 */
+	if (ephy_embed_utils_address_has_web_scheme (address) == FALSE)
+	{
+		effective_url = g_strconcat ("http://";, address, NULL);
+	}
+	else
+	{
+		effective_url = g_strdup (address);
+	}
 
 	LOG ("ephy_link_open address \"%s\" parent-embed %p flags %u", address, embed, flags);
 
 	g_signal_emit (link, signals[OPEN_LINK], 0,
-		       address, embed, flags,
+		       effective_url, embed, flags,
 		       &new_embed);
 
+	g_free (effective_url);
+
 	return new_embed;
 }
 



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