Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Ms2ger opened this issue Dec 12, 2023 · 0 comments

Comments

@Ms2ger
Copy link
Member

Ms2ger commented Dec 12, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant