OLD | NEW |
(Empty) | |
| 1 <html> |
| 2 <head> |
| 3 <script src="../../../http/tests/inspector/inspector-test.js"></script> |
| 4 <script src="../../../http/tests/inspector/debugger-test.js"></script> |
| 5 <script> |
| 6 "use strict"; |
| 7 |
| 8 let globalLet = 41; |
| 9 const globalConst = 42; |
| 10 |
| 11 function makeClosure(n) |
| 12 { |
| 13 let makeClosureBlockVar = "block." + n; |
| 14 var makeClosureLocalVar = "local." + n; |
| 15 { |
| 16 let makeClosureDeeperBlockVar = "block.deep." + n; |
| 17 var makeClosureDeeperLocalVar = "local.deep." + n; |
| 18 return function innerFunction(x) |
| 19 { |
| 20 let innerFunctionBlockVar = x + 102; |
| 21 var innerFunctionLocalVar = x + 2; |
| 22 var negInf = -Infinity; |
| 23 var negZero = 1 / negInf; |
| 24 { |
| 25 let block1 = "block {...}"; |
| 26 const const1 = 1; |
| 27 try { |
| 28 throw new Error("An exception"); |
| 29 } catch (e) { |
| 30 let block2 = "catch(e) {...}"; |
| 31 const const2 = 2; |
| 32 e.toString(); |
| 33 debugger; |
| 34 } |
| 35 } |
| 36 return n + makeClosureLocalVar + x + innerFunctionLocalVar + innerFu
nctionBlockVar + |
| 37 makeClosureBlockVar + makeClosureDeeperBlockVar + makeClosureDee
perLocalVar; |
| 38 } |
| 39 } |
| 40 } |
| 41 |
| 42 function testFunction() |
| 43 { |
| 44 var f = makeClosure("TextParam"); |
| 45 f(2014); |
| 46 } |
| 47 |
| 48 function test() |
| 49 { |
| 50 InspectorTest.startDebuggerTest(step1); |
| 51 |
| 52 function step1() |
| 53 { |
| 54 InspectorTest.runTestFunctionAndWaitUntilPaused(step2); |
| 55 } |
| 56 |
| 57 function step2() |
| 58 { |
| 59 InspectorTest.expandScopeVariablesSidebarPane(step3); |
| 60 } |
| 61 |
| 62 function step3() |
| 63 { |
| 64 InspectorTest.addResult(""); |
| 65 InspectorTest.dumpScopeVariablesSidebarPane(); |
| 66 InspectorTest.completeDebuggerTest(); |
| 67 } |
| 68 } |
| 69 |
| 70 </script> |
| 71 </head> |
| 72 |
| 73 <body onload="runTest()"> |
| 74 <input type='button' onclick='testFunction()' value='Test'/> |
| 75 <p> |
| 76 Tests ES6 harmony scope sections. |
| 77 </p> |
| 78 </body> |
| 79 </html> |
OLD | NEW |