Skip to content

Commit

Permalink
Updates to Proxy trap: ownKeys
Browse files Browse the repository at this point in the history
  • Loading branch information
rwaldron committed Aug 4, 2017
1 parent c0b520b commit 3ebd97c
Show file tree
Hide file tree
Showing 16 changed files with 44 additions and 40 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// Copyright (C) 2015 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 9.5.12
esid: sec-proxy-object-internal-methods-and-internal-slots-ownpropertykeys
description: >
[[OwnPropertyKeys]] ( )
8. Let trapResultArray be Call(trap, handler, «target»).
7. Let trapResultArray be ? Call(trap, handler, « target »).
---*/

var _target, _handler;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
// Copyright (C) 2015 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 9.5.12
esid: sec-proxy-object-internal-methods-and-internal-slots-ownpropertykeys
description: >
[[OwnPropertyKeys]] ( )
8. Let trapResultArray be Call(trap, handler, «target»).
7. Let trapResultArray be ? Call(trap, handler, « target »).
features: [Symbol]
---*/

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (C) 2015 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 9.5.12
esid: sec-proxy-object-internal-methods-and-internal-slots-ownpropertykeys
description: >
[[OwnPropertyKeys]] ( )
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
// Copyright (C) 2015 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 9.5.12
esid: sec-proxy-object-internal-methods-and-internal-slots-ownpropertykeys
description: >
If target is extensible, return the non-falsy trap result if target doesn't
contain any non-configurable keys.
info: >
[[OwnPropertyKeys]] ( )
...
19. If extensibleTarget is true and targetNonconfigurableKeys is empty, then
15. If extensibleTarget is true and targetNonconfigurableKeys is empty, then
a. Return trapResult.
---*/

Expand Down
4 changes: 2 additions & 2 deletions test/built-ins/Proxy/ownKeys/extensible-return-trap-result.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
// Copyright (C) 2015 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 9.5.12
esid: sec-proxy-object-internal-methods-and-internal-slots-ownpropertykeys
description: >
If target is extensible, return the non-falsy trap result if it contains all
of target's non-configurable keys.
info: >
[[OwnPropertyKeys]] ( )
...
22. If extensibleTarget is true, return trapResult.
18. If extensibleTarget is true, return trapResult.
---*/

var target = {};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
// Copyright (C) 2015 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 9.5.12
esid: sec-proxy-object-internal-methods-and-internal-slots-ownpropertykeys
description: >
If target is not extensible, the result must contain all the keys of the own
properties of the target object.
info: >
[[OwnPropertyKeys]] ( )
...
23. Repeat, for each key that is an element of targetConfigurableKeys,
19. For each key that is an element of targetConfigurableKeys, do
a. If key is not an element of uncheckedResultKeys, throw a TypeError
exception.
---*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
// Copyright (C) 2015 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 9.5.12
esid: sec-proxy-object-internal-methods-and-internal-slots-ownpropertykeys
description: >
If target is not extensible, the result can't contain keys names not
contained in the target object.
info: >
[[OwnPropertyKeys]] ( )
...
24. If uncheckedResultKeys is not empty, throw a TypeError exception.
20. If uncheckedResultKeys is not empty, throw a TypeError exception.
---*/

