-
Notifications
You must be signed in to change notification settings - Fork 471
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Proxy, [[OwnPropertyKeys]]: If trapResult contains any duplicate entr…
…ies, throw a TypeError Ref: tc39/ecma262#833
- Loading branch information
Showing
1 changed file
with
22 additions
and
0 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
test/built-ins/Proxy/ownKeys/return-duplicate-entries-throws.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
}); |