michael@0: load(libdir + "asserts.js"); michael@0: michael@0: /* michael@0: * Throw a TypeError if both the current descriptor and the descriptor returned michael@0: * by the trap are accessor descriptors, the current descriptor is michael@0: * non-configurable, and the descriptor returned by the trap has a different michael@0: * setter. michael@0: */ michael@0: var target = {}; michael@0: Object.defineProperty(target, 'foo', { michael@0: set: function (value) {i michael@0: target.foo = 'bar'; michael@0: }, michael@0: configurable: false michael@0: }); michael@0: var caught = false; michael@0: assertThrowsInstanceOf(function () { michael@0: Object.getOwnPropertyDescriptor(new Proxy(target, { michael@0: getOwnPropertyDescriptor: function (target, name) { michael@0: return { michael@0: set: function (value) { michael@0: target.foo = 'baz'; michael@0: }, michael@0: configurable: false michael@0: }; michael@0: } michael@0: }), 'foo'); michael@0: }, TypeError);