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

Unified Diff: components/json_schema/json_schema_validator.cc

Issue 138003003: Add additional restriction to policy schema internal (part1) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more fixes Created 6 years, 11 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
« no previous file with comments | « no previous file | components/policy/core/common/schema.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/json_schema/json_schema_validator.cc
diff --git a/components/json_schema/json_schema_validator.cc b/components/json_schema/json_schema_validator.cc
index eadba17b06b8be6e2128015a6ae0fc066d02d0bf..18558d0e111213bd789ac96633b8bc43afaaa53f 100644
--- a/components/json_schema/json_schema_validator.cc
+++ b/components/json_schema/json_schema_validator.cc
@@ -162,7 +162,10 @@ bool IsValidSchema(const base::DictionaryValue* dict,
return false;
}
- if (!it.value().IsType(entry->type)) {
+ // Integer can be converted to double.
+ if (!(it.value().IsType(entry->type) ||
+ (it.value().IsType(base::Value::TYPE_INTEGER) &&
+ entry->type == base::Value::TYPE_DOUBLE))) {
*error = base::StringPrintf("Invalid value for %s attribute",
it.key().c_str());
return false;
« no previous file with comments | « no previous file | components/policy/core/common/schema.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698