summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/class/superPropProxy.js
blob: fe0e5369a48f1c2c8e8358b15a5c748bbedabfbf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// Define constructor with a proxy as prototype
let hook = { get: function(target, name, receiver) { return receiver; } }
let Base = function() { }
Base.prototype = new Proxy(Base.prototype, hook);

class Derived extends Base {
    test() {
        // Check proxy receiver is |this|, rather than Base.[[Prototype]]
        assertEq(super.x, this);
    }

    test_elem() {
        // Check proxy receiver is |this|, rather than Base.[[Prototype]]
        assertEq(super[0], this);
    }
}

let d = new Derived();

for (let i = 0; i < 20; ++i) {
    d.test();
    d.test_elem();
}