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 debug and monitor methods from Command Line API works with bou
nd function."); |
| 6 |
| 7 InspectorTest.addScript(` |
| 8 function foo() {} |
| 9 function boo() {} |
| 10 var bar = boo.bind(null); |
| 11 |
| 12 function testFunction() { |
| 13 console.log("> debug foo and bar"); |
| 14 debug(foo); |
| 15 debug(bar); |
| 16 console.log("> call foo and bar"); |
| 17 foo(); |
| 18 bar(); |
| 19 console.log("> undebug foo and bar"); |
| 20 undebug(foo); |
| 21 undebug(bar); |
| 22 console.log("> call foo and bar"); |
| 23 foo(); |
| 24 bar(); |
| 25 |
| 26 console.log("> monitor foo and bar"); |
| 27 monitor(foo); |
| 28 monitor(bar); |
| 29 console.log("> call foo and bar"); |
| 30 foo(); |
| 31 bar(); |
| 32 console.log("> unmonitor foo and bar"); |
| 33 unmonitor(foo); |
| 34 unmonitor(bar); |
| 35 console.log("> call foo and bar"); |
| 36 foo(); |
| 37 bar(); |
| 38 |
| 39 console.log("> monitor and debug bar"); |
| 40 monitor(bar); |
| 41 debug(bar); |
| 42 console.log("> call bar"); |
| 43 bar(); |
| 44 console.log("> undebug bar"); |
| 45 undebug(bar); |
| 46 console.log("> call bar"); |
| 47 bar(); |
| 48 console.log("> debug and unmonitor bar"); |
| 49 debug(bar); |
| 50 unmonitor(bar); |
| 51 console.log("> call bar"); |
| 52 bar(); |
| 53 }`); |
| 54 |
| 55 Protocol.Runtime.enable(); |
| 56 Protocol.Debugger.enable(); |
| 57 Protocol.Debugger.onPaused(message => { |
| 58 var functionName = message.params.callFrames[0].functionName; |
| 59 InspectorTest.log(`paused in ${functionName}`); |
| 60 Protocol.Debugger.resume(); |
| 61 }); |
| 62 Protocol.Runtime.onConsoleAPICalled(message => InspectorTest.log(message.params.
args[0].value)); |
| 63 Protocol.Runtime.evaluate({ expression: "testFunction()", includeCommandLineAPI:
true }) |
| 64 .then(InspectorTest.completeTest); |
OLD | NEW |