Status: New
Owner: ----

New issue 2804 by [email protected]: Generic use of __proto__ accessor not allowed
http://code.google.com/p/v8/issues/detail?id=2804

On v8 3.20.8.1 / Chrome v28, `__proto__` is reflected as an accessor, but extracting the setter and calling it is prohibited:

{{{
var protoDesc = Object.getOwnPropertyDescriptor(Object.prototype,'__proto__'); protoDesc.set.call({}, {}); // TypeError: Generic use of __proto__ accessor not allowed
}}}

I hit this error because I'm maintaining a library that shims Object.setPrototypeOf, a new primitive in ES6 (see <https://github.com/tvcutsem/harmony-reflect/issues/18> for details)

My code tests whether a platform reflects `__proto__` as an accessor property whose setter is a function and if so, uses the extracted setter to implement Object.setPrototypeOf.

I updated my shim to take v8's throwing behavior into account, but I wonder, since v8 supports mutable `__proto__` (by virtue of `obj.__proto__ = v` ), why disallow the generic setter? Especially as ES6 will add `Object.setPrototypeOf` which is equivalent.

Finally, if a mutable generic setter is really undesirable, it would be easier to feature-detect if `protoDesc.set` were set to `undefined`, which is the standard way in which a property descriptor signals that the property cannot be updated.

--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to