aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXan Lopez <xan@gnome.org>2009-09-24 22:30:41 +0800
committerXan Lopez <xan@gnome.org>2009-09-24 22:30:41 +0800
commitfe64e80f6f486467de76c397e107e0c53498ae0f (patch)
treea8a60b9c3fc10f58d137184b1bd6c7b6d9bcf7b3
parent76032eecc218e48c887727cd58ab7b63cfae5802 (diff)
downloadgsoc2013-epiphany-fe64e80f6f486467de76c397e107e0c53498ae0f.tar
gsoc2013-epiphany-fe64e80f6f486467de76c397e107e0c53498ae0f.tar.gz
gsoc2013-epiphany-fe64e80f6f486467de76c397e107e0c53498ae0f.tar.bz2
gsoc2013-epiphany-fe64e80f6f486467de76c397e107e0c53498ae0f.tar.lz
gsoc2013-epiphany-fe64e80f6f486467de76c397e107e0c53498ae0f.tar.xz
gsoc2013-epiphany-fe64e80f6f486467de76c397e107e0c53498ae0f.tar.zst
gsoc2013-epiphany-fe64e80f6f486467de76c397e107e0c53498ae0f.zip
ephy-window.c: workaround bug in WebKit progress notification
LOAD_FINISHED is notified before progress 100% completed, which makes it very hard to rely on those signals to figure out if a page is still loading or not when syncing progress in a tab. Try to workaround this as best as possible.
-rw-r--r--src/ephy-window.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/ephy-window.c b/src/ephy-window.c
index 80a37fe60..59a06c72d 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -1608,6 +1608,7 @@ sync_tab_load_progress (EphyWebView *view, GParamSpec *pspec, EphyWindow *window
gdouble progress;
const char *uri;
gboolean loading;
+ gboolean switching_tab = pspec == NULL;
if (window->priv->closing) return;
@@ -1623,13 +1624,19 @@ sync_tab_load_progress (EphyWebView *view, GParamSpec *pspec, EphyWindow *window
for about:blank until the load is finished, so assume NULL
here means we are loading about:blank. This might not be
rigt :) */
- loading = ephy_web_view_is_loading (view);
+ /* All the weird checks for progress == 1.0 and !switching_tab
+ * are because we receive first the LOAD_FINISHED status than
+ * the 100% progress report, so for progress == 1.0 there's no
+ * sane way of knowing whether we are still loading or
+ * not. See https://bugs.webkit.org/show_bug.cgi?id=28851 */
uri = webkit_web_view_get_uri (WEBKIT_WEB_VIEW (view));
- if (loading && (!uri || strcmp (uri, "about:blank") == 0))
+ if (!switching_tab && (!uri || strcmp (uri, "about:blank") == 0))
return;
progress = webkit_web_view_get_progress (WEBKIT_WEB_VIEW (view));
- if (progress == 1.0 && loading)
+ loading = ephy_web_view_is_loading (view);
+
+ if (progress == 1.0 && !switching_tab)
{
window->priv->clear_progress_timeout_id =
g_timeout_add (500,
@@ -1640,7 +1647,7 @@ sync_tab_load_progress (EphyWebView *view, GParamSpec *pspec, EphyWindow *window
/* Do not set progress in the entry if the load is already
finished */
gtk_entry_set_progress_fraction (GTK_ENTRY (window->priv->entry),
- loading ? progress : 0.0);
+ loading || (progress == 1.0 && !switching_tab) ? progress : 0.0);
}
static void