mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-08-15 08:53:07 +09:00
Issue #2838 - Use ToIndex in TypedArray CTORs
Also adjusts index handling to be more accurate/spec compliant.
This commit is contained in:
parent
2026586ce1
commit
c07ea665ea
5 changed files with 33 additions and 24 deletions
|
|
@ -83,8 +83,7 @@ static bool
|
|||
ReportOutOfRange(JSContext* cx)
|
||||
{
|
||||
// Use JSMSG_BAD_INDEX here even if it is generic, since that is
|
||||
// the message used by ToIntegerIndex for its initial range
|
||||
// checking.
|
||||
// the message used by NonStandardToIndex for its initial range checking.
|
||||
JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_BAD_INDEX);
|
||||
return false;
|
||||
}
|
||||
|
|
@ -114,7 +113,7 @@ static bool
|
|||
GetTypedArrayIndex(JSContext* cx, HandleValue v, Handle<TypedArrayObject*> view, uint32_t* offset)
|
||||
{
|
||||
uint64_t index;
|
||||
if (!js::ToIntegerIndex(cx, v, &index))
|
||||
if (!NonStandardToIndex(cx, v, &index))
|
||||
return false;
|
||||
if (index >= view->length())
|
||||
return ReportOutOfRange(cx);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue