After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 593743 - Sort out tab, window, loading, <insert your fav> title madness
Sort out tab, window, loading, <insert your fav> title madness
Status: RESOLVED FIXED
Product: epiphany
Classification: Core
Component: Backend
git master
Other Linux
: Normal normal
: ---
Assigned To: Xan Lopez
Epiphany Maintainers
Depends on:
Blocks:
 
 
Reported: 2009-09-01 02:46 UTC by Diego Escalante Urrelo (not reading bugmail)
Modified: 2010-06-28 08:21 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
[PATCH] ephy-web-view: avoid empty titles while loading (689 bytes, patch)
2009-09-01 02:48 UTC, Diego Escalante Urrelo (not reading bugmail)
reviewed Details | Review
[PATCH] ephy-notebook: sync tab title with window title (439 bytes, patch)
2009-09-01 02:49 UTC, Diego Escalante Urrelo (not reading bugmail)
reviewed Details | Review
Proposed patch (3.53 KB, patch)
2010-01-07 17:53 UTC, Alejandro G. Castro
none Details | Review
Proposed patch (14.37 KB, patch)
2010-01-21 17:17 UTC, Alejandro G. Castro
none Details | Review
Proposed patch (14.33 KB, patch)
2010-01-26 20:45 UTC, Alejandro G. Castro
none Details | Review
Remove ephy net states patch (6.80 KB, patch)
2010-02-09 19:22 UTC, Alejandro G. Castro
accepted-commit_now Details | Review
Refactor web view load status (11.97 KB, patch)
2010-02-09 19:22 UTC, Alejandro G. Castro
needs-work Details | Review
Handle failed load status (1.09 KB, patch)
2010-02-09 19:23 UTC, Alejandro G. Castro
needs-work Details | Review
Remove ephy net states patch (7.07 KB, patch)
2010-04-29 17:48 UTC, Alejandro G. Castro
accepted-commit_now Details | Review
Refactor web view load status patch (13.29 KB, patch)
2010-04-29 17:49 UTC, Alejandro G. Castro
none Details | Review
Refactor web view load status patch (1.87 KB, patch)
2010-04-29 17:49 UTC, Alejandro G. Castro
none Details | Review
Refactor web view load status patch (13.29 KB, patch)
2010-04-29 17:53 UTC, Alejandro G. Castro
none Details | Review
Handle failed load status patch (1.87 KB, patch)
2010-04-29 17:54 UTC, Alejandro G. Castro
none Details | Review
Handle failed load status patch (1.86 KB, patch)
2010-04-29 17:58 UTC, Alejandro G. Castro
none Details | Review
Fix the load title in the provisional state (1.40 KB, patch)
2010-05-04 11:27 UTC, Alejandro G. Castro
accepted-commit_now Details | Review
Handle failed load status patch (2.24 KB, patch)
2010-05-04 11:28 UTC, Alejandro G. Castro
accepted-commit_now Details | Review
Don't report errors in title for policy change load errors (1.07 KB, patch)
2010-06-25 07:39 UTC, Mario Sánchez Prada
none Details | Review

Description Diego Escalante Urrelo (not reading bugmail) 2009-09-01 02:46:49 UTC
I'm attaching two patches, the first one modifying ephy-web-view.c avoids "" titles while loading pages. Instead it shows "Loading...".

The current behaviour is not modified other than the corner case when the pages is loading BUT there is no loading_title yet (not sure who to blame). loading_title getter is not used anywhere btw, and can't think of it as useful, it's possible functionality is already covered by title_composite.
Anyway, the logic now is: if we are loading then tell the use what are we loading or if we don't know yet just let them know we are loading; if we are not loading and the page is blank then say so, otherwise just show the real title.

The second patch makes tab titles sync with window titles, we are using composited title for windows but plain title for tabs, the current behaviour allows pages with "Loading slashdot.org" titles but Blank page tab titles, this is obviously evil and misleading.
Comment 1 Diego Escalante Urrelo (not reading bugmail) 2009-09-01 02:48:14 UTC
Created attachment 142190 [details] [review]
[PATCH] ephy-web-view: avoid empty titles while loading


Bug 593743 - Sort out tab, window, loading, <insert your fav> title madness
---
 embed/ephy-web-view.c |   14 +++++---------
 1 files changed, 5 insertions(+), 9 deletions(-)
