Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(892)

Unified Diff: src/v8natives.js

Issue 7745017: Make FromPropertyDescriptor not trigger inherited setters. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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)) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698