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

// Throw a TypeError if the trap sets a non-writable, non-configurable property
for (var key of ['foo', Symbol.for('quux')]) {
    var target = {};
    Object.defineProperty(target, key, {
        value: 'bar',
        writable: false,
        configurable: false
    });
    var handler = { set: () => true };
    for (let p of [new Proxy(target, handler), Proxy.revocable(target, handler).proxy])
        assertThrowsInstanceOf(() => p[key] = 'baz', TypeError);
}