From efe4d1924092e2767ff2e35d1e447ea7847d2861 Mon Sep 17 00:00:00 2001 From: Eugene Ostroukhov Date: Mon, 12 Sep 2016 11:58:26 -0700 Subject: [PATCH] inspector: report default context Fixes: https://github.com/nodejs/node/issues/8426 PR-URL: https://github.com/nodejs/node/pull/8502 Reviewed-By: bnoordhuis - Ben Noordhuis --- src/inspector_agent.cc | 11 ++++++++--- test/inspector/test-inspector.js | 7 +++++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/inspector_agent.cc b/src/inspector_agent.cc index 60844d20eb8bfc..774f0011430725 100644 --- a/src/inspector_agent.cc +++ b/src/inspector_agent.cc @@ -328,7 +328,7 @@ class V8NodeInspector : public v8_inspector::V8InspectorClient { V8NodeInspector(AgentImpl* agent, node::Environment* env, v8::Platform* platform) : agent_(agent), - isolate_(env->isolate()), + env_(env), platform_(platform), terminated_(false), running_nested_loop_(false), @@ -348,7 +348,7 @@ class V8NodeInspector : public v8_inspector::V8InspectorClient { Mutex::ScopedLock scoped_lock(agent_->pause_lock_); agent_->pause_cond_.Wait(scoped_lock); } - while (v8::platform::PumpMessageLoop(platform_, isolate_)) + while (v8::platform::PumpMessageLoop(platform_, env_->isolate())) {} } while (!terminated_); terminated_ = false; @@ -376,13 +376,18 @@ class V8NodeInspector : public v8_inspector::V8InspectorClient { session_->dispatchProtocolMessage(message); } + v8::Local ensureDefaultContextInGroup(int contextGroupId) + override { + return env_->context(); + } + V8Inspector* inspector() { return inspector_.get(); } private: AgentImpl* agent_; - v8::Isolate* isolate_; + node::Environment* env_; v8::Platform* platform_; bool terminated_; bool running_nested_loop_; diff --git a/test/inspector/test-inspector.js b/test/inspector/test-inspector.js index 2e550f6a02677c..e2493c87396112 100644 --- a/test/inspector/test-inspector.js +++ b/test/inspector/test-inspector.js @@ -141,6 +141,13 @@ function testInspectScope(session) { } }, setupExpectValue(1002) ], + [ + { + 'method': 'Runtime.evaluate', 'params': { + 'expression': '5 * 5' + } + }, (message) => assert.strictEqual(25, message['result']['value']) + ], ]); }