| Index: content/renderer/render_frame_impl.cc
|
| diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
|
| index 437e8c98be937398ffd4b3ca46cdfb4c5b964f16..fddcf9d26c84028266841de4693e34e35c081452 100644
|
| --- a/content/renderer/render_frame_impl.cc
|
| +++ b/content/renderer/render_frame_impl.cc
|
| @@ -1091,6 +1091,10 @@ void RenderFrameImpl::OnNavigate(
|
| } else if (is_history_navigation) {
|
| // We must know the page ID of the page we are navigating back to.
|
| DCHECK_NE(history_params.page_id, -1);
|
| + // We must know the nav entry ID of the page we are navigating back to,
|
| + // which should be the case because history navigations are routed via the
|
| + // browser.
|
| + DCHECK_NE(0, history_params.nav_entry_id);
|
| scoped_ptr<HistoryEntry> entry =
|
| PageStateToHistoryEntry(history_params.page_state);
|
| if (entry) {
|
| @@ -1135,6 +1139,10 @@ void RenderFrameImpl::OnNavigate(
|
|
|
| // A session history navigation should have been accompanied by state.
|
| CHECK_EQ(history_params.page_id, -1);
|
| + // FYIREMOVEME(avi): Page id being -1 will happen with browser-initiated new
|
| + // (non-history) navigations, and that's the test here. Nav entry unique
|
| + // ids, however, are always provided with browser-initiated navigations,
|
| + // history or new, so this test isn't valid for nav entry unique ids.
|
|
|
| // Record this before starting the load, we need a lower bound of this time
|
| // to sanitize the navigationStart override set below.
|
| @@ -2436,10 +2444,17 @@ void RenderFrameImpl::didFailProvisionalLoad(blink::WebLocalFrame* frame,
|
| //
|
| // TODO(davidben): This should also take the failed navigation's replacement
|
| // state into account, if a location.replace() failed.
|
| + ui::PageTransition transition = navigation_state->transition_type();
|
| bool replace =
|
| navigation_state->pending_page_id() != -1 ||
|
| - ui::PageTransitionCoreTypeIs(navigation_state->transition_type(),
|
| - ui::PAGE_TRANSITION_AUTO_SUBFRAME);
|
| + ui::PageTransitionCoreTypeIs(transition,
|
| + ui::PAGE_TRANSITION_AUTO_SUBFRAME);
|
| + bool replace2 =
|
| + ui::PageTransitionCoreTypeIs(transition, ui::PAGE_TRANSITION_RELOAD) ||
|
| + transition & ui::PAGE_TRANSITION_FORWARD_BACK ||
|
| + ui::PageTransitionCoreTypeIs(transition,
|
| + ui::PAGE_TRANSITION_AUTO_SUBFRAME);
|
| + DCHECK_EQ(replace, replace2);
|
|
|
| // If we failed on a browser initiated request, then make sure that our error
|
| // page load is regarded as the same browser initiated request.
|
| @@ -2457,6 +2472,7 @@ void RenderFrameImpl::didFailProvisionalLoad(blink::WebLocalFrame* frame,
|
| document_state->request_time()),
|
| HistoryNavigationParams(
|
| PageState(), navigation_state->pending_page_id(),
|
| + navigation_state->pending_nav_entry_id(),
|
| navigation_state->pending_history_list_offset(), -1, 0,
|
| navigation_state->history_list_was_cleared())));
|
| }
|
| @@ -2505,6 +2521,7 @@ void RenderFrameImpl::didCommitProvisionalLoad(
|
| }
|
| internal_data->set_use_error_page(false);
|
|
|
| + bool successful_history_nav = false;
|
| bool is_new_navigation = commit_type == blink::WebStandardCommit;
|
| if (is_new_navigation) {
|
| // We bump our Page ID to correspond with the new session history entry.
|
| @@ -2543,6 +2560,7 @@ void RenderFrameImpl::didCommitProvisionalLoad(
|
| navigation_state->pending_page_id() != render_view_->page_id_ &&
|
| !navigation_state->request_committed()) {
|
| // This is a successful session history navigation!
|
| + successful_history_nav = true;
|
| render_view_->page_id_ = navigation_state->pending_page_id();
|
|
|
| render_view_->history_list_offset_ =
|
| @@ -2550,6 +2568,13 @@ void RenderFrameImpl::didCommitProvisionalLoad(
|
| }
|
| }
|
|
|
| + if (commit_type == blink::WebBackForwardCommit) {
|
| + // Checking the commit type is planned to be the replacement for the if()
|
| + // block containing the comment "This is a successful session history
|
| + // navigation!" Make sure that it fires correspondingly.
|
| + DCHECK(successful_history_nav);
|
| + }
|
| +
|
| bool sent = Send(
|
| new FrameHostMsg_DidAssignPageId(routing_id_, render_view_->page_id_));
|
| CHECK(sent); // http://crbug.com/407376
|
| @@ -3704,8 +3729,11 @@ void RenderFrameImpl::SendDidCommitProvisionalLoad(
|
| params.http_status_code = response.httpStatusCode();
|
| params.url_is_unreachable = ds->hasUnreachableURL();
|
| params.is_post = false;
|
| + // params.commit_type = commit_type;
|
| + params.did_create_new_entry = commit_type == blink::WebStandardCommit;
|
| params.post_id = -1;
|
| params.page_id = render_view_->page_id_;
|
| + params.nav_entry_id = navigation_state->pending_nav_entry_id();
|
| // We need to track the RenderViewHost routing_id because of downstream
|
| // dependencies (crbug.com/392171 DownloadRequestHandle, SaveFileManager,
|
| // ResourceDispatcherHostImpl, MediaStreamUIProxy,
|
|
|