summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/gc/oomInArrayProtoTest.js
blob: 3e3365cde53e46d6d2d4f0b132541e659f0ff461 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
function arrayProtoOutOfRange() {
    function f(obj) {
        return typeof obj[15];
    }

    function test() {
        var a = [1, 2];
        a.__proto__ = {15: 1337};
        var b = [1, 2, 3, 4];

        for (var i = 0; i < 200; i++) {
            var r = f(i % 2 ? a : b);
            assertEq(r, i % 2 ? "number" : "undefined");
        }
    }

    test();
}

oomTest(arrayProtoOutOfRange);