[webkit-dev] Global constructors attributes

Kentaro Hara haraken at chromium.org
Wed Apr 17 18:02:10 PDT 2013


>
> Alternatively, we could add [NotEnumerable, Deletable] before each
> *Constructor attribute in DOMWindow.idl but it seemed easier the patch the
> generator considering the number of such attributes in DOMWindow. Also,
> there is a risk of someone adding a new constructor attribute without the
> needed extended attributes.


BTW, it is sad that we have to add XXXConstructor for all interfaces
exposed to window. In terms of the Web IDL spec, we should implement
[NoInterfaceObject] IDL attribute to WebKit/Blink and remove
XXXConstructors from DOMWindow.idl.

I mean, a right way to solve your problem might be (1) implement
[NoInterfaceObject] and then (2) tweak generated code for interfaces that
do not have [NoInterfaceObject].



On Thu, Apr 18, 2013 at 3:49 AM, Christophe Dumez - SISA <
ch.dumez at partner.samsung.com> wrote:

>  Hi,
>
> The code change is actually really small. This is basically, 2/3 lines in
> the bindings generator.
>
> Alternatively, we could add [NotEnumerable, Deletable] before each
> *Constructor attribute in DOMWindow.idl but it seemed easier the patch the
> generator considering the number of such attributes in DOMWindow. Also,
> there is a risk of someone adding a new constructor attribute without the
> needed extended attributes.
>
> Either way though, it seems easily reversible.
>
> Kr,
> Christophe DUMEZ.
>
>  ------------------------------
> *From:* ryosuke.niwa at gmail.com [ryosuke.niwa at gmail.com] on behalf of
> Ryosuke Niwa [rniwa at webkit.org]
> *Sent:* Wednesday, April 17, 2013 21:36
> *To:* Christophe Dumez - SISA
> *Cc:* webkit-dev at lists.webkit.org
> *Subject:* Re: [webkit-dev] Global constructors attributes
>
>   This seems like a worthwhile change and I do support it but is it
> possible to make this fix behind a build flag or make it self-contained
> such that we can revert easily if needed?
>
>  While I do agree with you that the compatibility risk is probably small,
> I'd like to make sure we have an option of being able to revert the change
> or disabling the fix if we did find a compatibility issue later.
>
> On Wed, Apr 17, 2013 at 11:32 AM, Christophe Dumez - SISA <
> ch.dumez at partner.samsung.com> wrote:
>
>>  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
>>
>>
>> _______________________________________________
>> webkit-dev mailing list
>> webkit-dev at lists.webkit.org
>> https://lists.webkit.org/mailman/listinfo/webkit-dev
>>
>>
>
> _______________________________________________
> webkit-dev mailing list
> webkit-dev at lists.webkit.org
> https://lists.webkit.org/mailman/listinfo/webkit-dev
>
> --
> Kentaro Hara, Tokyo, Japan
> <https://lists.webkit.org/mailman/listinfo/webkit-dev>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20130418/bd35874b/attachment.html>


More information about the webkit-dev mailing list