diff options
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/glue/devtools/debugger_agent_manager.cc | 21 | ||||
-rw-r--r-- | webkit/glue/devtools/js/debugger_agent.js | 2 |
2 files changed, 20 insertions, 3 deletions
diff --git a/webkit/glue/devtools/debugger_agent_manager.cc b/webkit/glue/devtools/debugger_agent_manager.cc index d2f41d3..791831c 100644 --- a/webkit/glue/devtools/debugger_agent_manager.cc +++ b/webkit/glue/devtools/debugger_agent_manager.cc @@ -120,18 +120,33 @@ void DebuggerAgentManager::DebugDetach(DebuggerAgentImpl* debugger_agent) { } int host_id = debugger_agent->webdevtools_agent()->host_id(); DCHECK(attached_agents_map_->get(host_id) == debugger_agent); + bool is_on_breakpoint = (FindAgentForCurrentV8Context() == debugger_agent); attached_agents_map_->remove(host_id); if (attached_agents_map_->isEmpty()) { delete attached_agents_map_; attached_agents_map_ = NULL; // Note that we do not empty handlers while in dispatch - we schedule - // continue and do removal once we are out of the dispatch. + // continue and do removal once we are out of the dispatch. Also there is + // no need to send continue command in this case since removing message + // handler will cause debugger unload and all breakpoints will be cleared. if (!in_host_dispatch_handler_) { v8::Debug::SetMessageHandler2(NULL); v8::Debug::SetHostDispatchHandler(NULL); - } else if (FindAgentForCurrentV8Context() == debugger_agent) { - // Force continue just in case to handle close while on a breakpoint. + } + } else { + // Remove all breakpoints set by the agent. + std::wstring clear_breakpoint_group_cmd(StringPrintf( + L"{\"seq\":1,\"type\":\"request\",\"command\":\"clearbreakpointgroup\"," + L"\"arguments\":{\"groupId\":%d}}", + host_id)); + SendCommandToV8(WideToUTF16(clear_breakpoint_group_cmd), + new CallerIdWrapper()); + + if (is_on_breakpoint) { + // Force continue if detach happened in nessted message loop while + // debugger was paused on a breakpoint(as long as there are other + // attached agents v8 will wait for explicit'continue' message). SendContinueCommandToV8(); } } diff --git a/webkit/glue/devtools/js/debugger_agent.js b/webkit/glue/devtools/js/debugger_agent.js index 251577c..bab5b4c 100644 --- a/webkit/glue/devtools/js/debugger_agent.js +++ b/webkit/glue/devtools/js/debugger_agent.js @@ -223,6 +223,7 @@ devtools.DebuggerAgent.prototype.addBreakpoint = function(sourceId, line) { breakpoints[line] = breakpointInfo; commandArguments = { + 'groupId': this.contextId_, 'type': 'script', 'target': script.getUrl(), 'line': line @@ -237,6 +238,7 @@ devtools.DebuggerAgent.prototype.addBreakpoint = function(sourceId, line) { script.addBreakpointInfo(breakpointInfo); commandArguments = { + 'groupId': this.contextId_, 'type': 'scriptId', 'target': sourceId, 'line': line |