OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 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 print("Check that while Runtime.getProperties call on proxy object no user defin
ed trap will be executed."); |
| 6 |
| 7 InspectorTest.evaluateInPage(` |
| 8 var self = this; |
| 9 function testFunction() |
| 10 { |
| 11 self.counter = 0; |
| 12 var handler = { |
| 13 get: function(target, name){ |
| 14 self.counter++; |
| 15 return Reflect.get.apply(this, arguments); |
| 16 }, |
| 17 set: function(target, name){ |
| 18 self.counter++; |
| 19 return Reflect.set.apply(this, arguments); |
| 20 }, |
| 21 getPrototypeOf: function(target) { |
| 22 self.counter++; |
| 23 return Reflect.getPrototypeOf.apply(this, arguments); |
| 24 }, |
| 25 setPrototypeOf: function(target) { |
| 26 self.counter++; |
| 27 return Reflect.setPrototypeOf.apply(this, arguments); |
| 28 }, |
| 29 isExtensible: function(target) { |
| 30 self.counter++; |
| 31 return Reflect.isExtensible.apply(this, arguments); |
| 32 }, |
| 33 isExtensible: function(target) { |
| 34 self.counter++; |
| 35 return Reflect.isExtensible.apply(this, arguments); |
| 36 }, |
| 37 isExtensible: function(target) { |
| 38 self.counter++; |
| 39 return Reflect.isExtensible.apply(this, arguments); |
| 40 }, |
| 41 preventExtensions: function() { |
| 42 self.counter++; |
| 43 return Reflect.preventExtensions.apply(this, arguments); |
| 44 }, |
| 45 getOwnPropertyDescriptor: function() { |
| 46 self.counter++; |
| 47 return Reflect.getOwnPropertyDescriptor.apply(this, arguments); |
| 48 }, |
| 49 defineProperty: function() { |
| 50 self.counter++; |
| 51 return Reflect.defineProperty.apply(this, arguments); |
| 52 }, |
| 53 has: function() { |
| 54 self.counter++; |
| 55 return Reflect.has.apply(this, arguments); |
| 56 }, |
| 57 get: function() { |
| 58 self.counter++; |
| 59 return Reflect.get.apply(this, arguments); |
| 60 }, |
| 61 set: function() { |
| 62 self.counter++; |
| 63 return Reflect.set.apply(this, arguments); |
| 64 }, |
| 65 deleteProperty: function() { |
| 66 self.counter++; |
| 67 return Reflect.deleteProperty.apply(this, arguments); |
| 68 }, |
| 69 ownKeys: function() { |
| 70 self.counter++; |
| 71 return Reflect.ownKeys.apply(this, arguments); |
| 72 }, |
| 73 apply: function() { |
| 74 self.counter++; |
| 75 return Reflect.apply.apply(this, arguments); |
| 76 }, |
| 77 construct: function() { |
| 78 self.counter++; |
| 79 return Reflect.construct.apply(this, arguments); |
| 80 } |
| 81 }; |
| 82 return new Proxy({ a : 1}, handler); |
| 83 }`); |
| 84 |
| 85 InspectorTest.sendCommandOrDie("Runtime.evaluate", { expression: "testFunction()
"}, requestProperties); |
| 86 |
| 87 function requestProperties(result) |
| 88 { |
| 89 InspectorTest.sendCommandOrDie("Runtime.getProperties", { objectId: result.res
ult.objectId, generatePreview: true }, checkCounter); |
| 90 } |
| 91 |
| 92 function checkCounter(result) |
| 93 { |
| 94 InspectorTest.sendCommandOrDie("Runtime.evaluate", { expression: "self.counter
" }, dumpCounter); |
| 95 } |
| 96 |
| 97 function dumpCounter(result) |
| 98 { |
| 99 InspectorTest.logObject(result); |
| 100 InspectorTest.completeTest(); |
| 101 } |
OLD | NEW |