Index: chrome/renderer/resources/extensions/binding.js |
diff --git a/chrome/renderer/resources/extensions/binding.js b/chrome/renderer/resources/extensions/binding.js |
index 4bb9b99bfbdece26a428b09c1b9b5ed391275adb..7e6996f7f2d138c671ae176c74929f6f7ac258f2 100644 |
--- a/chrome/renderer/resources/extensions/binding.js |
+++ b/chrome/renderer/resources/extensions/binding.js |
@@ -243,13 +243,29 @@ Binding.prototype = { |
mod = mod[name]; |
} |
- // Add types to global schemaValidator, the types we depend on from other |
- // namespaces will be added as needed. |
if (schema.types) { |
$Array.forEach(schema.types, function(t) { |
if (!isSchemaNodeSupported(t, platform, manifestVersion)) |
return; |
+ |
+ // Add types to global schemaValidator, the types we depend on from |
+ // other namespaces will be added as needed. |
schemaUtils.schemaValidator.addTypes(t); |
+ |
+ // Generate symbols for enums. |
+ var enumValues = t['enum']; |
+ if (enumValues) { |
+ // Type IDs are qualified with the namespace during compilation, |
+ // unfortunately, so remove it here. |
+ var namespaceAndId = $String.split(t.id, '.'); |
+ logging.DCHECK(namespaceAndId.length == 2, t.id); |
+ logging.DCHECK(namespaceAndId[0] == schema.namespace, t.id); |
+ var id = namespaceAndId[1]; |
+ mod[id] = {}; |
+ $Array.forEach(enumValues, function(enumValue) { |
+ mod[id][enumValue] = enumValue; |
+ }); |
+ } |
}, this); |
} |