RESOLVED FIXED 158321
[WebIDL] 'undefined' should be an acceptable value for nullable parameters
https://bugs.webkit.org/show_bug.cgi?id=158321
Summary [WebIDL] 'undefined' should be an acceptable value for nullable parameters
Chris Dumez
Reported 2016-06-02 15:31:57 PDT
'undefined' should be an acceptable value for nullable parameters (and should be converted to null): https://heycam.github.io/webidl/#es-nullable-type Our bindings get most of the cases right but there is a bug in our overload resolution code.
Attachments
Patch (6.53 KB, patch)
2016-06-02 15:33 PDT, Chris Dumez
no flags
Patch (9.44 KB, patch)
2016-06-02 15:58 PDT, Chris Dumez
no flags
Chris Dumez
Comment 1 2016-06-02 15:33:25 PDT
Chris Dumez
Comment 2 2016-06-02 15:58:16 PDT
Chris Dumez
Comment 3 2016-06-02 16:44:11 PDT
Comment on attachment 280377 [details] Patch Clearing flags on attachment: 280377 Committed r201627: <http://trac.webkit.org/changeset/201627>
Chris Dumez
Comment 4 2016-06-02 16:44:15 PDT
All reviewed patches have been landed. Closing bug.
Darin Adler
Comment 5 2016-06-03 19:41:23 PDT
Comment on attachment 280377 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=280377&action=review > Source/WebCore/bindings/scripts/CodeGeneratorJS.pm:1691 > $condition .= "${value}.isUndefined() || " if $parameter->isOptional; > > - # FIXME: WebIDL says that undefined is also acceptable for nullable parameters and should be converted to null: > # http://heycam.github.io/webidl/#es-nullable-type > - $condition .= "${value}.isNull() || " if $parameter->isNullable; > + $condition .= "${value}.isUndefinedOrNull() || " if $parameter->isNullable; This doesn’t seem optimal for parameters that are both optional and nullable. Also, I don’t think we need to keep the URL to the current draft of WebIDL here.
Chris Dumez
Comment 6 2016-06-04 10:17:06 PDT
(In reply to comment #5) > Comment on attachment 280377 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=280377&action=review > > > Source/WebCore/bindings/scripts/CodeGeneratorJS.pm:1691 > > $condition .= "${value}.isUndefined() || " if $parameter->isOptional; > > > > - # FIXME: WebIDL says that undefined is also acceptable for nullable parameters and should be converted to null: > > # http://heycam.github.io/webidl/#es-nullable-type > > - $condition .= "${value}.isNull() || " if $parameter->isNullable; > > + $condition .= "${value}.isUndefinedOrNull() || " if $parameter->isNullable; > > This doesn’t seem optimal for parameters that are both optional and nullable. > > Also, I don’t think we need to keep the URL to the current draft of WebIDL > here. Ok, -> https://bugs.webkit.org/show_bug.cgi?id=158380
Note You need to log in before you can comment on or make changes to this bug.