Index: src/apinatives.js |
diff --git a/src/apinatives.js b/src/apinatives.js |
index ccbedd6d397455aa18f2b26bcda172683ba750c7..f104567751cec00f21d18dd69ac727d90d4d9710 100644 |
--- a/src/apinatives.js |
+++ b/src/apinatives.js |
@@ -104,19 +104,26 @@ function InstantiateFunction(data, name) { |
function ConfigureTemplateInstance(obj, data) { |
var properties = %GetTemplateField(data, kApiPropertyListOffset); |
- if (properties) { |
- // Disable access checks while instantiating the object. |
- var requires_access_checks = %DisableAccessChecks(obj); |
- try { |
- for (var i = 0; i < properties[0]; i += 3) { |
+ if (!properties) return; |
+ // Disable access checks while instantiating the object. |
+ var requires_access_checks = %DisableAccessChecks(obj); |
+ try { |
+ for (var i = 1; i < properties[0];) { |
+ var length = properties[i]; |
+ if (length == 3) { |
var name = properties[i + 1]; |
var prop_data = properties[i + 2]; |
var attributes = properties[i + 3]; |
var value = Instantiate(prop_data, name); |
%SetProperty(obj, name, value, attributes); |
+ } else if (length == 5) { |
+ %DefineJsAccessor(obj, properties, i); |
Sven Panne
2013/08/21 10:46:25
Hmmm, this is somehow inconsistent with the 'lengt
dcarney
2013/08/21 10:59:33
okay
|
+ } else { |
+ throw "Bad properties array"; |
} |
- } finally { |
- if (requires_access_checks) %EnableAccessChecks(obj); |
+ i += length + 1; |
} |
+ } finally { |
+ if (requires_access_checks) %EnableAccessChecks(obj); |
} |
} |