Skip to content

Commit

Permalink
Proxy, [[OwnPropertyKeys]]: If trapResult contains any duplicate entr…
Browse files Browse the repository at this point in the history
…ies, throw a TypeError

Ref: tc39/ecma262#833
  • Loading branch information
rwaldron committed Aug 4, 2017
1 parent 3ebd97c commit a775c24
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions test/built-ins/Proxy/ownKeys/return-duplicate-entries-throws.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Copyright (C) 2017 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-proxy-object-internal-methods-and-internal-slots-ownpropertykeys
description: >
The returned list must not contain any duplicate entries.
info: >
[[OwnPropertyKeys]] ( )
...
9. If trapResult contains any duplicate entries, throw a TypeError exception.
---*/

var p = new Proxy({}, {
ownKeys() {
return ["a", "a"];
}
});

assert.throws(TypeError, function() {
Object.keys(p);
});

0 comments on commit a775c24

Please sign in to comment.