 Chromium Code Reviews
 Chromium Code Reviews Issue 5861006:
  Change Object.defineProperty to accept undefined as getters and setters and t...  (Closed) 
  Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
    
  
    Issue 5861006:
  Change Object.defineProperty to accept undefined as getters and setters and t...  (Closed) 
  Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/| Index: src/runtime.cc | 
| =================================================================== | 
| --- src/runtime.cc (revision 6011) | 
| +++ src/runtime.cc (working copy) | 
| @@ -3516,7 +3516,8 @@ | 
| CONVERT_ARG_CHECKED(JSObject, obj, 0); | 
| CONVERT_CHECKED(String, name, args[1]); | 
| 
Lasse Reichstein
2010/12/16 09:43:34
This argument is not stored in a handle, so why us
 
Rico
2010/12/16 12:17:55
Done.
 | 
| CONVERT_CHECKED(Smi, flag_setter, args[2]); | 
| - CONVERT_CHECKED(JSFunction, fun, args[3]); | 
| + Handle<Object> fun = args.at<Object>(3); | 
| + RUNTIME_ASSERT(fun->IsJSFunction() || fun->IsUndefined()); | 
| CONVERT_CHECKED(Smi, flag_attr, args[4]); | 
| int unchecked = flag_attr->value(); | 
| RUNTIME_ASSERT((unchecked & ~(READ_ONLY | DONT_ENUM | DONT_DELETE)) == 0); | 
| @@ -3537,7 +3538,7 @@ | 
| if (!maybe_ok->ToObject(&ok)) return maybe_ok; | 
| } | 
| } | 
| - return obj->DefineAccessor(name, flag_setter->value() == 0, fun, attr); | 
| + return obj->DefineAccessor(name, flag_setter->value() == 0, *fun, attr); | 
| } | 
| static MaybeObject* Runtime_DefineOrRedefineDataProperty(Arguments args) { | 
| @@ -3572,7 +3573,7 @@ | 
| } | 
| LookupResult result; | 
| - js_object->LocalLookupRealNamedProperty(*name, &result); | 
| + js_object->LookupRealNamedProperty(*name, &result); | 
| // Take special care when attributes are different and there is already | 
| // a property. For simplicity we normalize the property which enables us | 
| @@ -3580,7 +3581,8 @@ | 
| // map. The current version of SetObjectProperty does not handle attributes | 
| // correctly in the case where a property is a field and is reset with | 
| // new attributes. | 
| - if (result.IsProperty() && attr != result.GetAttributes()) { | 
| + if (result.IsProperty() && | 
| + (attr != result.GetAttributes() || result.type() == CALLBACKS)) { | 
| // New attributes - normalize to avoid writing to instance descriptor | 
| NormalizeProperties(js_object, CLEAR_INOBJECT_PROPERTIES, 0); | 
| // Use IgnoreAttributes version since a readonly property may be |