[webkit-dev] Optional parameter in IDL and undefined JS value

Kenneth Russell kbr at google.com
Tue Apr 26 18:40:53 PDT 2011

To be clear, the reason "undefined" converts to 0 in this case is
because the argument uses Web IDL type "long", so the argument is
converted using ToInt32 (defined in ECMA-262 in terms of ToNumber).
ToNumber converts undefined to NaN, and ToInt32 then converts NaN to


On Tue, Apr 26, 2011 at 1:34 PM, Jian Li <jianli at chromium.org> wrote:
> Kenneth pointed out that NaN should then be converted to 0 per ECMA. So
> we're doing the right thing in our code generators. Since File API has been
> updated to get this issue clarified, we're fine here with nothing particular
> that needs to be done. Thanks for all your help.
> On Mon, Apr 25, 2011 at 4:43 PM, Jian Li <jianli at chromium.org> wrote:
>> Please see inline for the reply from the spec author Arun about your
>> questions.
>> Arun has updated Blob.slice in the File API spec to explicitly illustrate
>> the case for optional end parameter.
>> If the optional end parameter is not used as a parameter when making this
>> call, let relativeEnd be size.
>> For undefined value being passed to optional numeric parameter, should we
>> consider following ECMA-262 (referred from Web IDL) that defines the
>> conversion of undefined to "NaN" (see Table 12 in Section 9.3)?

More information about the webkit-dev mailing list