| 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 19395064f60735c176a6bdf25b5a622ba416abb9..4a0c7cec73ffc4825e29fd96547d6e33faaef1c2 100644
|
| --- a/content/browser/frame_host/navigation_request.cc
|
| +++ b/content/browser/frame_host/navigation_request.cc
|
| @@ -72,12 +72,13 @@ 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;
|
| }
|
| }
|
|
|
| @@ -231,8 +232,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 +252,42 @@ 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.
|
| + // Only normal navigations to a different document or reloads are expected.
|
| + // - Renderer-initiated fragment-navigations never take place in the browser,
|
| + // even with PlzNavigate.
|
| + // - Restore-navigations are always browser-initiated.
|
| + // - History-navigations use the browser-initiated path, event the ones that
|
| + // are initiated by a javascript script, please see the IPC message
|
| + // ViewHostMsg_GoToEntryAtOffset.
|
| + DCHECK(FrameMsg_Navigate_Type::IsReload(common_params.navigation_type) ||
|
| + common_params.navigation_type ==
|
| + FrameMsg_Navigate_Type::DIFFERENT_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 +354,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.
|
| @@ -382,8 +391,6 @@ void NavigationRequest::BeginNavigation() {
|
|
|
| void NavigationRequest::CreateNavigationHandle(int pending_nav_entry_id) {
|
| DCHECK_EQ(frame_tree_node_->navigation_request(), this);
|
| - // TODO(nasko): Update the NavigationHandle creation to ensure that the
|
| - // proper values are specified for is_same_page.
|
| FrameTreeNode* frame_tree_node = frame_tree_node_;
|
|
|
| std::vector<GURL> redirect_chain;
|
| @@ -393,11 +400,11 @@ void NavigationRequest::CreateNavigationHandle(int pending_nav_entry_id) {
|
|
|
| std::unique_ptr<NavigationHandleImpl> navigation_handle =
|
| NavigationHandleImpl::Create(
|
| - common_params_.url, redirect_chain, frame_tree_node_,
|
| - !browser_initiated_,
|
| - false, // is_same_page
|
| - common_params_.navigation_start, pending_nav_entry_id,
|
| - false); // started_in_context_menu
|
| + common_params_.url, redirect_chain, frame_tree_node_,
|
| + !browser_initiated_, FrameMsg_Navigate_Type::IsSameDocument(
|
| + common_params_.navigation_type),
|
| + common_params_.navigation_start, pending_nav_entry_id,
|
| + false); // started_in_context_menu
|
|
|
| if (!frame_tree_node->navigation_request()) {
|
| // A callback could have cancelled this request synchronously in which case
|
| @@ -723,7 +730,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.
|
|
|