diff options
author | creis@chromium.org <creis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-30 05:12:18 +0000 |
---|---|---|
committer | creis@chromium.org <creis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-30 05:12:18 +0000 |
commit | fe1b635dd8dd4965971ace2c6f977855b0edc2ab (patch) | |
tree | ac7f54f12788d67f2a323fc541fae0e8f5c95eca /content/browser | |
parent | a64c31c5b503fe298a9880cac39eab9d42ae25cf (diff) | |
download | chromium_src-fe1b635dd8dd4965971ace2c6f977855b0edc2ab.zip chromium_src-fe1b635dd8dd4965971ace2c6f977855b0edc2ab.tar.gz chromium_src-fe1b635dd8dd4965971ace2c6f977855b0edc2ab.tar.bz2 |
Only run beforeunload once during a cross-process redirect.
BUG=235914
TEST=Click a link that redirects to CWS on a page with a beforeunload handler.
Review URL: https://chromiumcodereview.appspot.com/14283018
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@197282 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser')
-rw-r--r-- | content/browser/web_contents/render_view_host_manager.cc | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/content/browser/web_contents/render_view_host_manager.cc b/content/browser/web_contents/render_view_host_manager.cc index 8c001a1..e305a71 100644 --- a/content/browser/web_contents/render_view_host_manager.cc +++ b/content/browser/web_contents/render_view_host_manager.cc @@ -832,26 +832,35 @@ RenderViewHostImpl* RenderViewHostManager::UpdateRendererStateForNavigate( render_view_host_->Send( new ViewMsg_Stop(render_view_host_->GetRoutingID())); + // We need to wait until the beforeunload handler has run, unless we are + // transferring an existing request (in which case it has already run). // 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 + // beforeunload 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, base::TimeTicks()); + bool is_transfer = + entry.transferred_global_request_id() != GlobalRequestID(); + if (!is_transfer) { + pending_render_view_host_->SetNavigationsSuspended(true, + base::TimeTicks()); + } // 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. + // old page's unload 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 + // Unless we are transferring an existing request, we should now + // tell the old render view to run its beforeunload 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); + if (!is_transfer) + render_view_host_->FirePageBeforeUnload(true); return pending_render_view_host_; } else { |