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

Issue 7491096: Fix regression with back-button not working on prerendered and instant pages. (Closed)

Created:
9 years, 4 months ago by cbentzel
Modified:
9 years, 4 months ago
CC:
chromium-reviews, joi+watch-content_chromium.org, Avi (use Gerrit), jam, brettw-cc_chromium.org
Visibility:
Public.

Description

A fairly recent change introduced a history of page_ids for each RenderView, to validate that Navigation's go to legitimate pages. In the prerender and instant cases, the history of page_id's was not accurate, because it was not offset to reflect the point in time when the page was swapped in. For example, if the history for the tab looks like about:blank http://www.launchprerender.com/ http://www.prerendered_page.com/first_page.html http://www.prerendered_page.com/second_page.html The history of page_id's in the prerender-page RenderView should look like [-1, -1, 13, 14] - with the first two entries being -1 since they are not captured in this render view. Before this fix, it would look like [13, 14] - and when the back navigation was attempted, the length was not as long as expected. BUG=89798 TEST=Go to prerender_test.appspot.com, do a prerender on dev.chromium.org, click on a link within dev.chromium.org, press back and see that it works instead of spinning forever. Also, browser_tests --gtest_filter=*BackToPrerenderedPage, which fails without the change. Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=96109

Patch Set 1 #

Total comments: 1

Patch Set 2 : Regression test and clean up #

Patch Set 3 : Regression test and clean up #

Patch Set 4 : A few more touch-ups #

Patch Set 5 : Add test page #

Total comments: 10

Patch Set 6 : prerender_loader quotes #

Patch Set 7 : Add javascript function to determine if nav is to correct page #

Patch Set 8 : Call javascript #

Total comments: 15

Patch Set 9 : Naming, comments, and logic #

Patch Set 10 : Add a swap #

Total comments: 1

Patch Set 11 : Function and message name change #

Patch Set 12 : Comment change #

Total comments: 15

Patch Set 13 : Some fixes for creis #

Patch Set 14 : A few fixes for multiple history entries at swap in #

Total comments: 8

Patch Set 15 : More comments, some small fixes #

Patch Set 16 : Rebase #

Unified diffs Side-by-side diffs Delta from patch set Stats (+159 lines, -5 lines) Patch
M chrome/browser/prerender/prerender_browsertest.cc View 1 2 3 4 5 6 2 chunks +57 lines, -0 lines 0 comments Download
M chrome/test/data/prerender/prerender_loader.html View 1 2 3 4 5 2 chunks +13 lines, -5 lines 0 comments Download
A chrome/test/data/prerender/prerender_page_with_link.html View 1 2 3 4 5 6 1 chunk +30 lines, -0 lines 0 comments Download
M content/browser/tab_contents/navigation_controller.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +3 lines, -0 lines 0 comments Download
M content/browser/tab_contents/tab_contents.h View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +7 lines, -0 lines 0 comments Download
M content/browser/tab_contents/tab_contents.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 chunk +8 lines, -0 lines 0 comments Download
M content/common/view_messages.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 chunk +12 lines, -0 lines 0 comments Download
M content/renderer/render_view.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 chunk +1 line, -0 lines 0 comments Download
M content/renderer/render_view.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 2 chunks +28 lines, -0 lines 0 comments Download

Messages

