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

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: Addressed comments 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 ba1d0cdbeb4fa6e373675f002c4a6736d0433c15..ee2d80617019ef44ba95ef46bf8f0d970f4f5fb5 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -4677,9 +4677,12 @@ void WebContentsImpl::OnDialogClosed(int render_process_id,
last_dialog_suppressed_ = dialog_was_suppressed;
if (is_showing_before_unload_dialog_ && !success) {
- if (rfh)
+ // It is possible for the RenderFrameHost to have been swapped out in the
nasko 2016/03/29 20:19:06 nit: Let's start avoiding using "swapped out" as t
clamy 2016/03/30 13:31:11 Done.
+ // meantime. Do not reset the navigation state in that case.
+ if (rfh && rfh == rfh->frame_tree_node()->current_frame_host()) {
rfh->frame_tree_node()->BeforeUnloadCanceled();
- controller_.DiscardNonCommittedEntries();
+ controller_.DiscardNonCommittedEntries();
+ }
FOR_EACH_OBSERVER(WebContentsObserver, observers_,
BeforeUnloadDialogCancelled());

Powered by Google App Engine
This is Rietveld 408576698