W3C home > Mailing lists > Public > whatwg@whatwg.org > September 2013

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

From: Gavin Barraclough <barraclough@apple.com>
Date: Wed, 11 Sep 2013 15:05:06 -0700
Message-id: <C9BAE4B7-C54B-451A-872D-40D6CEAED23C@apple.com>
To: Boris Zbarsky <bzbarsky@MIT.EDU>
Cc: whatwg@lists.whatwg.org, "public-script-coord@w3.org" <public-script-coord@w3.org>
Hi Boris,

Thanks, this is really helpful.

On Sep 5, 2013, at 7:15 PM, Boris Zbarsky <bzbarsky@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. :-)

Thanks,
Gavin

>> 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
Received on Wednesday, 11 September 2013 22:05:33 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 17:00:09 UTC