| 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 debugger; | 8 debugger; |
| 9 } | 9 } |
| 10 //# sourceURL=foo.js`); | 10 //# sourceURL=foo.js`); |
| 11 | 11 |
| 12 InspectorTest.sendCommand("Debugger.enable", {}); | 12 Protocol.Debugger.enable(); |
| 13 | 13 |
| 14 InspectorTest.eventHandler["Debugger.paused"] = handleDebuggerPausedOne; | 14 Protocol.Debugger.oncePaused().then(handleDebuggerPausedOne); |
| 15 | 15 |
| 16 InspectorTest.sendCommand("Runtime.evaluate", { "expression": "setTimeout(testFu
nction, 0)" }); | 16 Protocol.Runtime.evaluate({ "expression": "setTimeout(testFunction, 0)" }); |
| 17 | 17 |
| 18 var obsoleteTopFrameId; | 18 var obsoleteTopFrameId; |
| 19 | 19 |
| 20 function handleDebuggerPausedOne(messageObject) | 20 function handleDebuggerPausedOne(messageObject) |
| 21 { | 21 { |
| 22 InspectorTest.log("Paused on 'debugger;'"); | 22 InspectorTest.log("Paused on 'debugger;'"); |
| 23 | 23 |
| 24 var topFrame = messageObject.params.callFrames[0]; | 24 var topFrame = messageObject.params.callFrames[0]; |
| 25 obsoleteTopFrameId = topFrame.callFrameId; | 25 obsoleteTopFrameId = topFrame.callFrameId; |
| 26 | 26 |
| 27 InspectorTest.eventHandler["Debugger.paused"] = undefined; | 27 Protocol.Debugger.resume().then(callbackResume); |
| 28 | |
| 29 InspectorTest.sendCommand("Debugger.resume", { }, callbackResume); | |
| 30 } | 28 } |
| 31 | 29 |
| 32 function callbackResume(response) | 30 function callbackResume(response) |
| 33 { | 31 { |
| 34 InspectorTest.log("resume"); | 32 InspectorTest.log("resume"); |
| 35 InspectorTest.log("restartFrame"); | 33 InspectorTest.log("restartFrame"); |
| 36 InspectorTest.sendCommand("Debugger.restartFrame", { callFrameId: obsoleteTopF
rameId }, callbackRestartFrame); | 34 Protocol.Debugger.restartFrame({ callFrameId: obsoleteTopFrameId }).then(callb
ackRestartFrame); |
| 37 } | 35 } |
| 38 | 36 |
| 39 function callbackRestartFrame(response) | 37 function callbackRestartFrame(response) |
| 40 { | 38 { |
| 41 logErrorResponse(response); | 39 logErrorResponse(response); |
| 42 InspectorTest.log("evaluateOnFrame"); | 40 InspectorTest.log("evaluateOnFrame"); |
| 43 InspectorTest.sendCommand("Debugger.evaluateOnCallFrame", { callFrameId: obsol
eteTopFrameId, expression: "0"} , callbackEvaluate); | 41 Protocol.Debugger.evaluateOnCallFrame({ callFrameId: obsoleteTopFrameId, expre
ssion: "0"}).then(callbackEvaluate); |
| 44 } | 42 } |
| 45 | 43 |
| 46 function callbackEvaluate(response) | 44 function callbackEvaluate(response) |
| 47 { | 45 { |
| 48 logErrorResponse(response); | 46 logErrorResponse(response); |
| 49 InspectorTest.log("setVariableValue"); | 47 InspectorTest.log("setVariableValue"); |
| 50 InspectorTest.sendCommand("Debugger.setVariableValue", { callFrameId: obsolete
TopFrameId, scopeNumber: 0, variableName: "a", newValue: { value: 0 } }, callbac
kSetVariableValue); | 48 Protocol.Debugger.setVariableValue({ callFrameId: obsoleteTopFrameId, scopeNum
ber: 0, variableName: "a", newValue: { value: 0 } }).then(callbackSetVariableVal
ue); |
| 51 } | 49 } |
| 52 | 50 |
| 53 function callbackSetVariableValue(response) | 51 function callbackSetVariableValue(response) |
| 54 { | 52 { |
| 55 logErrorResponse(response); | 53 logErrorResponse(response); |
| 56 InspectorTest.completeTest(); | 54 InspectorTest.completeTest(); |
| 57 } | 55 } |
| 58 | 56 |
| 59 function logErrorResponse(response) | 57 function logErrorResponse(response) |
| 60 { | 58 { |
| 61 if (response.error) { | 59 if (response.error) { |
| 62 if (response.error.message.indexOf("Can only perform operation while paused.
") !== -1) { | 60 if (response.error.message.indexOf("Can only perform operation while paused.
") !== -1) { |
| 63 InspectorTest.log("PASS, error message as expected"); | 61 InspectorTest.log("PASS, error message as expected"); |
| 64 return; | 62 return; |
| 65 } | 63 } |
| 66 } | 64 } |
| 67 InspectorTest.log("FAIL, unexpected error message"); | 65 InspectorTest.log("FAIL, unexpected error message"); |
| 68 InspectorTest.log(JSON.stringify(response)); | 66 InspectorTest.log(JSON.stringify(response)); |
| 69 } | 67 } |
| OLD | NEW |