[epiphany] ephy-web-view: do not clear typed address on first load



commit 0c3938f33f0a9eae849425a1dd9876f44c98a229
Author: Claudio Saavedra <csaavedra igalia com>
Date:   Mon May 12 15:38:40 2014 +0300

    ephy-web-view: do not clear typed address on first load
    
    Previously, the first page loaded in a webview would be done with
    before the user had any chance to type an address, so it was safe to
    assume that any typed address could be cleared during page loads,
    as they would always come from previously loaded pages.
    
    Now that the process of creating a webview is different and
    involves spawning a web process that needs to be ready before
    the initial page can be loaded, it might be possible for users
    to type an address before this is ready. This breaks the previous
    assumption and needs to be dealt with, in order to avoid
    cleaning up typed text during the initial page load.
    
    Additionally, it makes sense to make set_address() a no-op if
    the given address is the same as the currently loaded.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=728143

 embed/ephy-web-view.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c
index 36bb023..de2e36f 100644
--- a/embed/ephy-web-view.c
+++ b/embed/ephy-web-view.c
@@ -807,7 +807,12 @@ ephy_web_view_set_address (EphyWebView *view,
   EphyWebViewPrivate *priv = view->priv;
   GObject *object = G_OBJECT (view);
   gboolean is_blank;
+  gboolean was_empty;
 
+  if (g_strcmp0 (priv->address, address) == 0)
+    return;
+
+  was_empty = priv->address == NULL;
   g_free (priv->address);
   priv->address = g_strdup (address);
 
@@ -815,7 +820,8 @@ ephy_web_view_set_address (EphyWebView *view,
              strcmp (address, "about:blank") == 0;
   _ephy_web_view_set_is_blank (view, is_blank);
 
-  if (ephy_web_view_is_loading (view) && priv->typed_address != NULL)
+  /* If the view was empty there is no need to clean the typed address. */
+  if (!was_empty && ephy_web_view_is_loading (view) && priv->typed_address != NULL)
     ephy_web_view_set_typed_address (view, NULL);
 
   g_object_notify (object, "address");


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]