Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Issue 2949023002: [WIP] Fix history.replaceState() not propagating back favicons (Closed)

Created:
3 years, 6 months ago by mastiz
Modified:
3 years, 4 months ago
Reviewers:
pkotwicz
CC:
chromium-reviews, pam+watch_chromium.org, jam, browser-components-watch_chromium.org, sync-reviews_chromium.org, darin-cc_chromium.org, sky, Charlie Reis, Nate Chapin
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

Fix history.replaceState() not propagating back favicons When a page URL replaces another one in history, the transition can be treated similarly to redirect chains such that the favicons are associated to all page URLs. This makes sense because the actual page content doesn't really change. The special handling is needed because favicons might not have been reported for the first URL, prior to the replace, since WebContents calls WebContentsObserver::DidUpdateFaviconURL() late during the page load. BUG=741340, 736254

Patch Set 1 #

Total comments: 6

Patch Set 2 : Updated. #

Patch Set 3 : Rebased. #

Patch Set 4 : Rebased. #

Patch Set 5 : Focus on history.replaceState() #

Unified diffs Side-by-side diffs Delta from patch set Stats (+92 lines, -38 lines) Patch
M chrome/browser/favicon/content_favicon_driver_browsertest.cc View 1 2 3 4 1 chunk +23 lines, -0 lines 0 comments Download
M chrome/browser/history/history_tab_helper.cc View 1 2 3 4 1 chunk +6 lines, -3 lines 0 comments Download
M chrome/browser/search_engines/chrome_template_url_service_client.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/supervised_user/supervised_user_navigation_observer.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/sync/test/integration/typed_urls_helper.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/ui/webui/web_dialog_web_contents_delegate_unittest.cc View 1 chunk +1 line, -1 line 0 comments Download
A chrome/test/data/favicon/replacestate_with_favicon.html View 1 chunk +14 lines, -0 lines 0 comments Download
M components/history/core/browser/history_backend.cc View 1 2 3 4 5 chunks +30 lines, -15 lines 0 comments Download
M components/history/core/browser/history_service.h View 1 2 3 2 chunks +3 lines, -3 lines 0 comments Download
M components/history/core/browser/history_service.cc View 1 2 3 2 chunks +4 lines, -4 lines 0 comments Download
M components/history/core/browser/history_types.h View 1 3 chunks +3 lines, -2 lines 0 comments Download
M components/history/core/browser/history_types.cc View 3 chunks +5 lines, -7 lines 0 comments Download

Messages

