1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
// Forward to the target if the trap is not defined
var target;
function testProxy(p, key) {
Object.defineProperty(p, key, {
value: 'bar',
writable: true,
enumerable: false,
configurable: true
});
var desc = Object.getOwnPropertyDescriptor(target, key);
assertEq(desc.value, 'bar');
assertEq(desc.writable, true);
assertEq(desc.enumerable, false);
assertEq(desc.configurable, true);
}
for (var key of ['foo', Symbol("quux")]) {
target = {};
testProxy(new Proxy(target, {}), key);
target = {};
testProxy(Proxy.revocable(target, {}).proxy, key);
}
|