Commit 67bb22e3 authored by Alexey Kozyatinskiy's avatar Alexey Kozyatinskiy Committed by Commit Bot

[inspector] do not resume on agent disable if there is other agents

If there is more then one agent accepts current pause, we should resume
only when last agent is disabled.

R=dgozman@chromium.org

Bug: chromium:834056
Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel
Change-Id: I2904b3f4ab76117511e16450dd575ebf3e20a068
Reviewed-on: https://chromium-review.googlesource.com/1041207Reviewed-by: 's avatarDmitry Gozman <dgozman@chromium.org>
Commit-Queue: Aleksey Kozyatinskiy <kozyatinskiy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#52931}
parent cfc79faa
......@@ -418,12 +418,10 @@ Response V8DebuggerAgentImpl::disable() {
v8::debug::NoBreakOnException);
m_state->setInteger(DebuggerAgentState::asyncCallStackDepth, 0);
if (isPaused()) m_debugger->continueProgram(m_session->contextGroupId());
if (m_breakpointsActive) {
m_debugger->setBreakpointsActive(false);
m_breakpointsActive = false;
}
m_debugger->disable();
m_blackboxedPositions.clear();
m_blackboxPattern.reset();
resetBlackboxedStateCache();
......@@ -440,6 +438,7 @@ Response V8DebuggerAgentImpl::disable() {
m_state->remove(DebuggerAgentState::blackboxPattern);
m_enabled = false;
m_state->setBoolean(DebuggerAgentState::debuggerEnabled, false);
m_debugger->disable();
return Response::OK();
}
......
......@@ -184,6 +184,18 @@ void V8Debugger::enable() {
}
void V8Debugger::disable() {
if (isPaused()) {
bool scheduledOOMBreak = m_scheduledOOMBreak;
bool hasAgentAcceptsPause = false;
m_inspector->forEachSession(
m_pausedContextGroupId, [&scheduledOOMBreak, &hasAgentAcceptsPause](
V8InspectorSessionImpl* session) {
if (session->debuggerAgent()->acceptsPause(scheduledOOMBreak)) {
hasAgentAcceptsPause = true;
}
});
if (!hasAgentAcceptsPause) m_inspector->client()->quitMessageLoopOnPause();
}
if (--m_enableCount) return;
clearContinueToLocation();
allAsyncTasksCanceled();
......
......@@ -52,6 +52,7 @@ InspectorTest.runAsyncTestSuite([
InspectorTest.log(
'> Debugger.enable in another context group returns own debugger id');
}
await Protocol2.Debugger.disable();
},
async function testInstrumentation() {
......
......@@ -226,3 +226,6 @@ Paused in 2:
hit breakpoints:
location: <anonymous>@1
data: null
Activating debugger agent in 1
Disabling debugger agent in 2
Disabling debugger agent in 1
......@@ -182,6 +182,15 @@ function bar() {
session2.Protocol.Runtime.evaluate({expression: 'baz();\ndebugger;'});
await waitForPaused(session2, 2);
session1.Protocol.Debugger.onResumed(() => InspectorTest.log('session1 is resumed'));
session2.Protocol.Debugger.onResumed(() => InspectorTest.log('session2 is resumed'));
InspectorTest.log('Activating debugger agent in 1');
await session1.Protocol.Debugger.enable();
InspectorTest.log('Disabling debugger agent in 2');
await session2.Protocol.Debugger.disable();
InspectorTest.log('Disabling debugger agent in 1');
await session1.Protocol.Debugger.disable();
InspectorTest.completeTest();
function waitForBothPaused() {
......
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