summaryrefslogtreecommitdiffstats
path: root/js/src/tests/ecma_6/Proxy/regress-bug1062349.js
blob: fe0ad3d9a980a42f86ca1e249c38e7a7c78c9591 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Adapted from a test case contributed by André Bargull in bug 1062349.

var log = [];
var hh = {
    get(t, pk) {
        log.push("trap: " + pk);
        return t[pk];
    }
};
var h = new Proxy({
    get set() {
        log.push("called set()");
        Object.defineProperty(o, "prop", {value: 0});
        log.push("o.prop:", Object.getOwnPropertyDescriptor(o, "prop"));
    }
}, hh);
var p = new Proxy({}, h);
var o = {__proto__: p};

o.prop = 1;

var expectedDesc = {value: 0, writable: false, enumerable: false, configurable: false};
assertDeepEq(log, [
    "trap: set",
    "called set()",
    "o.prop:",
    expectedDesc
]);
assertDeepEq(Object.getOwnPropertyDescriptor(o, "prop"), expectedDesc);

reportCompare(0, 0);