RESOLVED FIXED 159087
Binding generator should generate safe accessors for constructors used in JS builtin code
https://bugs.webkit.org/show_bug.cgi?id=159087
Summary Binding generator should generate safe accessors for constructors used in JS ...
youenn fablet
Reported 2016-06-24 04:51:38 PDT
ReadableStrem as well as RTC codes is using JS built-in. It is often useful to have a safe access to constructors (@ReadableStream for instance). Binding generator should be able to handle that using PrivateIdentifier/PublicIdentifier keywords.
Attachments
Patch (10.07 KB, patch)
2016-06-24 05:08 PDT, youenn fablet
no flags
Patch (29.59 KB, patch)
2016-06-25 06:54 PDT, youenn fablet
no flags
youenn fablet
Comment 1 2016-06-24 05:08:05 PDT
youenn fablet
Comment 2 2016-06-24 05:10:01 PDT
With this patch, it also becomes a bit easier to do type checks in JS-builtins like: if(arg1 instanceof @MyClass) @throw...
Alex Christensen
Comment 3 2016-06-24 18:10:47 PDT
Could you add a bindings test that shows the new behavior of the bindings generator?
Adam Bergkvist
Comment 4 2016-06-25 02:33:10 PDT
This feature would be very useful. Thanks Youenn.
Adam Bergkvist
Comment 5 2016-06-25 02:37:01 PDT
Comment on attachment 281969 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=281969&action=review > Source/WebCore/Modules/mediastream/MediaStream.idl:32 > + PublicIdentifier Is it obvious that these extended attributes are referring to the constructor? Would it be more descriptive to use 'PrivateConstructorIdentifier' and 'PublicConstructorIdentifier'?
youenn fablet
Comment 6 2016-06-25 06:54:40 PDT
youenn fablet
Comment 7 2016-06-25 07:00:59 PDT
(In reply to comment #3) > Could you add a bindings test that shows the new behavior of the bindings > generator? I added a binding test for global object attribute. This does not fully test these attributes on constructors though. Maybe run-binding-tests should be beefed up and support that as well. > > Source/WebCore/Modules/mediastream/MediaStream.idl:32 > > + PublicIdentifier > > Is it obvious that these extended attributes are referring to the > constructor? Would it be more descriptive to use > 'PrivateConstructorIdentifier' and 'PublicConstructorIdentifier'? I am not opposed to that although I did not do it in the uploaded patch. Doing so would require to convert PrivateConstructorIdentifier into PrivateIdentifier when adding attributes to the global object for each defined constructor in Source/WebCore/bindings/scripts/preprocess-idls.pl script.
Adam Bergkvist
Comment 8 2016-06-27 10:46:26 PDT
(In reply to comment #7) > > Is it obvious that these extended attributes are referring to the > > constructor? Would it be more descriptive to use > > 'PrivateConstructorIdentifier' and 'PublicConstructorIdentifier'? > > I am not opposed to that although I did not do it in the uploaded patch. > Doing so would require to convert PrivateConstructorIdentifier into > PrivateIdentifier when adding attributes to the global object for each > defined constructor in Source/WebCore/bindings/scripts/preprocess-idls.pl > script. I think it works as is as well.
Alex Christensen
Comment 9 2016-06-27 23:33:13 PDT
Comment on attachment 282072 [details] Patch Sure. We can change the names later if we're unhappy with them.
WebKit Commit Bot
Comment 10 2016-06-28 00:05:15 PDT
Comment on attachment 282072 [details] Patch Clearing flags on attachment: 282072 Committed r202551: <http://trac.webkit.org/changeset/202551>
WebKit Commit Bot
Comment 11 2016-06-28 00:05:22 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.