diff options
Diffstat (limited to 'js/src/builtin/Array.js')
-rw-r--r-- | js/src/builtin/Array.js | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/js/src/builtin/Array.js b/js/src/builtin/Array.js index 45f90a7b8..30e6fb35f 100644 --- a/js/src/builtin/Array.js +++ b/js/src/builtin/Array.js @@ -711,13 +711,14 @@ function CreateArrayIterator(obj, kind) { // http://www.ecma-international.org/ecma-262/6.0/index.html#sec-%arrayiteratorprototype%.next function ArrayIteratorNext() { // Step 1-3. - if (!IsObject(this) || !IsArrayIterator(this)) { + var obj; + if (!IsObject(this) || (obj = GuardToArrayIterator(this)) === null) { return callFunction(CallArrayIteratorMethodIfWrapped, this, "ArrayIteratorNext"); } // Step 4. - var a = UnsafeGetReservedSlot(this, ITERATOR_SLOT_TARGET); + var a = UnsafeGetReservedSlot(obj, ITERATOR_SLOT_TARGET); var result = { value: undefined, done: false }; // Step 5. @@ -728,10 +729,10 @@ function ArrayIteratorNext() { // Step 6. // The index might not be an integer, so we have to do a generic get here. - var index = UnsafeGetReservedSlot(this, ITERATOR_SLOT_NEXT_INDEX); + var index = UnsafeGetReservedSlot(obj, ITERATOR_SLOT_NEXT_INDEX); // Step 7. - var itemKind = UnsafeGetInt32FromReservedSlot(this, ITERATOR_SLOT_ITEM_KIND); + var itemKind = UnsafeGetInt32FromReservedSlot(obj, ITERATOR_SLOT_ITEM_KIND); // Step 8-9. var len = IsPossiblyWrappedTypedArray(a) @@ -740,13 +741,13 @@ function ArrayIteratorNext() { // Step 10. if (index >= len) { - UnsafeSetReservedSlot(this, ITERATOR_SLOT_TARGET, null); + UnsafeSetReservedSlot(obj, ITERATOR_SLOT_TARGET, null); result.done = true; return result; } // Step 11. - UnsafeSetReservedSlot(this, ITERATOR_SLOT_NEXT_INDEX, index + 1); + UnsafeSetReservedSlot(obj, ITERATOR_SLOT_NEXT_INDEX, index + 1); // Step 16. if (itemKind === ITEM_KIND_VALUE) { @@ -900,11 +901,7 @@ function ArrayToLocaleString(locales, options) { if (firstElement === undefined || firstElement === null) { R = ""; } else { -#if EXPOSE_INTL_API R = ToString(callContentFunction(firstElement.toLocaleString, firstElement, locales, options)); -#else - R = ToString(callContentFunction(firstElement.toLocaleString, firstElement)); -#endif } // Step 3 (reordered). @@ -919,11 +916,7 @@ function ArrayToLocaleString(locales, options) { // Steps 9.a, 9.c-e. R += separator; if (!(nextElement === undefined || nextElement === null)) { -#if EXPOSE_INTL_API R += ToString(callContentFunction(nextElement.toLocaleString, nextElement, locales, options)); -#else - R += ToString(callContentFunction(nextElement.toLocaleString, nextElement)); -#endif } } |