blob: b614228960be1c65295bec7293652055d418189e [file] [log] [blame]
<html>
<head>
<script type="text/javascript" src="../../http/tests/inspector-protocol/inspector-protocol-test.js"></script>
<script>
function testFunction()
{
debugger;
}
function test()
{
InspectorTest.sendCommand("Debugger.enable", {});
InspectorTest.eventHandler["Debugger.paused"] = handleDebuggerPausedOne;
InspectorTest.sendCommand("Runtime.evaluate", { "expression": "setTimeout(testFunction, 0)" });
var obsoleteTopFrameId;
function handleDebuggerPausedOne(messageObject)
{
InspectorTest.log("Paused on 'debugger;'");
var topFrame = messageObject.params.callFrames[0];
obsoleteTopFrameId = topFrame.callFrameId;
InspectorTest.eventHandler["Debugger.paused"] = undefined;
InspectorTest.sendCommand("Debugger.resume", { }, callbackResume);
}
function callbackResume(response)
{
InspectorTest.log("resume");
InspectorTest.log("restartFrame");
InspectorTest.sendCommand("Debugger.restartFrame", { callFrameId: obsoleteTopFrameId }, callbackRestartFrame);
}
function callbackRestartFrame(response)
{
logErrorResponse(response);
InspectorTest.log("evaluateOnFrame");
InspectorTest.sendCommand("Debugger.evaluateOnCallFrame", { callFrameId: obsoleteTopFrameId, expression: "0"} , callbackEvaluate);
}
function callbackEvaluate(response)
{
logErrorResponse(response);
InspectorTest.log("setVariableValue");
InspectorTest.sendCommand("Debugger.setVariableValue", { callFrameId: obsoleteTopFrameId, scopeNumber: 0, variableName: "a", newValue: { value: 0 } }, callbackSetVariableValue);
}
function callbackSetVariableValue(response)
{
logErrorResponse(response);
InspectorTest.completeTest();
}
function logErrorResponse(response)
{
if (response.error) {
if (response.error.message.indexOf("Can only perform operation while paused.") != -1) {
InspectorTest.log("PASS, error message as expected");
return;
}
}
InspectorTest.log("FAIL, unexpected error message");
InspectorTest.log(JSON.stringify(response));
}
}
</script>
</head>
<body onLoad="runTest();">
</body>
</html>