blob: daaaca97965291994d2890bd56d4c0d1ac13f90d [file] [log] [blame]
<!doctype html>
<html>
<head>
<script src="../../http/tests/inspector/resources/inspector-test.js"></script>
<script src="../../http/tests/inspector/debugger/debugger-test.js"></script>
<script src="./resources/tail-deleted-frames.js"></script>
<script>
function test()
{
var scriptObject;
function remoteObjectJSONFilter(key, value) {
if (key === "_target" || key === "_listeners")
return undefined;
if (key === "_objectId" || key === "_stackTrace")
return "<filtered>";
return value;
}
function startTest() {
InspectorTest.log("Starting Test");
// 0 based indices.
let testInfo = {line: 3, column: 4};
let location = scriptObject.createSourceCodeLocation(testInfo.line, testInfo.column);
let breakpoint = new WI.Breakpoint(location);
WI.debuggerManager.addBreakpoint(breakpoint);
InspectorTest.evaluateInPage("startABC()");
}
WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.CallFramesDidChange, function(event) {
var activeCallFrame = WI.debuggerManager.activeCallFrame;
if (!activeCallFrame)
return;
var stopLocation = "line: " + activeCallFrame.sourceCodeLocation.lineNumber + ", column: " + activeCallFrame.sourceCodeLocation.columnNumber;
InspectorTest.log("\n\n------------------------------------");
InspectorTest.log("Hit breakpoint at " + stopLocation);
InspectorTest.log("------------------------------------");
// top down list
let expectedFrames = [
{functionName: 'a', scope: ['x', 20], isTailDeleted: false},
{functionName: 'b', scope: ['y', 40], isTailDeleted: true},
{functionName: 'c', scope: ['z', 60], isTailDeleted: true}
];
let targetData = WI.debuggerManager.dataForTarget(WI.debuggerManager.activeCallFrame.target);
let callFrames = targetData.callFrames;
InspectorTest.assert(callFrames.length >= expectedFrames.length);
for (let i = 0; i < expectedFrames.length; i++) {
let callFrame = callFrames[i];
let expectedFrame = expectedFrames[i];
InspectorTest.log("Expected frame: " + JSON.stringify(expectedFrame));
InspectorTest.assert(callFrame.functionName === expectedFrame.functionName);
InspectorTest.assert(callFrame.isTailDeleted === expectedFrame.isTailDeleted);
let topScope = callFrame.scopeChain[0];
topScope.objects[0].getPropertyDescriptors(function(properties) {
let found = false;
let variableName = expectedFrame.scope[0];
let variableValue = expectedFrame.scope[1];
for (let propertyDescriptor of properties) {
if (propertyDescriptor.name === variableName) {
found = true;
InspectorTest.log("Looking at frame number: " + i);
InspectorTest.log(` variable '${variableName}': ${JSON.stringify(propertyDescriptor.value, remoteObjectJSONFilter)}`);
InspectorTest.assert(propertyDescriptor.value.type === 'number');
InspectorTest.assert(propertyDescriptor.value.value === variableValue);
}
}
InspectorTest.assert(found);
});
}
WI.debuggerManager.resume();
});
WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.Resumed, function(event) {
InspectorTest.log("Tests done");
InspectorTest.completeTest();
});
WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.ScriptAdded, function(event) {
eventScriptObject = event.data.script;
if (/tail-deleted-frames\.js$/.test(eventScriptObject.url)) {
scriptObject = eventScriptObject;
startTest();
return;
}
});
InspectorTest.reloadPage();
}
</script>
</head>
<body onload="runTest()">
<p>Testing that we keep around tail deleted frames in the inspector. </p>
</body>
</html>