'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.
Created attachment 280372 [details] Patch
Created attachment 280377 [details] Patch
Comment on attachment 280377 [details] Patch Clearing flags on attachment: 280377 Committed r201627: <http://trac.webkit.org/changeset/201627>
All reviewed patches have been landed. Closing bug.
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.
(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