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