Commit 5852180e authored by dgozman's avatar dgozman Committed by Commit Bot

[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}
parent 468fc742
...@@ -1035,9 +1035,7 @@ V8DebuggerAgentImpl::currentAsyncStackTrace() { ...@@ -1035,9 +1035,7 @@ V8DebuggerAgentImpl::currentAsyncStackTrace() {
} }
bool V8DebuggerAgentImpl::isPaused() const { bool V8DebuggerAgentImpl::isPaused() const {
// TODO(dgozman): this check allows once context group to resume the other, return m_debugger->isPausedInContextGroup(m_session->contextGroupId());
// since they share debugger.
return m_debugger->isPaused();
} }
void V8DebuggerAgentImpl::didParseSource( void V8DebuggerAgentImpl::didParseSource(
......
...@@ -198,6 +198,10 @@ void V8Debugger::disable() { ...@@ -198,6 +198,10 @@ void V8Debugger::disable() {
m_isolate->RestoreOriginalHeapLimit(); m_isolate->RestoreOriginalHeapLimit();
} }
bool V8Debugger::isPausedInContextGroup(int contextGroupId) const {
return isPaused() && m_pausedContextGroupId == contextGroupId;
}
bool V8Debugger::enabled() const { return !m_debuggerScript.IsEmpty(); } bool V8Debugger::enabled() const { return !m_debuggerScript.IsEmpty(); }
void V8Debugger::getCompiledScripts( void V8Debugger::getCompiledScripts(
......
...@@ -83,6 +83,7 @@ class V8Debugger : public v8::debug::DebugDelegate { ...@@ -83,6 +83,7 @@ class V8Debugger : public v8::debug::DebugDelegate {
void disable(); void disable();
bool isPaused() const { return m_pausedContextGroupId; } bool isPaused() const { return m_pausedContextGroupId; }
bool isPausedInContextGroup(int contextGroupId) const;
v8::Local<v8::Context> pausedContext() { return m_pausedContext; } v8::Local<v8::Context> pausedContext() { return m_pausedContext; }
int maxAsyncCallChainDepth() { return m_maxAsyncCallStackDepth; } int maxAsyncCallChainDepth() { return m_maxAsyncCallStackDepth; }
......
...@@ -34,6 +34,39 @@ paused at: ...@@ -34,6 +34,39 @@ paused at:
#var a = 42; #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 Running test: testDisableBreaksShouldCancelPause
paused at: paused at:
#debugger #debugger
......
...@@ -82,6 +82,23 @@ InspectorTest.runAsyncTestSuite([ ...@@ -82,6 +82,23 @@ InspectorTest.runAsyncTestSuite([
await Protocol1.Debugger.resume(); 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() { async function testDisableBreaksShouldCancelPause() {
await Protocol1.Debugger.pause(); await Protocol1.Debugger.pause();
await Protocol1.Debugger.setBreakpointsActive({active: false}); await Protocol1.Debugger.setBreakpointsActive({active: false});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment