OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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("Check that inspector correctly passes caught/uncaught information."); | 5 InspectorTest.log("Check that inspector correctly passes caught/uncaught informa
tion."); |
6 | 6 |
7 InspectorTest.addScript( | 7 InspectorTest.addScript( |
8 `function throwCaught() { try { throw new Error(); } catch (_) {} } | 8 `function throwCaught() { try { throw new Error(); } catch (_) {} } |
9 function throwUncaught() { throw new Error(); } | 9 function throwUncaught() { throw new Error(); } |
10 function schedule(f) { setTimeout(f, 0); } | 10 function schedule(f) { setTimeout(f, 0); } |
11 `); | 11 `); |
12 | 12 |
13 Protocol.Debugger.enable(); | 13 Protocol.Debugger.enable(); |
14 | 14 |
15 Protocol.Debugger.setPauseOnExceptions({ "state": "all" }); | 15 Protocol.Debugger.setPauseOnExceptions({ "state": "all" }); |
16 Protocol.Debugger.onPaused(message => { | 16 Protocol.Debugger.onPaused(message => { |
17 InspectorTest.log("paused in " + message.params.callFrames[0].functionName); | 17 InspectorTest.log("paused in " + message.params.callFrames[0].functionName); |
18 InspectorTest.log("uncaught: " + message.params.data.uncaught); | 18 InspectorTest.log("uncaught: " + message.params.data.uncaught); |
19 Protocol.Debugger.resume(); | 19 Protocol.Debugger.resume(); |
20 }); | 20 }); |
21 | 21 |
22 Protocol.Runtime.evaluate({ "expression": "schedule(throwCaught);" }) | 22 Protocol.Runtime.evaluate({ "expression": "schedule(throwCaught);" }) |
23 .then(() => Protocol.Runtime.evaluate( | 23 .then(() => Protocol.Runtime.evaluate( |
24 { "expression": "schedule(throwUncaught);" })) | 24 { "expression": "schedule(throwUncaught);" })) |
25 .then(() => InspectorTest.completeTest()); | 25 .then(() => InspectorTest.completeTest()); |
OLD | NEW |