Total messages: 26 (0 generated)
gavinp
http://codereview.chromium.org/7491096/diff/1/content/browser/tab_contents/tab_contents.cc File content/browser/tab_contents/tab_contents.cc (right): http://codereview.chromium.org/7491096/diff/1/content/browser/tab_contents/tab_contents.cc#newcode1806 content/browser/tab_contents/tab_contents.cc:1806: // make sure we get the right one. NIT: ...
9 years, 4 months ago (2011-08-08 16:39:47 UTC) #1
cbentzel
tburkard, mmenke: Please look at the overall change. I have both of you because this ...
9 years, 4 months ago (2011-08-09 13:50:33 UTC) #2
mmenke
http://codereview.chromium.org/7491096/diff/8002/chrome/browser/prerender/prerender_browsertest.cc File chrome/browser/prerender/prerender_browsertest.cc (right): http://codereview.chromium.org/7491096/diff/8002/chrome/browser/prerender/prerender_browsertest.cc#newcode1662 chrome/browser/prerender/prerender_browsertest.cc:1662: back_nav_observer.Wait(); Maybe run a script here or something, to ...
9 years, 4 months ago (2011-08-09 14:54:03 UTC) #3
cbentzel
http://codereview.chromium.org/7491096/diff/8002/chrome/browser/prerender/prerender_browsertest.cc File chrome/browser/prerender/prerender_browsertest.cc (right): http://codereview.chromium.org/7491096/diff/8002/chrome/browser/prerender/prerender_browsertest.cc#newcode1662 chrome/browser/prerender/prerender_browsertest.cc:1662: back_nav_observer.Wait(); On 2011/08/09 14:54:03, Matt Menke wrote: > Maybe ...
9 years, 4 months ago (2011-08-09 15:42:39 UTC) #4
mmenke
http://codereview.chromium.org/7491096/diff/8002/chrome/browser/prerender/prerender_browsertest.cc File chrome/browser/prerender/prerender_browsertest.cc (right): http://codereview.chromium.org/7491096/diff/8002/chrome/browser/prerender/prerender_browsertest.cc#newcode1662 chrome/browser/prerender/prerender_browsertest.cc:1662: back_nav_observer.Wait(); On 2011/08/09 15:42:39, cbentzel wrote: > On 2011/08/09 ...
9 years, 4 months ago (2011-08-09 15:48:37 UTC) #5
mmenke
http://codereview.chromium.org/7491096/diff/8002/chrome/browser/prerender/prerender_browsertest.cc File chrome/browser/prerender/prerender_browsertest.cc (right): http://codereview.chromium.org/7491096/diff/8002/chrome/browser/prerender/prerender_browsertest.cc#newcode1662 chrome/browser/prerender/prerender_browsertest.cc:1662: back_nav_observer.Wait(); On 2011/08/09 15:48:37, Matt Menke wrote: > On ...
9 years, 4 months ago (2011-08-09 15:49:35 UTC) #6
cbentzel
On 2011/08/09 15:49:35, Matt Menke wrote: > http://codereview.chromium.org/7491096/diff/8002/chrome/browser/prerender/prerender_browsertest.cc > File chrome/browser/prerender/prerender_browsertest.cc (right): > > http://codereview.chromium.org/7491096/diff/8002/chrome/browser/prerender/prerender_browsertest.cc#newcode1662 ...
9 years, 4 months ago (2011-08-09 15:57:36 UTC) #7
mmenke
The BrowserTest LGTM. Rest of the code looks fine, too, but I'm not familiar enough ...
9 years, 4 months ago (2011-08-09 15:59:23 UTC) #8
brettw
http://codereview.chromium.org/7491096/diff/5019/content/browser/tab_contents/tab_contents.cc File content/browser/tab_contents/tab_contents.cc (right): http://codereview.chromium.org/7491096/diff/5019/content/browser/tab_contents/tab_contents.cc#newcode1808 content/browser/tab_contents/tab_contents.cc:1808: rvh->Send(new ViewMsg_OffsetAndPruneHistory(rvh->routing_id(), offset)); Don't we need to do something ...
9 years, 4 months ago (2011-08-09 16:29:46 UTC) #9
cbentzel
http://codereview.chromium.org/7491096/diff/5019/content/browser/tab_contents/tab_contents.cc File content/browser/tab_contents/tab_contents.cc (right): http://codereview.chromium.org/7491096/diff/5019/content/browser/tab_contents/tab_contents.cc#newcode1808 content/browser/tab_contents/tab_contents.cc:1808: rvh->Send(new ViewMsg_OffsetAndPruneHistory(rvh->routing_id(), offset)); On 2011/08/09 16:29:47, brettw wrote: > ...
9 years, 4 months ago (2011-08-09 16:47:22 UTC) #10
tburkard
LGTM http://codereview.chromium.org/7491096/diff/5019/content/renderer/render_view.cc File content/renderer/render_view.cc (right): http://codereview.chromium.org/7491096/diff/5019/content/renderer/render_view.cc#newcode1023 content/renderer/render_view.cc:1023: int current_page_id = -1; I'd add a comment ...
9 years, 4 months ago (2011-08-09 17:36:03 UTC) #11
brettw
http://codereview.chromium.org/7491096/diff/5019/content/browser/tab_contents/tab_contents.cc File content/browser/tab_contents/tab_contents.cc (right): http://codereview.chromium.org/7491096/diff/5019/content/browser/tab_contents/tab_contents.cc#newcode1808 content/browser/tab_contents/tab_contents.cc:1808: rvh->Send(new ViewMsg_OffsetAndPruneHistory(rvh->routing_id(), offset)); Okay, I think that answers my ...
9 years, 4 months ago (2011-08-09 18:14:40 UTC) #12
cbentzel
I will add comments describing what this is doing. http://codereview.chromium.org/7491096/diff/5019/content/common/view_messages.h File content/common/view_messages.h (right): http://codereview.chromium.org/7491096/diff/5019/content/common/view_messages.h#newcode747 content/common/view_messages.h:747: ...
9 years, 4 months ago (2011-08-09 18:21:14 UTC) #13
cbentzel
Thanks for the reviews so far. http://codereview.chromium.org/7491096/diff/5019/content/browser/tab_contents/tab_contents.cc File content/browser/tab_contents/tab_contents.cc (right): http://codereview.chromium.org/7491096/diff/5019/content/browser/tab_contents/tab_contents.cc#newcode1808 content/browser/tab_contents/tab_contents.cc:1808: rvh->Send(new ViewMsg_OffsetAndPruneHistory(rvh->routing_id(), offset)); ...
9 years, 4 months ago (2011-08-09 19:12:14 UTC) #14
brettw
http://codereview.chromium.org/7491096/diff/5019/content/common/view_messages.h File content/common/view_messages.h (right): http://codereview.chromium.org/7491096/diff/5019/content/common/view_messages.h#newcode747 content/common/view_messages.h:747: // Used to fix page_id offsets when pruning history. ...
9 years, 4 months ago (2011-08-09 19:38:33 UTC) #15
brettw
Sorry for the confusing comments. Apparently I forgot to send mail from my last pass ...
9 years, 4 months ago (2011-08-09 19:40:04 UTC) #16
cbentzel
I changed the name to SetHistoryLengthAndClear and updated comments. No functional changes were made with ...
9 years, 4 months ago (2011-08-09 20:23:10 UTC) #17
brettw
LGTM. Charlie: it would be great if you could take a look at this when ...
9 years, 4 months ago (2011-08-09 20:55:45 UTC) #18
cbentzel
Charlie's looking at it now. I'm going to hold off landing until he gets eyes ...
9 years, 4 months ago (2011-08-09 20:58:05 UTC) #19
Charlie Reis
Thanks Chris. My comments below-- I'm mainly concerned about what would happen if this were ...
9 years, 4 months ago (2011-08-09 20:59:31 UTC) #20
cbentzel
Still looking at the other issues you brought up. http://codereview.chromium.org/7491096/diff/15013/content/browser/tab_contents/navigation_controller.cc File content/browser/tab_contents/navigation_controller.cc (right): http://codereview.chromium.org/7491096/diff/15013/content/browser/tab_contents/navigation_controller.cc#newcode936 content/browser/tab_contents/navigation_controller.cc:936: ...
9 years, 4 months ago (2011-08-09 21:21:12 UTC) #21
cbentzel
My most recent patch set does a better job handling the case that the prerendered ...
9 years, 4 months ago (2011-08-09 22:22:14 UTC) #22
Charlie Reis
Thanks-- comments inline. http://codereview.chromium.org/7491096/diff/15013/content/browser/tab_contents/tab_contents.cc File content/browser/tab_contents/tab_contents.cc (right): http://codereview.chromium.org/7491096/diff/15013/content/browser/tab_contents/tab_contents.cc#newcode600 content/browser/tab_contents/tab_contents.cc:600: RenderViewHost* rvh = render_view_host(); On 2011/08/09 ...
9 years, 4 months ago (2011-08-09 22:51:42 UTC) #23
cbentzel
Thanks again for the review. Last patchset is what I plan to land with additional ...
9 years, 4 months ago (2011-08-09 23:14:23 UTC) #24
Charlie Reis
OK, LGTM for tonight. Let's follow up for round 2 tomorrow. http://codereview.chromium.org/7491096/diff/15013/content/browser/tab_contents/tab_contents.cc File content/browser/tab_contents/tab_contents.cc (right): ...
9 years, 4 months ago (2011-08-09 23:25:16 UTC) #25
cbentzel
9 years, 4 months ago (2011-08-09 23:29:37 UTC) #26
I kicked off tryjobs and don't want to introduce anything else at this
point. I already created a new branch that has these changes in it so
I won't forget.

