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

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

Issue 2655463006: PlzNavigate: Enforce 'frame-src' CSP on the browser. (Closed)
Patch Set: Addressed comments @alexmos. Created 3 years, 10 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 false)); // should_bypass_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 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 // mojom::Renderer::CreateFrameProxy. 606 // mojom::Renderer::CreateFrameProxy.
606 render_frame_host->frame_tree_node()->SetCurrentOrigin( 607 render_frame_host->frame_tree_node()->SetCurrentOrigin(
607 params.origin, params.has_potentially_trustworthy_unique_origin); 608 params.origin, params.has_potentially_trustworthy_unique_origin);
608 609
609 render_frame_host->frame_tree_node()->SetInsecureRequestPolicy( 610 render_frame_host->frame_tree_node()->SetInsecureRequestPolicy(
610 params.insecure_request_policy); 611 params.insecure_request_policy);
611 612
612 // Navigating to a new location means a new, fresh set of http headers and/or 613 // Navigating to a new location means a new, fresh set of http headers and/or
613 // <meta> elements - we need to reset CSP and Feature Policy. 614 // <meta> elements - we need to reset CSP and Feature Policy.
614 if (!is_navigation_within_page) { 615 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()->ResetContentSecurityPolicy();
alexmos 2017/03/01 02:22:28 It looks a bit weird to call something to reset CS
arthursonzogni 2017/03/06 15:09:02 Done.
616 render_frame_host->frame_tree_node()->ResetFeaturePolicyHeader(); 618 render_frame_host->frame_tree_node()->ResetFeaturePolicyHeader();
617 } 619 }
618 620
619 // When using --site-per-process, we notify the RFHM for all navigations, 621 // When using --site-per-process, we notify the RFHM for all navigations,
620 // not just main frame navigations. 622 // not just main frame navigations.
621 if (oopifs_possible) { 623 if (oopifs_possible) {
622 FrameTreeNode* frame = render_frame_host->frame_tree_node(); 624 FrameTreeNode* frame = render_frame_host->frame_tree_node();
623 frame->render_manager()->DidNavigateFrame( 625 frame->render_manager()->DidNavigateFrame(
624 render_frame_host, params.gesture == NavigationGestureUser); 626 render_frame_host, params.gesture == NavigationGestureUser);
625 } 627 }
(...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after
1287 if (navigation_handle) 1289 if (navigation_handle)
1288 navigation_handle->update_entry_id_for_transfer(entry->GetUniqueID()); 1290 navigation_handle->update_entry_id_for_transfer(entry->GetUniqueID());
1289 1291
1290 controller_->SetPendingEntry(std::move(entry)); 1292 controller_->SetPendingEntry(std::move(entry));
1291 if (delegate_) 1293 if (delegate_)
1292 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL); 1294 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL);
1293 } 1295 }
1294 } 1296 }
1295 1297
1296 } // namespace content 1298 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698