var target = {
Expand Down
4 changes: 2 additions & 2 deletions test/built-ins/Proxy/ownKeys/not-extensible-return-keys.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
// Copyright (C) 2015 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 9.5.12
esid: sec-proxy-object-internal-methods-and-internal-slots-ownpropertykeys
description: >
If target is not extensible, the result must contain all the keys of the own
properties of the target object and no other values
info: >
[[OwnPropertyKeys]] ( )
...
25. Return trapResult.
21. Return trapResult.
---*/

var target = {
Expand Down
2 changes: 1 addition & 1 deletion test/built-ins/Proxy/ownKeys/null-handler.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (C) 2015 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 9.5.12
esid: sec-proxy-object-internal-methods-and-internal-slots-ownpropertykeys
description: >
[[OwnPropertyKeys]] ( )
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
// Copyright (C) 2015 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 9.5.12
esid: sec-proxy-object-internal-methods-and-internal-slots-ownpropertykeys
description: >
The result List must contain the keys of all non-configurable own properties
of the target object.
info: >
[[OwnPropertyKeys]] ( )
...
21. Repeat, for each key that is an element of targetNonconfigurableKeys,
17. For each key that is an element of targetNonconfigurableKeys, do
a. If key is not an element of uncheckedResultKeys, throw a TypeError
exception.
---*/

var target = {
Expand Down
9 changes: 3 additions & 6 deletions test/built-ins/Proxy/ownKeys/return-is-abrupt.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
// Copyright (C) 2015 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 9.5.12
esid: sec-proxy-object-internal-methods-and-internal-slots-ownpropertykeys
description: >
Trap returns abrupt.
info: >
[[OwnPropertyKeys]] ( )
...
8. Let trapResultArray be Call(trap, handler, «target»).
9. Let trapResult be CreateListFromArrayLike(trapResultArray, «‍String, Symbol»).
7.3.17 CreateListFromArrayLike (obj [, elementTypes] )
7. Let trapResultArray be ? Call(trap, handler, « target »).
8. Let trapResult be ? CreateListFromArrayLike(trapResultArray, « String, Symbol »).
1. ReturnIfAbrupt(obj).
...
---*/

var p = new Proxy({}, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-proxy-object-internal-methods-and-internal-slots-ownpropertykeys
es6id: 9.5.12
description: >
If return is not a list object, throw a TypeError exception (honoring
the Realm of the current execution context)
Expand All @@ -13,10 +12,11 @@ info: |
Symbol »).
...
#sec-createlistfromarraylike
7.3.17 CreateListFromArrayLike (obj [, elementTypes] )
...
3. If Type(obj) is not Object, throw a TypeError exception.
2. If Type(obj) is not Object, throw a TypeError exception.
features: [Symbol]
---*/

Expand Down
16 changes: 10 additions & 6 deletions test/built-ins/Proxy/ownKeys/return-not-list-object-throws.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
// Copyright (C) 2015 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 9.5.12
esid: sec-proxy-object-internal-methods-and-internal-slots-ownpropertykeys
description: >
If return is not a list object, throw a TypeError exception
info: >
[[OwnPropertyKeys]] ( )
8. Let trapResultArray be Call(trap, handler, «target»).
9. Let trapResult be CreateListFromArrayLike(trapResultArray, «String,
Symbol»).
7. Let trapResultArray be ? Call(trap, handler, « target »).
8. Let trapResult be ? CreateListFromArrayLike(trapResultArray, « String,
Symbol »).
...
7.3.17 CreateListFromArrayLike (obj [, elementTypes] )
3. If Type(obj) is not Object, throw a TypeError exception.
#sec-createlistfromarraylike
7.3.17 CreateListFromArrayLike (obj [, elementTypes] )
2. If Type(obj) is not Object, throw a TypeError exception.
features: [Symbol]
---*/

Expand Down
4 changes: 2 additions & 2 deletions test/built-ins/Proxy/ownKeys/trap-is-not-callable-realm.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-proxy-object-internal-methods-and-internal-slots-ownpropertykeys
es6id: 9.5.12
description: >
Throws if trap is not callable (honoring the Realm of the current execution
context)
Expand All @@ -12,9 +11,10 @@ info: |
5. Let trap be GetMethod(handler, "ownKeys").
...
#sec-getmethod
7.3.9 GetMethod (O, P)
5. If IsCallable(func) is false, throw a TypeError exception.
4. If IsCallable(func) is false, throw a TypeError exception.
---*/

var OProxy = $262.createRealm().global.Proxy;
Expand Down
7 changes: 4 additions & 3 deletions test/built-ins/Proxy/ownKeys/trap-is-not-callable.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
// Copyright (C) 2015 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 9.5.12
esid: sec-proxy-object-internal-methods-and-internal-slots-ownpropertykeys
description: >
Trap is not callable.
info: >
[[OwnPropertyKeys]] ( )
5. Let trap be GetMethod(handler, "ownKeys").
5. Let trap be ? GetMethod(handler, "ownKeys").
...
#sec-getmethod
7.3.9 GetMethod (O, P)
5. If IsCallable(func) is false, throw a TypeError exception.
4. If IsCallable(func) is false, throw a TypeError exception.
---*/

var p = new Proxy({attr:1}, {
Expand Down
4 changes: 2 additions & 2 deletions test/built-ins/Proxy/ownKeys/trap-is-undefined.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// Copyright (C) 2015 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
es6id: 9.5.12
esid: sec-proxy-object-internal-methods-and-internal-slots-ownpropertykeys
description: >
[[OwnPropertyKeys]] ( )
7. If trap is undefined, then Return target.[[OwnPropertyKeys]]()
6. If trap is undefined, then Return target.[[OwnPropertyKeys]]()
---*/

var target = {
Expand Down

0 comments on commit 3ebd97c

Please sign in to comment.