3 <script type=
"text/javascript" src=
"../../http/tests/inspector-protocol/inspector-protocol-test.js"></script>
6 function TestFunction()
14 var newVariableValue
= 55;
16 InspectorTest
.sendCommand("Debugger.enable", {});
18 InspectorTest
.eventHandler
["Debugger.paused"] = handleDebuggerPaused
;
20 InspectorTest
.sendCommand("Runtime.evaluate", { "expression": "setTimeout(TestFunction, 0)" });
22 function handleDebuggerPaused(messageObject
)
24 InspectorTest
.log("Paused on 'debugger;'");
25 InspectorTest
.eventHandler
["Debugger.paused"] = undefined;
27 var topFrame
= messageObject
.params
.callFrames
[0];
28 var topFrameId
= topFrame
.callFrameId
;
29 InspectorTest
.sendCommand("Debugger.evaluateOnCallFrame", { "callFrameId": topFrameId
, "expression": "a = " + newVariableValue
}, callbackChangeValue
);
32 function callbackChangeValue(response
)
34 InspectorTest
.log("Variable value changed");
35 InspectorTest
.sendCommand("Debugger.getBacktrace", { }, callbackGetBacktrace
);
38 function callbackGetBacktrace(response
)
40 InspectorTest
.log("Stacktrace re-read again");
41 var localScope
= response
.result
.callFrames
[0].scopeChain
[0];
42 InspectorTest
.sendCommand("Runtime.getProperties", { "objectId": localScope
.object
.objectId
}, callbackGetProperties
);
45 function callbackGetProperties(response
)
47 InspectorTest
.log("Scope variables downloaded anew");
49 var propertyList
= response
.result
.result
;
50 for (var i
= 0; i
< propertyList
.length
; i
++) {
51 if (propertyList
[i
].name
=== "a") {
52 varNamedA
= propertyList
[i
];
57 var actualValue
= varNamedA
.value
.value
;
58 InspectorTest
.log("New variable is " + actualValue
+ ", expected is " + newVariableValue
+ ", old was: 2");
59 InspectorTest
.log(actualValue
== newVariableValue
? "SUCCESS" : "FAIL");
61 InspectorTest
.log("Failed to find variable in scope");
63 InspectorTest
.completeTest();
68 <body onLoad=
"runTest();">