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

Issue 2974553002: Fix NavigationHandle being thrown out and recreated (without all the state) after rapid navigations. (Closed)

Created:
3 years, 5 months ago by jam
Modified:
3 years, 5 months ago
Reviewers:
clamy
CC:
chromium-reviews, nasko+codewatch_chromium.org, darin-cc_chromium.org, creis+watch_chromium.org
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

Fix NavigationHandle being thrown out and recreated (without all the state) after rapid navigations. This only happens with PlzNavigate as the NavigationHandle is created when the renderer sends back the FrameHostMsg_BeforeUnload_ACK IPC. If there was a previous navigation in the renderer, it could end up generating a FrameHostMsg_DidStopLoading or FrameHostMsg_DidCommitProvisionalLoad IPCs which would reset the new navigation's NavigationHandle in RenderFrameHost. Once the new navigation receives FrameHostMsg_DidCommitProvisionalLoad, it would recreate a NavigationHandle in RenderFrameHostImpl::TakeNavigationHandleForCommit. However that NavigationHandle would be missing the SSLStatus, which is why rapid back-to-back navigations sometimes causes the SSL lock icon to disappear. Similarly, RenderFrameHostImpl::OnDidStopLoading() resets the NavigationHandle leading to the same outcome. This doesn't happen without PlzNavigate because the NavigationHandle is created later, when the FrameHostMsg_DidStartProvisionalLoad IPC is sent. This ensures that IPCs related to previous navigations have already been flushed. The fix is to call WebFrame::StopLoading when the renderer receives the FrameMsg_BeforeUnload IPC. This ensures that IPCs related to stopping/committing a previous navigations are flushed from the pipe before the new NavigationHandle is created. To handle stray IPCs related to loading finishing on a scheduled task, RenderFrameImpl::DidStopLoading also has to avoid send IPCs inbetween the time that beforeunload handler proceeded and the next commit. BUG=738177, 727892 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_site_isolation

Patch Set 1 #

Patch Set 2 : fix #

Total comments: 3
Unified diffs Side-by-side diffs Delta from patch set Stats (+52 lines, -4 lines) Patch
M chrome/browser/ssl/ssl_browser_tests.cc View 1 1 chunk +28 lines, -0 lines 0 comments Download
M content/browser/frame_host/navigation_controller_impl.cc View 1 1 chunk +1 line, -4 lines 0 comments Download
M content/renderer/render_frame_impl.h View 1 1 chunk +4 lines, -0 lines 0 comments Download
M content/renderer/render_frame_impl.cc View 1 5 chunks +19 lines, -0 lines 3 comments Download

Messages

Total messages: 38 (35 generated)
jam
https://codereview.chromium.org/2974553002/diff/80001/content/renderer/render_frame_impl.cc File content/renderer/render_frame_impl.cc (right): https://codereview.chromium.org/2974553002/diff/80001/content/renderer/render_frame_impl.cc#newcode1772 content/renderer/render_frame_impl.cc:1772: frame_->StopLoading(); this prevents stray FrameHostMsg_DidCommitProvisionalLoad and sometimes FrameHostMsg_DidStopLoading https://codereview.chromium.org/2974553002/diff/80001/content/renderer/render_frame_impl.cc#newcode5090 ...
3 years, 5 months ago (2017-07-08 01:32:49 UTC) #33
clamy
Thanks! I'm not sure the approach in that patch is what we want though. Nasko ...
3 years, 5 months ago (2017-07-10 13:02:05 UTC) #37
jam
3 years, 5 months ago (2017-07-10 14:43:45 UTC) #38
(Camille and I chatted, here's the summary)

Camille pointed out that calling stop is wrong since only beforeunload ran, and
not unload. Combined with the other points about other changes that will fix
this issue, I'm going to close this change. I will try to do an isolated change
just for the SSL state lost bug.

On 2017/07/10 13:02:05, clamy wrote:
> Thanks! I'm not sure the approach in that patch is what we want though. Nasko
> and I have been thinking that having DidStopLoading reset the NavigationHandle
> in RenderFrameHostImpl is wrong when PlzNavigate is enabled. Maybe you could
> look into that direction? Note: I'm having ahemery@ experiment with that as
part
> of skipping waiting for BeforeUnload when it's not needed. Also as part of
> refactoring NavigationRequest so that we can send OnResponseComplete to the
> renderer when we have a Mojo datapipe, I'm thinking of storing all
> NavigationHandles that we ask the renderer to commit instead of just the last
> one. This could also help with those race conditions.
> 
>
https://codereview.chromium.org/2974553002/diff/80001/content/renderer/render...
> File content/renderer/render_frame_impl.cc (right):
> 
>
https://codereview.chromium.org/2974553002/diff/80001/content/renderer/render...
> content/renderer/render_frame_impl.cc:1772: frame_->StopLoading();
> On 2017/07/08 01:32:49, jam wrote:
> > this prevents stray FrameHostMsg_DidCommitProvisionalLoad and sometimes
> > FrameHostMsg_DidStopLoading
> 
> That seems wrong to me. If we're trying to load a page and the navigation
> doesn't go through (eg if it's cancelled), the user will be stuck with a
> half-loaded page. I don't think this is what we want.

Powered by Google App Engine
This is Rietveld 408576698