Re: Figuring out the behavior of WindowProxy in the face of non-configurable properties

On 12/4/14, 10:44 AM, Travis Leithead wrote:
> So... this will prevent defining non-configurable properties on the global?

It will prevent using

   Object.defineProperty(window, "name",  non-configurable-descriptor);

to define a property.

Note that "window" is not the global.  It's a proxy whose target is the 
global.

> Combined with [PrimaryGlobal], this seems at odds with what browsers do internally to prevent re-definition of some properties like "document"?

Browsers can define properties on the actual global, so there is no 
problem here.

> Are we sure we want this restriction?

Well, good question.  If we don't do this restriction (by which I assume 
defineProperty throwing; I assume getOwnPropertyDescriptor claiming 
configurable always is less controversial), what do we want to do?

Note that I did a bit of digging into the history here and as far as I 
can tell every single UA screwed up when implementing 
Object.getOwnPropertyDescriptor and company in ES5.  ES5 clearly spells 
out the rules for these methods, and browsers just didn't follow those 
rules.  Plus lack of testing and here we are.

-Boris

Received on Thursday, 4 December 2014 19:11:31 UTC