Bug 1524943 - IsPackedArray must only be called with objects. r=jandem

This commit is contained in:
André Bargull 2019-02-05 03:09:28 -08:00
Родитель f27d09b731
Коммит ade3d0c3e7
2 изменённых файлов: 5 добавлений и 1 удалений

Просмотреть файл

@ -1508,7 +1508,7 @@ function TypedArrayStaticFrom(source, mapfn = undefined, thisArg = undefined) {
// Try to take a fast path when there's no mapper function and the
// constructor is a built-in TypedArray constructor.
if (!mapping && IsTypedArrayConstructor(C)) {
if (!mapping && IsTypedArrayConstructor(C) && IsObject(source)) {
// TODO: Add fast path for TypedArray inputs (bug 1491813).
// The source is a packed array using the default iterator.

Просмотреть файл

@ -0,0 +1,4 @@
Object.prototype[Symbol.iterator] = Array.prototype[Symbol.iterator];
// Just ensure it doesn't crash.
Uint8Array.from(0);