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 function foo1() { |
| 7 return 10; |
| 8 } |
| 9 |
| 10 function foo2() { |
| 11 return {a:x => 2 * x}; |
| 12 } |
| 13 |
| 14 async function bar1() { |
| 15 return 10; |
| 16 } |
| 17 |
| 18 async function bar2(x) { |
| 19 return 2 * x; |
| 20 } |
| 21 |
| 22 async function foo3() { |
| 23 debugger; |
| 24 var a = foo1() + foo1(); |
| 25 var b = foo2(); |
| 26 if (a) { |
| 27 a = b.a(a); |
| 28 } |
| 29 |
| 30 bar1().then((xxx, yyy) => console.log(xxx)); |
| 31 bar1().then( (xxx, yyy) => console.log(xxx)); |
| 32 bar1().then( (xxx, /*zzz*/ yyy /* xyz */) => console.log(xxx)); |
| 33 bar1().then ( bar2 ); |
| 34 bar1().then ( console.log() ); |
| 35 bar1().then ( console.log ); |
| 36 bar1().then(function(x) { |
| 37 console.log(x); |
| 38 }); |
| 39 bar1().then( async /* comment */ function(x) { |
| 40 console.log(x); |
| 41 }); |
| 42 bar1().then( async function(x) { |
| 43 console.log(x); |
| 44 }); |
| 45 bar1().then(bar2.bind(null)); |
| 46 bar1().then(() => bar2(5)); |
| 47 bar1().then(async () => await bar2(5)); |
| 48 bar1().then(async (x, y) => await bar2(x)); |
| 49 setTimeout(bar1, 2000); |
| 50 a = await bar1(); |
| 51 bar1().then((x, |
| 52 y) => console.log(x)); |
| 53 bar1().then(( |
| 54 x, y) => console.log(x)); |
| 55 bar1().then(async ( |
| 56 x, y) => console.log(x)); |
| 57 bar1().then( |
| 58 async (x, y) => console.log(x)); |
| 59 bar1().then( |
| 60 bar2); |
| 61 bar1().then((bar2)); |
| 62 bar1().then(Promise.resolve()); |
| 63 bar1().then(Promise.resolve(42).then(bar2)); |
| 64 bar1().then((Promise.resolve())); |
| 65 |
| 66 var False = false; |
| 67 if (False) |
| 68 bar1().then(bar2); |
| 69 bar1().then(bar2); |
| 70 |
| 71 bar1().then(/* comment */ bar2.bind(null)); |
| 72 return 10; |
| 73 } |
| 74 </script> |
| 75 <script> |
| 76 |
| 77 function testFunction() |
| 78 { |
| 79 foo3(); |
| 80 } |
| 81 |
| 82 var test = function() |
| 83 { |
| 84 InspectorTest.startDebuggerTest(step1, true); |
| 85 |
| 86 function step1() |
| 87 { |
| 88 InspectorTest.addSnifferPromise(Sources.JavaScriptSourceFrame.prototype,
"_continueToLocationRenderedForTest").then(step2); |
| 89 InspectorTest.addSniffer(Sources.JavaScriptSourceFrame.prototype, "setEx
ecutionLocation", function() { |
| 90 InspectorTest.showUISourceCodePromise(this.uiSourceCode()).then(() =>
{ |
| 91 this._showContinueToLocations(); |
| 92 }); |
| 93 }); |
| 94 InspectorTest.runTestFunctionAndWaitUntilPaused(); |
| 95 } |
| 96 |
| 97 function step2() |
| 98 { |
| 99 var currentFrame = UI.panels.sources.visibleView; |
| 100 var decorations = currentFrame._continueToLocationDecorations; |
| 101 var lines = []; |
| 102 for (var decoration of decorations.keysArray()) { |
| 103 var find = decoration.find(); |
| 104 var line = find.from.line; |
| 105 var text = currentFrame.textEditor.line(line).substring(find.from.ch
, find.to.ch); |
| 106 lines.push(`${decoration.className} @${line + 1}:${find.from.ch} = '
${text}'`); |
| 107 } |
| 108 lines.sort(); |
| 109 InspectorTest.addResults(lines); |
| 110 InspectorTest.completeDebuggerTest(); |
| 111 } |
| 112 } |
| 113 |
| 114 </script> |
| 115 </head> |
| 116 <body onload="runTest()"> |
| 117 <p>Tests that continue to location markers are computed correctly.</p> |
| 118 </body> |
| 119 </html> |
OLD | NEW |