Reviewers: Mads Ager,

Description:
Added IsProperty() check to result in DefineOrRedefineAccessor - if no check
this causes the debug check to fails since type() asserts that the
lookup_type != NOT_FOUND. This does not change any functionality since we
explicitly checked if it was one of the three types that we need to delete.
Also changed defineProperties in v8natives to actually return the object
being defined (as specified by spec)


Please review this at http://codereview.chromium.org/572003

SVN Base: http://v8.googlecode.com/svn/branches/bleeding_edge/

Affected files:
  M     src/runtime.cc
  M     src/v8natives.js


Index: src/v8natives.js
===================================================================
--- src/v8natives.js    (revision 3786)
+++ src/v8natives.js    (working copy)
@@ -689,6 +689,7 @@
     var desc = key_values[i + 1];
     DefineOwnProperty(obj, key, desc, true);
   }
+  return obj;
 }


Index: src/runtime.cc
===================================================================
--- src/runtime.cc      (revision 3786)
+++ src/runtime.cc      (working copy)
@@ -2906,10 +2906,11 @@
   // If an existing property is either FIELD, NORMAL or CONSTANT_FUNCTION
   // delete it to avoid running into trouble in DefineAccessor, which
   // handles this incorrectly if the property is readonly (does nothing)
-  if (result.type() == FIELD || result.type() == NORMAL
-      || result.type() == CONSTANT_FUNCTION)
+  if (result.IsProperty() &&
+      (result.type() == FIELD || result.type() == NORMAL
+       || result.type() == CONSTANT_FUNCTION)) {
     obj->DeleteProperty(name, JSObject::NORMAL_DELETION);
-
+  }
   return obj->DefineAccessor(name, flag_setter->value() == 0, fun, attr);
 }



--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to