testDirectProxySet4.js (462B)
1 load(libdir + "asserts.js"); 2 3 /* 4 * Throw a TypeError if the trap sets a non-configurable accessor property that 5 * doest not have a setter 6 */ 7 var target = {}; 8 Object.defineProperty(target, 'foo', { 9 get: function () { 10 return 'bar' 11 }, 12 configurable: false 13 }); 14 15 var handler = { set: () => true }; 16 for (let p of [new Proxy(target, handler), Proxy.revocable(target, handler).proxy]) 17 assertThrowsInstanceOf(() => p['foo'] = 'baz', TypeError);