michael@0: // Return the names returned by the trap michael@0: var target = {}; michael@0: Object.defineProperty(target, 'foo', { michael@0: configurable: true michael@0: }); michael@0: var names = Object.getOwnPropertyNames(new Proxy(target, { michael@0: getOwnPropertyNames : function (target) { michael@0: return [ 'bar' ]; michael@0: } michael@0: })); michael@0: assertEq(names.length, 1); michael@0: assertEq(names[0], 'bar'); michael@0: michael@0: var names = Object.getOwnPropertyNames(new Proxy(Object.create(Object.create(null, { michael@0: a: { michael@0: enumerable: true, michael@0: configurable: true michael@0: }, michael@0: b: { michael@0: enumerable: false, michael@0: configurable: true michael@0: } michael@0: }), { michael@0: c: { michael@0: enumerable: true, michael@0: configurable: true michael@0: }, michael@0: d: { michael@0: enumerable: false, michael@0: configurable: true michael@0: } michael@0: }), { michael@0: getOwnPropertyNames: function (target) { michael@0: return [ 'c', 'e' ]; michael@0: } michael@0: })); michael@0: assertEq(names.length, 2); michael@0: assertEq(names[0], 'c'); michael@0: assertEq(names[1], 'e');