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 e24b58e84c6d09a62902022699c380921c95f04c..f1f0d2564b0b4e82afe1a87da1e62fa81d800fb3 100644 |
--- a/content/browser/frame_host/navigation_controller_impl.cc |
+++ b/content/browser/frame_host/navigation_controller_impl.cc |
@@ -854,19 +854,24 @@ bool NavigationControllerImpl::RendererDidNavigate( |
pending_entry_->restore_type() != NavigationEntryImpl::RESTORE_NONE) |
pending_entry_->set_restore_type(NavigationEntryImpl::RESTORE_NONE); |
- // If we are doing a cross-site reload, we need to replace the existing |
- // navigation entry, not add another entry to the history. This has the side |
- // effect of removing forward browsing history, if such existed. Or if we are |
- // doing a cross-site redirect navigation, we will do a similar thing. |
+ // If the pending entry matches this commit, check if it says to replace the |
+ // current entry (which preserves forward history). This is used for things |
+ // like cross-process client redirects or cross-process reloads. |
Charlie Harrison
2016/03/11 15:15:14
Maybe reference location.replace(<cross-site>). I
Charlie Reis
2016/03/11 20:12:48
Done.
|
// |
// If this is an error load, we may have already removed the pending entry |
// when we got the notice of the load failure. If so, look at the copy of the |
- // pending parameters that were saved. |
- if (params.url_is_unreachable && failed_pending_entry_id_ != 0) { |
+ // pending parameters that were saved and see if they match the handle. |
+ NavigationHandleImpl* handle = rfh->navigation_handle(); |
+ DCHECK(handle); |
+ if (params.url_is_unreachable && failed_pending_entry_id_ != 0 && |
+ handle->pending_nav_entry_id() == failed_pending_entry_id_) { |
details->did_replace_entry = failed_pending_entry_should_replace_; |
+ } else if (pending_entry_ && |
+ pending_entry_->GetUniqueID() == handle->pending_nav_entry_id() && |
Charlie Harrison
2016/03/11 15:15:14
Suggestion: This logic is duplicated in a bunch of
Charlie Reis
2016/03/11 20:12:48
Good idea. I wrote a helper function for it.
We
|
+ pending_entry_->should_replace_entry()) { |
+ details->did_replace_entry = pending_entry_->should_replace_entry(); |
} else { |
- details->did_replace_entry = pending_entry_ && |
- pending_entry_->should_replace_entry(); |
+ details->did_replace_entry = false; |
} |
// Do navigation-type specific actions. These will make and commit an entry. |