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

Unified Diff: third_party/WebKit/Source/core/loader/FrameLoader.cpp

Issue 2655463006: PlzNavigate: Enforce 'frame-src' CSP on the browser. (Closed)
Patch Set: Rebase. 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/loader/FrameLoader.cpp
diff --git a/third_party/WebKit/Source/core/loader/FrameLoader.cpp b/third_party/WebKit/Source/core/loader/FrameLoader.cpp
index d675d5d3ab5d00a6972caca5f0dcdeb1d24ee7a8..555ae30b964c7052366a3be891cb20fe70b170cb 100644
--- a/third_party/WebKit/Source/core/loader/FrameLoader.cpp
+++ b/third_party/WebKit/Source/core/loader/FrameLoader.cpp
@@ -1632,6 +1632,10 @@ bool FrameLoader::shouldContinueForNavigationPolicy(
FrameLoadType frameLoadType,
bool isClientRedirect,
HTMLFormElement* form) {
+ Settings* settings = m_frame->settings();
+ bool browserSideNavigationEnabled =
+ settings && settings->getBrowserSideNavigationEnabled();
alexmos 2017/02/24 06:40:27 nit: could move this after the if statement below,
arthursonzogni 2017/02/24 16:13:29 Done.
+
// Don't ask if we are loading an empty URL.
if (request.url().isEmpty() || substituteData.isValid())
return true;
@@ -1640,7 +1644,12 @@ bool FrameLoader::shouldContinueForNavigationPolicy(
// against the parent's Content Security Policy and kill the load if that
// check fails, unless we should bypass the main world's CSP.
if (policy == NavigationPolicyCurrentTab &&
- shouldCheckMainWorldContentSecurityPolicy == CheckContentSecurityPolicy) {
+ shouldCheckMainWorldContentSecurityPolicy == CheckContentSecurityPolicy &&
+ // TODO(arthursonzogni): 'frame-src' check is disabled on the
+ // renderer-side with browser-side-navigation, but is enforced on the
+ // browser-side. See http://crbug.com/692595 for understanding why it
+ // can't be enforced on both side instead.
alexmos 2017/02/24 06:40:28 nit: s/side/sides/
arthursonzogni 2017/02/24 16:13:29 Done.
+ !browserSideNavigationEnabled) {
Frame* parentFrame = m_frame->tree().parent();
if (parentFrame) {
ContentSecurityPolicy* parentPolicy =
@@ -1666,9 +1675,9 @@ bool FrameLoader::shouldContinueForNavigationPolicy(
bool replacesCurrentHistoryItem =
frameLoadType == FrameLoadTypeReplaceCurrentItem;
- policy = client()->decidePolicyForNavigation(request, loader, type, policy,
- replacesCurrentHistoryItem,
- isClientRedirect, form);
+ policy = client()->decidePolicyForNavigation(
+ request, loader, type, policy, replacesCurrentHistoryItem,
+ isClientRedirect, form, shouldCheckMainWorldContentSecurityPolicy);
if (policy == NavigationPolicyCurrentTab)
return true;
if (policy == NavigationPolicyIgnore)

Powered by Google App Engine
This is Rietveld 408576698