[webkit-dev] Global constructors attributes

Christophe Dumez - SISA ch.dumez at partner.samsung.com
Wed Apr 17 11:32:22 PDT 2013


Hi,

According to the Web IDL specification [1] (still valid in the latest Editor Draft [2]), global constructors should have the following attributes:
{ [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true }

Quoting from the specification:
"""

For every interface<http://dev.w3.org/2006/webapi/WebIDL/#dfn-interface> that:

  *   is a callback interface<http://dev.w3.org/2006/webapi/WebIDL/#dfn-callback-interface> that has constants<http://dev.w3.org/2006/webapi/WebIDL/#dfn-constant> declared on it, or
  *   is a non-callback interface<http://dev.w3.org/2006/webapi/WebIDL/#dfn-interface> that is not declared with the [NoInterfaceObject]<http://dev.w3.org/2006/webapi/WebIDL/#NoInterfaceObject> extended attribute<http://dev.w3.org/2006/webapi/WebIDL/#dfn-extended-attribute>,

a corresponding property must exist on the ECMAScript global object. The name of the property is the identifier<http://dev.w3.org/2006/webapi/WebIDL/#dfn-identifier> of the interface, and its value is an object called theinterface object.

The property has the attributes { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true }. The characteristics of an interface object are described in section 4.4.1<http://dev.w3.org/2006/webapi/WebIDL/#interface-object>below.

"""

Currently, global constructors have the following attributes in WebKit, which is not according to spec:
{ [[Writable]]: true, [[Enumerable]]: true, [[Configurable]]: false }

This is causing some W3C compliance tests to fail, such as this one [3].

Behavior of other browsers:
- Firefox follows the specification
- Blink does not follow the specification
- IE9 follows partly the spec:
  * global constructors are not enumerable (according to spec)
  * global constructors are not deletable (not according to spec)

I don't think it is likely web sites rely on those global constructors being enumerable considering that they are not enumerable in both IE9 and Firefox. Making them deletable seems low risk to me as well.

I uploaded a patch proposal to bugzilla [4] to make WebKit follow this part of the spec. I would appreciate feedback from the rest of the community as this is a "web-exposed" behavior change.

Kr,
Christophe DUMEZ

[1] http://www.w3.org/TR/2012/CR-WebIDL-20120419/#es-interfaces
[2] http://dev.w3.org/2006/webapi/WebIDL/#es-interfaces
[3] http://w3c-test.org/webapps/ProgressEvents/tests/submissions/Ms2ger/interface.html (2 last tests)
[4] https://bugs.webkit.org/show_bug.cgi?id=110573

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20130417/9e688204/attachment.html>


More information about the webkit-dev mailing list