Skip to content

Truncation in "convert a Web IDL arguments list to an ECMAScript arguments list" seems (potentially) incorrect #1377

@Ms2ger

Description

@Ms2ger

What is the issue with the Web IDL Standard?

https://webidl.spec.whatwg.org/#web-idl-arguments-list-converting

  1. Let esArgs be an empty list.

  2. Let i be 0.

  3. Let count be 0.

  4. While i < args’s size:

    1. If args[i] is the special value “missing”, then append undefined to esArgs.

    2. Otherwise, args[i] is an IDL value:

      1. Let convertResult be the result of converting args[i] to an ECMAScript value. Rethrow any exceptions.

      2. Append convertResult to esArgs.

      3. Set count to i + 1.

    3. Set i to i + 1.

  5. Truncate esArgs to contain count items.

  6. Return esArgs.

As far as I can tell, args could be « value, "missing", optionalValue », in which case count would be 2 in step 5 and the output would be « value, undefined ». This seems incorrect.

If that case is impossible, the spec should say that. Otherwise I suppose it should count the number of trailing "missing" values in args separately.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions