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

Unified Diff: content/browser/frame_host/navigation_controller_impl.cc

Issue 2952483002: Revert of Always update the omnibox URL when cancelling via onbeforeunload (Closed)
Patch Set: Created 3 years, 6 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
« no previous file with comments | « no previous file | content/browser/frame_host/render_frame_host_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/frame_host/navigation_controller_impl.cc
diff --git a/content/browser/frame_host/navigation_controller_impl.cc b/content/browser/frame_host/navigation_controller_impl.cc
index 572f3c5f2fb27d56730361bf351a9d278a1e2fb8..1f07ec664e0b2f0f212e746e2fb5d89d9d80db42 100644
--- a/content/browser/frame_host/navigation_controller_impl.cc
+++ b/content/browser/frame_host/navigation_controller_impl.cc
@@ -915,6 +915,7 @@
// the caller that nothing has happened.
if (pending_entry_) {
DiscardNonCommittedEntries();
+ delegate_->NotifyNavigationStateChanged(INVALIDATE_TYPE_URL);
}
return false;
default:
@@ -1776,26 +1777,13 @@
}
void NavigationControllerImpl::DiscardNonCommittedEntries() {
- bool discarding_visible_entry = GetVisibleEntry() != GetLastCommittedEntry();
- bool had_transient_entry = GetTransientEntry() != nullptr;
-
- // Clearing the transient entry should always result in a change to the
- // visible entry.
- DCHECK(!had_transient_entry || discarding_visible_entry);
-
- // Actually discard pending entries.
+ bool transient = transient_entry_index_ != -1;
DiscardNonCommittedEntriesInternal();
- DCHECK_EQ(GetVisibleEntry(), GetLastCommittedEntry());
- DCHECK(!GetTransientEntry());
- DCHECK(!GetPendingEntry());
-
- if (discarding_visible_entry) {
- // If we discarded a visible transient entry, invalidate all.
- // Otherwise we've discarded a pending entry, and we only
- // need to invalidate the URL.
- delegate_->NotifyNavigationStateChanged(
- had_transient_entry ? INVALIDATE_TYPE_ALL : INVALIDATE_TYPE_URL);
+ // If there was a transient entry, invalidate everything so the new active
+ // entry state is shown.
+ if (transient) {
+ delegate_->NotifyNavigationStateChanged(INVALIDATE_TYPE_ALL);
}
}
« no previous file with comments | « no previous file | content/browser/frame_host/render_frame_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698