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
"array index property name" doesn't guard against failure #346
Comments
I must be missing something. https://heycam.github.io/webidl/#dfn-array-index-property-name says:
So we land in https://tc39.github.io/ecma262/#sec-touint32 which can only throw via ToNumber, and our argument is guaranteed to be a String. https://tc39.github.io/ecma262/#sec-tonumber in the string case says:
so how can this throw? |
Is the Type(P) is String an assertion that the input must meet or a check on input that makes it return false if you pass a Symbol? |
The latter. Any property name for which Type(P) is not string or the algorithm returns false is not an array index property name. If there's a clearer way of phrasing this, happy to do that. |
Making the type check the first step of the algorithm and confidently asserting that ToUint32 and ToString cannot throw with the ! convention from JavaScript would do the trick. |
I tried to find out if we could reuse a definition from JavaScript directly, but https://tc39.github.io/ecma262/#sec-array-exotic-objects seems to have the bug that IDL does not and it's defined somewhat informatively. |
Filed tc39/ecma262#900. |
Make it explicit that the algorithm only accepts strings as input and does not throw. Fixes whatwg#346.
Make it explicit that the algorithm only accepts strings as input and does not throw. Fixes #346.
In particular, ToUint32 can throw and the various callers we have of this check don't expect that. (At least not those in HTML.)
The text was updated successfully, but these errors were encountered: