| 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 InspectorTest.log('Async caught exception prediction and blackboxing.'); | 5 let {session, contextGroup, Protocol} = InspectorTest.start('Async caught except
ion prediction and blackboxing.'); |
| 6 | 6 |
| 7 InspectorTest.addScript(` | 7 contextGroup.addScript(` |
| 8 function constructorThrow() { | 8 function constructorThrow() { |
| 9 return new Promise((resolve, reject) => | 9 return new Promise((resolve, reject) => |
| 10 Promise.resolve().then(() => | 10 Promise.resolve().then(() => |
| 11 reject("f") // Exception f | 11 reject("f") // Exception f |
| 12 ) | 12 ) |
| 13 ); | 13 ); |
| 14 } | 14 } |
| 15 | 15 |
| 16 function dotCatch(producer) { | 16 function dotCatch(producer) { |
| 17 Promise.resolve(producer()).catch(() => {}); | 17 Promise.resolve(producer()).catch(() => {}); |
| 18 } | 18 } |
| 19 //# sourceURL=framework.js`); | 19 //# sourceURL=framework.js`); |
| 20 | 20 |
| 21 InspectorTest.setupScriptMap(); | 21 session.setupScriptMap(); |
| 22 (async function test() { | 22 (async function test() { |
| 23 Protocol.Debugger.enable(); | 23 Protocol.Debugger.enable(); |
| 24 Protocol.Debugger.setBlackboxPatterns({patterns: ['framework\.js']}); | 24 Protocol.Debugger.setBlackboxPatterns({patterns: ['framework\.js']}); |
| 25 Protocol.Debugger.setPauseOnExceptions({state: 'all'}); | 25 Protocol.Debugger.setPauseOnExceptions({state: 'all'}); |
| 26 Protocol.Runtime.evaluate({expression: 'dotCatch(constructorThrow);'}); | 26 Protocol.Runtime.evaluate({expression: 'dotCatch(constructorThrow);'}); |
| 27 // Should break at this debugger statement, not at reject. | 27 // Should break at this debugger statement, not at reject. |
| 28 Protocol.Runtime.evaluate({expression: 'setTimeout(\'debugger;\', 0);'}); | 28 Protocol.Runtime.evaluate({expression: 'setTimeout(\'debugger;\', 0);'}); |
| 29 await waitPauseAndDumpLocation(); | 29 await waitPauseAndDumpLocation(); |
| 30 InspectorTest.completeTest(); | 30 InspectorTest.completeTest(); |
| 31 })(); | 31 })(); |
| 32 | 32 |
| 33 async function waitPauseAndDumpLocation() { | 33 async function waitPauseAndDumpLocation() { |
| 34 var message = await Protocol.Debugger.oncePaused(); | 34 var message = await Protocol.Debugger.oncePaused(); |
| 35 InspectorTest.log('paused at:'); | 35 InspectorTest.log('paused at:'); |
| 36 InspectorTest.logSourceLocation(message.params.callFrames[0].location); | 36 session.logSourceLocation(message.params.callFrames[0].location); |
| 37 return message; | 37 return message; |
| 38 } | 38 } |
| OLD | NEW |