2017-03-24 02:44:25 +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.
|
|
|
|
|
|
|
|
InspectorTest.log('Checks Debugger.pause');
|
|
|
|
|
|
|
|
InspectorTest.setupScriptMap();
|
|
|
|
Protocol.Debugger.enable();
|
|
|
|
InspectorTest.runAsyncTestSuite([
|
|
|
|
async function testPause() {
|
|
|
|
Protocol.Debugger.pause();
|
|
|
|
Protocol.Runtime.evaluate({expression: 'var a = 42;'});
|
|
|
|
await waitPauseAndDumpLocation();
|
|
|
|
await Protocol.Debugger.resume();
|
|
|
|
},
|
|
|
|
|
|
|
|
async function testSkipFrameworks() {
|
|
|
|
Protocol.Debugger.setBlackboxPatterns({patterns: ['framework\.js']});
|
|
|
|
Protocol.Debugger.pause();
|
|
|
|
Protocol.Runtime.evaluate({expression: 'var a = 42; //# sourceURL=framework.js'});
|
|
|
|
Protocol.Runtime.evaluate({expression: 'var a = 239;'});
|
|
|
|
await waitPauseAndDumpLocation();
|
|
|
|
await Protocol.Debugger.resume();
|
|
|
|
},
|
|
|
|
|
|
|
|
async function testSkipOtherContext1() {
|
2017-05-18 23:11:20 +00:00
|
|
|
let contextGroup = InspectorTest.createContextGroup();
|
|
|
|
let session = InspectorTest.createSession(contextGroup);
|
|
|
|
session.Protocol.Debugger.enable({});
|
2017-03-24 02:44:25 +00:00
|
|
|
Protocol.Debugger.pause();
|
|
|
|
Protocol.Runtime.evaluate({expression: 'var a = 42; //# sourceURL=framework.js'});
|
2017-05-18 23:11:20 +00:00
|
|
|
session.Protocol.Runtime.evaluate({expression: 'var a = 239;'});
|
2017-03-24 02:44:25 +00:00
|
|
|
Protocol.Runtime.evaluate({expression: 'var a = 1;'});
|
|
|
|
await waitPauseAndDumpLocation();
|
|
|
|
await Protocol.Debugger.resume();
|
2017-05-18 23:11:20 +00:00
|
|
|
await session.Protocol.Debugger.disable({});
|
2017-03-24 02:44:25 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
async function testSkipOtherContext2() {
|
2017-05-18 23:11:20 +00:00
|
|
|
let contextGroup = InspectorTest.createContextGroup();
|
|
|
|
let session = InspectorTest.createSession(contextGroup);
|
|
|
|
InspectorTest.setupScriptMap(session);
|
|
|
|
session.Protocol.Debugger.enable({});
|
|
|
|
session.Protocol.Debugger.pause({});
|
2017-03-24 02:44:25 +00:00
|
|
|
Protocol.Runtime.evaluate({expression: 'var a = 42; //# sourceURL=framework.js'});
|
2017-05-18 23:11:20 +00:00
|
|
|
session.Protocol.Runtime.evaluate({expression: 'var a = 239;'});
|
2017-03-24 02:44:25 +00:00
|
|
|
Protocol.Runtime.evaluate({expression: 'var a = 1;'});
|
2017-05-18 23:11:20 +00:00
|
|
|
await waitPauseAndDumpLocation(session);
|
2017-04-25 21:35:59 +00:00
|
|
|
// should not resume pause from different context group id.
|
|
|
|
Protocol.Debugger.resume();
|
2017-05-18 23:11:20 +00:00
|
|
|
session.Protocol.Debugger.stepOver({});
|
|
|
|
await waitPauseAndDumpLocation(session);
|
|
|
|
await session.Protocol.Debugger.resume({});
|
|
|
|
await session.Protocol.Debugger.disable({});
|
2017-03-24 02:44:25 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
async function testWithNativeBreakpoint() {
|
2017-05-18 23:11:20 +00:00
|
|
|
InspectorTest.contextGroup.schedulePauseOnNextStatement('', '');
|
2017-03-24 02:44:25 +00:00
|
|
|
await Protocol.Debugger.pause();
|
2017-05-18 23:11:20 +00:00
|
|
|
InspectorTest.contextGroup.cancelPauseOnNextStatement();
|
2017-03-24 02:44:25 +00:00
|
|
|
Protocol.Runtime.evaluate({expression: 'var a = 42;'});
|
|
|
|
await waitPauseAndDumpLocation();
|
|
|
|
await Protocol.Debugger.resume();
|
|
|
|
|
|
|
|
await Protocol.Debugger.pause();
|
2017-05-18 23:11:20 +00:00
|
|
|
InspectorTest.contextGroup.schedulePauseOnNextStatement('', '');
|
|
|
|
InspectorTest.contextGroup.cancelPauseOnNextStatement();
|
2017-03-24 02:44:25 +00:00
|
|
|
Protocol.Runtime.evaluate({expression: 'var a = 42;'});
|
|
|
|
await waitPauseAndDumpLocation();
|
|
|
|
await Protocol.Debugger.resume();
|
|
|
|
|
2017-05-18 23:11:20 +00:00
|
|
|
InspectorTest.contextGroup.schedulePauseOnNextStatement('', '');
|
|
|
|
InspectorTest.contextGroup.cancelPauseOnNextStatement();
|
2017-03-24 02:44:25 +00:00
|
|
|
await Protocol.Debugger.pause();
|
|
|
|
Protocol.Runtime.evaluate({expression: 'var a = 42;'});
|
|
|
|
await waitPauseAndDumpLocation();
|
|
|
|
await Protocol.Debugger.resume();
|
|
|
|
},
|
|
|
|
|
|
|
|
async function testDisableBreaksShouldCancelPause() {
|
|
|
|
await Protocol.Debugger.pause();
|
|
|
|
await Protocol.Debugger.setBreakpointsActive({active: false});
|
|
|
|
Protocol.Runtime.evaluate({expression: 'var a = 42;'})
|
|
|
|
.then(() => Protocol.Debugger.setBreakpointsActive({active: true}))
|
|
|
|
.then(() => Protocol.Runtime.evaluate({expression: 'debugger'}));
|
|
|
|
await waitPauseAndDumpLocation();
|
|
|
|
await Protocol.Debugger.resume();
|
|
|
|
}
|
|
|
|
]);
|
|
|
|
|
2017-05-18 23:11:20 +00:00
|
|
|
async function waitPauseAndDumpLocation(session) {
|
|
|
|
session = session || InspectorTest.session;
|
|
|
|
var message = await session.Protocol.Debugger.oncePaused();
|
2017-03-24 02:44:25 +00:00
|
|
|
InspectorTest.log('paused at:');
|
2017-05-18 23:11:20 +00:00
|
|
|
await InspectorTest.logSourceLocation(message.params.callFrames[0].location, session);
|
2017-03-24 02:44:25 +00:00
|
|
|
return message;
|
|
|
|
}
|