Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(839)

Unified Diff: chrome/browser/devtools/devtools_ui_bindings.cc

Issue 1504763004: [DevTools] Fix frontend host race and assert. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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.

Powered by Google App Engine
This is Rietveld 408576698