Comment 2 Diego Escalante Urrelo (not reading bugmail) 2009-09-01 02:49:41 UTC
Created attachment 142191 [details] [review]
[PATCH] ephy-notebook: sync tab title with window title


Bug 593743 - Sort out tab, window, loading, <insert your fav> title madness
---
 src/ephy-notebook.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Comment 3 Diego Escalante Urrelo (not reading bugmail) 2009-09-01 18:33:55 UTC
On second thought, the real problem with the empty titles is that loading_title is not set by us until we get a response from the host. Deserves further investigation, this would qualify as a work around only.
Comment 4 Alejandro G. Castro 2010-01-07 07:44:23 UTC
*** Bug 606098 has been marked as a duplicate of this bug. ***
Comment 5 Alejandro G. Castro 2010-01-07 17:53:18 UTC
Created attachment 150987 [details] [review]
Proposed patch

This patch adds a new variable to handle the state of the title, the behavior of the title is like the one in Chrome and Firefox.
Comment 6 Xan Lopez 2010-01-07 22:32:39 UTC
(In reply to comment #5)
> Created an attachment (id=150987) [details] [review]
> Proposed patch
> 
> This patch adds a new variable to handle the state of the title, the behavior
> of the title is like the one in Chrome and Firefox.

I don't really like this approach, I think we are just confusing things more and more here. You are workarounding the fact that 'is_blank' has stopped working, in a way, and adding a new else branch in the get_composite_title, with new logic and a new title flag. Logically the page is still blank, so we should be using the original if, but in the WebKit port we know set the address earlier than in the gecko port through the provisional data source, which contains the address the user has typed (which not be even valid), see load_status_changed_cb in ephy-embed.c.

I think the first step in fixing this correctly is to clear this situation, reflecting the new situation correctly in the 'is_blank' flag by acknowledging that the address set from the provisional data source is not final and the page is still blank for our purposes. Then can move on to fix this bug.
Comment 7 Alejandro G. Castro 2010-01-08 16:02:22 UTC
Xan is right, the whole state code is a little mess, the is_blank actually did
not affect this problem because the code is using get_title, not
get_title_composite. And things like the NEGOTIATING are not being correctly
used. I'm going to check this code in more detail.

I've reopened the blank page bug 606098, and added a patch that fixes the
current situation, and I'm going to work in deeper review in this bug. BTW, we
could use this bug to agree about the loading sequence, after talking with Xan
a little bit this is an initial proposal:

1) "" (object created, rendering the tab), currently is "Blank page", until
LOAD_PROVISIONAL (very short time)
2) "[S] <typed_uri>", from LOAD_PROVISIONAL to LOAD_COMMITTED
3) "[S] <committed_uri>, from LOAD_COMMITTED to didReceiveTitle
4) "[S] <title>, from didReceiveTitle to LOAD_FINISHED
5) "<title>" from LOAD_FINISHED

Comments?
Comment 8 Alejandro G. Castro 2010-01-21 17:17:51 UTC
Created attachment 151954 [details] [review]
Proposed patch

This is the first proposal, it needs more testing and probably review the code structure.
Comment 9 Alejandro G. Castro 2010-01-26 20:45:26 UTC
Created attachment 152341 [details] [review]
Proposed patch

First review proposal, check it and send comments about it.
Comment 10 Xan Lopez 2010-02-05 21:36:31 UTC
(In reply to comment #9)
> Created an attachment (id=152341) [details] [review]
> Proposed patch
> 
> First review proposal, check it and send comments about it.

So, I think the direction the patch moves things is good, but I think you are doing more changes in one go than we should do (the biggest one is handling LOAD_FAILED explicitly, which AFAICT we were not doing before).

So, as usual, let's split this to make things easier: I agree than getting rid of the epiphany custom states and using the webkit ones directly is a good thing, so let's do first one patch that does that and nothing else.
Comment 11 Alejandro G. Castro 2010-02-09 19:22:27 UTC
Created attachment 153357 [details] [review]
Remove ephy net states patch

Thanks for the comments.

I've divided the patch in three steps as suggested:
   1. Remove ephy net states
   2. Refactor load status
   3. Handle failed status

And this is the first patch.
Comment 12 Alejandro G. Castro 2010-02-09 19:22:56 UTC
Created attachment 153358 [details] [review]
Refactor web view load status
Comment 13 Alejandro G. Castro 2010-02-09 19:23:39 UTC
Created attachment 153359 [details] [review]
Handle failed load status
Comment 14 Diego Escalante Urrelo (not reading bugmail) 2010-02-09 20:02:02 UTC
Review of attachment 153357 [details] [review]:

:)

