call-parameters.js (930B)
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 features: [Proxy] 14 ---*/ 15 16 var _handler, _target, _prop; 17 var target = { 18 attr: 1 19 }; 20 var handler = { 21 deleteProperty: function(t, prop) { 22 _handler = this; 23 _target = t; 24 _prop = prop; 25 return delete t[prop]; 26 } 27 }; 28 var p = new Proxy(target, handler); 29 30 delete p.attr; 31 32 assert.sameValue(_handler, handler, "handler object as the trap context"); 33 assert.sameValue(_target, target, "first argument is the target object"); 34 assert.sameValue(_prop, "attr", "second argument is the property name"); 35 36 reportCompare(0, 0);