Bug 1686936 part 9 - Make GetElements work with large buffers. r=anba

Depends on D102150

Differential Revision: https://phabricator.services.mozilla.com/D102151
This commit is contained in:
Jan de Mooij 2021-01-19 10:11:41 +00:00
parent c151cdec28
commit 2ab627369b
2 changed files with 3 additions and 3 deletions

View File

@ -453,7 +453,7 @@ bool js::GetElements(JSContext* cx, HandleObject aobj, uint32_t length,
if (aobj->is<TypedArrayObject>()) {
Handle<TypedArrayObject*> typedArray = aobj.as<TypedArrayObject>();
if (typedArray->length().deprecatedGetUint32() == length) {
if (typedArray->length().get() == length) {
return TypedArrayObject::getElements(cx, typedArray, vp);
}
}

View File

@ -2190,13 +2190,13 @@ bool TypedArrayObject::getElementPure(size_t index, Value* vp) {
bool TypedArrayObject::getElements(JSContext* cx,
Handle<TypedArrayObject*> tarray,
Value* vp) {
uint32_t length = tarray->length().deprecatedGetUint32();
size_t length = tarray->length().get();
MOZ_ASSERT_IF(length > 0, !tarray->hasDetachedBuffer());
switch (tarray->type()) {
#define GET_ELEMENTS(T, N) \
case Scalar::N: \
for (uint32_t i = 0; i < length; ++i, ++vp) { \
for (size_t i = 0; i < length; ++i, ++vp) { \
if (!N##Array::getElement(cx, tarray, i, \
MutableHandleValue::fromMarkedLocation(vp))) { \
return false; \