Index: third_party/WebKit/Source/build/scripts/json5_generator.py |
diff --git a/third_party/WebKit/Source/build/scripts/json5_generator.py b/third_party/WebKit/Source/build/scripts/json5_generator.py |
index 00f4e9ad937ce91117d6005bf843b78ce5a2a332..4c7a63d7f2fd7d677095f69ab9a0e5fa36f33897 100644 |
--- a/third_party/WebKit/Source/build/scripts/json5_generator.py |
+++ b/third_party/WebKit/Source/build/scripts/json5_generator.py |
@@ -164,14 +164,23 @@ class Json5File(object): |
return entry |
def _validate_parameter(self, parameter, value): |
- valid_values = parameter.get("valid_values") |
- if valid_values and value not in valid_values: |
- raise Exception("Unknown value: '%s'\nKnown values: %s" % |
- (value, valid_values)) |
valid_type = parameter.get("valid_type") |
if valid_type and type(value).__name__ != valid_type: |
raise Exception("Incorrect type: '%s'\nExpected type: %s" % |
(type(value).__name__, valid_type)) |
+ valid_values = parameter.get("valid_values") |
+ if not valid_values: |
+ return |
+ # If valid_values is a list of simple items and not list of list, then |
+ # validate each item in the value list against valid_values. |
+ if valid_type == "list" and type(valid_values[0]) is not list: |
+ for item in value: |
+ if item not in valid_values: |
+ raise Exception("Unknown value: '%s'\nKnown values: %s" % |
+ (item, valid_values)) |
+ elif value not in valid_values: |
+ raise Exception("Unknown value: '%s'\nKnown values: %s" % |
+ (value, valid_values)) |
class Writer(object): |