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