Index: webkit/glue/devtools/debugger_agent_manager.cc |
=================================================================== |
--- webkit/glue/devtools/debugger_agent_manager.cc (revision 21519) |
+++ webkit/glue/devtools/debugger_agent_manager.cc (working copy) |
@@ -29,6 +29,12 @@ |
// static |
DebuggerAgentManager::DeferrersMap DebuggerAgentManager::page_deferrers_; |
+// static |
+bool DebuggerAgentManager::in_utility_context_ = false; |
+ |
+// static |
+bool DebuggerAgentManager::debug_break_delayed_ = false; |
+ |
namespace { |
class CallerIdWrapper : public v8::Debug::ClientData { |
@@ -157,7 +163,11 @@ |
#if USE(V8) |
DCHECK(DebuggerAgentForHostId(debugger_agent->webdevtools_agent()->host_id()) |
== debugger_agent); |
- v8::Debug::DebugBreak(); |
+ if (in_utility_context_) { |
+ debug_break_delayed_ = true; |
+ } else { |
+ v8::Debug::DebugBreak(); |
+ } |
#endif |
} |
@@ -201,15 +211,25 @@ |
return; |
} |
- // If the context is from one of the inpected tabs or injected extension |
- // scripts it must have host_id in the data field. |
- int host_id = WebCore::V8Proxy::contextDebugId(context); |
- if (host_id != -1) { |
- DebuggerAgentImpl* agent = DebuggerAgentForHostId(host_id); |
- if (agent) { |
- agent->DebuggerOutput(out); |
- return; |
+ if (in_utility_context_) { |
+ if (message.GetEvent() == v8::Break) { |
+ // This may happen when two tabs are being debugged in the same process. |
+ // Suppose that first debugger is pauesed on an exception. It will run |
+ // nested MessageLoop which may process Break request from the second |
+ // debugger. |
+ debug_break_delayed_ = true; |
} |
+ } else { |
+ // If the context is from one of the inpected tabs or injected extension |
+ // scripts it must have host_id in the data field. |
+ int host_id = WebCore::V8Proxy::contextDebugId(context); |
+ if (host_id != -1) { |
+ DebuggerAgentImpl* agent = DebuggerAgentForHostId(host_id); |
+ if (agent) { |
+ agent->DebuggerOutput(out); |
+ return; |
+ } |
+ } |
} |
if (!message.WillStartRunning()) { |