From 91fb85947dffa02eabd40db95907c992aae7dc23 Mon Sep 17 00:00:00 2001 From: minggo Date: Tue, 6 Sep 2016 17:53:42 +0800 Subject: [PATCH] WebContents::InspectElement and WebContents::InspenctServiceWorker return immediately if DevTools is disabled --- atom/browser/api/atom_api_web_contents.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/atom/browser/api/atom_api_web_contents.cc b/atom/browser/api/atom_api_web_contents.cc index 77da81fdab..508ccf9c31 100644 --- a/atom/browser/api/atom_api_web_contents.cc +++ b/atom/browser/api/atom_api_web_contents.cc @@ -1012,6 +1012,9 @@ void WebContents::InspectElement(int x, int y) { if (type_ == REMOTE) return; + if (disable_devtools_) + return; + if (!managed_web_contents()->GetDevToolsWebContents()) OpenDevTools(nullptr); scoped_refptr agent( @@ -1023,6 +1026,9 @@ void WebContents::InspectServiceWorker() { if (type_ == REMOTE) return; + if (disable_devtools_) + return; + for (const auto& agent_host : content::DevToolsAgentHost::GetOrCreateAll()) { if (agent_host->GetType() == content::DevToolsAgentHost::TYPE_SERVICE_WORKER) {