summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/gc/oomInArrayProtoTest.js
blob: f528468592e00761adb247ca824a7d67a058732c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
if (!('oomTest' in this))
    quit();

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);