[inspector] Return error when paused in different context group

... when trying to resume or step.

BUG=none

Review-Url: https://codereview.chromium.org/2923243002
Cr-Commit-Position: refs/heads/master@{#45747}
This commit is contained in:
dgozman 2017-06-06 11:45:52 -07:00 committed by Commit Bot
parent 468fc74230
commit 5852180eb8
5 changed files with 56 additions and 3 deletions

View File

@ -1035,9 +1035,7 @@ V8DebuggerAgentImpl::currentAsyncStackTrace() {
}
bool V8DebuggerAgentImpl::isPaused() const {
// TODO(dgozman): this check allows once context group to resume the other,
// since they share debugger.
return m_debugger->isPaused();
return m_debugger->isPausedInContextGroup(m_session->contextGroupId());
}
void V8DebuggerAgentImpl::didParseSource(

View File

@ -198,6 +198,10 @@ void V8Debugger::disable() {
m_isolate->RestoreOriginalHeapLimit();
}
bool V8Debugger::isPausedInContextGroup(int contextGroupId) const {
return isPaused() && m_pausedContextGroupId == contextGroupId;
}
bool V8Debugger::enabled() const { return !m_debuggerScript.IsEmpty(); }
void V8Debugger::getCompiledScripts(

View File

@ -83,6 +83,7 @@ class V8Debugger : public v8::debug::DebugDelegate {
void disable();
bool isPaused() const { return m_pausedContextGroupId; }
bool isPausedInContextGroup(int contextGroupId) const;
v8::Local<v8::Context> pausedContext() { return m_pausedContext; }
int maxAsyncCallChainDepth() { return m_maxAsyncCallStackDepth; }

View File

@ -34,6 +34,39 @@ paused at:
#var a = 42;
Running test: testResumeAnotherGroup
paused at:
#var a = 42;
{
error : {
code : -32000
message : Can only perform operation while paused.
}
id : <messageId>
}
{
error : {
code : -32000
message : Can only perform operation while paused.
}
id : <messageId>
}
{
error : {
code : -32000
message : Can only perform operation while paused.
}
id : <messageId>
}
{
error : {
code : -32000
message : Can only perform operation while paused.
}
id : <messageId>
}
Running test: testDisableBreaksShouldCancelPause
paused at:
#debugger

View File

@ -82,6 +82,23 @@ InspectorTest.runAsyncTestSuite([
await Protocol1.Debugger.resume();
},
async function testResumeAnotherGroup() {
let contextGroup2 = new InspectorTest.ContextGroup();
let session2 = contextGroup2.connect();
session2.setupScriptMap();
let Protocol2 = session2.Protocol;
Protocol2.Debugger.enable();
Protocol1.Debugger.pause();
Protocol1.Runtime.evaluate({expression: 'var a = 42;'});
await waitPauseAndDumpLocation(session1);
InspectorTest.logMessage(await Protocol2.Debugger.resume());
InspectorTest.logMessage(await Protocol2.Debugger.stepOver());
InspectorTest.logMessage(await Protocol2.Debugger.stepInto());
InspectorTest.logMessage(await Protocol2.Debugger.stepOut());
await Protocol1.Debugger.resume();
await Protocol2.Debugger.disable();
},
async function testDisableBreaksShouldCancelPause() {
await Protocol1.Debugger.pause();
await Protocol1.Debugger.setBreakpointsActive({active: false});