Index: content/renderer/render_frame_impl.cc |
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc |
index e8a975722c1bee62d080a582d6d5aca364305502..510fa920adbd738e653769ca35d38e6a8e29a9af 100644 |
--- a/content/renderer/render_frame_impl.cc |
+++ b/content/renderer/render_frame_impl.cc |
@@ -1100,6 +1100,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_); |
+ 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. |
@@ -2554,6 +2568,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() ? |
@@ -2562,8 +2578,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(), |
Charlie Reis
2015/04/22 20:44:57
Style nit: This indent looks odd. git cl format m
Nate Chapin
2015/04/22 21:59:23
Done.
Charlie Reis
2015/04/22 22:04:29
Thanks. (I don't see the new patch uploaded yet.)
|
+ 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 resource request |
+ // 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(), |
@@ -3147,16 +3173,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); |
@@ -3295,8 +3314,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. |