| OLD | NEW |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 InspectorTest.evaluateInPage( | 5 InspectorTest.addScript( |
| 6 `function TestFunction() | 6 `function TestFunction() |
| 7 { | 7 { |
| 8 var a = 2; | 8 var a = 2; |
| 9 debugger; | 9 debugger; |
| 10 debugger; | 10 debugger; |
| 11 }`); | 11 }`); |
| 12 | 12 |
| 13 var newVariableValue = 55; | 13 var newVariableValue = 55; |
| 14 | 14 |
| 15 InspectorTest.sendCommand("Debugger.enable", {}); | 15 Protocol.Debugger.enable(); |
| 16 | 16 |
| 17 InspectorTest.eventHandler["Debugger.paused"] = handleDebuggerPaused; | 17 Protocol.Debugger.oncePaused().then(handleDebuggerPaused); |
| 18 | 18 |
| 19 InspectorTest.sendCommand("Runtime.evaluate", { "expression": "setTimeout(TestFu
nction, 0)" }); | 19 Protocol.Runtime.evaluate({ "expression": "setTimeout(TestFunction, 0)" }); |
| 20 | 20 |
| 21 function handleDebuggerPaused(messageObject) | 21 function handleDebuggerPaused(messageObject) |
| 22 { | 22 { |
| 23 InspectorTest.log("Paused on 'debugger;'"); | 23 InspectorTest.log("Paused on 'debugger;'"); |
| 24 InspectorTest.eventHandler["Debugger.paused"] = undefined; | |
| 25 | 24 |
| 26 var topFrame = messageObject.params.callFrames[0]; | 25 var topFrame = messageObject.params.callFrames[0]; |
| 27 var topFrameId = topFrame.callFrameId; | 26 var topFrameId = topFrame.callFrameId; |
| 28 InspectorTest.sendCommand("Debugger.evaluateOnCallFrame", { "callFrameId": top
FrameId, "expression": "a = " + newVariableValue }, callbackChangeValue); | 27 Protocol.Debugger.evaluateOnCallFrame({ "callFrameId": topFrameId, "expression
": "a = " + newVariableValue }).then(callbackChangeValue); |
| 29 } | 28 } |
| 30 | 29 |
| 31 function callbackChangeValue(response) | 30 function callbackChangeValue(response) |
| 32 { | 31 { |
| 33 InspectorTest.log("Variable value changed"); | 32 InspectorTest.log("Variable value changed"); |
| 34 InspectorTest.eventHandler["Debugger.paused"] = callbackGetBacktrace; | 33 Protocol.Debugger.oncePaused().then(callbackGetBacktrace); |
| 35 InspectorTest.sendCommand("Debugger.resume", { }); | 34 Protocol.Debugger.resume(); |
| 36 } | 35 } |
| 37 | 36 |
| 38 function callbackGetBacktrace(response) | 37 function callbackGetBacktrace(response) |
| 39 { | 38 { |
| 40 InspectorTest.log("Stacktrace re-read again"); | 39 InspectorTest.log("Stacktrace re-read again"); |
| 41 var localScope = response.params.callFrames[0].scopeChain[0]; | 40 var localScope = response.params.callFrames[0].scopeChain[0]; |
| 42 InspectorTest.sendCommand("Runtime.getProperties", { "objectId": localScope.ob
ject.objectId }, callbackGetProperties); | 41 Protocol.Runtime.getProperties({ "objectId": localScope.object.objectId }).the
n(callbackGetProperties); |
| 43 } | 42 } |
| 44 | 43 |
| 45 function callbackGetProperties(response) | 44 function callbackGetProperties(response) |
| 46 { | 45 { |
| 47 InspectorTest.log("Scope variables downloaded anew"); | 46 InspectorTest.log("Scope variables downloaded anew"); |
| 48 var varNamedA; | 47 var varNamedA; |
| 49 var propertyList = response.result.result; | 48 var propertyList = response.result.result; |
| 50 for (var i = 0; i < propertyList.length; i++) { | 49 for (var i = 0; i < propertyList.length; i++) { |
| 51 if (propertyList[i].name === "a") { | 50 if (propertyList[i].name === "a") { |
| 52 varNamedA = propertyList[i]; | 51 varNamedA = propertyList[i]; |
| 53 break; | 52 break; |
| 54 } | 53 } |
| 55 } | 54 } |
| 56 if (varNamedA) { | 55 if (varNamedA) { |
| 57 var actualValue = varNamedA.value.value; | 56 var actualValue = varNamedA.value.value; |
| 58 InspectorTest.log("New variable is " + actualValue + ", expected is " + newV
ariableValue + ", old was: 2"); | 57 InspectorTest.log("New variable is " + actualValue + ", expected is " + newV
ariableValue + ", old was: 2"); |
| 59 InspectorTest.log(actualValue === newVariableValue ? "SUCCESS" : "FAIL"); | 58 InspectorTest.log(actualValue === newVariableValue ? "SUCCESS" : "FAIL"); |
| 60 } else { | 59 } else { |
| 61 InspectorTest.log("Failed to find variable in scope"); | 60 InspectorTest.log("Failed to find variable in scope"); |
| 62 } | 61 } |
| 63 InspectorTest.completeTest(); | 62 InspectorTest.completeTest(); |
| 64 } | 63 } |
| OLD | NEW |