From ca9a54a41eb70390a9ac18b3c695c07a933e0cde Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 17 Sep 2015 15:00:14 +0800 Subject: [PATCH] Check whether devtools is opened when executing js code Fixes atom/electron#2808. --- brightray/browser/inspectable_web_contents_impl.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/brightray/browser/inspectable_web_contents_impl.cc b/brightray/browser/inspectable_web_contents_impl.cc index f6532e4ed0f0..82ba5970ed6e 100644 --- a/brightray/browser/inspectable_web_contents_impl.cc +++ b/brightray/browser/inspectable_web_contents_impl.cc @@ -281,6 +281,9 @@ void InspectableWebContentsImpl::CallClientFunction(const std::string& function_ const base::Value* arg1, const base::Value* arg2, const base::Value* arg3) { + if (!devtools_web_contents_) + return; + std::string javascript = function_name + "("; if (arg1) { std::string json;