From 5f0720e096823616b7e271c168cf82e2a22c85a2 Mon Sep 17 00:00:00 2001 From: Marshall Greenblatt Date: Fri, 31 Jul 2015 16:54:54 -0400 Subject: [PATCH] Fix loading of the DevTools window. - The devtools.html file has been renamed to inspector.html. --- libcef/browser/devtools_delegate.cc | 2 +- libcef/browser/devtools_frontend.cc | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/libcef/browser/devtools_delegate.cc b/libcef/browser/devtools_delegate.cc index 9a6ba0524..cd96a0a54 100644 --- a/libcef/browser/devtools_delegate.cc +++ b/libcef/browser/devtools_delegate.cc @@ -112,7 +112,7 @@ std::string CefDevToolsDelegate::GetFrontendResource( } std::string CefDevToolsDelegate::GetChromeDevToolsURL() { - return base::StringPrintf("%s://%s/devtools.html", + return base::StringPrintf("%s://%s/inspector.html", content::kChromeDevToolsScheme, scheme::kChromeDevToolsHost); } diff --git a/libcef/browser/devtools_frontend.cc b/libcef/browser/devtools_frontend.cc index 7b87bdd92..f0c0c2d6f 100644 --- a/libcef/browser/devtools_frontend.cc +++ b/libcef/browser/devtools_frontend.cc @@ -186,9 +186,15 @@ void CefDevToolsFrontend::RenderViewCreated( } void CefDevToolsFrontend::DocumentAvailableInMainFrame() { - agent_host_ = + // Don't call AttachClient multiple times for the same DevToolsAgentHost. + // Otherwise it will call AgentHostClosed which closes the DevTools window. + // This may happen in cases where the DevTools content fails to load. + scoped_refptr agent_host = content::DevToolsAgentHost::GetOrCreateFor(inspected_contents_); - agent_host_->AttachClient(this); + if (agent_host != agent_host_) { + agent_host_ = agent_host; + agent_host_->AttachClient(this); + } } void CefDevToolsFrontend::WebContentsDestroyed() {