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

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

Issue 2655463006: PlzNavigate: Enforce 'frame-src' CSP on the browser. (Closed)
Patch Set: Fix tests. 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 26bd2f95c92e404ed37be2e1c80177c58efb2a69..7bacc520b53fc8148d8ff9667fe8f3bb16f7384f 100644
--- a/third_party/WebKit/Source/core/loader/FrameLoader.cpp
+++ b/third_party/WebKit/Source/core/loader/FrameLoader.cpp
@@ -1628,6 +1628,10 @@ bool FrameLoader::shouldContinueForNavigationPolicy(
FrameLoadType frameLoadType,
bool isClientRedirect,
HTMLFormElement* form) {
+ Settings* settings = m_frame->settings();
+ bool browserSideNavigationEnabled =
+ settings && settings->getBrowserSideNavigationEnabled();
+
// Don't ask if we are loading an empty URL.
if (request.url().isEmpty() || substituteData.isValid())
return true;
@@ -1636,7 +1640,8 @@ 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 &&
+ !browserSideNavigationEnabled) {
arthursonzogni 2017/02/10 16:42:22 Note: It is possible to check the CSP with PlzNavi
alexmos 2017/02/10 22:59:53 I might be fuzzy on how this part works with PlzNa
arthursonzogni 2017/02/13 16:33:20 With PlzNavigate, we currently use a dirty hack to
alexmos 2017/02/14 06:57:20 Acknowledged, thanks for the explanation. Can you
arthursonzogni 2017/02/15 17:02:16 Done. See http://crbug.com/692595
Frame* parentFrame = m_frame->tree().parent();
if (parentFrame) {
ContentSecurityPolicy* parentPolicy =
@@ -1662,9 +1667,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