| OLD | NEW |
| (Empty) |
| 1 <html> | |
| 2 <head> | |
| 3 <script type="text/javascript" src="../../http/tests/inspector-protocol/resource
s/inspector-protocol-test.js"></script> | |
| 4 <script> | |
| 5 | |
| 6 function TestFunction() | |
| 7 { | |
| 8 var a = 2; | |
| 9 debugger; | |
| 10 debugger; | |
| 11 } | |
| 12 | |
| 13 function test() | |
| 14 { | |
| 15 var newVariableValue = 55; | |
| 16 | |
| 17 InspectorTest.sendCommand("Debugger.enable", {}); | |
| 18 | |
| 19 InspectorTest.eventHandler["Debugger.paused"] = handleDebuggerPaused; | |
| 20 | |
| 21 InspectorTest.sendCommand("Runtime.evaluate", { "expression": "setTimeout(Te
stFunction, 0)" }); | |
| 22 | |
| 23 function handleDebuggerPaused(messageObject) | |
| 24 { | |
| 25 InspectorTest.log("Paused on 'debugger;'"); | |
| 26 InspectorTest.eventHandler["Debugger.paused"] = undefined; | |
| 27 | |
| 28 var topFrame = messageObject.params.callFrames[0]; | |
| 29 var topFrameId = topFrame.callFrameId; | |
| 30 InspectorTest.sendCommand("Debugger.evaluateOnCallFrame", { "callFrameId
": topFrameId, "expression": "a = " + newVariableValue }, callbackChangeValue); | |
| 31 } | |
| 32 | |
| 33 function callbackChangeValue(response) | |
| 34 { | |
| 35 InspectorTest.log("Variable value changed"); | |
| 36 InspectorTest.eventHandler["Debugger.paused"] = callbackGetBacktrace; | |
| 37 InspectorTest.sendCommand("Debugger.resume", { }); | |
| 38 } | |
| 39 | |
| 40 function callbackGetBacktrace(response) | |
| 41 { | |
| 42 InspectorTest.log("Stacktrace re-read again"); | |
| 43 var localScope = response.params.callFrames[0].scopeChain[0]; | |
| 44 InspectorTest.sendCommand("Runtime.getProperties", { "objectId": localSc
ope.object.objectId }, callbackGetProperties); | |
| 45 } | |
| 46 | |
| 47 function callbackGetProperties(response) | |
| 48 { | |
| 49 InspectorTest.log("Scope variables downloaded anew"); | |
| 50 var varNamedA; | |
| 51 var propertyList = response.result.result; | |
| 52 for (var i = 0; i < propertyList.length; i++) { | |
| 53 if (propertyList[i].name === "a") { | |
| 54 varNamedA = propertyList[i]; | |
| 55 break; | |
| 56 } | |
| 57 } | |
| 58 if (varNamedA) { | |
| 59 var actualValue = varNamedA.value.value; | |
| 60 InspectorTest.log("New variable is " + actualValue + ", expected is
" + newVariableValue + ", old was: 2"); | |
| 61 InspectorTest.log(actualValue == newVariableValue ? "SUCCESS" : "FAI
L"); | |
| 62 } else { | |
| 63 InspectorTest.log("Failed to find variable in scope"); | |
| 64 } | |
| 65 InspectorTest.completeTest(); | |
| 66 } | |
| 67 } | |
| 68 </script> | |
| 69 </head> | |
| 70 <body onLoad="runTest();"> | |
| 71 </body> | |
| 72 </html> | |
| OLD | NEW |