Chromium Code Reviews| 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; | |
|
yurys
2014/11/21 13:30:54
I'd also add makeClosureDeeperLocalkVar to check t
aandrey
2014/11/21 13:53:14
Done.
| |
| 17 return function innerFunction(x) | |
| 18 { | |
| 19 let innerFunctionBlockVar = x + 102; | |
| 20 var innerFunctionLocalVar = x + 2; | |
| 21 var negInf = -Infinity; | |
| 22 var negZero = 1 / negInf; | |
| 23 { | |
| 24 let block1 = "block {...}"; | |
| 25 const const1 = 1; | |
| 26 try { | |
| 27 throw new Error("An exception"); | |
| 28 } catch (e) { | |
| 29 let block2 = "catch(e) {...}"; | |
| 30 const const2 = 2; | |
| 31 e.toString(); | |
| 32 debugger; | |
| 33 } | |
| 34 } | |
| 35 return n + makeClosureLocalVar + x + innerFunctionLocalVar + innerFu nctionBlockVar + makeClosureBlockVar + makeClosureDeeperBlockVar; | |
| 36 } | |
| 37 } | |
| 38 } | |
| 39 | |
| 40 function testFunction() | |
| 41 { | |
| 42 var f = makeClosure("TextParam"); | |
| 43 f(2014); | |
| 44 } | |
| 45 | |
| 46 function test() | |
| 47 { | |
| 48 InspectorTest.startDebuggerTest(step1); | |
| 49 | |
| 50 function step1() | |
| 51 { | |
| 52 InspectorTest.runTestFunctionAndWaitUntilPaused(step2); | |
| 53 } | |
| 54 | |
| 55 function step2() | |
| 56 { | |
| 57 InspectorTest.expandScopeVariablesSidebarPane(step3); | |
| 58 } | |
| 59 | |
| 60 function step3() | |
| 61 { | |
| 62 InspectorTest.addResult(""); | |
| 63 InspectorTest.dumpScopeVariablesSidebarPane(); | |
| 64 InspectorTest.completeDebuggerTest(); | |
| 65 } | |
| 66 } | |
| 67 | |
| 68 </script> | |
| 69 </head> | |
| 70 | |
| 71 <body onload="runTest()"> | |
| 72 <input type='button' onclick='testFunction()' value='Test'/> | |
| 73 <p> | |
| 74 Tests ES6 harmony scope sections. | |
| 75 </p> | |
| 76 </body> | |
| 77 </html> | |
| OLD | NEW |