OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/frame_host/navigator_impl.h" | 5 #include "content/browser/frame_host/navigator_impl.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 started_from_context_menu = pending_entry->has_started_from_context_menu(); | 224 started_from_context_menu = pending_entry->has_started_from_context_menu(); |
225 } | 225 } |
226 | 226 |
227 std::vector<GURL> validated_redirect_chain = redirect_chain; | 227 std::vector<GURL> validated_redirect_chain = redirect_chain; |
228 for (size_t i = 0; i < validated_redirect_chain.size(); ++i) | 228 for (size_t i = 0; i < validated_redirect_chain.size(); ++i) |
229 render_process_host->FilterURL(false, &validated_redirect_chain[i]); | 229 render_process_host->FilterURL(false, &validated_redirect_chain[i]); |
230 render_frame_host->SetNavigationHandle(NavigationHandleImpl::Create( | 230 render_frame_host->SetNavigationHandle(NavigationHandleImpl::Create( |
231 validated_url, validated_redirect_chain, | 231 validated_url, validated_redirect_chain, |
232 render_frame_host->frame_tree_node(), is_renderer_initiated, | 232 render_frame_host->frame_tree_node(), is_renderer_initiated, |
233 false, // is_same_page | 233 false, // is_same_page |
234 navigation_start, pending_nav_entry_id, started_from_context_menu)); | 234 navigation_start, pending_nav_entry_id, started_from_context_menu, |
| 235 CSPDisposition::CHECK)); // should_check_main_world_csp |
235 } | 236 } |
236 | 237 |
237 void NavigatorImpl::DidFailProvisionalLoadWithError( | 238 void NavigatorImpl::DidFailProvisionalLoadWithError( |
238 RenderFrameHostImpl* render_frame_host, | 239 RenderFrameHostImpl* render_frame_host, |
239 const FrameHostMsg_DidFailProvisionalLoadWithError_Params& params) { | 240 const FrameHostMsg_DidFailProvisionalLoadWithError_Params& params) { |
240 VLOG(1) << "Failed Provisional Load: " << params.url.possibly_invalid_spec() | 241 VLOG(1) << "Failed Provisional Load: " << params.url.possibly_invalid_spec() |
241 << ", error_code: " << params.error_code | 242 << ", error_code: " << params.error_code |
242 << ", error_description: " << params.error_description | 243 << ", error_description: " << params.error_description |
243 << ", showing_repost_interstitial: " << | 244 << ", showing_repost_interstitial: " << |
244 params.showing_repost_interstitial | 245 params.showing_repost_interstitial |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
599 // mojom::Renderer::CreateFrameProxy. | 600 // mojom::Renderer::CreateFrameProxy. |
600 render_frame_host->frame_tree_node()->SetCurrentOrigin( | 601 render_frame_host->frame_tree_node()->SetCurrentOrigin( |
601 params.origin, params.has_potentially_trustworthy_unique_origin); | 602 params.origin, params.has_potentially_trustworthy_unique_origin); |
602 | 603 |
603 render_frame_host->frame_tree_node()->SetInsecureRequestPolicy( | 604 render_frame_host->frame_tree_node()->SetInsecureRequestPolicy( |
604 params.insecure_request_policy); | 605 params.insecure_request_policy); |
605 | 606 |
606 // Navigating to a new location means a new, fresh set of http headers and/or | 607 // Navigating to a new location means a new, fresh set of http headers and/or |
607 // <meta> elements - we need to reset CSP and Feature Policy. | 608 // <meta> elements - we need to reset CSP and Feature Policy. |
608 if (!is_navigation_within_page) { | 609 if (!is_navigation_within_page) { |
609 render_frame_host->frame_tree_node()->ResetContentSecurityPolicy(); | 610 render_frame_host->ResetContentSecurityPolicies(); |
| 611 render_frame_host->frame_tree_node()->ResetCspHeaders(); |
610 render_frame_host->frame_tree_node()->ResetFeaturePolicyHeader(); | 612 render_frame_host->frame_tree_node()->ResetFeaturePolicyHeader(); |
611 } | 613 } |
612 | 614 |
613 // When using --site-per-process, we notify the RFHM for all navigations, | 615 // When using --site-per-process, we notify the RFHM for all navigations, |
614 // not just main frame navigations. | 616 // not just main frame navigations. |
615 if (oopifs_possible) { | 617 if (oopifs_possible) { |
616 FrameTreeNode* frame = render_frame_host->frame_tree_node(); | 618 FrameTreeNode* frame = render_frame_host->frame_tree_node(); |
617 frame->render_manager()->DidNavigateFrame( | 619 frame->render_manager()->DidNavigateFrame( |
618 render_frame_host, params.gesture == NavigationGestureUser); | 620 render_frame_host, params.gesture == NavigationGestureUser); |
619 } | 621 } |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
658 MSG_ROUTING_NONE, controller_->GetLastCommittedEntryIndex(), | 660 MSG_ROUTING_NONE, controller_->GetLastCommittedEntryIndex(), |
659 controller_->GetEntryCount()), | 661 controller_->GetEntryCount()), |
660 site_instance); | 662 site_instance); |
661 } | 663 } |
662 | 664 |
663 // Keep track of the last committed URL and origin in the RenderFrameHost | 665 // Keep track of the last committed URL and origin in the RenderFrameHost |
664 // itself. These allow GetLastCommittedURL and GetLastCommittedOrigin to | 666 // itself. These allow GetLastCommittedURL and GetLastCommittedOrigin to |
665 // stay correct even if the render_frame_host later becomes pending deletion. | 667 // stay correct even if the render_frame_host later becomes pending deletion. |
666 // The URL is set regardless of whether it's for a net error or not. | 668 // The URL is set regardless of whether it's for a net error or not. |
667 render_frame_host->frame_tree_node()->SetCurrentURL(params.url); | 669 render_frame_host->frame_tree_node()->SetCurrentURL(params.url); |
668 render_frame_host->set_last_committed_origin(params.origin); | 670 render_frame_host->SetLastCommittedOrigin(params.origin); |
669 | 671 |
670 // Separately, update the frame's last successful URL except for net error | 672 // Separately, update the frame's last successful URL except for net error |
671 // pages, since those do not end up in the correct process after transfers | 673 // pages, since those do not end up in the correct process after transfers |
672 // (see https://crbug.com/560511). Instead, the next cross-process navigation | 674 // (see https://crbug.com/560511). Instead, the next cross-process navigation |
673 // or transfer should decide whether to swap as if the net error had not | 675 // or transfer should decide whether to swap as if the net error had not |
674 // occurred. | 676 // occurred. |
675 // TODO(creis): Remove this block and always set the URL once transfers handle | 677 // TODO(creis): Remove this block and always set the URL once transfers handle |
676 // network errors or PlzNavigate is enabled. See https://crbug.com/588314. | 678 // network errors or PlzNavigate is enabled. See https://crbug.com/588314. |
677 if (!params.url_is_unreachable) | 679 if (!params.url_is_unreachable) |
678 render_frame_host->set_last_successful_url(params.url); | 680 render_frame_host->set_last_successful_url(params.url); |
(...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1286 if (navigation_handle) | 1288 if (navigation_handle) |
1287 navigation_handle->update_entry_id_for_transfer(entry->GetUniqueID()); | 1289 navigation_handle->update_entry_id_for_transfer(entry->GetUniqueID()); |
1288 | 1290 |
1289 controller_->SetPendingEntry(std::move(entry)); | 1291 controller_->SetPendingEntry(std::move(entry)); |
1290 if (delegate_) | 1292 if (delegate_) |
1291 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL); | 1293 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL); |
1292 } | 1294 } |
1293 } | 1295 } |
1294 | 1296 |
1295 } // namespace content | 1297 } // namespace content |
OLD | NEW |