Index: content/browser/frame_host/navigation_request.cc |
diff --git a/content/browser/frame_host/navigation_request.cc b/content/browser/frame_host/navigation_request.cc |
index 895d3891a6ca6662039bd1f7a5bf949729ed204b..05b87002ca48792f4214899fd0dbac8eaba54fee 100644 |
--- a/content/browser/frame_host/navigation_request.cc |
+++ b/content/browser/frame_host/navigation_request.cc |
@@ -72,12 +72,15 @@ void UpdateLoadFlagsWithCacheFlags( |
*load_flags |= |
net::LOAD_ONLY_FROM_CACHE | net::LOAD_SKIP_CACHE_VALIDATION; |
break; |
- case FrameMsg_Navigate_Type::NORMAL: |
+ case FrameMsg_Navigate_Type::SAME_DOCUMENT: |
+ case FrameMsg_Navigate_Type::DIFFERENT_DOCUMENT: |
+ case FrameMsg_Navigate_Type::HISTORY_SAME_DOCUMENT: |
+ case FrameMsg_Navigate_Type::HISTORY_DIFFERENT_DOCUMENT: |
if (is_post) |
*load_flags |= net::LOAD_VALIDATE_CACHE; |
break; |
- default: |
- break; |
+ case FrameMsg_Navigate_Type::UNSPECIFIED: |
+ NOTREACHED(); |
} |
} |
@@ -231,8 +234,7 @@ std::unique_ptr<NavigationRequest> NavigationRequest::CreateBrowserInitiated( |
blink::WebMixedContentContextType::Blockable, |
initiator), |
entry.ConstructRequestNavigationParams( |
- frame_entry, is_same_document_history_load, |
- is_history_navigation_in_new_child, |
+ frame_entry, is_history_navigation_in_new_child, |
entry.GetSubframeUniqueNames(frame_tree_node), |
frame_tree_node->has_committed_real_load(), |
controller->GetPendingEntryIndex() == -1, |
@@ -252,34 +254,38 @@ std::unique_ptr<NavigationRequest> NavigationRequest::CreateRendererInitiated( |
const BeginNavigationParams& begin_params, |
int current_history_list_offset, |
int current_history_list_length) { |
- // TODO(clamy): Check if some PageState should be provided here. |
nasko
2017/01/19 00:43:35
Why did this TODO disappear? Are we sure PageState
arthursonzogni
2017/01/19 17:49:21
Yes I believe that no PageState should be provided
|
+ // No history-navigation uses this method. |
+ DCHECK(!FrameMsg_Navigate_Type::IsHistory(common_params.navigation_type)); |
+ // No fragment-navigation uses this method because the navigation takes place |
nasko
2017/01/19 00:43:35
nit: Empty line before the comment.
arthursonzogni
2017/01/19 17:49:21
Acknowledged.
|
+ // in the renderer without asking the browser to navigate. |
+ DCHECK(common_params.navigation_type != |
+ FrameMsg_Navigate_Type::SAME_DOCUMENT); |
+ |
// TODO(clamy): See how we should handle override of the user agent when the |
// navigation may start in a renderer and commit in another one. |
// TODO(clamy): See if the navigation start time should be measured in the |
// renderer and sent to the browser instead of being measured here. |
// TODO(clamy): The pending history list offset should be properly set. |
RequestNavigationParams request_params( |
- false, // is_overriding_user_agent |
- std::vector<GURL>(), // redirects |
- false, // can_load_local_resources |
- PageState(), // page_state |
- 0, // nav_entry_id |
- false, // is_same_document_history_load |
- false, // is_history_navigation_in_new_child |
- std::map<std::string, bool>(), // subframe_unique_names |
+ false, // is_overriding_user_agent |
+ std::vector<GURL>(), // redirects |
+ false, // can_load_local_resources |
+ PageState(), // page_state |
+ 0, // nav_entry_id |
+ false, // is_history_navigation_in_new_child |
+ std::map<std::string, bool>(), // subframe_unique_names |
frame_tree_node->has_committed_real_load(), |
- false, // intended_as_new_entry |
- -1, // pending_history_list_offset |
+ false, // intended_as_new_entry |
+ -1, // pending_history_list_offset |
current_history_list_offset, current_history_list_length, |
- false, // is_view_source |
- false, // should_clear_history_list |
+ false, // is_view_source |
+ false, // should_clear_history_list |
begin_params.has_user_gesture); |
- std::unique_ptr<NavigationRequest> navigation_request( |
- new NavigationRequest(frame_tree_node, common_params, begin_params, |
- request_params, |
- false, // browser_initiated |
- false, // may_transfer |
- nullptr, nullptr)); |
+ std::unique_ptr<NavigationRequest> navigation_request(new NavigationRequest( |
+ frame_tree_node, common_params, begin_params, request_params, |
+ false, // browser_initiated |
+ false, // may_transfer |
+ nullptr, nullptr)); |
return navigation_request; |
} |
@@ -346,7 +352,8 @@ void NavigationRequest::BeginNavigation() { |
state_ = STARTED; |
RenderFrameDevToolsAgentHost::OnBeforeNavigation(navigation_handle_.get()); |
- if (ShouldMakeNetworkRequestForURL(common_params_.url)) { |
+ if (ShouldMakeNetworkRequestForURL(common_params_.url) && |
+ !navigation_handle_->IsSamePage()) { |
// It's safe to use base::Unretained because this NavigationRequest owns |
// the NavigationHandle where the callback will be stored. |
// TODO(clamy): pass the real value for |is_external_protocol| if needed. |
@@ -381,11 +388,11 @@ void NavigationRequest::BeginNavigation() { |
} |
void NavigationRequest::CreateNavigationHandle(int pending_nav_entry_id) { |
- // TODO(nasko): Update the NavigationHandle creation to ensure that the |
- // proper values are specified for is_same_page. |
+ bool is_same_page = |
+ FrameMsg_Navigate_Type::IsSameDocument(common_params_.navigation_type); |
nasko
2017/01/19 00:43:35
Why not call the method as part of the parameter p
arthursonzogni
2017/01/19 17:49:21
What you suggest looks good.
Done.
|
+ |
navigation_handle_ = NavigationHandleImpl::Create( |
- common_params_.url, frame_tree_node_, !browser_initiated_, |
- false, // is_same_page |
+ common_params_.url, frame_tree_node_, !browser_initiated_, is_same_page, |
common_params_.navigation_start, pending_nav_entry_id, |
false); // started_in_context_menu |
@@ -697,7 +704,8 @@ void NavigationRequest::OnWillProcessResponseChecksComplete( |
} |
void NavigationRequest::CommitNavigation() { |
- DCHECK(response_ || !ShouldMakeNetworkRequestForURL(common_params_.url)); |
+ DCHECK(response_ || !ShouldMakeNetworkRequestForURL(common_params_.url) || |
+ navigation_handle_->IsSamePage()); |
DCHECK(!common_params_.url.SchemeIs(url::kJavaScriptScheme)); |
// Retrieve the RenderFrameHost that needs to commit the navigation. |