getOwnPropertyDescriptor side effects

Boris Zbarsky bzbarsky at mit.edu
Tue Jan 10 19:21:28 UTC 2017


On 1/10/17 2:10 PM, Raul-Sebastian Mihăilă wrote:
> Do you mean that an implementation is allowed to return an exotic object
> from the Error constructor?

No, I'm saying some implementations do that, because they want to 
implement a non-standard "stack" property and the only way to get 
reasonable behavior (as those implementations define "reasonable") for 
it is to have the object be an exotic object.

There are other implementation strategies for "stack" that don't involve 
an exotic Error object, of course (e.g. SpiderMonkey implements it as an 
accessor property on Error.prototype).  They have their own tradeoffs, 
though.

> Not returning an ordinary object from the Error constructor is
> non-conformant and, assuming that conformance is a requirement for V8,
> it's a bug.

Sure, just like arguably the presence of the "stack" property to start 
with is a bug, because per spec it's totally unexpected.

-Boris


More information about the es-discuss mailing list