Skip to content

Commit

Permalink
Add check for %ArrayIteratorPrototype%.next modification again
Browse files Browse the repository at this point in the history
  • Loading branch information
petamoriken committed Dec 24, 2022
1 parent 64d9d79 commit 7367f51
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/_util/is.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import {
ArrayBufferPrototypeGetByteLength,
ArrayIsArray,
ArrayIteratorPrototype,
ArrayIteratorPrototypeNext,
MathTrunc,
NativeArrayPrototypeSymbolIterator,
NativeSharedArrayBuffer,
Expand Down Expand Up @@ -89,7 +91,11 @@ export function isOrdinaryArray(value) {
return false;
}

if (value[SymbolIterator] === NativeArrayPrototypeSymbolIterator) {
// Verify that there are no changes in ArrayIterator
if (
value[SymbolIterator] === NativeArrayPrototypeSymbolIterator &&
ArrayIteratorPrototype.next === ArrayIteratorPrototypeNext
) {
return true;
}

Expand All @@ -108,7 +114,11 @@ export function isOrdinaryNativeTypedArray(value) {
return false;
}

if (value[SymbolIterator] === NativeTypedArrayPrototypeSymbolIterator) {
// Verify that there are no changes in ArrayIterator
if (
value[SymbolIterator] === NativeTypedArrayPrototypeSymbolIterator &&
ArrayIteratorPrototype.next === ArrayIteratorPrototypeNext
) {
return true;
}

Expand Down

0 comments on commit 7367f51

Please sign in to comment.