aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXan Lopez <xan@gnome.org>2009-08-10 18:55:51 +0800
committerXan Lopez <xan@gnome.org>2009-08-10 18:55:51 +0800
commitaf12311055ac2d9ea29103fbb507a3a1f6798658 (patch)
treeeae5f478974e868012f4d8b93baa263bbb84462e
parent44706a1d0bc863eb6ffd9e14a207c230e9d3a028 (diff)
downloadgsoc2013-epiphany-af12311055ac2d9ea29103fbb507a3a1f6798658.tar
gsoc2013-epiphany-af12311055ac2d9ea29103fbb507a3a1f6798658.tar.gz
gsoc2013-epiphany-af12311055ac2d9ea29103fbb507a3a1f6798658.tar.bz2
gsoc2013-epiphany-af12311055ac2d9ea29103fbb507a3a1f6798658.tar.lz
gsoc2013-epiphany-af12311055ac2d9ea29103fbb507a3a1f6798658.tar.xz
gsoc2013-epiphany-af12311055ac2d9ea29103fbb507a3a1f6798658.tar.zst
gsoc2013-epiphany-af12311055ac2d9ea29103fbb507a3a1f6798658.zip
Move address normalization to the EphyWebView functions.
EphyLink is called repeatedly when opening URLs, so normalizing the address there all the time is pointless. Also, we don't go through here in all cases, so we need to add the normalization in the ephy_web_view_load_request function too; this fixes opening URLs like "foo.com" from the command line, for example.
-rw-r--r--embed/ephy-web-view.c19
-rw-r--r--src/ephy-link.c7
2 files changed, 16 insertions, 10 deletions
diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c
index db11f1f07..9da36edda 100644
--- a/embed/ephy-web-view.c
+++ b/embed/ephy-web-view.c
@@ -1043,11 +1043,18 @@ ephy_web_view_load_request (EphyWebView *web_view,
WebKitNetworkRequest *request)
{
WebKitWebFrame *main_frame;
+ const char *url;
+ char *effective_url;
- g_return_if_fail(EPHY_IS_WEB_VIEW(web_view));
- g_return_if_fail(WEBKIT_IS_NETWORK_REQUEST(request));
+ g_return_if_fail(EPHY_IS_WEB_VIEW(web_view));
+ g_return_if_fail(WEBKIT_IS_NETWORK_REQUEST(request));
- main_frame = webkit_web_view_get_main_frame (WEBKIT_WEB_VIEW(web_view));
+ url = webkit_network_request_get_uri (request);
+ effective_url = ephy_embed_utils_normalize_address (url);
+ webkit_network_request_set_uri (request, effective_url);
+ g_free (effective_url);
+
+ main_frame = webkit_web_view_get_main_frame (WEBKIT_WEB_VIEW(web_view));
webkit_web_frame_load_request(main_frame, request);
}
@@ -1062,10 +1069,14 @@ void
ephy_web_view_load_url (EphyWebView *view,
const char *url)
{
+ char *effective_url;
+
g_return_if_fail (EPHY_IS_WEB_VIEW (view));
g_return_if_fail (url);
- webkit_web_view_open (WEBKIT_WEB_VIEW (view), url);
+ effective_url = ephy_embed_utils_normalize_address (url);
+ webkit_web_view_open (WEBKIT_WEB_VIEW (view), effective_url);
+ g_free (effective_url);
}
/**
diff --git a/src/ephy-link.c b/src/ephy-link.c
index d6b226d65..49faa52ae 100644
--- a/src/ephy-link.c
+++ b/src/ephy-link.c
@@ -89,18 +89,13 @@ ephy_link_open (EphyLink *link,
EphyLinkFlags flags)
{
EphyEmbed *new_embed = NULL;
- char *effective_address;
LOG ("ephy_link_open address \"%s\" parent-embed %p flags %u", address, embed, flags);
- effective_address = ephy_embed_utils_normalize_address (address);
-
g_signal_emit (link, signals[OPEN_LINK], 0,
- effective_address, embed, flags,
+ address, embed, flags,
&new_embed);
- g_free (effective_address);
-
return new_embed;
}