Chromium Code Reviews| Index: src/v8natives.js |
| =================================================================== |
| --- src/v8natives.js (revision 7115) |
| +++ src/v8natives.js (working copy) |
| @@ -251,7 +251,9 @@ |
| if (!IS_FUNCTION(fun)) { |
| throw new $TypeError('Object.prototype.__defineGetter__: Expecting function'); |
| } |
| - return %DefineAccessor(ToObject(this), ToString(name), GETTER, fun); |
| + var desc = { get: fun, enumerable: true, configurable: true }; |
| + desc = ToPropertyDescriptor(desc); |
|
Lasse Reichstein
2011/03/11 07:52:35
Why not
var desc = new PropertyDescriptor();
des
Rico
2011/03/11 08:05:48
Done.
|
| + DefineOwnProperty(ToObject(this), ToString(name), desc, true); |
| } |
| @@ -271,7 +273,9 @@ |
| throw new $TypeError( |
| 'Object.prototype.__defineSetter__: Expecting function'); |
| } |
| - return %DefineAccessor(ToObject(this), ToString(name), SETTER, fun); |
| + var desc = { set: fun, enumerable: true, configurable: true }; |
|
Lasse Reichstein
2011/03/11 07:52:35
Ditto.
Rico
2011/03/11 08:05:48
Done.
|
| + desc = ToPropertyDescriptor(desc); |
| + DefineOwnProperty(ToObject(this), ToString(name), desc, true); |
| } |
| @@ -394,6 +398,7 @@ |
| this.hasSetter_ = false; |
| } |
| +//PropertyDescriptor.prototype.__proto__ = null; |
|
Lasse Reichstein
2011/03/11 07:52:35
Uncomment this! :)
And add:
PropertyDescriptor.pro
Rico
2011/03/11 08:05:48
Ups, sorry, and done
|
| PropertyDescriptor.prototype.setValue = function(value) { |
| this.value_ = value; |
| @@ -495,7 +500,7 @@ |
| // property descriptor. For a description of the array layout please |
| // see the runtime.cc file. |
| function ConvertDescriptorArrayToDescriptor(desc_array) { |
| - if (desc_array == false) { |
| + if (desc_array === false) { |
| throw 'Internal error: invalid desc_array'; |
| } |
| @@ -554,7 +559,7 @@ |
| function DefineOwnProperty(obj, p, desc, should_throw) { |
| var current_or_access = %GetOwnProperty(ToObject(obj), ToString(p)); |
| // A false value here means that access checks failed. |
| - if (current_or_access == false) return void 0; |
| + if (current_or_access === false) return void 0; |
| var current = ConvertDescriptorArrayToDescriptor(current_or_access); |
| var extensible = %IsExtensible(ToObject(obj)); |