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