Index: src/v8natives.js |
diff --git a/src/v8natives.js b/src/v8natives.js |
index c16d73e82ed05dc75890a8ba4e82c965330ffc92..c8359fab8d2b4abf9f2a1ae7de17b9e5576aa2c6 100644 |
--- a/src/v8natives.js |
+++ b/src/v8natives.js |
@@ -354,33 +354,50 @@ function IsInconsistentDescriptor(desc) { |
// ES5 8.10.4 |
function FromPropertyDescriptor(desc) { |
if (IS_UNDEFINED(desc)) return desc; |
- var obj = new $Object(); |
+ |
if (IsDataDescriptor(desc)) { |
- obj.value = desc.getValue(); |
- obj.writable = desc.isWritable(); |
+ return { value: desc.getValue(), |
+ writable: desc.isWritable(), |
+ enumerable: desc.isEnumerable(), |
+ configurable: desc.isConfigurable() }; |
} |
- if (IsAccessorDescriptor(desc)) { |
- obj.get = desc.getGet(); |
- obj.set = desc.getSet(); |
- } |
- obj.enumerable = desc.isEnumerable(); |
- obj.configurable = desc.isConfigurable(); |
- return obj; |
+ // Must be an AccessorDescriptor then. We never return a generic descriptor. |
+ return { get: desc.getGet(), |
+ set: desc.getSet(), |
+ enumerable: desc.isEnumerable(), |
+ configurable: desc.isConfigurable() }; |
} |
+ |
// Harmony Proxies |
function FromGenericPropertyDescriptor(desc) { |
if (IS_UNDEFINED(desc)) return desc; |
var obj = new $Object(); |
- if (desc.hasValue()) obj.value = desc.getValue(); |
- if (desc.hasWritable()) obj.writable = desc.isWritable(); |
- if (desc.hasGetter()) obj.get = desc.getGet(); |
- if (desc.hasSetter()) obj.set = desc.getSet(); |
- if (desc.hasEnumerable()) obj.enumerable = desc.isEnumerable(); |
- if (desc.hasConfigurable()) obj.configurable = desc.isConfigurable(); |
+ |
+ if (desc.hasValue()) { |
+ %IgnoreAttributesAndSetProperty(obj, "value", desc.getValue(), NONE); |
+ } |
+ if (desc.hasWritable()) { |
+ %IgnoreAttributesAndSetProperty(obj, "writable", desc.isWritable(), NONE); |
+ } |
+ if (desc.hasGetter()) { |
+ %IgnoreAttributesAndSetProperty(obj, "get", desc.getGet(), NONE); |
+ } |
+ if (desc.hasSetter()) { |
+ %IgnoreAttributesAndSetProperty(obj, "set", desc.getSet(), NONE); |
+ } |
+ if (desc.hasEnumerable()) { |
+ %IgnoreAttributesAndSetProperty(obj, "enumerable", |
+ desc.isEnumerable(), NONE); |
+ } |
+ if (desc.hasConfigurable()) { |
+ %IgnoreAttributesAndSetProperty(obj, "configurable", |
+ desc.isConfigurable(), NONE); |
+ } |
return obj; |
} |
+ |
// ES5 8.10.5. |
function ToPropertyDescriptor(obj) { |
if (!IS_SPEC_OBJECT(obj)) { |