aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGustavo Noronha Silva <gns@gnome.org>2009-05-29 23:29:38 +0800
committerGustavo Noronha Silva <kov@debian.org>2009-05-30 00:15:59 +0800
commitb8fbb465b2dd76b7fd27582fe9d376d870f404e0 (patch)
treef6b79dad08ba78880256dd8f67abfc004cb1a21a
parent8f4747aa1731acf83f1bd7249b392d0cded08c4b (diff)
downloadgsoc2013-epiphany-b8fbb465b2dd76b7fd27582fe9d376d870f404e0.tar
gsoc2013-epiphany-b8fbb465b2dd76b7fd27582fe9d376d870f404e0.tar.gz
gsoc2013-epiphany-b8fbb465b2dd76b7fd27582fe9d376d870f404e0.tar.bz2
gsoc2013-epiphany-b8fbb465b2dd76b7fd27582fe9d376d870f404e0.tar.lz
gsoc2013-epiphany-b8fbb465b2dd76b7fd27582fe9d376d870f404e0.tar.xz
gsoc2013-epiphany-b8fbb465b2dd76b7fd27582fe9d376d870f404e0.tar.zst
gsoc2013-epiphany-b8fbb465b2dd76b7fd27582fe9d376d870f404e0.zip
Fix missing HTTP information when opening links in new tabs
Bug #120341 This changeset reworks ephy_shell_new_tab_full (and its callers) to use a WebKitNetworkRequest instead of an URL when handling openning links in new tabs. This gains us the advantage of feeding the new WebView with the same WebKitNetworkRequest WebKit would use to navigate to the new address.
-rw-r--r--src/ephy-session.c7
-rw-r--r--src/ephy-shell.c30
-rw-r--r--src/ephy-shell.h3
-rw-r--r--src/ephy-window.c14
-rw-r--r--src/epiphany.defs2
5 files changed, 33 insertions, 23 deletions
diff --git a/src/ephy-session.c b/src/ephy-session.c
index 4dabe3f46..d4e38b988 100644
--- a/src/ephy-session.c
+++ b/src/ephy-session.c
@@ -641,6 +641,7 @@ session_command_open_uris (EphySession *session,
{
const char *url = uris[i];
EphyNewTabFlags page_flags;
+ WebKitNetworkRequest *request;
if (url[0] == '\0')
{
@@ -651,13 +652,15 @@ session_command_open_uris (EphySession *session,
page_flags = EPHY_NEW_TAB_OPEN_PAGE;
}
+ request = webkit_network_request_new (url);
embed = ephy_shell_new_tab_full (shell, window,
NULL /* parent tab */,
- url,
+ request,
flags | page_flags,
EPHY_EMBED_CHROME_ALL,
FALSE /* is popup? */,
user_time);
+ g_object_unref (request);
window = EPHY_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (embed)));
}
@@ -698,7 +701,7 @@ session_command_dispatch (EphySession *session)
{
ephy_shell_new_tab_full (ephy_shell_get_default (),
NULL /* window */, NULL /* tab */,
- NULL /* URL */,
+ NULL /* NetworkRequest */,
EPHY_NEW_TAB_IN_NEW_WINDOW |
EPHY_NEW_TAB_HOME_PAGE,
EPHY_EMBED_CHROME_ALL,
diff --git a/src/ephy-shell.c b/src/ephy-shell.c
index 231069687..b0339207e 100644
--- a/src/ephy-shell.c
+++ b/src/ephy-shell.c
@@ -35,6 +35,8 @@
#include "ephy-prefs.h"
#include "ephy-file-helpers.h"
#include "ephy-favicon-cache.h"
+#include "ephy-web-view.h"
+#include "ephy-embed-utils.h"
#include "ephy-window.h"
#include "ephy-bookmarks-ui.h"
#include "ephy-bookmarks-import.h"
@@ -406,7 +408,7 @@ load_homepage (EphyEmbed *embed)
* @shell: a #EphyShell
* @parent_window: the target #EphyWindow or %NULL
* @previous_embed: the referrer embed, or %NULL
- * @url: an url to load or %NULL
+ * @request: a #WebKitNetworkRequest to load or %NULL
* @chrome: a #EphyEmbedChrome mask to use if creating a new window
* @is_popup: whether the new window is a popup
* @user_time: a timestamp, or 0
@@ -420,7 +422,7 @@ EphyEmbed *
ephy_shell_new_tab_full (EphyShell *shell,
EphyWindow *parent_window,
EphyEmbed *previous_embed,
- const char *url,
+ WebKitNetworkRequest *request,
EphyNewTabFlags flags,
EphyEmbedChrome chrome,
gboolean is_popup,
@@ -520,7 +522,7 @@ ephy_shell_new_tab_full (EphyShell *shell,
{
EphyEmbedLoadFlags load_flags = 0;
- g_assert (url != NULL);
+ g_assert (request != NULL);
if (flags & EPHY_NEW_TAB_ALLOW_FIXUP)
{
@@ -530,13 +532,10 @@ ephy_shell_new_tab_full (EphyShell *shell,
{
load_flags = EPHY_EMBED_LOAD_FLAGS_NONE;
}
- /* FIXME */
- /* We need to audit every caller to see if this
- won't make us send referer for undesirable loads.
- Passing NULL referrer atm */
- ephy_embed_load (embed, url, load_flags, NULL);
- is_empty = url_is_empty (url);
+ ephy_web_view_load_request (EPHY_WEB_VIEW (EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed)),
+ request);
+ is_empty = url_is_empty (webkit_network_request_get_uri (request));
}
/* Make sure the initial focus is somewhere sensible and not, for
@@ -582,9 +581,16 @@ ephy_shell_new_tab (EphyShell *shell,
const char *url,
EphyNewTabFlags flags)
{
- return ephy_shell_new_tab_full (shell, parent_window,
- previous_embed, url, flags,
- EPHY_EMBED_CHROME_ALL, FALSE, 0);
+ EphyEmbed *embed;
+ WebKitNetworkRequest *request = webkit_network_request_new (url);
+
+ embed = ephy_shell_new_tab_full (shell, parent_window,
+ previous_embed, request, flags,
+ EPHY_EMBED_CHROME_ALL, FALSE, 0);
+
+ g_object_unref (request);
+
+ return embed;
}
/**
diff --git a/src/ephy-shell.h b/src/ephy-shell.h
index 77dd927f1..00a1765fa 100644
--- a/src/ephy-shell.h
+++ b/src/ephy-shell.h
@@ -30,6 +30,7 @@
#include "ephy-window.h"
#include "ephy-embed.h"
+#include <webkit/webkit.h>
#include <glib-object.h>
#include <glib.h>
@@ -100,7 +101,7 @@ EphyEmbed *ephy_shell_new_tab (EphyShell *shell,
EphyEmbed *ephy_shell_new_tab_full (EphyShell *shell,
EphyWindow *parent_window,
EphyEmbed *previous_embed,
- const char *url,
+ WebKitNetworkRequest *request,
EphyNewTabFlags flags,
EphyEmbedChrome chrome,
gboolean is_popup,
diff --git a/src/ephy-window.c b/src/ephy-window.c
index 5d7babc60..ca926c4de 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -2562,16 +2562,16 @@ policy_decision_required_cb (WebKitWebView *web_view,
const char *uri;
EphyEmbed *embed;
- uri = webkit_network_request_get_uri (request);
embed = ephy_embed_container_get_active_child
(EPHY_EMBED_CONTAINER (window));
- ephy_shell_new_tab (ephy_shell_get_default (),
- window,
- embed,
- uri,
- EPHY_NEW_TAB_IN_EXISTING_WINDOW |
- EPHY_NEW_TAB_OPEN_PAGE);
+ ephy_shell_new_tab_full (ephy_shell_get_default (),
+ window,
+ embed,
+ request,
+ EPHY_NEW_TAB_IN_EXISTING_WINDOW |
+ EPHY_NEW_TAB_OPEN_PAGE,
+ EPHY_EMBED_CHROME_ALL, FALSE, 0);
return TRUE;
}
diff --git a/src/epiphany.defs b/src/epiphany.defs
index d0d5faaa7..ca5785480 100644
--- a/src/epiphany.defs
+++ b/src/epiphany.defs
@@ -3086,7 +3086,7 @@
(parameters
'("EphyWindow*" "parent_window")
'("EphyEmbed*" "previous_tab")
- '("const-char*" "url")
+ '("WebKitNetworkRequest*" "request")
'("EphyNewTabFlags" "flags")
'("EphyEmbedChrome" "chrome")
'("gboolean" "is_popup")