summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/proxy/testDirectProxyGetInherited3.js
blob: d9f34e60e890ea54717b8d437193e8fb41cfd828 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Recursion through the get hook works; runaway recursion is checked.

load(libdir + "asserts.js");

var hits = 0, limit = 10;
var proto = new Proxy({}, {
    get(t, id, r) {
        assertEq(r, obj);
        if (hits++ >= limit)
            return "ding";
        return obj[id];
    }
});

var obj = Object.create(proto);
assertEq(obj.prop, "ding");

hits = 0;
limit = Infinity;
assertThrowsInstanceOf(() => obj.prop, InternalError);
assertEq(hits > 10, true);