Index: src/v8natives.js |
=================================================================== |
--- src/v8natives.js (revision 8946) |
+++ src/v8natives.js (working copy) |
@@ -1015,25 +1015,30 @@ |
} |
+function GetOwnPropertyNames(properties) { |
Lasse Reichstein
2011/08/18 08:35:22
Put "Enuerable" in the name somewhere.
|
+ var names = new InternalArray(); |
+ for (var key in properties) { |
Lasse Reichstein
2011/08/18 08:35:22
I was hoping there would be a way to get the own p
|
+ global.print("key: " + key); |
Lasse Reichstein
2011/08/18 08:35:22
Without the prints? :)
|
+ if (%HasLocalProperty(properties, key)) { |
+ global.print("key: " + key); |
+ names.push(key); |
+ } |
+ } |
+ return names; |
+} |
+ |
+ |
// ES5 section 15.2.3.7. |
function ObjectDefineProperties(obj, properties) { |
if (!IS_SPEC_OBJECT(obj)) |
throw MakeTypeError("obj_ctor_property_non_object", ["defineProperties"]); |
var props = ToObject(properties); |
- var key_values = []; |
- for (var key in props) { |
- if (%HasLocalProperty(props, key)) { |
- key_values.push(key); |
- var value = props[key]; |
- var desc = ToPropertyDescriptor(value); |
- key_values.push(desc); |
- } |
+ var names = GetOwnPropertyNames(props); |
+ for (var i = 0; i < names.length; i++) { |
+ var name = names[i]; |
+ var desc = ToPropertyDescriptor(props[name]); |
+ DefineOwnProperty(obj, name, desc, true); |
} |
- for (var i = 0; i < key_values.length; i += 2) { |
- var key = key_values[i]; |
- var desc = key_values[i + 1]; |
- DefineOwnProperty(obj, key, desc, true); |
- } |
return obj; |
} |