blob: ce90d74a650e33334d4a370cc691c1969444a26e [file] [log] [blame]
<html>
<head>
<script src="../../http/tests/inspector/inspector-test.js"></script>
<script src="../../http/tests/inspector/debugger-test.js"></script>
<script>
function makeClosure(n) {
var makeClosureLocalVar = 'local.' + n;
return function innerFunction(x) {
var innerFunctionLocalVar = arguments[0] + 2;
try {
throw new Error("An exception");
} catch (e) {
e.toString();
debugger;
}
return n + makeClosureLocalVar + arguments[0] + innerFunctionLocalVar;
}
}
function testFunction() {
var f = makeClosure('TextParam');
f(2010);
}
function test()
{
var scriptToEvaluate = "setTimeout(testFunction, 0)";
InspectorTest.startDebuggerTest(step1);
function step1()
{
InspectorTest.evaluateInConsole(scriptToEvaluate, InspectorTest.addResult.bind(InspectorTest, "Evaluated script in console."));
InspectorTest.waitUntilPaused(step2);
}
function step2()
{
// Expand all but global scopes. Expanding global scope takes for too long
// so we keep it collapsed.
var sections = WebInspector.inspectorView.currentPanel().sidebarPanes.scopechain._sections;
// global scope is always the last one.
for (var i = 0; i < sections.length - 1; i++)
sections[i].expand();
InspectorTest.runAfterPendingDispatches(step3);
}
function step3()
{
var sections = WebInspector.inspectorView.currentPanel().sidebarPanes.scopechain._sections;
InspectorTest.addResult("");
InspectorTest.addResult("Dump scope sections:");
for (var i = 0; i < sections.length; i++) {
var section = sections[i];
var properties = section.propertiesForTest;
InspectorTest.addResult(InspectorTest.textContentWithLineBreaks(section.element));
if (!section.expanded)
InspectorTest.addResult(" <section collapsed>");
}
InspectorTest.completeDebuggerTest();
}
}
</script>
</head>
<body onload="runTest()">
<input type='button' onclick='testFunction()' value='Test'/>
<p>
Test that sections representing scopes of the current call frame are expandable
and contain correct data.
</p>
</body>
</html>