W3C home > Mailing lists > Public > public-script-coord@w3.org > October to December 2014

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

From: Boris Zbarsky <bzbarsky@mit.edu>
Date: Thu, 04 Dec 2014 11:10:59 -0800
Message-ID: <5480B1C3.3020008@mit.edu>
To: Travis Leithead <travis.leithead@microsoft.com>, "Mark S. Miller" <erights@google.com>
CC: es-discuss <es-discuss@mozilla.org>, "public-script-coord@w3.org" <public-script-coord@w3.org>, Domenic Denicola <domenic@domenicdenicola.com>
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

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:14:23 UTC