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

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: Cleanup 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 7deb8ab7489f40eab42a8053545b4c5a5d97cf50..ea4d3080949da1625a08c964633ddedffb436bbb 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 {
@@ -101,11 +102,20 @@ void SecurityContext::enforceSuborigin(const Suborigin& suborigin) {
void SecurityContext::setFeaturePolicyFromHeader(
const WebParsedFeaturePolicyHeader& parsedHeader,
- FeaturePolicy* parentFeaturePolicy) {
+ const WebFeaturePolicy* parentFeaturePolicy) {
DCHECK(!m_featurePolicy);
- m_featurePolicy = FeaturePolicy::createFromParentPolicy(parentFeaturePolicy,
- m_securityOrigin);
- m_featurePolicy->setHeaderPolicy(parsedHeader);
+
+ // Compose the new policy based on the parent policy, with the new header
+ WebSecurityOrigin origin = WebSecurityOrigin(m_securityOrigin);
+ m_featurePolicy.reset(Platform::current()->createFeaturePolicy(
+ parentFeaturePolicy, parsedHeader, origin));
+}
+
+void SecurityContext::updateFeaturePolicyOrigin() {
raymes 2017/02/13 04:45:22 Should we just call this from setSecurityOrigin in
iclelland 2017/02/23 20:04:12 Yes. Done.
+ if (!m_featurePolicy)
+ return;
+ Platform::current()->updateFeaturePolicyOrigin(
+ m_featurePolicy.get(), WebSecurityOrigin(m_securityOrigin));
raymes 2017/02/13 04:45:22 Do you know under what circumstances we can change
iclelland 2017/02/23 20:04:12 There are a few odd scenarios around document.open
}
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698