Index: chrome/browser/devtools/devtools_ui_bindings.cc |
diff --git a/chrome/browser/devtools/devtools_ui_bindings.cc b/chrome/browser/devtools/devtools_ui_bindings.cc |
index acd7397bd037ed93d328383b7d014fea6ab04cda..f7ac4f9613a6904822ca0bcbf68d8c29c8fa778b 100644 |
--- a/chrome/browser/devtools/devtools_ui_bindings.cc |
+++ b/chrome/browser/devtools/devtools_ui_bindings.cc |
@@ -484,6 +484,7 @@ DevToolsUIBindings::DevToolsUIBindings(content::WebContents* web_contents) |
delegate_(new DefaultBindingsDelegate(web_contents_)), |
devices_updates_enabled_(false), |
frontend_loaded_(false), |
+ frontend_reattaching_(false), |
weak_factory_(this) { |
g_instances.Get().push_back(this); |
frontend_contents_observer_.reset(new FrontendWebContentsObserver(this)); |
@@ -893,7 +894,7 @@ void DevToolsUIBindings::ClearPreferences() { |
void DevToolsUIBindings::DispatchProtocolMessageFromDevToolsFrontend( |
const std::string& message) { |
- if (agent_host_.get()) |
+ if (agent_host_.get() && !frontend_reattaching_) |
pfeldman
2015/12/07 21:38:42
When does this happen and why should it be ignored
dgozman
2015/12/07 21:46:40
Happens in Reattach. First paragraph of the patch
pfeldman
2015/12/07 21:48:36
But how can it be dispatched twice?
dgozman
2015/12/07 22:03:53
Sorry, it wasn't clear. It's not the same message
|
agent_host_->DispatchProtocolMessage(message); |
} |
@@ -1126,6 +1127,7 @@ void DevToolsUIBindings::AttachTo( |
} |
void DevToolsUIBindings::Reattach() { |
+ frontend_reattaching_ = true; |
DCHECK(agent_host_.get()); |
agent_host_->DetachClient(); |
agent_host_->AttachClient(this); |
@@ -1175,6 +1177,7 @@ void DevToolsUIBindings::CallClientFunction(const std::string& function_name, |
} |
void DevToolsUIBindings::DocumentOnLoadCompletedInMainFrame() { |
+ frontend_reattaching_ = false; |
// In the DEBUG_DEVTOOLS mode, the DocumentOnLoadCompletedInMainFrame event |
// arrives before the LoadCompleted event, thus it should not trigger the |
// frontend load handling. |