Browse Source

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 <info@bnoordhuis.nl>
v7.x
Eugene Ostroukhov 8 years ago
committed by Ali Ijaz Sheikh
parent
commit
efe4d19240
  1. 11
      src/inspector_agent.cc
  2. 7
      test/inspector/test-inspector.js

11
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<v8::Context> 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_;

7
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'])
],
]);
}

Loading…
Cancel
Save