[whatwg] [[GetOwnProperty]] for named properties of the Window object

Gavin Barraclough barraclough at apple.com
Wed Sep 11 15:05:06 PDT 2013

Hi Boris,

Thanks, this is really helpful.

On Sep 5, 2013, at 7:15 PM, Boris Zbarsky <bzbarsky at MIT.EDU> wrote:
> Ccing public-script-coord, since that's the right place for this discussion (because WebIDL is the relevant specification).
> On 9/5/13 6:45 PM, Gavin Barraclough wrote:
>> Firefox and Chrome both return descriptors from an object on the prototype chain per the spec
> Chrome doesn't quite follow the spec here, for what it's worth: it returns them from Window.prototype as far as I can tell, not from an actual named properties object.

Interesting, I had just assumed this was okay – is it not spec-compliant for Window.prototype to be a named properties object?

>> attributes of the value are configured differently, with enumerable set to false, writable and configurable set to true.
> Current tip Firefox returns {"configurable":true,"enumerable":true,"writable":true} and enumerates the properties.  Probably a change from https://bugzilla.mozilla.org/show_bug.cgi?id=895758 to align better with the spec in terms of the enumeration behavior.
>> There seem to be some compelling reasons to follow Firefox / Chrome (writable true seems more congruent with ECMA262 specified [[Put]]
> Indeed.  I think the current setup in the spec would make window.foo not settable if <img id="foo"> exists....  That seems bad.

I believe these properties are implemented as shadowable in the same way as [Replaceable] properties, so I was somewhat expecting the spec to define properties returned by named property objects to implicitly have the [Replaceable] extended attribute specified in WebIDL (and then assume a modified behaviour of ES [Put] for properties with this attribute, to permit overwrite even if readonly).  But I’m not yet familiar enough with the spec to know if this is a reasonable line of thought. :-)


>> unless there is another mechanism I’m missing here, enumerable is odd since I don’t think the spec says anything about [[GetOwnPropertyNames]])
> It doesn't, but it does talk about enumeration; see http://dev.w3.org/2006/webapi/WebIDL/#property-enumeration (whether that's applicable to the Named Properties Object is an interesting question).
> Granted, I would rather that were defined in terms of [[GetOwnPropertyNames]] on the relevant objects instead; that's what actually needs to happen under the hood anyway.
>> ,so I was hoping to better understand why the spec requires the behaviour it does (or whether I’m just following it incorrectly!)
> I think you're following it correctly; it's just buggy.  ;)
> -Boris

More information about the whatwg mailing list