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

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

Issue 2254533002: [FeaturePolicy] Initial implementation of Feature Policy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@fp-flag
Patch Set: Remove overaggressive bool transform Created 4 years, 3 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 c77b0809a669aac76888ac4d737ef0ad2d0195ec..c502f189c7db2578d0721d4d3e1387dc64f3d590 100644
--- a/third_party/WebKit/Source/core/loader/FrameLoader.cpp
+++ b/third_party/WebKit/Source/core/loader/FrameLoader.cpp
@@ -88,6 +88,7 @@
#include "platform/ScriptForbiddenScope.h"
#include "platform/TraceEvent.h"
#include "platform/UserGestureIndicator.h"
+#include "platform/feature_policy/FeaturePolicy.h"
#include "platform/network/HTTPParsers.h"
#include "platform/network/ResourceRequest.h"
#include "platform/scroll/ScrollAnimatorBase.h"
@@ -523,6 +524,16 @@ void FrameLoader::didBeginDocument()
}
OriginTrialContext::addTokensFromHeader(m_frame->document(), m_documentLoader->response().httpHeaderField(HTTPNames::Origin_Trial));
+ if (RuntimeEnabledFeatures::featurePolicyEnabled()) {
+ FeaturePolicy* featurePolicy;
+ if (!isLoadingMainFrame()) {
lunalu1 2016/09/20 14:55:49 Personal preference: FeaturePolicy::createFromPare
iclelland 2016/10/14 19:37:49 Done (except that I omitted the "!" and swapped th
+ featurePolicy = FeaturePolicy::createFromParentPolicy(m_frame->client()->parent()->getFeaturePolicy(), m_frame->securityContext()->getSecurityOrigin());
+ } else {
+ featurePolicy = FeaturePolicy::createFromParentPolicy(nullptr, m_frame->securityContext()->getSecurityOrigin());
+ }
+ featurePolicy->addPolicyFromString(m_documentLoader->response().httpHeaderField(HTTPNames::Feature_Policy));
+ m_frame->setFeaturePolicy(featurePolicy);
+ }
}
if (m_documentLoader && RuntimeEnabledFeatures::referrerPolicyHeaderEnabled()) {

Powered by Google App Engine
This is Rietveld 408576698