Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / inspector-protocol / debugger / updateCallFrameScopes.html
blob1adeb75fa67de3a2535471c8289149f03d42bfa2
1 <html>
2 <head>
3 <script type="text/javascript" src="../../http/tests/inspector-protocol/inspector-protocol-test.js"></script>
4 <script>
6 function TestFunction()
8 var a = 2;
9 debugger;
12 function test()
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");
48 var varNamedA;
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];
53 break;
56 if (varNamedA) {
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");
60 } else {
61 InspectorTest.log("Failed to find variable in scope");
63 InspectorTest.completeTest();
66 </script>
67 </head>
68 <body onLoad="runTest();">
69 </body>
70 </html>