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

Unified Diff: third_party/WebKit/Source/core/dom/SecurityContext.cpp

Issue 2651883008: Make content::FeaturePolicy implement WebFeaturePolicy, and use it in blink code (Closed)
Patch Set: Duplicate FP object rather than modifying in-place 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/dom/SecurityContext.cpp
diff --git a/third_party/WebKit/Source/core/dom/SecurityContext.cpp b/third_party/WebKit/Source/core/dom/SecurityContext.cpp
index efbb7d00dbe4b6d9fdba4d3098a1dc0c7c18d85d..19cdd87bc49c1248fdce2ca1001675fe92811451 100644
--- a/third_party/WebKit/Source/core/dom/SecurityContext.cpp
+++ b/third_party/WebKit/Source/core/dom/SecurityContext.cpp
@@ -29,6 +29,7 @@
#include "core/frame/csp/ContentSecurityPolicy.h"
#include "platform/RuntimeEnabledFeatures.h"
#include "platform/weborigin/SecurityOrigin.h"
+#include "public/platform/Platform.h"
namespace blink {
@@ -46,6 +47,7 @@ DEFINE_TRACE(SecurityContext) {
void SecurityContext::setSecurityOrigin(
PassRefPtr<SecurityOrigin> securityOrigin) {
m_securityOrigin = securityOrigin;
+ updateFeaturePolicyOrigin();
}
void SecurityContext::setContentSecurityPolicy(
@@ -99,15 +101,23 @@ void SecurityContext::enforceSuborigin(const Suborigin& suborigin) {
didUpdateSecurityOrigin();
}
-void SecurityContext::setFeaturePolicyFromHeader(
+void SecurityContext::initializeFeaturePolicy(
const WebParsedFeaturePolicyHeader& parsedHeader,
- FeaturePolicy* parentFeaturePolicy) {
+ const WebFeaturePolicy* parentFeaturePolicy) {
DCHECK(!m_featurePolicy);
// TODO(iclelland): Use the frame owner properties here to pass the frame
// policy, if it exists.
- m_featurePolicy = FeaturePolicy::createFromParentPolicy(
- parentFeaturePolicy, nullptr, m_securityOrigin);
- m_featurePolicy->setHeaderPolicy(parsedHeader);
+ WebParsedFeaturePolicyHeader containerPolicy;
+ WebSecurityOrigin origin = WebSecurityOrigin(m_securityOrigin);
+ m_featurePolicy.reset(Platform::current()->createFeaturePolicy(
+ parentFeaturePolicy, containerPolicy, parsedHeader, origin));
+}
+
+void SecurityContext::updateFeaturePolicyOrigin() {
+ if (!m_featurePolicy)
+ return;
+ m_featurePolicy.reset(Platform::current()->duplicateFeaturePolicyWithOrigin(
+ *m_featurePolicy, WebSecurityOrigin(m_securityOrigin)));
haraken 2017/03/04 07:36:01 Oh, if your intention is just to *update* (not dup
iclelland 2017/03/06 04:17:40 That is really the only modification being conside
}
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698