diff options
author | Gustavo Noronha Silva <gns@gnome.org> | 2009-12-23 00:28:34 +0800 |
---|---|---|
committer | Gustavo Noronha Silva <gns@gnome.org> | 2010-01-16 00:54:48 +0800 |
commit | bac714eab6253cf088761501117937e9b48bcea9 (patch) | |
tree | 7635b8f3d3d1fa9d74058a811f5bd3622a7c017c | |
parent | 589e0fa8cf257346c1f089fa84fd96733381d89f (diff) | |
download | gsoc2013-epiphany-bac714eab6253cf088761501117937e9b48bcea9.tar.gz gsoc2013-epiphany-bac714eab6253cf088761501117937e9b48bcea9.tar.zst gsoc2013-epiphany-bac714eab6253cf088761501117937e9b48bcea9.zip |
Remove error handling work-arounds
WebKit will stop emitting load signals when it loads the error page,
which makes life easier for us.
Bug #377012
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | embed/ephy-embed-prefs.c | 1 | ||||
-rw-r--r-- | embed/ephy-embed.c | 52 |
3 files changed, 23 insertions, 32 deletions
diff --git a/configure.ac b/configure.ac index ee917a8c6..b22de5a5e 100644 --- a/configure.ac +++ b/configure.ac @@ -100,7 +100,7 @@ LIBXSLT_REQUIRED=1.1.7 LIBSTARTUP_NOTIFICATION_REQUIRED=0.5 LIBNOTIFY_REQUIRED=0.4 DBUS_GLIB_REQUIRED=0.35 -WEBKIT_GTK_REQUIRED=1.1.18 +WEBKIT_GTK_REQUIRED=1.1.19 LIBSOUP_GNOME_REQUIRED=2.29.4 GNOME_KEYRING_REQUIRED=2.26.0 diff --git a/embed/ephy-embed-prefs.c b/embed/ephy-embed-prefs.c index bccf7251a..0323d3282 100644 --- a/embed/ephy-embed-prefs.c +++ b/embed/ephy-embed-prefs.c @@ -396,6 +396,7 @@ ephy_embed_prefs_init (void) "auto-shrink-images", FALSE, "enable-default-context-menu", FALSE, "enable-site-specific-quirks", TRUE, + "enable-page-cache", TRUE, NULL); /* Connections */ diff --git a/embed/ephy-embed.c b/embed/ephy-embed.c index 072a9b5df..fe81fd22c 100644 --- a/embed/ephy-embed.c +++ b/embed/ephy-embed.c @@ -62,7 +62,7 @@ struct EphyEmbedPrivate WebKitWebView *web_view; EphyHistory *history; GtkWidget *inspector_window; - char *load_failed_uri; + char *loading_uri; guint is_setting_zoom : 1; GSList *destroy_on_transition_list; }; @@ -196,6 +196,7 @@ load_status_changed_cb (WebKitWebView *view, GParamSpec *spec, EphyEmbed *embed) { + EphyEmbedPrivate *priv = embed->priv; WebKitLoadStatus status = webkit_web_view_get_load_status (view); if (status == WEBKIT_LOAD_COMMITTED) { @@ -206,15 +207,9 @@ load_status_changed_cb (WebKitWebView *view, ephy_embed_destroy_top_widgets (embed); - /* If the load failed for this URI, do nothing else */ - if (embed->priv->load_failed_uri && - g_str_equal (embed->priv->load_failed_uri, uri)) { - g_free (embed->priv->load_failed_uri); - embed->priv->load_failed_uri = NULL; - - ephy_web_view_set_security_level (EPHY_WEB_VIEW (view), EPHY_WEB_VIEW_STATE_IS_UNKNOWN); - - return; + if (g_strcmp0 (uri, priv->loading_uri) != 0) { + g_free (priv->loading_uri); + priv->loading_uri = g_strdup (uri); } ephy_web_view_location_changed (EPHY_WEB_VIEW (view), @@ -238,7 +233,7 @@ load_status_changed_cb (WebKitWebView *view, ephy_web_view_set_security_level (EPHY_WEB_VIEW (view), security_level); } else if (status == WEBKIT_LOAD_PROVISIONAL || status == WEBKIT_LOAD_FINISHED) { EphyWebViewNetState estate = EPHY_WEB_VIEW_STATE_UNKNOWN; - const char *loading_uri = NULL; + char *loading_uri = NULL; if (status == WEBKIT_LOAD_PROVISIONAL) { WebKitWebFrame *frame; @@ -248,7 +243,12 @@ load_status_changed_cb (WebKitWebView *view, frame = webkit_web_view_get_main_frame (view); source = webkit_web_frame_get_provisional_data_source (frame); request = webkit_web_data_source_get_initial_request (source); - loading_uri = webkit_network_request_get_uri (request); + loading_uri = g_strdup (webkit_network_request_get_uri (request)); + + /* We also store the URI we are currently loading here, because + * we will want to use it in WEBKIT_LOAD_FINISHED, because if a + * load fails we may never get to committed */ + priv->loading_uri = g_strdup (loading_uri); estate = (EphyWebViewNetState) (estate | EPHY_WEB_VIEW_STATE_START | @@ -258,17 +258,23 @@ load_status_changed_cb (WebKitWebView *view, g_signal_emit_by_name (EPHY_WEB_VIEW (view), "new-document-now", loading_uri); } else if (status == WEBKIT_LOAD_FINISHED) { - loading_uri = ephy_web_view_get_address (EPHY_WEB_VIEW (view)); + loading_uri = priv->loading_uri; + + /* Will be freed bellow */ + priv->loading_uri = NULL; estate = (EphyWebViewNetState) (estate | EPHY_WEB_VIEW_STATE_STOP | EPHY_WEB_VIEW_STATE_IS_DOCUMENT | EPHY_WEB_VIEW_STATE_IS_NETWORK); } - + ephy_web_view_update_from_net_state (EPHY_WEB_VIEW (view), loading_uri, (EphyWebViewNetState)estate); + + g_free (loading_uri); + } } @@ -332,7 +338,7 @@ ephy_embed_finalize (GObject *object) EphyEmbed *embed = EPHY_EMBED (object); GSList *list; - g_free (embed->priv->load_failed_uri); + g_free (embed->priv->loading_uri); list = embed->priv->destroy_on_transition_list; for (; list; list = list->next) { @@ -863,21 +869,6 @@ download_requested_cb (WebKitWebView *web_view, return TRUE; } -static gboolean -load_error_cb (WebKitWebView *web_view, - WebKitWebFrame *frame, - const char *uri, - GError *error, - EphyEmbed *embed) -{ - /* Flag the page as error. We need the flag to check it when - receiving COMMITTED status, since for some reason we are getting - that when the load fails too */ - embed->priv->load_failed_uri = g_strdup (uri); - - return FALSE; -} - static void ephy_embed_constructed (GObject *object) { @@ -909,7 +900,6 @@ ephy_embed_constructed (GObject *object) "signal::notify::zoom-level", G_CALLBACK (zoom_changed_cb), embed, "signal::notify::title", G_CALLBACK (title_changed_cb), embed, "signal::notify::uri", G_CALLBACK (uri_changed_cb), embed, - "signal::load-error", G_CALLBACK (load_error_cb), embed, NULL); embed->priv->inspector_window = gtk_window_new (GTK_WINDOW_TOPLEVEL); |