summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/basic/for-in-densified-elements.js
blob: 4874901f1741f38bef2a58699e4f170ab685a69b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
function test() {
    // An array with sparse elements...
    var arr = [];
    arr[10_000] = 1;
    arr[10_001] = 1;

    for (var prop in arr) {
        assertEq(prop, "10000");
        assertEq(arr.length, 10_002);

        // Densify the elements.
        for (var i = 0; i < arr.length; i++) {
            arr[i] = 1;
        }

        // Delete the last dense element (10001). It should not be visited by the
        // active for-in (checked above).
        arr.length = 10_001;
    }
}
test();