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

Unified Diff: content/browser/renderer_host/render_view_host.cc

Issue 6973073: Avoid canceling a pending navigation if the old RVH commits right away. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix failing unit tests. Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/render_view_host.cc
diff --git a/content/browser/renderer_host/render_view_host.cc b/content/browser/renderer_host/render_view_host.cc
index 3232ed7949414dbfff3be8ad3492f01f1163dedf..8c47c98087d6063e4abdba5822b8f57a0edde237 100644
--- a/content/browser/renderer_host/render_view_host.cc
+++ b/content/browser/renderer_host/render_view_host.cc
@@ -799,25 +799,17 @@ void RenderViewHost::OnMsgNavigate(const IPC::Message& msg) {
Read(&msg, &iter, &validated_params))
return;
- // If we're waiting for a beforeunload ack from this renderer and we receive
- // a Navigate message from the main frame, then the renderer was navigating
- // before it received the request. If it is during a cross-site navigation,
- // then we should forget about the beforeunload, because the navigation will
- // now be canceled. (If it is instead during an attempt to close the page,
- // we should be sure to keep waiting for the ack, which the new page will
- // send.)
- //
- // If we did not clear this state, an unresponsiveness timer might think we
- // are waiting for an ack but are not in a cross-site navigation, and would
- // close the tab. TODO(creis): That timer code should be refactored to only
- // close the tab if we explicitly know the user tried to close the tab, and
- // not just check for the absence of a cross-site navigation. Once that's
- // fixed, this check can go away.
+ // If we're waiting for a cross-site beforeunload ack from this renderer and
+ // we receive a Navigate message from the main frame, then the renderer was
+ // navigating already and sent it before hearing the ViewMsg_Stop message.
+ // We do not want to cancel the pending navigation in this case, since the
+ // old page will soon be stopped. Instead, treat this as a beforeunload ack
+ // to allow the pending navigation to continue.
brettw 2011/06/02 08:48:24 This explanation seems reasonable, but I'm trustin
if (is_waiting_for_beforeunload_ack_ &&
unload_ack_is_for_cross_site_transition_ &&
PageTransition::IsMainFrame(validated_params.transition)) {
- is_waiting_for_beforeunload_ack_ = false;
- StopHangMonitorTimeout();
+ OnMsgShouldCloseACK(true);
+ return;
}
// If we're waiting for an unload ack from this renderer and we receive a
« no previous file with comments | « chrome/browser/tab_contents/web_contents_unittest.cc ('k') | content/browser/tab_contents/navigation_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698