[epiphany] Move address normalization to the EphyWebView functions.
- From: Xan Lopez <xan src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [epiphany] Move address normalization to the EphyWebView functions.
- Date: Mon, 10 Aug 2009 10:58:18 +0000 (UTC)
commit af12311055ac2d9ea29103fbb507a3a1f6798658
Author: Xan Lopez <xan gnome org>
Date: Mon Aug 10 13:55:51 2009 +0300
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.
embed/ephy-web-view.c | 19 +++++++++++++++----
src/ephy-link.c | 7 +------
2 files changed, 16 insertions(+), 10 deletions(-)
---
diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c
index db11f1f..9da36ed 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 d6b226d..49faa52 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;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]