« Bugzilla Issues Index

#1672 — %TypedArray% constructors and constructor selection issues

The constructor " %TypedArray% (length)":
- change end of first sentence in preamble from "is not Number" to "is not Object".
- step 2 is empty

The constructor " %TypedArray% (typedArray)":
- add an additional step to throw a TypeError if srcArray's [[ViewedArrayBuffer]] is undefined
- srcArray's [[ByteOffset]] data property is not taken into account when the array buffer is cloned
- remove step 16-17, the data was already cloned in step 12, calling SetArrayBufferData() would erase the contents resp. create a new clear buffer

The constructor " %TypedArray% (array)":
- step 3, variable "srcArray" is unused
- step 12, change TypeError to RangeError
- step 17, change "status" to "data"
- step 19b, change "Get(O, Pk)" to "Get(array, Pk)"

The constructor " %TypedArray% (buffer, byteOffset=0, length=undefined)":
- missing step? If buffer's [[ArrayBufferData]] is undefined then throw TypeError. Or should it be possible to initialise a TypedArray object with an uninitialised ArrayBuffer object?
- add test after step 15b, if newByteLength < 0 then throw RangeError

" %TypedArray% (all other argument combinations)":
- Typo "that do match" -> "that do not match"

The constructor selection does not reflect the current browser situation, e.g. SpiderMonkey/V8/JSC accept `new Int8Array(16, 0)` and treat it as an equivalent call to `new Int8Array(16)` whereas the current selection algorithm requires this call to throw a TypeError.

fixed in rev17 editor's draft

fixed in rev17, August 23, 2013 draft