| 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 |
es6id: 9.5.10 |
| 5 |
description: > |
| 6 |
[[Delete]] (P) |
| 7 |
|
| 8 |
9. Let booleanTrapResult be ToBoolean(Call(trap, handler, «target, P»)). |
| 9 |
info: | |
| 10 |
6.1.7.2 Object Internal Methods and Internal Slots |
| 11 |
|
| 12 |
(...) Receiver is used as the this value when evaluating the code |
| 13 |
---*/ |
| 14 |
|
| 15 |
var _handler, _target, _prop; |
| 16 |
var target = { |
| 17 |
attr: 1 |
| 18 |
}; |
| 19 |
var handler = { |
| 20 |
deleteProperty: function(t, prop) { |
| 21 |
_handler = this; |
| 22 |
_target = t; |
| 23 |
_prop = prop; |
| 24 |
return delete t[prop]; |
| 25 |
} |
| 26 |
}; |
| 27 |
var p = new Proxy(target, handler); |
| 28 |
|
| 29 |
delete p.attr; |
| 30 |
|
| 31 |
assert.sameValue(_handler, handler, "handler object as the trap context"); |
| 32 |
assert.sameValue(_target, target, "first argument is the target object"); |
| 33 |
assert.sameValue(_prop, "attr", "second argument is the property name"); |