::: embed/ephy-web-view.c
@@ +2332,3 @@
  * @view: an #EphyWebView
  * @uri: the uri associated with @view
+ * @state: an #WebKitLoadStatus

an -> a
Comment 15 Xan Lopez 2010-02-10 10:54:12 UTC
Comment on attachment 153357 [details] [review]
Remove ephy net states patch

Looks good!
Comment 16 Xan Lopez 2010-02-10 21:49:27 UTC
Comment on attachment 153358 [details] [review]
Refactor web view load status

You dropped the call to update_navigation_flags somewhere along the way; the function is defined but you never call it.

Also, the style guidelines (see HACKING) say to not use braces for one line clauses, would be good to take to opportunity to do that.

And one nitpick, 'eview' for the EphyWebView is kind of icky, just 'view' is fine IMHO.
Comment 17 Xan Lopez 2010-02-10 21:52:39 UTC
Comment on attachment 153359 [details] [review]
Handle failed load status

I think we should have as title something like "Problem occurred while loading %s", with the failed URL in there.
Comment 18 Alejandro G. Castro 2010-04-29 17:48:04 UTC
Created attachment 159922 [details] [review]
Remove ephy net states patch

Updated and reviewed patch
Comment 19 Alejandro G. Castro 2010-04-29 17:49:08 UTC
Created attachment 159923 [details] [review]
Refactor web view load status  patch

Updated and reviewed patch
Comment 20 Alejandro G. Castro 2010-04-29 17:49:53 UTC
Created attachment 159924 [details] [review]
Refactor web view load status patch

Updated and reviewed patch
Comment 21 Alejandro G. Castro 2010-04-29 17:53:12 UTC
Created attachment 159926 [details] [review]
Refactor web view load status patch

I messed up with the patches badly, sorry. Trying to fix the mess.
Comment 22 Alejandro G. Castro 2010-04-29 17:54:13 UTC
Created attachment 159927 [details] [review]
Handle failed load status patch

Reviewed and updated
Comment 23 Alejandro G. Castro 2010-04-29 17:58:06 UTC
Created attachment 159930 [details] [review]
Handle failed load status patch

Small style review.
Comment 24 Xan Lopez 2010-05-01 11:29:13 UTC
Comment on attachment 159922 [details] [review]
Remove ephy net states patch

ok!
Comment 25 Alejandro G. Castro 2010-05-04 11:27:33 UTC
Created attachment 160253 [details] [review]
Fix the load title in the provisional state
Comment 26 Alejandro G. Castro 2010-05-04 11:28:30 UTC
Created attachment 160254 [details] [review]
Handle failed load status patch
Comment 27 Xan Lopez 2010-05-04 11:36:21 UTC
Comment on attachment 160253 [details] [review]
Fix the load title in the provisional state

The patch looks good, but the commit message is backwards: you are avoiding setting the provisional uri as title, not the other way around.
Comment 28 Xan Lopez 2010-05-04 11:39:50 UTC
Comment on attachment 160254 [details] [review]
Handle failed load status patch

Looks fine, but should be 'A problem occurred...' ?
Comment 29 Xan Lopez 2010-05-04 12:04:45 UTC
All patches landed, closing bug.
Comment 30 Mario Sánchez Prada 2010-06-25 06:57:36 UTC
There's still a problem with the title here: 

Whenever you try to download a file with epiphany, the main window title always changes to "A problem occurred while loading <URL>", and then it either shows the dialog to select the directory or automatically starts the download process (depending on your config).

I've been taking a look to this yesterday and it seems the problem comes because WebKit always emits the "load-error" signal whenever an unhandled mime-type is going to be retrieved through epiphany, resulting in the following error code: WEBKIT_POLICY_ERROR_FRAME_LOAD_INTERRUPTED_BY_POLICY_CHANGE.

I was digging for a while with gdb and it looks policyChecker()->stopCheck() is getting called whenever this (downloading a file) happens, which ends up emitting this signal and therefore being captured in ephy and updating the title according to this piece of code:

