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

Issue 2226023003: Fix RenderView reuse issues after a pending RenderFrameHost dies. (Closed)

Created:
4 years, 4 months ago by alexmos
Modified:
4 years, 4 months ago
Reviewers:
nasko
CC:
chromium-reviews, jam, nasko+codewatch_chromium.org, darin-cc_chromium.org, creis+watch_chromium.org, site-isolation-reviews_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Fix RenderView reuse issues after a pending RenderFrameHost dies. This CL fixes two issues related to a pending RenderFrameHost's process dying before commit. First, the is_active() state of RVH was being reset to true in ResetWaitingState(), called as part of RenderFrameHostImpl::Navigate(). This leaves the RVH with the wrong state if that navigation never commits, which was the case if the pending RFH's process dies before commit. If the RVH is reused later, it will be reinitialized with params.swapped_out being false, even if there is still a corresponding proxy around. To fix this, this CL moves the RVH::set_is_active(true) to be done at commit time, which matches the point in time at which we update the RVH's main_frame_routing_id_ and also better matches what happens on the renderer side. Second, UpdateStateForNavigate attempts to reuse the pending RFH for a same-site navigation. This failed when the reused pending RFH was not live: when trying to reinitialize it in RFHM::Navigate(), we hit a CHECK in CreateRenderView due to having neither a main frame routing ID nor a proxy ID. This is because the RVH doesn't have a main frame routing ID (since the pending RFH died before commit, and main frame routing ID is updated at commit); and while it does have a corresponding proxy (which isn't live), the InitRenderView call in RenderFrameHostManager::Navigate doesn't pass it in: if (!dest_render_frame_host->IsRenderFrameLive()) { ... if (!InitRenderView(dest_render_frame_host->render_view_host(), nullptr)) ... } To fix this, this CL destroys the pending RFH when its process dies, as there is no reason to keep it around. This way, we can be certain that when a pending RFH is reused, it will be live. The InitRenderView call above is still problematic -- namely, it is not correct for reinitializing a subframe dest_render_frame_host -- but that will be fixed in a follow-up CL and tracked in issue 634368. BUG=627400, 627893, 544755, 581912, 575245 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_site_isolation Committed: https://crrev.com/20b99f04d03da2bcf3b7381955040aa9d4fc15a0 Cr-Commit-Position: refs/heads/master@{#410925}

Patch Set 1 #

Patch Set 2 : Resolve conflicts #

Total comments: 20

Patch Set 3 : Address feedback from creis@ and nasko@ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+155 lines, -19 lines) Patch
M content/browser/frame_host/render_frame_host_impl.cc View 1 2 3 chunks +11 lines, -12 lines 0 comments Download
M content/browser/frame_host/render_frame_host_manager.h View 1 2 3 chunks +7 lines, -3 lines 0 comments Download
M content/browser/frame_host/render_frame_host_manager.cc View 1 2 3 chunks +22 lines, -3 lines 0 comments Download
M content/browser/renderer_host/render_view_host_impl.cc View 1 chunk +1 line, -1 line 0 comments Download
M content/browser/site_per_process_browsertest.cc View 1 2 1 chunk +114 lines, -0 lines 0 comments Download

Dependent Patchsets:

Messages

Total messages: 27 (17 generated)
alexmos
Nasko, can you please take a look? https://codereview.chromium.org/2226023003/diff/20001/content/browser/frame_host/render_frame_host_impl.cc File content/browser/frame_host/render_frame_host_impl.cc (left): https://codereview.chromium.org/2226023003/diff/20001/content/browser/frame_host/render_frame_host_impl.cc#oldcode2146 content/browser/frame_host/render_frame_host_impl.cc:2146: render_view_host_->set_is_active(true); Looking ...
4 years, 4 months ago (2016-08-08 23:59:02 UTC) #9
Charlie Reis
https://codereview.chromium.org/2226023003/diff/20001/content/browser/frame_host/render_frame_host_manager.cc File content/browser/frame_host/render_frame_host_manager.cc (right): https://codereview.chromium.org/2226023003/diff/20001/content/browser/frame_host/render_frame_host_manager.cc#newcode1032 content/browser/frame_host/render_frame_host_manager.cc:1032: void RenderFrameHostManager::CancelPendingIfNecessary( Drive-by: I just made CancelPending() public in ...
4 years, 4 months ago (2016-08-09 16:31:19 UTC) #12
nasko
Looks very good! Few comments. https://codereview.chromium.org/2226023003/diff/20001/content/browser/frame_host/render_frame_host_impl.cc File content/browser/frame_host/render_frame_host_impl.cc (left): https://codereview.chromium.org/2226023003/diff/20001/content/browser/frame_host/render_frame_host_impl.cc#oldcode2146 content/browser/frame_host/render_frame_host_impl.cc:2146: render_view_host_->set_is_active(true); On 2016/08/08 23:59:01, ...
4 years, 4 months ago (2016-08-09 18:32:32 UTC) #13
alexmos
Thanks for reviewing! Comments addressed, including Charlie's drive-by. https://codereview.chromium.org/2226023003/diff/20001/content/browser/frame_host/render_frame_host_impl.cc File content/browser/frame_host/render_frame_host_impl.cc (left): https://codereview.chromium.org/2226023003/diff/20001/content/browser/frame_host/render_frame_host_impl.cc#oldcode2146 content/browser/frame_host/render_frame_host_impl.cc:2146: render_view_host_->set_is_active(true); ...
4 years, 4 months ago (2016-08-09 23:09:46 UTC) #16
nasko
Thanks for tracking this down and fixing it! LGTM https://codereview.chromium.org/2226023003/diff/20001/content/browser/frame_host/render_frame_host_manager.cc File content/browser/frame_host/render_frame_host_manager.cc (right): https://codereview.chromium.org/2226023003/diff/20001/content/browser/frame_host/render_frame_host_manager.cc#newcode2213 content/browser/frame_host/render_frame_host_manager.cc:2213: ...
4 years, 4 months ago (2016-08-09 23:49:15 UTC) #17
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2226023003/40001
4 years, 4 months ago (2016-08-09 23:50:28 UTC) #20
commit-bot: I haz the power
Try jobs failed on following builders: linux_android_rel_ng on master.tryserver.chromium.android (JOB_FAILED, https://build.chromium.org/p/tryserver.chromium.android/builders/linux_android_rel_ng/builds/119263)
4 years, 4 months ago (2016-08-10 00:46:07 UTC) #22
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2226023003/40001
4 years, 4 months ago (2016-08-10 00:48:11 UTC) #24
commit-bot: I haz the power
Committed patchset #3 (id:40001)
4 years, 4 months ago (2016-08-10 02:20:38 UTC) #25
commit-bot: I haz the power
4 years, 4 months ago (2016-08-10 02:22:33 UTC) #27
Message was sent while issue was closed.
Patchset 3 (id:??) landed as
https://crrev.com/20b99f04d03da2bcf3b7381955040aa9d4fc15a0
Cr-Commit-Position: refs/heads/master@{#410925}

Powered by Google App Engine
This is Rietveld 408576698