summaryrefslogtreecommitdiffstats
path: root/components/json_schema/json_schema_validator.cc
diff options
context:
space:
mode:
authorbinjin@chromium.org <binjin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-22 10:15:09 +0000
committerbinjin@chromium.org <binjin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-22 10:15:09 +0000
commit1f704e24d76047007913ce298be6939b46a1bcba (patch)
treecbf2a03e0a5d9df22f766ac764b2bb4ccc22a950 /components/json_schema/json_schema_validator.cc
parent1ea264df790896735f216faea3d8a95d6d61a430 (diff)
downloadchromium_src-1f704e24d76047007913ce298be6939b46a1bcba.zip
chromium_src-1f704e24d76047007913ce298be6939b46a1bcba.tar.gz
chromium_src-1f704e24d76047007913ce298be6939b46a1bcba.tar.bz2
Add additional restriction to policy schema internal, includes modification to python generator and C++ parser with correspond unit tests.
BUG=258339 Review URL: https://codereview.chromium.org/138003003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@246266 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'components/json_schema/json_schema_validator.cc')
-rw-r--r--components/json_schema/json_schema_validator.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/components/json_schema/json_schema_validator.cc b/components/json_schema/json_schema_validator.cc
index eadba17..18558d0 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;