getOwnPropertyDescriptor side effects

Boris Zbarsky bzbarsky at
Thu Jan 19 14:21:13 UTC 2017

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
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

I should note, per items 1 and 3 above, that the proposal at as of today is in fact 
not web-compatible.


More information about the es-discuss mailing list