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 9b8a0578467160ba1737dfa649a9bfbbe79b4064..0736b2836dcf90521e30ff19e87cc431593b86e2 100644 |
| --- a/third_party/WebKit/Source/platform/feature_policy/FeaturePolicy.cpp |
| +++ b/third_party/WebKit/Source/platform/feature_policy/FeaturePolicy.cpp |
| @@ -57,7 +57,7 @@ WebParsedFeaturePolicyHeader parseFeaturePolicy(const String& policy, |
| std::unique_ptr<JSONArray> policyItems = parseJSONHeader(policy, 50); |
| if (!policyItems) { |
| if (messages) |
| - messages->push_back("Unable to parse header"); |
| + messages->push_back("Unable to parse header."); |
| return whitelists; |
| } |
| @@ -65,13 +65,18 @@ WebParsedFeaturePolicyHeader parseFeaturePolicy(const String& policy, |
| JSONObject* item = JSONObject::cast(policyItems->at(i)); |
| if (!item) { |
| if (messages) |
| - messages->push_back("Policy is not an object"); |
| + messages->push_back("Policy is not an object."); |
| continue; // Array element is not an object; skip |
| } |
| for (size_t j = 0; j < item->size(); ++j) { |
| JSONObject::Entry entry = item->at(j); |
| - String featureName = entry.first; |
| + WebFeaturePolicyFeature feature = getWebFeaturePolicyFeature(entry.first); |
| + if (feature == WebFeaturePolicyFeature::NotFound) { |
| + if (messages) |
| + messages->push_back("Feature name is unrecognized."); |
|
iclelland
2017/03/15 15:33:02
I don't think we should report this like an error
|
| + continue; // Unrecognized feature; skip |
| + } |
| JSONArray* targets = JSONArray::cast(entry.second); |
| if (!targets) { |
| if (messages) |
| @@ -80,7 +85,7 @@ WebParsedFeaturePolicyHeader parseFeaturePolicy(const String& policy, |
| } |
| WebParsedFeaturePolicyDeclaration whitelist; |
| - whitelist.featureName = featureName; |
| + whitelist.feature = feature; |
| Vector<WebSecurityOrigin> origins; |
| String targetString; |
| for (size_t j = 0; j < targets->size(); ++j) { |