getOwnPropertyDescriptor side effects

Isiah Meadows isiahmeadows at
Thu Jan 19 17:24:39 UTC 2017

I agree that no setter (I didn't see one in the spec) is not Web
compatible. In fact, I recall Bluebird running into serious issues with
erroneous warnings over read-only stacks in PhantomJS, and had to disable
them in my tests as a result. (I eventually dropped the dependency in favor
of native promises + a smaller polyfill, but not until later.)

But I do have a couple questions:

1. What does Firefox do with the getter on non-errors? Does it delegate to
the own `stack`? (I'm not familiar)
2. How breaking is having the getter and setter throwing on non-errors? I'm
struggling to see how it'd be that breaking. It's a getter, not a method,
so it requires a call to `__locateGetter__` or `Object.defineProperty` to
even access. Also, V8 returns a lazily computed value descriptor (spec
violation, unlikely to be fixed before this is implemented).

On Thu, Jan 19, 2017, 09:21 Boris Zbarsky <bzbarsky at> wrote:

> On 1/19/17 2:33 AM, Jordan Harband wrote:
> > The beginnings of the Error Stacks proposal is now up
> > at
> I can't speak for other browsers, but the description of the Firefox
> behavior in that proposal does not look correct.
> Here's what I understand the Firefox behavior to be:
> 1)  The getter does NOT throw on a non-Error receiver.  Doing that
>      would be very much not web-compatible.
> 2)  The behavior of the getter is as follows:
>    a) If the receiver is not an object, throw.
>    b) Walk up the prototype chain (note: this can invoke proxy
>       [[GetPrototype]] traps) until we find either an Error object
>       or Error.prototype.  If we reach null before doing either of
>       those, throw.
>    c) Return the stack string for the object we found.  For
>       Error.prototype this would be the empty string; for an Error
>       object it's the stack captured when it was created.
> 3)  The setter doesn't care what the receiver is, as long as it's
>      an object.  Again, throwing for non-Error would not be
>      web-compatible.
> 4)  The actual behavior of the setter is to throw if called with
>      no arguments.  Otherwise, the setter invokes its receiver's
>      [[DefineOwnProperty]] with the property name "stack" and a
>      property descriptor that looks like this:
>      { [[Value]]: setterArg, [[Configurable]]: true,
>        [[Writable]]: true, [[Enumerable]]: true }
>      where setterArg is the first argument that was passed to the
>      setter.
> I should note, per items 1 and 3 above, that the proposal at
> as of today is in fact
> not web-compatible.
> -Boris
> _______________________________________________
> es-discuss mailing list
> es-discuss at
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list