Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(321)

Side by Side Diff: content/browser/frame_host/navigator_impl.cc

Issue 2756913002: Revert of PlzNavigate: Enforce 'frame-src' CSP on the browser. (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
236 } 235 }
237 236
238 void NavigatorImpl::DidFailProvisionalLoadWithError( 237 void NavigatorImpl::DidFailProvisionalLoadWithError(
239 RenderFrameHostImpl* render_frame_host, 238 RenderFrameHostImpl* render_frame_host,
240 const FrameHostMsg_DidFailProvisionalLoadWithError_Params& params) { 239 const FrameHostMsg_DidFailProvisionalLoadWithError_Params& params) {
241 VLOG(1) << "Failed Provisional Load: " << params.url.possibly_invalid_spec() 240 VLOG(1) << "Failed Provisional Load: " << params.url.possibly_invalid_spec()
242 << ", error_code: " << params.error_code 241 << ", error_code: " << params.error_code
243 << ", error_description: " << params.error_description 242 << ", error_description: " << params.error_description
244 << ", showing_repost_interstitial: " << 243 << ", showing_repost_interstitial: " <<
245 params.showing_repost_interstitial 244 params.showing_repost_interstitial
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
606 // mojom::Renderer::CreateFrameProxy. 605 // mojom::Renderer::CreateFrameProxy.
607 render_frame_host->frame_tree_node()->SetCurrentOrigin( 606 render_frame_host->frame_tree_node()->SetCurrentOrigin(
608 params.origin, params.has_potentially_trustworthy_unique_origin); 607 params.origin, params.has_potentially_trustworthy_unique_origin);
609 608
610 render_frame_host->frame_tree_node()->SetInsecureRequestPolicy( 609 render_frame_host->frame_tree_node()->SetInsecureRequestPolicy(
611 params.insecure_request_policy); 610 params.insecure_request_policy);
612 611
613 // Navigating to a new location means a new, fresh set of http headers and/or 612 // Navigating to a new location means a new, fresh set of http headers and/or
614 // <meta> elements - we need to reset CSP and Feature Policy. 613 // <meta> elements - we need to reset CSP and Feature Policy.
615 if (!is_navigation_within_page) { 614 if (!is_navigation_within_page) {
616 render_frame_host->ResetContentSecurityPolicies(); 615 render_frame_host->frame_tree_node()->ResetContentSecurityPolicy();
617 render_frame_host->frame_tree_node()->ResetCspHeaders();
618 render_frame_host->frame_tree_node()->ResetFeaturePolicyHeader(); 616 render_frame_host->frame_tree_node()->ResetFeaturePolicyHeader();
619 } 617 }
620 618
621 // When using --site-per-process, we notify the RFHM for all navigations, 619 // When using --site-per-process, we notify the RFHM for all navigations,
622 // not just main frame navigations. 620 // not just main frame navigations.
623 if (oopifs_possible) { 621 if (oopifs_possible) {
624 FrameTreeNode* frame = render_frame_host->frame_tree_node(); 622 FrameTreeNode* frame = render_frame_host->frame_tree_node();
625 frame->render_manager()->DidNavigateFrame( 623 frame->render_manager()->DidNavigateFrame(
626 render_frame_host, params.gesture == NavigationGestureUser); 624 render_frame_host, params.gesture == NavigationGestureUser);
627 } 625 }
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
666 MSG_ROUTING_NONE, controller_->GetLastCommittedEntryIndex(), 664 MSG_ROUTING_NONE, controller_->GetLastCommittedEntryIndex(),
667 controller_->GetEntryCount()), 665 controller_->GetEntryCount()),
668 site_instance); 666 site_instance);
669 } 667 }
670 668
671 // Keep track of the last committed URL and origin in the RenderFrameHost 669 // Keep track of the last committed URL and origin in the RenderFrameHost
672 // itself. These allow GetLastCommittedURL and GetLastCommittedOrigin to 670 // itself. These allow GetLastCommittedURL and GetLastCommittedOrigin to
673 // stay correct even if the render_frame_host later becomes pending deletion. 671 // stay correct even if the render_frame_host later becomes pending deletion.
674 // The URL is set regardless of whether it's for a net error or not. 672 // The URL is set regardless of whether it's for a net error or not.
675 render_frame_host->frame_tree_node()->SetCurrentURL(params.url); 673 render_frame_host->frame_tree_node()->SetCurrentURL(params.url);
676 render_frame_host->SetLastCommittedOrigin(params.origin); 674 render_frame_host->set_last_committed_origin(params.origin);
677 675
678 // Separately, update the frame's last successful URL except for net error 676 // Separately, update the frame's last successful URL except for net error
679 // pages, since those do not end up in the correct process after transfers 677 // pages, since those do not end up in the correct process after transfers
680 // (see https://crbug.com/560511). Instead, the next cross-process navigation 678 // (see https://crbug.com/560511). Instead, the next cross-process navigation
681 // or transfer should decide whether to swap as if the net error had not 679 // or transfer should decide whether to swap as if the net error had not
682 // occurred. 680 // occurred.
683 // TODO(creis): Remove this block and always set the URL once transfers handle 681 // TODO(creis): Remove this block and always set the URL once transfers handle
684 // network errors or PlzNavigate is enabled. See https://crbug.com/588314. 682 // network errors or PlzNavigate is enabled. See https://crbug.com/588314.
685 if (!params.url_is_unreachable) 683 if (!params.url_is_unreachable)
686 render_frame_host->set_last_successful_url(params.url); 684 render_frame_host->set_last_successful_url(params.url);
(...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after
1294 if (navigation_handle) 1292 if (navigation_handle)
1295 navigation_handle->update_entry_id_for_transfer(entry->GetUniqueID()); 1293 navigation_handle->update_entry_id_for_transfer(entry->GetUniqueID());
1296 1294
1297 controller_->SetPendingEntry(std::move(entry)); 1295 controller_->SetPendingEntry(std::move(entry));
1298 if (delegate_) 1296 if (delegate_)
1299 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL); 1297 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL);
1300 } 1298 }
1301 } 1299 }
1302 1300
1303 } // namespace content 1301 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/navigation_request.cc ('k') | content/browser/frame_host/render_frame_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698