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 2d463287de60180ff5c1c2e3e3f41c96ae7d9f7b..d23172824418c72d0b24ae836ec32aa183b14d22 100644 |
--- a/content/browser/web_contents/web_contents_impl.cc |
+++ b/content/browser/web_contents/web_contents_impl.cc |
@@ -4688,9 +4688,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 current RenderFrameHost to have changed in the |
+ // 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(); |
carlosk
2016/03/31 09:48:58
This used to be called even if BeforeUnloadCancele
clamy
2016/04/01 10:19:00
Yes. This avoids deleting the entry when we're in
|
+ } |
FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
BeforeUnloadDialogCancelled()); |