Chromium Code Reviews| Index: content/renderer/render_frame_impl.cc |
| diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc |
| index 93029e3f14a69e9a308fdcc205568f9ac5cfa18c..412b64a08b385d0fda646a6438dea9bc381658d9 100644 |
| --- a/content/renderer/render_frame_impl.cc |
| +++ b/content/renderer/render_frame_impl.cc |
| @@ -1097,6 +1097,20 @@ void RenderFrameImpl::OnNavigate( |
| << request_params.frame_to_navigate; |
| } |
| + // If this frame isn't in the same process as its parent, it will naively |
| + // assume that this is the first navigation in the iframe, but this may not |
| + // actually be the case. The PageTransition differentiates between the first |
| + // navigation in a subframe and subsequent navigations, so if this is a |
| + // subsequent navigation, force the frame's state machine forward. |
| + if (ui::PageTransitionCoreTypeIs(common_params.transition, |
| + ui::PAGE_TRANSITION_MANUAL_SUBFRAME)) { |
| + CHECK(frame_->parent()); |
| + if (frame_->parent()->isWebRemoteFrame()) { |
| + CHECK_EQ(frame, frame_); |
|
Charlie Reis
2015/04/15 22:46:11
Is the assumption here that frame_to_navigate is o
Nate Chapin
2015/04/17 21:48:18
Uhh, now that I trace through this, it looks like
Charlie Reis
2015/04/22 20:44:56
Hmm, ok. We can leave it as is, and I'll try to c
|
| + frame_->setCommittedFirstRealLoad(); |
| + } |
| + } |
| + |
| if (is_reload && !render_view_->history_controller()->GetCurrentEntry()) { |
| // We cannot reload if we do not have any history state. This happens, for |
| // example, when recovering from a crash. |
| @@ -2544,6 +2558,8 @@ void RenderFrameImpl::didStartProvisionalLoad(blink::WebLocalFrame* frame, |
| document_state->set_start_load_time(Time::Now()); |
| bool is_top_most = !frame->parent(); |
| + NavigationStateImpl* navigation_state = |
| + static_cast<NavigationStateImpl*>(document_state->navigation_state()); |
| if (is_top_most) { |
| render_view_->set_navigation_gesture( |
| WebUserGestureIndicator::isProcessingUserGesture() ? |
| @@ -2552,8 +2568,18 @@ void RenderFrameImpl::didStartProvisionalLoad(blink::WebLocalFrame* frame, |
| // Subframe navigations that don't add session history items must be |
| // marked with AUTO_SUBFRAME. See also didFailProvisionalLoad for how we |
| // handle loading of error pages. |
| - static_cast<NavigationStateImpl*>(document_state->navigation_state()) |
| - ->set_transition_type(ui::PAGE_TRANSITION_AUTO_SUBFRAME); |
| + navigation_state->set_transition_type(ui::PAGE_TRANSITION_AUTO_SUBFRAME); |
| + } else if (ui::PageTransitionCoreTypeIs( |
| + navigation_state->GetTransitionType(), |
| + ui::PAGE_TRANSITION_LINK)) { |
| + // Subframe navigations that are creating a new history item should be |
| + // marked MANUAL_SUBFRAME, unless it has already been marked as a |
| + // FORM_SUBMIT. This state will be attached to a main resouce request |
|
Charlie Reis
2015/04/15 22:46:11
nit: resource
Nate Chapin
2015/04/17 21:48:18
Done.
|
| + // in the process that began the request. If the request is transferred |
| + // to a different process, this state will be used in |
| + // RenderFrameImpl::OnNavigate() in the new process (as well as in the |
| + // browser process). |
| + navigation_state->set_transition_type(ui::PAGE_TRANSITION_MANUAL_SUBFRAME); |
| } |
| FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(), |
| @@ -3172,16 +3198,9 @@ void RenderFrameImpl::willSendRequest( |
| } |
| } |
| - WebFrame* top_frame = frame->top(); |
| - // TODO(nasko): Hack around asking about top-frame data source. This means |
| - // for out-of-process iframes we are treating the current frame as the |
| - // top-level frame, which is wrong. |
| - if (!top_frame || top_frame->isWebRemoteFrame()) |
| - top_frame = frame; |
| - WebDataSource* provisional_data_source = top_frame->provisionalDataSource(); |
| - WebDataSource* top_data_source = top_frame->dataSource(); |
| + WebDataSource* provisional_data_source = frame->provisionalDataSource(); |
| WebDataSource* data_source = |
| - provisional_data_source ? provisional_data_source : top_data_source; |
| + provisional_data_source ? provisional_data_source : frame->dataSource(); |
| DocumentState* document_state = DocumentState::FromDataSource(data_source); |
| DCHECK(document_state); |
| @@ -3320,8 +3339,14 @@ void RenderFrameImpl::willSendRequest( |
| extra_data->set_stream_override(stream_override.Pass()); |
| request.setExtraData(extra_data); |
| + WebFrame* top_frame = frame->top(); |
| + // TODO(nasko): Hack around asking about top-frame data source. This means |
| + // for out-of-process iframes we are treating the current frame as the |
| + // top-level frame, which is wrong. |
| + if (!top_frame || top_frame->isWebRemoteFrame()) |
| + top_frame = frame; |
| DocumentState* top_document_state = |
| - DocumentState::FromDataSource(top_data_source); |
| + DocumentState::FromDataSource(top_frame->dataSource()); |
| if (top_document_state) { |
| // TODO(gavinp): separate out prefetching and prerender field trials |
| // if the rel=prerender rel type is sticking around. |