| OLD | NEW | 
|---|
| 1 // Copyright 2017 the V8 project authors. All rights reserved. | 1 // Copyright 2017 the V8 project authors. All rights reserved. | 
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be | 
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. | 
| 4 | 4 | 
| 5 print('Checks possible break locations.'); |  | 
| 6 |  | 
| 7 InspectorTest.addScript(` |  | 
| 8 |  | 
| 9 function testEval() { | 5 function testEval() { | 
| 10   eval('// comment only'); | 6   eval('// comment only'); | 
| 11   eval('// comment only\\n'); | 7   eval('// comment only\n'); | 
| 12 } | 8 } | 
| 13 | 9 | 
| 14 // function without return | 10 // function without return | 
| 15 function procedure() { | 11 function procedure() { | 
| 16   var a = 1; | 12   var a = 1; | 
| 17   var b = 2; | 13   var b = 2; | 
| 18 } | 14 } | 
| 19 | 15 | 
| 20 function testProcedure() { | 16 function testProcedure() { | 
| 21   procedure(); | 17   procedure(); | 
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 234     } | 230     } | 
| 235     setTimeout(returnCall, 0); | 231     setTimeout(returnCall, 0); | 
| 236     await foo(); | 232     await foo(); | 
| 237     await foo(); | 233     await foo(); | 
| 238     nextTest(); | 234     nextTest(); | 
| 239   } | 235   } | 
| 240   main(); | 236   main(); | 
| 241   return testPromise; | 237   return testPromise; | 
| 242 } | 238 } | 
| 243 | 239 | 
| 244 //# sourceURL=test.js`); | 240 function returnFunction() { | 
|  | 241   return returnObject; | 
|  | 242 } | 
| 245 | 243 | 
| 246 InspectorTest.setupScriptMap(); | 244 async function testPromiseComplex() { | 
| 247 Protocol.Debugger.onPaused(message => { | 245   var nextTest; | 
| 248   var frames = message.params.callFrames; | 246   var testPromise = new Promise(resolve => nextTest = resolve); | 
| 249   if (frames.length === 1) { | 247   async function main() { | 
| 250     Protocol.Debugger.stepInto(); | 248     async function foo() { | 
| 251     return; | 249       await Promise.resolve(); | 
|  | 250       return 42; | 
|  | 251     } | 
|  | 252     var x = 1; | 
|  | 253     var y = 2; | 
|  | 254     returnFunction(emptyFunction(), x++, --y, x => 2 * x, returnCall())().a = aw
     ait foo((a => 2 *a)(5)); | 
|  | 255     nextTest(); | 
| 252   } | 256   } | 
| 253   var scriptId = frames[0].location.scriptId; | 257   main(); | 
| 254   InspectorTest.log('break at:'); | 258   return testPromise; | 
| 255   InspectorTest.logCallFrameSourceLocation(frames[0]) | 259 } | 
| 256     .then(() => Protocol.Debugger.stepInto()); |  | 
| 257 }); |  | 
| 258 | 260 | 
| 259 Protocol.Debugger.enable(); | 261 function twiceDefined() { | 
| 260 Protocol.Runtime.evaluate({ expression: 'Object.keys(this).filter(name => name.i
     ndexOf(\'test\') === 0)', returnByValue: true }) | 262   return a + b; | 
| 261   .then(runTests); | 263 } | 
| 262 | 264 | 
| 263 function runTests(message) { | 265 function twiceDefined() { | 
| 264   var tests = message.result.result.value; | 266   return a + b; | 
| 265   InspectorTest.runTestSuite(tests.map(test => eval(`(function ${test}(next) { |  | 
| 266     Protocol.Runtime.evaluate({ expression: 'debugger; ${test}()', awaitPromise:
      ${test.indexOf('testPromise') === 0}}) |  | 
| 267       .then(next); |  | 
| 268   })`))); |  | 
| 269 } | 267 } | 
|  | 268 | 
|  | 269 //# sourceURL=break-locations.js | 
| OLD | NEW | 
|---|