Total messages: 22 (9 generated)
mastiz
pkotwicz@: consider this a RFC/WIP, I'm trying to understand the situation better.
3 years, 6 months ago (2017-06-21 14:35:39 UTC) #2
pkotwicz
Scott is a better reviewer than I. The idea behind the CL sounds reasonable to ...
3 years, 6 months ago (2017-06-21 19:08:37 UTC) #4
sky
https://codereview.chromium.org/2949023002/diff/1/chrome/browser/favicon/content_favicon_driver_browsertest.cc File chrome/browser/favicon/content_favicon_driver_browsertest.cc (right): https://codereview.chromium.org/2949023002/diff/1/chrome/browser/favicon/content_favicon_driver_browsertest.cc#newcode417 chrome/browser/favicon/content_favicon_driver_browsertest.cc:417: IN_PROC_BROWSER_TEST_F(ContentFaviconDriverTest, What is android/i-os specific here? https://codereview.chromium.org/2949023002/diff/1/chrome/browser/history/history_tab_helper.cc File chrome/browser/history/history_tab_helper.cc ...
3 years, 6 months ago (2017-06-22 15:26:39 UTC) #5
mastiz
https://codereview.chromium.org/2949023002/diff/1/chrome/browser/history/history_tab_helper.cc File chrome/browser/history/history_tab_helper.cc (right): https://codereview.chromium.org/2949023002/diff/1/chrome/browser/history/history_tab_helper.cc#newcode85 chrome/browser/history/history_tab_helper.cc:85: // TODO / DONOTSUBMIT(mastiz): if we really go with ...
3 years, 6 months ago (2017-06-22 20:31:10 UTC) #6
sky
On 2017/06/22 20:31:10, mastiz wrote: > https://codereview.chromium.org/2949023002/diff/1/chrome/browser/history/history_tab_helper.cc > File chrome/browser/history/history_tab_helper.cc (right): > > https://codereview.chromium.org/2949023002/diff/1/chrome/browser/history/history_tab_helper.cc#newcode85 > ...
3 years, 6 months ago (2017-06-22 21:15:16 UTC) #9
mastiz
On 2017/06/22 21:15:16, sky wrote: > On 2017/06/22 20:31:10, mastiz wrote: > > > https://codereview.chromium.org/2949023002/diff/1/chrome/browser/history/history_tab_helper.cc ...
3 years, 5 months ago (2017-06-27 08:39:01 UTC) #10
Charlie Reis
On 2017/06/27 08:39:01, mastiz wrote: > On 2017/06/22 21:15:16, sky wrote: > > On 2017/06/22 ...
3 years, 5 months ago (2017-06-27 19:10:06 UTC) #12
mastiz
On 2017/06/27 19:10:06, Charlie Reis (OOO til July 5) wrote: > On 2017/06/27 08:39:01, mastiz ...
3 years, 5 months ago (2017-07-05 06:32:11 UTC) #14
Nate Chapin
On 2017/07/05 06:32:11, mastiz wrote: > On 2017/06/27 19:10:06, Charlie Reis (OOO til July 5) ...
3 years, 5 months ago (2017-07-11 17:40:07 UTC) #15
mastiz
On 2017/07/11 17:40:07, Nate Chapin wrote: > On 2017/07/05 06:32:11, mastiz wrote: > > On ...
3 years, 5 months ago (2017-07-11 17:54:38 UTC) #16
Nate Chapin
On 2017/07/11 17:54:38, mastiz wrote: > On 2017/07/11 17:40:07, Nate Chapin wrote: > > On ...
3 years, 5 months ago (2017-07-11 18:02:54 UTC) #17
Charlie Reis
On 2017/07/11 18:02:54, Nate Chapin wrote: > On 2017/07/11 17:54:38, mastiz wrote: > > On ...
3 years, 5 months ago (2017-07-13 16:02:47 UTC) #19
mastiz
3 years, 4 months ago (2017-07-26 18:46:59 UTC) #22
On 2017/07/13 16:02:47, Charlie Reis (slow) wrote:
> On 2017/07/11 18:02:54, Nate Chapin wrote:
> > On 2017/07/11 17:54:38, mastiz wrote:
> > > On 2017/07/11 17:40:07, Nate Chapin wrote:
> > > > On 2017/07/05 06:32:11, mastiz wrote:
> > > > > On 2017/06/27 19:10:06, Charlie Reis (OOO til July 5) wrote:
> > > > > > On 2017/06/27 08:39:01, mastiz wrote:
> > > > > > > On 2017/06/22 21:15:16, sky wrote:
> > > > > > > > On 2017/06/22 20:31:10, mastiz wrote:
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>
https://codereview.chromium.org/2949023002/diff/1/chrome/browser/history/hist...
> > > > > > > > > File chrome/browser/history/history_tab_helper.cc (right):
> > > > > > > > > 
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>
https://codereview.chromium.org/2949023002/diff/1/chrome/browser/history/hist...
> > > > > > > > > chrome/browser/history/history_tab_helper.cc:85: // TODO /
> > > > > > > > DONOTSUBMIT(mastiz):
> > > > > > > > > if we really go with IsSameDocument, the
> > > > > > > > > On 2017/06/22 15:26:39, sky wrote:
> > > > > > > > > > ?
> > > > > > > > > 
> > > > > > > > > Sorry scott, the "RFC" in the title was trying to emphasize
that
> > > this
> > > > CL
> > > > > > is
> > > > > > > > not
> > > > > > > > > in a state to be landed, or even properly reviewed.
> > > > > > > > > 
> > > > > > > > > I'm looking for guidance and people with expertise in the area
> of
> > > > > > > client-side
> > > > > > > > > redirects, including meta-refresh tags and
javascript-initiated
> > > > > (reflected
> > > > > > > in
> > > > > > > > > browser tests). This particular TODO is one of the key
> questions,
> > as
> > > > per
> > > > > > > > whether
> > > > > > > > > either of IsSameDocument() or DidReplaceEntry() is appropriate
> for
> > > > this
> > > > > > > > purpose.
> > > > > > > > 
> > > > > > > > +creis
> > > > > > > > 
> > > > > > > > Hopefully Charlie is a good source to help answer this question,
> and
> > > if
> > > > > not
> > > > > > he
> > > > > > > > hopefully knows who to point you at.
> > > > > > > 
> > > > > > > creis@: friendly ping. And please keep in mind that it's a request
> for
> > > > > > > clarification, not an actual patch that is ready to be reviewed.
See
> > > > > paragraph
> > > > > > > above from my previous reply to scott.
> > > > > > 
> > > > > > Sorry about that-- I'm pretty overloaded at the moment, trying to
> catch
> > up
> > > > on
> > > > > a
> > > > > > large number of reviews after traveling last week.  We could wait
for
> > Nate
> > > > to
> > > > > > get back?  Or we could set up a VC and I can try to share whatever I
> > can.
> > > > > > 
> > > > > >
> > > > >
> > > >
> > >
> >
>
https://codereview.chromium.org/2949023002/diff/1/chrome/browser/history/hist...
> > > > > > File chrome/browser/history/history_tab_helper.cc (right):
> > > > > > 
> > > > > >
> > > > >
> > > >
> > >
> >
>
https://codereview.chromium.org/2949023002/diff/1/chrome/browser/history/hist...
> > > > > > chrome/browser/history/history_tab_helper.cc:85: // TODO /
> > > > > DONOTSUBMIT(mastiz):
> > > > > > if we really go with IsSameDocument, the
> > > > > > On 2017/06/22 20:31:09, mastiz wrote:
> > > > > > > On 2017/06/22 15:26:39, sky wrote:
> > > > > > > > ?
> > > > > > > 
> > > > > > > Sorry scott, the "RFC" in the title was trying to emphasize that
> this
> > CL
> > > > is
> > > > > > not
> > > > > > > in a state to be landed, or even properly reviewed.
> > > > > > > 
> > > > > > > I'm looking for guidance and people with expertise in the area of
> > > > > client-side
> > > > > > > redirects, including meta-refresh tags and javascript-initiated
> > > (reflected
> > > > > in
> > > > > > > browser tests). This particular TODO is one of the key questions,
as
> > per
> > > > > > whether
> > > > > > > either of IsSameDocument() or DidReplaceEntry() is appropriate for
> > this
> > > > > > purpose.
> > > > > > 
> > > > > > I think japhet@ is probably the best person to ask about that area,
> but
> > > he's
> > > > > OOO
> > > > > > at the moment.  I'm loosely familiar.
> > > > > 
> > > > > Friendly ping for japhet@, thanks.
> > > > 
> > > > Sorry, I'm just back from vacation and digging through the queue...
> > > > 
> > > > Just to warn you, I'm pretty clueless outside of content/. However,
> > > > DidReplaceEntry and IsSameDocument seem like distinct bits that
shouldn't
> be
> > > > mixed if we can avoid it. You can have DidReplaceEntry without
> > IsSameDocument
> > > > (e.g., location.replace() to a different document) and you can have
> > > > IsSameDocument without DidReplaceEntry (e.g., history.pushState(),
setting
> > > > location.href after onload completes, etc.).
> > > > 
> > > > It seems like the bug here may be that DidReplaceEntry is incorrect for
> some
> > > > same-document navigations?
> > > 
> > > For context related to your last question, please also take a look at
> > > https://codereview.chromium.org/2972793002/
> > > 
> > > In general, it looks like the old code attempts to cover the same-document
> > case,
> > > but it does so rather (IMO) poorly, by stripping out the ref in the former
> > > history_backend.cc:2103. That could be improved by adopting
IsSameDocument()
> > > instead, but it wouldn't have user-visible impact IIUC (modulo leaked
URLs).
> > > 
> > > Taking one step further, the goal here was to handle DidReplaceEntry cases
> to
> > a
> > > different page, based on the assumption that the favicon is the same for
> both.
> > 
> > Hrm. I think creis may in fact be better qualified here. My understanding of
> > DidReplaceEntry is based on the should_replace_current_entry bit that the
> > renderer process sends to the browser process, but in looking at
> > https://codereview.chromium.org/2972793002/, it's clear that the browser
> process
> > produces something subtly different to generate DidReplaceEntry, and I'm
> > unfamiliar with its subtleties.
> 
> Sorry I didn't get to this before heading out, but it does sound like this is
> related to our other discussion on https://codereview.chromium.org/2972793002/
> (and my attempt to fix it in
https://chromium-review.googlesource.com/c/567683).
>  Maybe you can help me understand the history code a bit more when I get
back--
> it would be great if this has a chance of resolving the
> HistoryBrowserTest.RedirectHistory failure we're seeing in the other CL(s). 
And
> yes, anything we can do to make DidReplaceEntry and IsSameDocument be more
> independent of each other is an improvement.

Closing this bug because, is it turns out, replaceState/pushState are considered
navigations within the same page, which is a simpler thing to handle, as
proposed in https://chromium-review.googlesource.com/c/585130/.

I'm adding browser tests that would cover future changes related to
https://chromium-review.googlesource.com/c/567683

Powered by Google App Engine
This is Rietveld 408576698