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() {