Reviewers: Erik Corry,

Message:
Small one line review.



Description:
Fixed issue 619 allowing Object.create to be called with a function.

This change allows Object.create to take a function as input in the
proto argument. The spec says that Type(O) for the proto argument
should be true but our IS_OBJECT does not check for this. I will make a
IS_SPEC_OBJECT in macros.py and refactor v8natives in another CL.


Please review this at http://codereview.chromium.org/2051001/show

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

Affected files:
  M     src/v8natives.js


Index: src/v8natives.js
===================================================================
--- src/v8natives.js    (revision 4607)
+++ src/v8natives.js    (working copy)
@@ -660,7 +660,8 @@

 // ES5 section 15.2.3.5.
 function ObjectCreate(proto, properties) {
-  if (!IS_OBJECT(proto) && !IS_NULL(proto)) {
+  // IS_OBJECT will return true on null covering this case.
+  if (!IS_OBJECT(proto) && !IS_FUNCTION(proto)) {
     throw MakeTypeError("proto_object_or_null", [proto]);
   }
   var obj = new $Object();


--
v8-dev mailing list
v8-dev@googlegroups.com
http://groups.google.com/group/v8-dev

Reply via email to