michael@0: load(libdir + "asserts.js"); michael@0: michael@0: /* michael@0: * Throw a TypeError if the enumerable fields of the current descriptor and the michael@0: * descriptor returned by the trap are the boolean negation of each other michael@0: */ michael@0: var target = {}; michael@0: Object.defineProperty(target, 'foo', { michael@0: configurable: false, michael@0: enumerable: true 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: configurable: false, michael@0: enumerable: false michael@0: }; michael@0: } michael@0: }), 'foo'); michael@0: }, TypeError); michael@0: michael@0: var target = {}; michael@0: Object.defineProperty(target, 'foo', { michael@0: configurable: false, michael@0: enumerable: 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: configurable: false, michael@0: enumerable: true michael@0: }; michael@0: } michael@0: }), 'foo'); michael@0: }, TypeError);