Comment #2 on issue 1837 by [email protected]: Defining properties in Object.prototype returns invalid (boxed) values
http://code.google.com/p/v8/issues/detail?id=1837

For the record, the boxed value is the correct result. The 'this' value of a non-strict user-defined function is always an object, not a primitive value.

if you change the code to:
  Object.defineProperty(Object.prototype, "toArray", {value: function() {
    "use strict";
    return Array.isArray(this) ? this : [this];
  }});
then the primitive value will not be boxed.

The bug in issue 1973 is that the getter doesn't properly box the 'this' value.

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

Reply via email to