Index: src/typedarray.js |
diff --git a/src/typedarray.js b/src/typedarray.js |
index 7bd16f670b4425b88319676a52374c480b5b2477..f9e732fa7f8f35bfd13598746c8a02f9af98b2ef 100644 |
--- a/src/typedarray.js |
+++ b/src/typedarray.js |
@@ -77,10 +77,11 @@ function CreateTypedArrayConstructor(name, elementSize, arrayId, constructor) { |
function ConstructByArrayLike(obj, arrayLike) { |
var length = arrayLike.length; |
var l = ToPositiveInteger(length, "invalid_typed_array_length"); |
- if(!%TypedArrayInitializeFromArrayLike(obj, arrayId, arrayLike, l)) { |
- for (var i = 0; i < l; i++) { |
- obj[i] = arrayLike[i]; |
- } |
+ var byteLength = l * elementSize; |
+ var buffer = new $ArrayBuffer(byteLength); |
+ %TypedArrayInitialize(obj, arrayId, buffer, 0, byteLength); |
+ for (var i = 0; i < l; i++) { |
+ obj[i] = arrayLike[i]; |
} |
} |