OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <script src="../../../http/tests/inspector/inspector-test.js"></script> | 3 <script src="../../../http/tests/inspector/inspector-test.js"></script> |
4 <script src="../../../http/tests/inspector/debugger-test.js"></script> | 4 <script src="../../../http/tests/inspector/debugger-test.js"></script> |
5 <script> | 5 <script> |
6 | 6 |
7 function makeClosure(n) { | 7 function makeClosure(n) |
8 var makeClosureLocalVar = 'local.' + n; | 8 { |
9 return function innerFunction(x) { | 9 var makeClosureLocalVar = "local." + n; |
10 var innerFunctionLocalVar = x + 2; | 10 return function innerFunction(x) |
11 var negInf = -Infinity; | 11 { |
12 var negZero = 1 / negInf; | 12 var innerFunctionLocalVar = x + 2; |
13 try { | 13 var negInf = -Infinity; |
14 throw new Error("An exception"); | 14 var negZero = 1 / negInf; |
15 } catch (e) { | 15 try { |
16 e.toString(); | 16 throw new Error("An exception"); |
17 debugger; | 17 } catch (e) { |
| 18 e.toString(); |
| 19 debugger; |
| 20 } |
| 21 return n + makeClosureLocalVar + x + innerFunctionLocalVar; |
18 } | 22 } |
19 return n + makeClosureLocalVar + x + innerFunctionLocalVar; | |
20 } | |
21 } | 23 } |
22 | 24 |
23 function testFunction() { | 25 function testFunction() |
24 var f = makeClosure('TextParam'); | 26 { |
25 f(2010); | 27 var f = makeClosure("TextParam"); |
| 28 f(2010); |
26 } | 29 } |
27 | 30 |
28 | |
29 function test() | 31 function test() |
30 { | 32 { |
31 var scriptToEvaluate = "setTimeout(testFunction, 0)"; | |
32 | |
33 InspectorTest.startDebuggerTest(step1); | 33 InspectorTest.startDebuggerTest(step1); |
34 | 34 |
35 function step1() | 35 function step1() |
36 { | 36 { |
37 InspectorTest.evaluateInPage(scriptToEvaluate, InspectorTest.addResult.b
ind(InspectorTest, "Evaluated script in console.")); | 37 InspectorTest.runTestFunctionAndWaitUntilPaused(step2); |
38 InspectorTest.waitUntilPaused(step2); | |
39 } | 38 } |
40 | 39 |
41 function step2() | 40 function step2() |
42 { | 41 { |
43 // Expand all but global scopes. Expanding global scope takes for too lo
ng | 42 InspectorTest.expandScopeVariablesSidebarPane(step3); |
44 // so we keep it collapsed. | |
45 var sections = WebInspector.inspectorView.currentPanel().sidebarPanes.sc
opechain._sections; | |
46 // global scope is always the last one. | |
47 for (var i = 0; i < sections.length - 1; i++) | |
48 sections[i].expand(); | |
49 InspectorTest.runAfterPendingDispatches(step3); | |
50 } | 43 } |
51 | 44 |
52 function step3() | 45 function step3() |
53 { | 46 { |
54 | |
55 var sections = WebInspector.inspectorView.currentPanel().sidebarPanes.sc
opechain._sections; | |
56 InspectorTest.addResult(""); | 47 InspectorTest.addResult(""); |
57 InspectorTest.addResult("Dump scope sections:"); | 48 InspectorTest.dumpScopeVariablesSidebarPane(); |
58 for (var i = 0; i < sections.length; i++) { | |
59 var section = sections[i]; | |
60 var properties = section.propertiesForTest; | |
61 InspectorTest.addResult(InspectorTest.textContentWithLineBreaks(sect
ion.element)); | |
62 if (!section.expanded) | |
63 InspectorTest.addResult(" <section collapsed>"); | |
64 } | |
65 InspectorTest.completeDebuggerTest(); | 49 InspectorTest.completeDebuggerTest(); |
66 } | 50 } |
67 } | 51 } |
68 | 52 |
69 </script> | 53 </script> |
70 </head> | 54 </head> |
71 | 55 |
72 <body onload="runTest()"> | 56 <body onload="runTest()"> |
73 <input type='button' onclick='testFunction()' value='Test'/> | 57 <input type='button' onclick='testFunction()' value='Test'/> |
74 <p> | 58 <p> |
75 Test that sections representing scopes of the current call frame are expandable | 59 Test that sections representing scopes of the current call frame are expandable |
76 and contain correct data. | 60 and contain correct data. |
77 </p> | 61 </p> |
78 </body> | 62 </body> |
79 </html> | 63 </html> |
OLD | NEW |