summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/proxy/testDirectProxySet4.js
blob: 760d1099dfcf9ea6118e725f50efc80fae02bfbc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
load(libdir + "asserts.js");

/*
 * Throw a TypeError if the trap sets a non-configurable accessor property that
 * doest not have a setter
 */
var target = {};
Object.defineProperty(target, 'foo', {
    get: function () {
        return 'bar'
    },
    configurable: false
});

var handler = { set: () => true };
for (let p of [new Proxy(target, handler), Proxy.revocable(target, handler).proxy])
    assertThrowsInstanceOf(() => p['foo'] = 'baz', TypeError);