diff options
author | creis@chromium.org <creis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-27 01:57:26 +0000 |
---|---|---|
committer | creis@chromium.org <creis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-27 01:57:26 +0000 |
commit | 397234445ea3915f88a5ae5138847b034c4c9ffc (patch) | |
tree | 525c052fa2ebf5c920a4a53cae08308f00fe08a4 /content/browser/tab_contents/render_view_host_manager.cc | |
parent | fd911dd1acb736447191b7d67ddf67db2c7260ee (diff) | |
download | chromium_src-397234445ea3915f88a5ae5138847b034c4c9ffc.zip chromium_src-397234445ea3915f88a5ae5138847b034c4c9ffc.tar.gz chromium_src-397234445ea3915f88a5ae5138847b034c4c9ffc.tar.bz2 |
Do not filter IPC messages until the new RVH commits, to avoid a race.
This is an alternate fix to http://codereview.chromium.org/8587029/.
BUG=93427
BUG=104600
TEST=Go back/forward quickly with cross-process navigations.
Review URL: http://codereview.chromium.org/9288037
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@119335 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/tab_contents/render_view_host_manager.cc')
-rw-r--r-- | content/browser/tab_contents/render_view_host_manager.cc | 50 |
1 files changed, 19 insertions, 31 deletions
diff --git a/content/browser/tab_contents/render_view_host_manager.cc b/content/browser/tab_contents/render_view_host_manager.cc index caaad5e..f517479 100644 --- a/content/browser/tab_contents/render_view_host_manager.cc +++ b/content/browser/tab_contents/render_view_host_manager.cc @@ -703,42 +703,30 @@ RenderViewHost* RenderViewHostManager::UpdateRendererStateForNavigate( } // Otherwise, it's safe to treat this as a pending cross-site transition. - // It is possible that a previous cross-site navigation caused - // render_view_host_ to be swapped out and we are still waiting for - // the old pending_render_view_host_ to inform us about the committed - // navigation. - if (!render_view_host_->is_swapped_out()) { - // Make sure the old render view stops, in case a load is in progress. - render_view_host_->Send( - new ViewMsg_Stop(render_view_host_->routing_id())); - - // Suspend the new render view (i.e., don't let it send the cross-site - // Navigate message) until we hear back from the old renderer's - // onbeforeunload handler. If the handler returns false, we'll have to - // cancel the request. - DCHECK(!pending_render_view_host_->are_navigations_suspended()); - pending_render_view_host_->SetNavigationsSuspended(true); - - // Tell the CrossSiteRequestManager that this RVH has a pending cross-site - // request, so that ResourceDispatcherHost will know to tell us to run the - // old page's onunload handler before it sends the response. - pending_render_view_host_->SetHasPendingCrossSiteRequest(true, -1); - - // Tell the old render view to run its onbeforeunload handler, since it - // doesn't otherwise know that the cross-site request is happening. This - // will trigger a call to ShouldClosePage with the reply. - render_view_host_->FirePageBeforeUnload(true); - } else { - // As the render_view_host_ is already swapped out, we do not need - // to instruct it to run its beforeunload or unload handlers. Therefore, - // we also do not need to suspend outgoing navigation messages and can - // just let the new pending_render_view_host_ immediately navigate. - } + // Make sure the old render view stops, in case a load is in progress. + render_view_host_->Send(new ViewMsg_Stop(render_view_host_->routing_id())); + + // Suspend the new render view (i.e., don't let it send the cross-site + // Navigate message) until we hear back from the old renderer's + // onbeforeunload handler. If the handler returns false, we'll have to + // cancel the request. + DCHECK(!pending_render_view_host_->are_navigations_suspended()); + pending_render_view_host_->SetNavigationsSuspended(true); + + // Tell the CrossSiteRequestManager that this RVH has a pending cross-site + // request, so that ResourceDispatcherHost will know to tell us to run the + // old page's onunload handler before it sends the response. + pending_render_view_host_->SetHasPendingCrossSiteRequest(true, -1); // We now have a pending RVH. DCHECK(!cross_navigation_pending_); cross_navigation_pending_ = true; + // Tell the old render view to run its onbeforeunload handler, since it + // doesn't otherwise know that the cross-site request is happening. This + // will trigger a call to ShouldClosePage with the reply. + render_view_host_->FirePageBeforeUnload(true); + return pending_render_view_host_; } else { if (pending_web_ui_.get() && render_view_host_->IsRenderViewLive()) |