Skip to content

Commit

Permalink
inspector: report default context
Browse files Browse the repository at this point in the history
Fixes: #8426
PR-URL: #8502
Reviewed-By: bnoordhuis - Ben Noordhuis <info@bnoordhuis.nl>
  • Loading branch information
Eugene Ostroukhov authored and Myles Borins committed Sep 30, 2016
1 parent b05ce84 commit 4ed46b4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/inspector_agent.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -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;
Expand Down Expand Up @@ -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_;
Expand Down
7 changes: 7 additions & 0 deletions test/inspector/test-inspector.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,13 @@ function testInspectScope(session) {
}
}, setupExpectValue(1002)
],
[
{
'method': 'Runtime.evaluate', 'params': {
'expression': '5 * 5'
}
}, (message) => assert.strictEqual(25, message['result']['value'])
],
]);
}

Expand Down

0 comments on commit 4ed46b4

Please sign in to comment.