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

Unified Diff: content/browser/web_contents/web_contents_impl.cc

Issue 1825523002: Do not reset navigation state when BeforeUnload is cancelled by a commit (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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/web_contents/web_contents_impl.cc
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 0a748f1078548df692d61e70b33952ee0b2ec6dc..948721bf3adfebeac585ea6203fac806b7cc62da 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -4690,7 +4690,9 @@ void WebContentsImpl::OnDialogClosed(int render_process_id,
render_frame_id);
last_dialog_suppressed_ = dialog_was_suppressed;
- if (is_showing_before_unload_dialog_ && !success) {
+ // It is possible for the RenderFrameHost to have been swapped out in the
+ // meantime. Do not reset the navigation state in that case.
+ if (is_showing_before_unload_dialog_ && !success && rfh == GetMainFrame()) {
Charlie Reis 2016/03/24 21:50:41 This won't work for subframes. (I know we have so
clamy 2016/03/25 13:43:48 I don't quite see which NavigationHandle I should
Charlie Reis 2016/03/25 23:59:43 Ok. I hadn't looked closely enough to see which R
clamy 2016/03/29 13:01:50 Done.
if (rfh)
rfh->frame_tree_node()->BeforeUnloadCanceled();
controller_.DiscardNonCommittedEntries();

Powered by Google App Engine
This is Rietveld 408576698