OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 var global = this; |
| 6 ;(function () { |
| 7 var calledDelete = false; |
| 8 var calledGet = false; |
| 9 var calledHas = false; |
| 10 var calledSet = false; |
| 11 var target = {}; |
| 12 var assertEquals = global.assertEquals; |
| 13 var proxy = new Proxy(target, { |
| 14 has(target, property) { |
| 15 calledHas = true; |
| 16 return Reflect.has(target, property); |
| 17 }, |
| 18 get(target, property, receiver) { |
| 19 calledGet = true; |
| 20 return Reflect.get(target, property, receiver); |
| 21 }, |
| 22 set(targer, property, value, receiver) { |
| 23 calledSet = true; |
| 24 return Reflect.set(target, property, value, receiver); |
| 25 }, |
| 26 delete(target, property, receiver) { |
| 27 calledDelete = true; |
| 28 return Reflect.delete(target, property, receiver); |
| 29 } |
| 30 }); |
| 31 Object.setPrototypeOf(global, proxy); |
| 32 getGlobal; |
| 33 assertTrue(calledGet); |
| 34 makeGlobal = 2; |
| 35 assertTrue(calledSet); |
| 36 "findGlobal" in global; |
| 37 assertTrue(calledHas); |
| 38 var deletedOwn = delete makeGlobal; |
| 39 assertTrue(deletedOwn); |
| 40 assertEquals(void 0, makeGlobal); |
| 41 })(); |
OLD | NEW |