static gboolean
load_error_cb (WebKitWebView *web_view,
               WebKitWebFrame *frame,
               gchar *uri,
               GError *error,
               gpointer user_data)
{
  EphyWebView *view = EPHY_WEB_VIEW (web_view);

  if (error->code != WEBKIT_NETWORK_ERROR_CANCELLED) {
    gchar *message;

    message = g_strdup_printf (_("A problem occurred while loading %s"),
                               uri);
    ephy_web_view_set_title (view, message);
    g_free (message);

    _ephy_web_view_set_icon_address (view, NULL);
  } else {
    EphyWebViewPrivate *priv = view->priv;

    if (priv->expire_address_now) {
      const gchar* prev_uri;

      prev_uri = webkit_web_view_get_uri (web_view);

      ephy_web_view_set_typed_address (view, NULL);
      ephy_web_view_set_address (view, prev_uri);
    }
  }

  return FALSE;
}

Hence, I'm not wondering what to do... perhaps there's a way not to get this change of policy being done (modify FrameLoaderClient::cancelPolicyCheck() not to do anything when, for instance, current status is LOAD_FINISHED?), or we should just add an extra condition to the "if" above like this:

  if (error->code != WEBKIT_NETWORK_ERROR_CANCELLED &&
      error->code != WEBKIT_POLICY_ERROR_FRAME_LOAD_INTERRUPTED_BY_POLICY_CHANGE) {

    [...]
  } else {
    [...]
  }

This second option would hide the problem for sure, but not sure that would be the right thing to do...

Opinions?

BTW, I think reopening this bug would be in place, but can't do that since I'm not the reporter. 

Diego? :-)
Comment 31 Mario Sánchez Prada 2010-06-25 07:39:58 UTC
Created attachment 164590 [details] [review]
Don't report errors in title for policy change load errors

Hmmm... seeing this in FrameLoaderClientGtk.cpp:


bool FrameLoaderClient::shouldFallBack(const ResourceError& error)
{
    return !(error.isCancellation() || error.errorCode() == WEBKIT_POLICY_ERROR_FRAME_LOAD_INTERRUPTED_BY_POLICY_CHANGE || error.errorCode() == WEBKIT_PLUGIN_ERROR_WILL_HANDLE_LOAD);
}

...looks like perhaps the idea of ignoring load errors in ephy-web-view because of policy changes (along with cancellations), wouldn't be so crazy. Still don't understand the whole thing behind this lines but just in case it was the right thing to do, I'm attaching the patch right now.

But still, eager to hear opinions or comments that help me understand why this happens this way, so don't be shy :-)
Comment 32 Alejandro G. Castro 2010-06-25 10:37:53 UTC
(In reply to comment #30)
> There's still a problem with the title here: 
> 
> Whenever you try to download a file with epiphany, the main window title always
> changes to "A problem occurred while loading <URL>", and then it either shows
> the dialog to select the directory or automatically starts the download process
> (depending on your config).
> 
> Opinions?
> 

I think you should open a new bug with this description and propose a patch with what you discovered, if we do not do that we would end up with huge bugs one about each topic.

Use something like you proposed but check if the else code is not also a problem in that case:

  if (error->code != WEBKIT_NETWORK_ERROR_CANCELLED &&
      error->code !=
WEBKIT_POLICY_ERROR_FRAME_LOAD_INTERRUPTED_BY_POLICY_CHANGE) {

    [...]
  } else {
    [...]
  }
Comment 33 Mario Sánchez Prada 2010-06-28 08:21:39 UTC
(In reply to comment #32)
> [...]
> I think you should open a new bug with this description and propose a patch
> with what you discovered, if we do not do that we would end up with huge bugs
> one about each topic.

Done: https://bugzilla.gnome.org/show_bug.cgi?id=623012
 
> Use something like you proposed but check if the else code is not also a
> problem in that case:
> 
>   if (error->code != WEBKIT_NETWORK_ERROR_CANCELLED &&
>       error->code !=
> WEBKIT_POLICY_ERROR_FRAME_LOAD_INTERRUPTED_BY_POLICY_CHANGE) {
> 
>     [...]
>   } else {
>     [...]
>   }

I think is not, but I'll double check it anyway :-)

Thanks for the feedback