Chromium Code Reviews| Index: third_party/WebKit/Source/platform/feature_policy/FeaturePolicy.cpp |
| diff --git a/third_party/WebKit/Source/platform/feature_policy/FeaturePolicy.cpp b/third_party/WebKit/Source/platform/feature_policy/FeaturePolicy.cpp |
| index 44d6c96359a7499994c6a3ded2c65001bcdcc404..98b5ca9b6bb16a17d03a012979ac827ec9565276 100644 |
| --- a/third_party/WebKit/Source/platform/feature_policy/FeaturePolicy.cpp |
| +++ b/third_party/WebKit/Source/platform/feature_policy/FeaturePolicy.cpp |
| @@ -123,6 +123,7 @@ const FeaturePolicy::FeatureList& FeaturePolicy::getDefaultFeatureList() { |
| // static |
| std::unique_ptr<FeaturePolicy> FeaturePolicy::createFromParentPolicy( |
| const FeaturePolicy* parent, |
| + const WebParsedFeaturePolicy* framePolicy, |
| RefPtr<SecurityOrigin> currentOrigin, |
| FeaturePolicy::FeatureList& features) { |
| DCHECK(currentOrigin); |
| @@ -136,17 +137,40 @@ std::unique_ptr<FeaturePolicy> FeaturePolicy::createFromParentPolicy( |
| newPolicy->m_inheritedFeatures.set(feature, false); |
| } |
| } |
| + if (framePolicy) { |
| + newPolicy->addFramePolicy(parent, framePolicy); |
| + } |
| return newPolicy; |
| } |
| // static |
| std::unique_ptr<FeaturePolicy> FeaturePolicy::createFromParentPolicy( |
| const FeaturePolicy* parent, |
| + const WebParsedFeaturePolicy* framePolicy, |
| RefPtr<SecurityOrigin> currentOrigin) { |
| - return createFromParentPolicy(parent, std::move(currentOrigin), |
| + return createFromParentPolicy(parent, framePolicy, std::move(currentOrigin), |
| getDefaultFeatureList()); |
| } |
| +void FeaturePolicy::addFramePolicy(const FeaturePolicy* parent, |
| + const WebParsedFeaturePolicy* framePolicy) { |
| + DCHECK(parent); |
| + DCHECK(framePolicy); |
| + for (const WebFeaturePolicy::ParsedWhitelist& parsedWhitelist : |
| + *framePolicy) { |
| + const FeaturePolicy::Feature* feature = |
| + featureForName(parsedWhitelist.featureName, m_features); |
| + if (!feature) |
| + continue; |
| + if (Whitelist::from(parsedWhitelist)->contains(*m_origin) && |
| + parent->m_inheritedFeatures.get(feature)) { |
|
raymes
2017/02/03 00:28:51
Hmm does this match what we had in https://docs.go
iclelland
2017/02/03 16:59:54
Without this (and we can certainly debate in the d
raymes
2017/02/03 18:11:28
Hmm, that's a good point. I guess the main problem
iclelland
2017/02/03 19:50:04
No that's a really good point. I'll update the spe
iclelland
2017/02/14 21:25:03
Changed this to require that the feature be enable
|
| + m_inheritedFeatures.set(feature, true); |
| + } else { |
| + m_inheritedFeatures.set(feature, false); |
| + } |
| + } |
| +} |
| + |
| // static |
| WebParsedFeaturePolicy FeaturePolicy::parseFeaturePolicy( |
| const String& policy, |