Figuring out the behavior of WindowProxy in the face of non-configurable properties
bzbarsky at mit.edu
Thu Dec 4 11:10:59 PST 2014
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
> 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
> 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.
More information about the es-discuss