3 <script src="../../http/tests/inspector/inspector-test.js"></script>
4 <script src="../../http/tests/inspector/debugger-test.js"></script>
7 function makeClosure(n) {
8 var makeClosureLocalVar = 'local.' + n;
9 return function innerFunction(x) {
10 var innerFunctionLocalVar = x + 2;
11 var negInf = -Infinity;
12 var negZero = 1 / negInf;
14 throw new Error("An exception");
19 return n + makeClosureLocalVar + x + innerFunctionLocalVar;
23 function testFunction() {
24 var f = makeClosure('TextParam');
31 var scriptToEvaluate = "setTimeout(testFunction, 0)";
33 InspectorTest.startDebuggerTest(step1);
37 InspectorTest.evaluateInConsole(scriptToEvaluate, InspectorTest.addResult.bind(InspectorTest, "Evaluated script in console."));
38 InspectorTest.waitUntilPaused(step2);
43 // Expand all but global scopes. Expanding global scope takes for too long
44 // so we keep it collapsed.
45 var sections = WebInspector.inspectorView.currentPanel().sidebarPanes.scopechain._sections;
46 // global scope is always the last one.
47 for (var i = 0; i < sections.length - 1; i++)
49 InspectorTest.runAfterPendingDispatches(step3);
55 var sections = WebInspector.inspectorView.currentPanel().sidebarPanes.scopechain._sections;
56 InspectorTest.addResult("");
57 InspectorTest.addResult("Dump scope sections:");
58 for (var i = 0; i < sections.length; i++) {
59 var section = sections[i];
60 var properties = section.propertiesForTest;
61 InspectorTest.addResult(InspectorTest.textContentWithLineBreaks(section.element));
62 if (!section.expanded)
63 InspectorTest.addResult(" <section collapsed>");
65 InspectorTest.completeDebuggerTest();
72 <body onload="runTest()">
73 <input type='button' onclick='testFunction()' value='Test'/>
75 Test that sections representing scopes of the current call frame are expandable
76 and contain correct data.