Comment #1 on issue 1233 by [email protected]: Can't get descriptor of
property whose values doesn't inherit from Object.prototype
http://code.google.com/p/v8/issues/detail?id=1233
It's a more general problem:
$ v8
V8 version 3.1.6 (candidate) [console: dumb]
d8> var x = { foo: Object.create(null) };
d8> void Object.freeze(x);
TypeError: Cannot convert object to primitive value
d8>
$ v8
V8 version 3.1.6 (candidate) [console: dumb]
d8> var x = { foo: Object.create(null) };
d8> x.foo.valueOf = function(){ throw Error('gotcha'); };
function (){ throw Error('gotcha'); }
d8> x.foo.toString = function(){ throw Error('gotcha2'); };
function (){ throw Error('gotcha2'); }
d8> void Object.freeze(x);
Error: gotcha2
d8>
It seems that at least Object.freeze and Object.getOwnPropertyDescriptor
are calling toString on the values of the properties it is operating on.
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev