Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Proxy/ownKeys/not-extensible-new-keys-throws.js

raw
1 // Copyright (C) 2015 the V8 project authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3 /*---
4 esid: sec-proxy-object-internal-methods-and-internal-slots-ownpropertykeys
5 description: >
6 If target is not extensible, the result can't contain keys names not
7 contained in the target object.
8 info: |
9 [[OwnPropertyKeys]] ( )
10
11 ...
12 20. If uncheckedResultKeys is not empty, throw a TypeError exception.
13 ---*/
14
15 var target = {
16 foo: 1
17 };
18
19 var p = new Proxy(target, {
20 ownKeys: function() {
21 return ["foo", "bar"];
22 }
23 });
24
25 Object.preventExtensions(target);
26
27 assert.throws(TypeError, function() {
28 Object.keys(p);
29 });