archives

« Bugzilla Issues Index

#3269 — 22.2.3.* %TypedArray%: toLocaleString and iterator methods currently use Get("length") instead of [[ArrayLength]]


22.2.3.6 %TypedArray%.prototype.entries ( )
22.2.3.15 %TypedArray%.prototype.keys ( )
22.2.3.28 %TypedArray%.prototype.toLocaleString ([ reserved1 [ , reserved2 ] ])
22.2.3.30 %TypedArray%.prototype.values ( )
22.2.3.31 %TypedArray%.prototype [ @@iterator ] ( )


All %TypedArray%.prototype except for toLocaleString and the iteration methods are using the [[ArrayLength]] internal slot to retrieve the typed array's length. It may make sense to [[ArrayLength]] for those methods, too.


---
// Typed array with own "length" property
var ta = Object.defineProperty(new Int8Array([1,2,3]), "length", {
writable: true, configurable: true, value: 1
});

print(ta.toString()); // Prints "1,2,3"
print(ta.toLocaleString()); // Prints "1"

print(ta.map(v => v * v).toString()); // Prints "1,4,9"
print(Int8Array.from(ta, v => v * v).toString()); // Prints "1"
---


fixed in rev30 editor's draft

toLocaleString is now TypedArray specialize

ArrayInteral next now has special case logic for accessing the length of typed arrays


fixed in rev30