Closed Bug 1149736 Opened 5 years ago Closed 3 years ago

GetTypedArrayIndex should use ToInteger, ToLength, or something similar to do conversions

Categories

(Core :: JavaScript: Standard Library, defect, minor)

defect
Not set
minor

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: Waldo, Assigned: mrrrgn)

References

(Blocks 2 open bugs)

Details

Particularly, using ValueToId and IsTypedArrayIndex is just not really right.  Without checking, I'd presume doing it this way means that if I were to do

   Atomics.load(arr, Symbol.iterator);

then I wouldn't get an error thrown trying to convert the index to a number.  But ordinarily trying to convert a symbol to anything is expected to throw.  This seems inconsistent with, e.g. new DataView(typedArray).getInt8(Symbol.iterator).
Seems plausible.  The spec is lagging here too, if I'm not mistaken.
GetSharedTypedArrayIndex is gone, but GetTypedArrayIndex has the same problem.
Blocks: es6
Summary: GetSharedTypedArrayIndex should use ToInteger, ToLength, or something similar to do conversions → GetTypedArrayIndex should use ToInteger, ToLength, or something similar to do conversions
Assignee: nobody → winter2718
No longer blocks: es6
GetTypedArrayIndex now delegates to ToIntegerIndex, which appears to do the right thing, and if it should turn out that it does not the right thing at least we're doing things consistently.  A big Thank You to whoever cleaned this up.
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.