Re: WindowProxy objects violate ES5 invariants

Le 15/12/2012 17:45, Boris Zbarsky a écrit :
> On 12/15/12 9:05 AM, David Bruant wrote:
>> A little point that may make things a little bit annoying: when a
>> variable is declared globally with "var" (I assume "let" too and it's
>> worse with "const") or a function declared globally, the
>> variable/function name is currently reflected as a non-configurable
>> property of the global object (I don't know if it's a DOM or an
>> ECMAScript thing).
>
> Oh, indeed.  This is an ECMAScript thing.  See ES5 section 10.5 step 2 
> and then step 8.c.i, which calls section 10.2.1.2.2.
Thanks for the reference.
I guess that reveals a different invariant violation :-)

> So yeah, WindowProxy would have to have some sort of whitelist of 
> things that are configurable
I guess you meant "non-configurable" here.

> if we wanted to report the [Unforgeable] stuff as configurable.
"non-configurable" here too.

Assuming you meant "non-configurable" in both cases, I agree with you.
But it creates a violation of ES5, because it means that 
var/let/const/function global declaration aren't reflected as 
non-configurable (while the section you linked too expects them to). I 
think the solution may just be to reflect as configurable, but act as if 
it was non-configurable (and I guess non-writable for "const" declarations)
I'll bring this issue to es-discuss as it's a more relevant place to 
talk about this problem.

Thanks,

David

Received on Saturday, 15 December 2012 17:06:02 UTC