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

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: Conform to JFV spec for header format Created 4 years, 2 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 83912c85c72ef76136a71665479b9a957ef579fc..4f59ccb9a14309b907c15cd5e498825ec070ddda 100644
--- a/third_party/WebKit/Source/core/loader/FrameLoader.cpp
+++ b/third_party/WebKit/Source/core/loader/FrameLoader.cpp
@@ -87,6 +87,7 @@
#include "platform/PluginScriptForbiddenScope.h"
#include "platform/ScriptForbiddenScope.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"
@@ -581,6 +582,17 @@ void FrameLoader::didBeginDocument() {
OriginTrialContext::addTokensFromHeader(
m_frame->document(),
m_documentLoader->response().httpHeaderField(HTTPNames::Origin_Trial));
+ if (RuntimeEnabledFeatures::featurePolicyEnabled()) {
+ FeaturePolicy* featurePolicy = FeaturePolicy::createFromParentPolicy(
+ (isLoadingMainFrame()
+ ? nullptr
+ : m_frame->client()->parent()->getFeaturePolicy()),
+ m_frame->securityContext()->getSecurityOrigin());
+ featurePolicy->setHeaderPolicy(
+ m_documentLoader->response().httpHeaderField(
+ HTTPNames::Feature_Policy));
+ m_frame->setFeaturePolicy(featurePolicy);
+ }
}
if (m_documentLoader) {

Powered by Google App Engine
This is Rietveld 408576698