blob: 6139cac32a927f19a6f8527bf1248d442129058a (
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
function testSealNonExtensibleArray() {
var obj = Object.preventExtensions([0]);
var desc = {value: 0, writable: true, enumerable: true, configurable: true};
var errorAt = -1;
var N = 100;
for (var i = 0; i <= N; ++i) {
if (i === N) {
Object.seal(obj);
}
try {
Object.defineProperty(obj, 0, desc);
} catch {
errorAt = i;
}
}
assertEq(errorAt, N);
}
for (var i = 0; i < 15; i++)
testSealNonExtensibleArray();
function testSealNonExtensibleObject() {
var obj = Object.preventExtensions({0:1});
var desc = {value: 0, writable: true, enumerable: true, configurable: true};
var errorAt = -1;
var N = 100;
for (var i = 0; i <= N; ++i) {
if (i === N) {
Object.seal(obj);
}
try {
Object.defineProperty(obj, 0, desc);
} catch {
errorAt = i;
}
}
assertEq(errorAt, N);
}
for (var i = 0; i < 15; i++)
testSealNonExtensibleObject();
|