blob: fc2c68d7f518fa650fdf470ac93b02583821669c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
// Test various ways of changing the behavior of |typedArray.length|.
function addLengthProperty() {
var x = new Uint16Array();
Object.defineProperty(x, "length", {value:1});
for (var i = 0; i < 5; i++)
assertEq(x.length, 1);
}
addLengthProperty();
function changePrototype() {
var x = new Uint16Array();
x.__proto__ = [0];
for (var i = 0; i < 5; i++)
assertEq(x.length, 1);
}
changePrototype();
function redefineLengthProperty() {
var x = new Uint16Array();
Object.defineProperty(Uint16Array.prototype, "length", {value:1});
for (var i = 0; i < 5; i++)
assertEq(x.length, 1);
}
redefineLengthProperty();
|