| 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 must contain all the keys of the own |
| 7 |
properties of the target object. |
| 8 |
info: | |
| 9 |
[[OwnPropertyKeys]] ( ) |
| 10 |
|
| 11 |
... |
| 12 |
19. For each key that is an element of targetConfigurableKeys, do |
| 13 |
a. If key is not an element of uncheckedResultKeys, throw a TypeError |
| 14 |
exception. |
| 15 |
---*/ |
| 16 |
|
| 17 |
var target = { |
| 18 |
foo: 1, |
| 19 |
bar: 2 |
| 20 |
}; |
| 21 |
|
| 22 |
var p = new Proxy(target, { |
| 23 |
ownKeys: function() { |
| 24 |
return ["foo"]; |
| 25 |
} |
| 26 |
}); |
| 27 |
|
| 28 |
Object.preventExtensions(target); |
| 29 |
|
| 30 |
assert.throws(TypeError, function() { |
| 31 |
Object.keys(p); |
| 32 |
}); |