getOwnPropertyDescriptor side effects

Isiah Meadows isiahmeadows at gmail.com
Wed Jan 11 11:43:32 UTC 2017


Not if it's (likely) throwing from the `new Error`.

On Tue, Jan 10, 2017, 15:16 Michał Wadas <michalwadas at gmail.com> wrote:

> V8 have bug.
>
> Reproduction code:
> Error.prepareStackTrace = ()=>{throw 123}
> Object.getOwnPropertyDescriptor(new Error, 'stack') // throws 123
>
> It should be probably filled on V8 bug tracker.
>
>
> On 10/01/17 21:14, Isiah Meadows wrote:
>
> To clarify, what engine has the bug here? I've lost that context.
>
> On Tue, Jan 10, 2017, 14:54 Michał Wadas < <michalwadas at gmail.com>
> michalwadas at gmail.com> wrote:
>
> Actually here spec repeats itself because...
>
> *A conforming implementation of ECMAScript may provide additional* types,
> values, objects, *properties*, and functions beyond those described in
> this specification. *In particular, a conforming implementation of
> ECMAScript may provide properties not described in this specification, and
> values for those properties, for objects that are described in this
> specification*.
>
> So implementation is explicitly allowed to add new properties on objects.
>
> Though, internal methods and internal slots are not properties:
>
> Internal slots correspond to internal state that is associated with
> objects and used by various ECMAScript specification algorithms. *Internal
> slots are not object properties* and they are not inherited.
>
> So it's spec violation to have custom [[GetOwnProperty]] implementation on
> ordinary objects.
> On 10/01/17 20:36, Boris Zbarsky wrote:
>
> On 1/10/17 2:31 PM, Michał Wadas wrote:
>
> Implementations are allowed to extend objects. Otherwise presence of
> global/console/// would violate spec...
>
>
> http://www.ecma-international.org/ecma-262/6.0/#sec-global-object
> explicitly says that the global object may have additional properties, so
> global .console is clearly not a spec violation.
>
> -Boris
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20170111/e11a901d/attachment-0001.html>


More information about the es-discuss mailing list