Chromium Code Reviews| 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 |