OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 print("Check that inspector correctly change break on exception state."); |
| 6 |
| 7 InspectorTest.addScript(` |
| 8 function scheduleUncaughtException() |
| 9 { |
| 10 setTimeout(throwUncaughtException, 0); |
| 11 } |
| 12 function throwUncaughtException() |
| 13 { |
| 14 throw new Error(); |
| 15 } |
| 16 function throwCaughtException() |
| 17 { |
| 18 throw new Error(); |
| 19 }`); |
| 20 |
| 21 Protocol.Debugger.onPaused(message => { |
| 22 InspectorTest.log("paused in " + message.params.callFrames[0].functionName); |
| 23 Protocol.Debugger.resume(); |
| 24 }); |
| 25 |
| 26 Protocol.Runtime.enable(); |
| 27 |
| 28 InspectorTest.runTestSuite([ |
| 29 function noBreakOnExceptionAfterEnabled(next) |
| 30 { |
| 31 Protocol.Debugger.enable(); |
| 32 Protocol.Debugger.setPauseOnExceptions({ state: "all" }); |
| 33 Protocol.Debugger.disable(); |
| 34 Protocol.Debugger.enable(); |
| 35 Protocol.Runtime.evaluate({ expression: "scheduleUncaughtException()" }) |
| 36 .then(() => Protocol.Runtime.evaluate({ expression: "throwCaughtException(
)" })) |
| 37 .then(() => Protocol.Debugger.disable()) |
| 38 .then(next); |
| 39 }, |
| 40 |
| 41 function breakOnUncaughtException(next) |
| 42 { |
| 43 Protocol.Debugger.enable(); |
| 44 Protocol.Debugger.setPauseOnExceptions({ state: "uncaught" }); |
| 45 Protocol.Runtime.evaluate({ expression: "scheduleUncaughtException()" }) |
| 46 .then(() => Protocol.Runtime.onceExceptionThrown()) |
| 47 .then(() => Protocol.Runtime.evaluate({ expression: "throwCaughtException(
)" })) |
| 48 .then(() => Protocol.Debugger.disable()) |
| 49 .then(next); |
| 50 }, |
| 51 |
| 52 function breakOnCaughtException(next) |
| 53 { |
| 54 Protocol.Debugger.enable(); |
| 55 Protocol.Debugger.setPauseOnExceptions({ state: "all" }); |
| 56 Protocol.Runtime.evaluate({ expression: "scheduleUncaughtException()" }) |
| 57 .then(() => Protocol.Runtime.onceExceptionThrown()) |
| 58 .then(() => Protocol.Runtime.evaluate({ expression: "throwCaughtException(
)" })) |
| 59 .then(() => Protocol.Debugger.disable()) |
| 60 .then(next); |
| 61 }, |
| 62 |
| 63 function noBreakInEvaluateInSilentMode(next) |
| 64 { |
| 65 Protocol.Debugger.enable(); |
| 66 Protocol.Debugger.setPauseOnExceptions({ state: "all" }) |
| 67 .then(() => Protocol.Runtime.evaluate({ expression: "throwCaughtException(
)", silent: true })) |
| 68 .then(() => Protocol.Debugger.disable()) |
| 69 .then(next); |
| 70 } |
| 71 ]); |
OLD | NEW |