Re: [WebIDL] interface objects and properties too restrictive?

On Aug 3, 2010, at 4:57 PM, Travis Leithead wrote:

> Hey folks, just wondering what the justification behind the current {DontDelete} semantics are in WebIDL 4.4 [1] and 4.5 (second bullet) [2]. When our IE9 binding ported this to ES5, it translated to "configurable: false", which completely destroyed the ability to set accessors on the interface objects as well as operations (and in our case, DOM accessors). Because of this, we actually don't mark our interface objects OR operations/attributes as configurable: false, rather configurable: true.*

I'm a little confused about what you mean and how it relates to the spec. To clarify what the spec actually says:
> 
> If this seems reasonable, I'd like to see the spec updated.
> 
> -Travis
> 
> *special exceptions apply :-)
> 
> [1] http://dev.w3.org/cvsweb/~checkout~/2006/webapi/WebIDL/Overview.html?rev=1.206&content-type=text/html; charset=iso-8859-1#es-interfaces

In this case, what's DontDelete is the property on the global object that represents the interface object. For example, for the HTMLElement interface, it would be the property window.HTMLElement. This should have no effect on making use of the object assigned to that property. It just means you can't alter that property of the Window object, other than to change its value.

> [2] http://dev.w3.org/cvsweb/~checkout~/2006/webapi/WebIDL/Overview.html?rev=1.206&content-type=text/html; charset=iso-8859-1#host-objects

And in this case, DontDelete only applies to readonly attributes. It seems correct and indeed required that you can't delete a readonly attribute or reconfigure it in other ways. An example of a readonly attribute in HTML5 is HTMLDocument.URL. It would (obviously I hope) make no sense to delete Document.URL or replace it with a setter.

I don't see how this "completely destroy[s] the ability to set accessors". You can still add a setter to HTMLElement.prototype.

Regards,
Maciej

Received on Wednesday, 4 August 2010 09:15:22 UTC