summaryrefslogtreecommitdiffstats
path: root/tools/json_schema_compiler/model.py
diff options
context:
space:
mode:
authorHokein.Wu@gmail.com <Hokein.Wu@gmail.com@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-30 05:28:58 +0000
committerHokein.Wu@gmail.com <Hokein.Wu@gmail.com@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-30 05:28:58 +0000
commite0eec63f26c1b5b1783670484a53e325e528b7fe (patch)
treedae65c691a9a5a52b2d9018df7e7465b94a01354 /tools/json_schema_compiler/model.py
parent79e7e602c4ac1c8031977a6725ea81b77f4abb24 (diff)
downloadchromium_src-e0eec63f26c1b5b1783670484a53e325e528b7fe.zip
chromium_src-e0eec63f26c1b5b1783670484a53e325e528b7fe.tar.gz
chromium_src-e0eec63f26c1b5b1783670484a53e325e528b7fe.tar.bz2
Add "platforms" key in IDL schema compiler.
Add analogue to JSON "platforms" key in IDL to restrict extension APIs' availability on different OS. The "platforms" key format like this: [platforms=("linux", "chromeos", "mac", "win", "chromeos_touch")] namespace Foo { ... }; BUG=119398 TEST=manual Review URL: https://codereview.chromium.org/38573008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@231767 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools/json_schema_compiler/model.py')
-rw-r--r--tools/json_schema_compiler/model.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/tools/json_schema_compiler/model.py b/tools/json_schema_compiler/model.py
index cc876df..7507ae7 100644
--- a/tools/json_schema_compiler/model.py
+++ b/tools/json_schema_compiler/model.py
@@ -486,8 +486,11 @@ class Platforms(object):
WIN = _PlatformInfo("win")
def _GetPlatforms(json):
- if 'platforms' not in json:
+ if 'platforms' not in json or json['platforms'] == None:
return None
+ # Sanity check: platforms should not be an empty list.
+ if not json['platforms']:
+ raise ValueError('"platforms" cannot be an empty list')
platforms = []
for platform_name in json['platforms']:
for platform_enum in _Enum.GetAll(Platforms):