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

/*
 * Throw a TypeError if the trap defines a new property on a non-extensible
 * object
 */
var target = {};
Object.preventExtensions(target);

var handler = { defineProperty: function (target, name, desc) { return true; } };

for (let p of [new Proxy(target, handler), Proxy.revocable(target, handler).proxy]) {
    assertThrowsInstanceOf(function () {
        Object.defineProperty(p, 'foo', { configurable: true });
    }, TypeError);
}