[inspector] V8DebuggerAgent should not resume break in different group
- introduced pausedContextGroupId, - added targetContextGroupId param for V8Debugger::continueProgram method. BUG=chromium:714955 R=dgozman@chromium.org Review-Url: https://codereview.chromium.org/2842733002 Cr-Commit-Position: refs/heads/master@{#44871}
This commit is contained in:
parent
6d9ca97cd2
commit
f661fe84f4
@ -237,7 +237,7 @@ Response V8DebuggerAgentImpl::disable() {
|
||||
v8::debug::NoBreakOnException);
|
||||
m_state->setInteger(DebuggerAgentState::asyncCallStackDepth, 0);
|
||||
|
||||
if (isPaused()) m_debugger->continueProgram();
|
||||
if (isPaused()) m_debugger->continueProgram(m_session->contextGroupId());
|
||||
m_debugger->disable();
|
||||
JavaScriptCallFrames emptyCallFrames;
|
||||
m_pausedCallFrames.swap(emptyCallFrames);
|
||||
@ -715,7 +715,7 @@ Response V8DebuggerAgentImpl::pause() {
|
||||
Response V8DebuggerAgentImpl::resume() {
|
||||
if (!isPaused()) return Response::Error(kDebuggerNotPaused);
|
||||
m_session->releaseObjectGroup(kBacktraceObjectGroup);
|
||||
m_debugger->continueProgram();
|
||||
m_debugger->continueProgram(m_session->contextGroupId());
|
||||
return Response::OK();
|
||||
}
|
||||
|
||||
|
@ -172,7 +172,6 @@ V8Debugger::V8Debugger(v8::Isolate* isolate, V8InspectorImpl* inspector)
|
||||
m_inspector(inspector),
|
||||
m_enableCount(0),
|
||||
m_breakpointsActivated(true),
|
||||
m_runningNestedMessageLoop(false),
|
||||
m_ignoreScriptParsedEventsCounter(0),
|
||||
m_maxAsyncCallStacks(kMaxAsyncTaskStacks),
|
||||
m_maxAsyncCallStackDepth(0),
|
||||
@ -362,7 +361,8 @@ void V8Debugger::breakProgram() {
|
||||
v8::debug::BreakRightNow(m_isolate);
|
||||
}
|
||||
|
||||
void V8Debugger::continueProgram() {
|
||||
void V8Debugger::continueProgram(int targetContextGroupId) {
|
||||
if (m_pausedContextGroupId != targetContextGroupId) return;
|
||||
if (isPaused()) m_inspector->client()->quitMessageLoopOnPause();
|
||||
m_pausedContext.Clear();
|
||||
m_executionState.Clear();
|
||||
@ -374,7 +374,7 @@ void V8Debugger::stepIntoStatement(int targetContextGroupId) {
|
||||
DCHECK(targetContextGroupId);
|
||||
m_targetContextGroupId = targetContextGroupId;
|
||||
v8::debug::PrepareStep(m_isolate, v8::debug::StepIn);
|
||||
continueProgram();
|
||||
continueProgram(targetContextGroupId);
|
||||
}
|
||||
|
||||
void V8Debugger::stepOverStatement(int targetContextGroupId) {
|
||||
@ -383,7 +383,7 @@ void V8Debugger::stepOverStatement(int targetContextGroupId) {
|
||||
DCHECK(targetContextGroupId);
|
||||
m_targetContextGroupId = targetContextGroupId;
|
||||
v8::debug::PrepareStep(m_isolate, v8::debug::StepNext);
|
||||
continueProgram();
|
||||
continueProgram(targetContextGroupId);
|
||||
}
|
||||
|
||||
void V8Debugger::stepOutOfFunction(int targetContextGroupId) {
|
||||
@ -392,7 +392,7 @@ void V8Debugger::stepOutOfFunction(int targetContextGroupId) {
|
||||
DCHECK(targetContextGroupId);
|
||||
m_targetContextGroupId = targetContextGroupId;
|
||||
v8::debug::PrepareStep(m_isolate, v8::debug::StepOut);
|
||||
continueProgram();
|
||||
continueProgram(targetContextGroupId);
|
||||
}
|
||||
|
||||
void V8Debugger::scheduleStepIntoAsync(
|
||||
@ -568,7 +568,7 @@ void V8Debugger::handleProgramBreak(v8::Local<v8::Context> pausedContext,
|
||||
|
||||
m_pausedContext = pausedContext;
|
||||
m_executionState = executionState;
|
||||
m_runningNestedMessageLoop = true;
|
||||
m_pausedContextGroupId = contextGroupId;
|
||||
agent->didPause(InspectedContext::contextId(pausedContext), exception,
|
||||
breakpointIds, isPromiseRejection, isUncaught,
|
||||
m_scheduledOOMBreak);
|
||||
@ -580,7 +580,7 @@ void V8Debugger::handleProgramBreak(v8::Local<v8::Context> pausedContext,
|
||||
CHECK(!context.IsEmpty() &&
|
||||
context != v8::debug::GetDebugContext(m_isolate));
|
||||
m_inspector->client()->runMessageLoopOnPause(groupId);
|
||||
m_runningNestedMessageLoop = false;
|
||||
m_pausedContextGroupId = 0;
|
||||
}
|
||||
// The agent may have been removed in the nested loop.
|
||||
agent = m_inspector->enabledDebuggerAgentForGroup(groupId);
|
||||
|
@ -51,7 +51,7 @@ class V8Debugger : public v8::debug::DebugDelegate {
|
||||
void setPauseOnExceptionsState(v8::debug::ExceptionBreakState);
|
||||
bool canBreakProgram();
|
||||
void breakProgram();
|
||||
void continueProgram();
|
||||
void continueProgram(int targetContextGroupId);
|
||||
|
||||
void setPauseOnNextStatement(bool, int targetContextGroupId);
|
||||
void stepIntoStatement(int targetContextGroupId);
|
||||
@ -77,7 +77,7 @@ class V8Debugger : public v8::debug::DebugDelegate {
|
||||
void enable();
|
||||
void disable();
|
||||
|
||||
bool isPaused() const { return m_runningNestedMessageLoop; }
|
||||
bool isPaused() const { return m_pausedContextGroupId; }
|
||||
v8::Local<v8::Context> pausedContext() { return m_pausedContext; }
|
||||
|
||||
int maxAsyncCallChainDepth() { return m_maxAsyncCallStackDepth; }
|
||||
@ -180,10 +180,10 @@ class V8Debugger : public v8::debug::DebugDelegate {
|
||||
v8::Global<v8::Context> m_debuggerContext;
|
||||
v8::Local<v8::Object> m_executionState;
|
||||
v8::Local<v8::Context> m_pausedContext;
|
||||
bool m_runningNestedMessageLoop;
|
||||
int m_ignoreScriptParsedEventsCounter;
|
||||
bool m_scheduledOOMBreak = false;
|
||||
int m_targetContextGroupId = 0;
|
||||
int m_pausedContextGroupId = 0;
|
||||
|
||||
using AsyncTaskToStackTrace =
|
||||
protocol::HashMap<void*, std::weak_ptr<AsyncStackTrace>>;
|
||||
|
@ -19,6 +19,9 @@ Running test: testSkipOtherContext2
|
||||
paused at:
|
||||
#var a = 239;
|
||||
|
||||
paused at:
|
||||
var a = #239;
|
||||
|
||||
|
||||
Running test: testWithNativeBreakpoint
|
||||
paused at:
|
||||
|
@ -43,7 +43,11 @@ InspectorTest.runAsyncTestSuite([
|
||||
Protocol.Runtime.evaluate({expression: 'var a = 239;'}, contextGroupId);
|
||||
Protocol.Runtime.evaluate({expression: 'var a = 1;'});
|
||||
await waitPauseAndDumpLocation();
|
||||
await Protocol.Debugger.resume();
|
||||
// should not resume pause from different context group id.
|
||||
Protocol.Debugger.resume();
|
||||
Protocol.Debugger.stepOver({}, contextGroupId);
|
||||
await waitPauseAndDumpLocation();
|
||||
await Protocol.Debugger.resume({}, contextGroupId);
|
||||
await Protocol.Debugger.disable({}, contextGroupId);
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user