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('Checks nested scheduled break in framework code.'); | 5 let {session, contextGroup, Protocol} = InspectorTest.start('Checks nested sched
uled break in framework code.'); |
6 | 6 |
7 InspectorTest.addScript(` | 7 contextGroup.addScript(` |
8 function frameworkCall(callback) { | 8 function frameworkCall(callback) { |
9 inspector.callWithScheduledBreak(doFrameworkWork.bind(null, callback), | 9 inspector.callWithScheduledBreak(doFrameworkWork.bind(null, callback), |
10 'top-framework-scheduled-break', | 10 'top-framework-scheduled-break', |
11 JSON.stringify({ data: 'data for top-framework-scheduled-break' })); | 11 JSON.stringify({ data: 'data for top-framework-scheduled-break' })); |
12 } | 12 } |
13 | 13 |
14 function doFrameworkWork(callback) { | 14 function doFrameworkWork(callback) { |
15 inspector.callWithScheduledBreak(doFrameworkBreak, 'should-not-be-a-reason', '
'); | 15 inspector.callWithScheduledBreak(doFrameworkBreak, 'should-not-be-a-reason', '
'); |
16 callback(); | 16 callback(); |
17 } | 17 } |
18 | 18 |
19 function doFrameworkBreak() { | 19 function doFrameworkBreak() { |
20 inspector.breakProgram('framework-break', JSON.stringify({ data: 'data for fra
mework-break' })); | 20 inspector.breakProgram('framework-break', JSON.stringify({ data: 'data for fra
mework-break' })); |
21 } | 21 } |
22 | 22 |
23 //# sourceURL=framework.js`, 7, 26); | 23 //# sourceURL=framework.js`, 7, 26); |
24 | 24 |
25 InspectorTest.addScript(` | 25 contextGroup.addScript(` |
26 function testFunction() { | 26 function testFunction() { |
27 inspector.callWithScheduledBreak(frameworkCall.bind(null, callback), | 27 inspector.callWithScheduledBreak(frameworkCall.bind(null, callback), |
28 'top-scheduled-break', ''); | 28 'top-scheduled-break', ''); |
29 } | 29 } |
30 | 30 |
31 function callback() { | 31 function callback() { |
32 inspector.breakProgram('user-break', JSON.stringify({ data: 'data for user-bre
ak' })); | 32 inspector.breakProgram('user-break', JSON.stringify({ data: 'data for user-bre
ak' })); |
33 return 42; | 33 return 42; |
34 } | 34 } |
35 | 35 |
36 //# sourceURL=user.js`, 25, 26); | 36 //# sourceURL=user.js`, 25, 26); |
37 | 37 |
38 InspectorTest.setupScriptMap(); | 38 session.setupScriptMap(); |
39 Protocol.Debugger.onPaused(message => { | 39 Protocol.Debugger.onPaused(message => { |
40 InspectorTest.log('break reason: ' + message.params.reason); | 40 InspectorTest.log('break reason: ' + message.params.reason); |
41 InspectorTest.log('break aux data: ' + JSON.stringify(message.params.data || {
}, null, ' ')); | 41 InspectorTest.log('break aux data: ' + JSON.stringify(message.params.data || {
}, null, ' ')); |
42 InspectorTest.logCallFrames(message.params.callFrames); | 42 session.logCallFrames(message.params.callFrames); |
43 InspectorTest.log(''); | 43 InspectorTest.log(''); |
44 Protocol.Debugger.resume(); | 44 Protocol.Debugger.resume(); |
45 }); | 45 }); |
46 Protocol.Debugger.enable() | 46 Protocol.Debugger.enable() |
47 .then(() => Protocol.Debugger.setBlackboxPatterns({patterns: ['framework\.js']
})) | 47 .then(() => Protocol.Debugger.setBlackboxPatterns({patterns: ['framework\.js']
})) |
48 .then(() => Protocol.Runtime.evaluate({ expression: 'testFunction()//# sourceU
RL=expr.js'})) | 48 .then(() => Protocol.Runtime.evaluate({ expression: 'testFunction()//# sourceU
RL=expr.js'})) |
49 .then(InspectorTest.completeTest); | 49 .then(InspectorTest.completeTest); |
OLD | NEW |