On Tue, Aug 9, 2011 at 7:25 PM,  <creis@chromium.org> wrote:
> OK, LGTM for tonight.  Let's follow up for round 2 tomorrow.
>
>
>
http://codereview.chromium.org/7491096/diff/15013/content/browser/tab_content...
> File content/browser/tab_contents/tab_contents.cc (right):
>
>
http://codereview.chromium.org/7491096/diff/15013/content/browser/tab_content...
> content/browser/tab_contents/tab_contents.cc:600: RenderViewHost* rvh =
> render_view_host();
> On 2011/08/09 22:51:42, creis wrote:
>>
>> On 2011/08/09 22:22:15, cbentzel wrote:
>> > On 2011/08/09 20:59:31, creis wrote:
>> > > This concerns me because a TabContents can have multiple
>
> RenderViewHosts
>>
>> > (e.g.,
>> > > a pending one), making a race possible here if this is called at
>
> the wrong
>>
>> > time.
>> > >  We would not want to send this message to an in-use
>
> RenderViewHost, since
>>
>> it
>> > > could corrupt its history and lead to worse problems.
>> > >
>> > > Are there assertions we can make here to be sure we're actually
>
> swapping in
>>
>> a
>> > > new TabContents that doesn't have a pending RVH?
>> >
>> > Is there a way to retrieve whether a NavigationEntry would be
>
> handled by a
>>
>> > particular RenderViewHost? I could skip sending this message down if
>
> the
>>
>> current
>> > render_view_host_ does not work for the NavigationEntry we are
>
> trying to
>>
>> retain
>> > when pruning.
>
>> Yes-- you can compare the SiteInstance of the NavigationEntry (if it
>
> has one)
>>
>> with the SiteInstance of the RVH.  If they don't match, abort.
>
> Please remember this for the followup CL.  (Maybe with a TODO?)
>
>
http://codereview.chromium.org/7491096/diff/15013/content/browser/tab_content...
> File content/browser/tab_contents/tab_contents.h (right):
>
>
http://codereview.chromium.org/7491096/diff/15013/content/browser/tab_content...
> content/browser/tab_contents/tab_contents.h:626: // Sets the history for
> this tab_contents to |history_length| entries, and
> On 2011/08/09 20:59:31, creis wrote:
>>
>> Sounds odd to me to "set the history for a TabContents."  History is
>
> maintained
>>
>> in the NavigationController and not here, but NavigationController is
>
> the one
>>
>> telling us to do this.
>
>> Perhaps we should say that it updates the history length in the
>
> current
>>
>> RenderView.
>
> Can you squeeze in this fix as well?
>
> http://codereview.chromium.org/7491096/
>

Powered by Google App Engine
This is Rietveld 408576698