2017-02-08 01:42:54 +00:00
|
|
|
// Copyright 2017 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.
|
|
|
|
|
2017-05-19 00:35:45 +00:00
|
|
|
let {session, contextGroup, Protocol} = InspectorTest.start('Checks nested scheduled break in framework code.');
|
2017-02-08 01:42:54 +00:00
|
|
|
|
2017-05-19 00:35:45 +00:00
|
|
|
contextGroup.addScript(`
|
2017-02-08 01:42:54 +00:00
|
|
|
function frameworkCall(callback) {
|
2017-04-21 23:41:07 +00:00
|
|
|
inspector.callWithScheduledBreak(doFrameworkWork.bind(null, callback),
|
2017-02-08 01:42:54 +00:00
|
|
|
'top-framework-scheduled-break',
|
|
|
|
JSON.stringify({ data: 'data for top-framework-scheduled-break' }));
|
|
|
|
}
|
|
|
|
|
|
|
|
function doFrameworkWork(callback) {
|
2017-04-21 23:41:07 +00:00
|
|
|
inspector.callWithScheduledBreak(doFrameworkBreak, 'should-not-be-a-reason', '');
|
2017-02-08 01:42:54 +00:00
|
|
|
callback();
|
|
|
|
}
|
|
|
|
|
|
|
|
function doFrameworkBreak() {
|
2017-04-21 23:41:07 +00:00
|
|
|
inspector.breakProgram('framework-break', JSON.stringify({ data: 'data for framework-break' }));
|
2017-02-08 01:42:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//# sourceURL=framework.js`, 7, 26);
|
|
|
|
|
2017-05-19 00:35:45 +00:00
|
|
|
contextGroup.addScript(`
|
2017-02-08 01:42:54 +00:00
|
|
|
function testFunction() {
|
2017-04-21 23:41:07 +00:00
|
|
|
inspector.callWithScheduledBreak(frameworkCall.bind(null, callback),
|
2017-02-08 01:42:54 +00:00
|
|
|
'top-scheduled-break', '');
|
|
|
|
}
|
|
|
|
|
|
|
|
function callback() {
|
2017-04-21 23:41:07 +00:00
|
|
|
inspector.breakProgram('user-break', JSON.stringify({ data: 'data for user-break' }));
|
2017-02-08 01:42:54 +00:00
|
|
|
return 42;
|
|
|
|
}
|
|
|
|
|
|
|
|
//# sourceURL=user.js`, 25, 26);
|
|
|
|
|
2017-05-19 00:35:45 +00:00
|
|
|
session.setupScriptMap();
|
2017-02-08 01:42:54 +00:00
|
|
|
Protocol.Debugger.onPaused(message => {
|
|
|
|
InspectorTest.log('break reason: ' + message.params.reason);
|
|
|
|
InspectorTest.log('break aux data: ' + JSON.stringify(message.params.data || {}, null, ' '));
|
2017-05-19 00:35:45 +00:00
|
|
|
session.logCallFrames(message.params.callFrames);
|
2017-02-08 01:42:54 +00:00
|
|
|
InspectorTest.log('');
|
|
|
|
Protocol.Debugger.resume();
|
|
|
|
});
|
|
|
|
Protocol.Debugger.enable()
|
|
|
|
.then(() => Protocol.Debugger.setBlackboxPatterns({patterns: ['framework\.js']}))
|
|
|
|
.then(() => Protocol.Runtime.evaluate({ expression: 'testFunction()//# sourceURL=expr.js'}))
|
|
|
|
.then(InspectorTest.completeTest);
|