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