blob: 4dfe32daae3486264ed758e2f7e2a1c031b1c821 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
function maybeFreeze(arr, b) {
with(this) {}; // Don't inline this.
if (b) {
Object.freeze(arr);
}
}
function test() {
var arr = [];
for (var i = 0; i < 1800; i++) {
maybeFreeze(arr, i > 1500);
try {
arr.push(2);
assertEq(i <= 1500, true);
} catch(e) {
assertEq(e instanceof TypeError, true);
}
}
}
test();
|