Index: content/renderer/render_frame_impl.cc |
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc |
index 0db8f24e912c0fabcddef7f30b37c8e696090b5a..8c1ab266ace3faf8c088c894958013f944e218ce 100644 |
--- a/content/renderer/render_frame_impl.cc |
+++ b/content/renderer/render_frame_impl.cc |
@@ -357,6 +357,14 @@ bool IsBrowserInitiated(NavigationParams* pending) { |
!pending->common_params.url.SchemeIs(url::kJavaScriptScheme); |
} |
+bool IsHistoryNavigation(const PageState& page_state, |
+ const ExplodedFrameState& frame_state) { |
+ if (SiteIsolationPolicy::UseSubframeNavigationEntries()) |
+ return frame_state.item_sequence_number != 0; |
+ |
+ return page_state.IsValid(); |
+} |
+ |
NOINLINE void CrashIntentionally() { |
// NOTE(shess): Crash directly rather than using NOTREACHED() so |
// that the signature is easier to triage in crash reports. |
@@ -4247,7 +4255,7 @@ void RenderFrameImpl::SendDidCommitProvisionalLoad( |
// In --site-per-process, just send a single HistoryItem for this frame, |
// rather than the whole tree. It will be stored in the corresponding |
// FrameNavigationEntry. |
- params.page_state = SingleHistoryItemToPageState(item); |
+ params.frame_state = HistoryItemToFrameState(item); |
post_id = ExtractPostId(item); |
} |
params.frame_unique_name = item.target().utf8(); |
@@ -4426,7 +4434,8 @@ void RenderFrameImpl::OnFailedNavigation( |
bool has_stale_copy_in_cache, |
int error_code) { |
bool is_reload = IsReload(common_params.navigation_type); |
- bool is_history_navigation = request_params.page_state.IsValid(); |
+ bool is_history_navigation = IsHistoryNavigation(request_params.page_state, |
+ request_params.frame_state); |
WebURLRequest::CachePolicy cache_policy = |
WebURLRequest::UseProtocolCachePolicy; |
RenderFrameImpl::PrepareRenderViewForNavigation( |
@@ -4756,7 +4765,8 @@ void RenderFrameImpl::NavigateInternal( |
// Lower bound for browser initiated navigation start time. |
base::TimeTicks renderer_navigation_start = base::TimeTicks::Now(); |
bool is_reload = IsReload(common_params.navigation_type); |
- bool is_history_navigation = request_params.page_state.IsValid(); |
+ bool is_history_navigation = IsHistoryNavigation(request_params.page_state, |
+ request_params.frame_state); |
WebURLRequest::CachePolicy cache_policy = |
WebURLRequest::UseProtocolCachePolicy; |
RenderFrameImpl::PrepareRenderViewForNavigation( |
@@ -4842,17 +4852,38 @@ void RenderFrameImpl::NavigateInternal( |
// which should be the case because history navigations are routed via the |
// browser. |
DCHECK_NE(0, request_params.nav_entry_id); |
- scoped_ptr<HistoryEntry> entry = |
- PageStateToHistoryEntry(request_params.page_state); |
- if (entry) { |
- // Ensure we didn't save the swapped out URL in UpdateState, since the |
- // browser should never be telling us to navigate to swappedout://. |
- CHECK(entry->root().urlString() != WebString::fromUTF8(kSwappedOutURL)); |
- |
- if (!browser_side_navigation) { |
- scoped_ptr<NavigationParams> navigation_params( |
- new NavigationParams(*pending_navigation_params_.get())); |
- if (!SiteIsolationPolicy::UseSubframeNavigationEntries()) { |
+ |
+ scoped_ptr<NavigationParams> navigation_params( |
+ new NavigationParams(*pending_navigation_params_.get())); |
+ |
+ if (SiteIsolationPolicy::UseSubframeNavigationEntries() && |
+ !browser_side_navigation) { |
+ // In --site-per-process, the browser process sends a WebHistoryItem |
+ // destined for this frame. |
+ SetPendingNavigationParams(navigation_params.Pass()); |
+ blink::WebHistoryItem history_item = |
+ FrameStateToHistoryItem(request_params.frame_state); |
+ blink::WebHistoryLoadType load_type = |
+ request_params.is_same_document_history_load |
+ ? blink::WebHistorySameDocumentLoad |
+ : blink::WebHistoryDifferentDocumentLoad; |
+ |
+ // Navigate the frame directly. |
+ // TODO(creis): Use InitialHistoryLoad rather than BackForward for a |
+ // history navigation in a newly created subframe. |
+ WebURLRequest request = |
+ frame_->requestFromHistoryItem(history_item, cache_policy); |
+ frame_->load(request, blink::WebFrameLoadType::BackForward, history_item, |
+ load_type); |
+ } else { |
+ scoped_ptr<HistoryEntry> entry = |
+ PageStateToHistoryEntry(request_params.page_state); |
+ if (entry) { |
+ // Ensure we didn't save the swapped out URL in UpdateState, since the |
+ // browser should never be telling us to navigate to swappedout://. |
+ CHECK(entry->root().urlString() != WebString::fromUTF8(kSwappedOutURL)); |
+ |
+ if (!browser_side_navigation) { |
// By default, tell the HistoryController to go the deserialized |
// HistoryEntry. This only works if all frames are in the same |
// process. |
@@ -4860,36 +4891,17 @@ void RenderFrameImpl::NavigateInternal( |
render_view_->history_controller()->GoToEntry( |
frame_, entry.Pass(), navigation_params.Pass(), cache_policy); |
} else { |
- // In --site-per-process, the browser process sends a single |
- // WebHistoryItem destined for this frame. |
- // TODO(creis): Change PageState to FrameState. In the meantime, we |
- // store the relevant frame's WebHistoryItem in the root of the |
- // PageState. |
- SetPendingNavigationParams(navigation_params.Pass()); |
- blink::WebHistoryItem history_item = entry->root(); |
- blink::WebHistoryLoadType load_type = |
- request_params.is_same_document_history_load |
- ? blink::WebHistorySameDocumentLoad |
- : blink::WebHistoryDifferentDocumentLoad; |
- |
- // Navigate the frame directly. |
- // TODO(creis): Use InitialHistoryLoad rather than BackForward for a |
- // history navigation in a newly created subframe. |
- WebURLRequest request = |
- frame_->requestFromHistoryItem(history_item, cache_policy); |
- frame_->load(request, blink::WebFrameLoadType::BackForward, |
- history_item, load_type); |
+ // TODO(clamy): this should be set to the HistoryItem sent by the |
+ // browser once the HistoryController has moved to the browser. |
+ // TODO(clamy): distinguish between different document and same |
+ // document |
+ // loads. |
+ // TODO(clamy): update this for subframes history loads. |
+ item_for_history_navigation = |
+ entry->GetHistoryNodeForFrame(this)->item(); |
+ load_type = blink::WebFrameLoadType::BackForward; |
+ should_load_request = true; |
} |
- } else { |
- // TODO(clamy): this should be set to the HistoryItem sent by the |
- // browser once the HistoryController has moved to the browser. |
- // TODO(clamy): distinguish between different document and same document |
- // loads. |
- // TODO(clamy): update this for subframes history loads. |
- item_for_history_navigation = |
- entry->GetHistoryNodeForFrame(this)->item(); |
- load_type = blink::WebFrameLoadType::BackForward; |
- should_load_request = true; |
} |
} |
} else { |
@@ -5204,7 +5216,7 @@ void RenderFrameImpl::SendUpdateState() { |
return; |
Send(new FrameHostMsg_UpdateState( |
- routing_id_, SingleHistoryItemToPageState(current_history_item_))); |
+ routing_id_, HistoryItemToFrameState(current_history_item_))); |
} |
void RenderFrameImpl::SendFailedProvisionalLoad( |
@@ -5290,12 +5302,15 @@ void RenderFrameImpl::PopulateDocumentStateFromPending( |
WebURLRequest::UseProtocolCachePolicy); |
} |
- if (IsReload(pending_navigation_params_->common_params.navigation_type)) |
+ if (IsReload(pending_navigation_params_->common_params.navigation_type)) { |
document_state->set_load_type(DocumentState::RELOAD); |
- else if (pending_navigation_params_->request_params.page_state.IsValid()) |
+ } else if (IsHistoryNavigation( |
+ pending_navigation_params_->request_params.page_state, |
+ pending_navigation_params_->request_params.frame_state)) { |
document_state->set_load_type(DocumentState::HISTORY_LOAD); |
- else |
+ } else { |
document_state->set_load_type(DocumentState::NORMAL_LOAD); |
+ } |
internal_data->set_is_overriding_user_agent( |
pending_navigation_params_->request_params.is_overriding_user_agent); |