Skip to content

Commit 4ed46b4

Browse files
Eugene OstroukhovMyles Borins
Eugene Ostroukhov
authored and
Myles Borins
committed
inspector: report default context
Fixes: #8426 PR-URL: #8502 Reviewed-By: bnoordhuis - Ben Noordhuis <[email protected]>
1 parent b05ce84 commit 4ed46b4

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

src/inspector_agent.cc

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ class V8NodeInspector : public v8_inspector::V8InspectorClient {
328328
V8NodeInspector(AgentImpl* agent, node::Environment* env,
329329
v8::Platform* platform)
330330
: agent_(agent),
331-
isolate_(env->isolate()),
331+
env_(env),
332332
platform_(platform),
333333
terminated_(false),
334334
running_nested_loop_(false),
@@ -348,7 +348,7 @@ class V8NodeInspector : public v8_inspector::V8InspectorClient {
348348
Mutex::ScopedLock scoped_lock(agent_->pause_lock_);
349349
agent_->pause_cond_.Wait(scoped_lock);
350350
}
351-
while (v8::platform::PumpMessageLoop(platform_, isolate_))
351+
while (v8::platform::PumpMessageLoop(platform_, env_->isolate()))
352352
{}
353353
} while (!terminated_);
354354
terminated_ = false;
@@ -376,13 +376,18 @@ class V8NodeInspector : public v8_inspector::V8InspectorClient {
376376
session_->dispatchProtocolMessage(message);
377377
}
378378

379+
v8::Local<v8::Context> ensureDefaultContextInGroup(int contextGroupId)
380+
override {
381+
return env_->context();
382+
}
383+
379384
V8Inspector* inspector() {
380385
return inspector_.get();
381386
}
382387

383388
private:
384389
AgentImpl* agent_;
385-
v8::Isolate* isolate_;
390+
node::Environment* env_;
386391
v8::Platform* platform_;
387392
bool terminated_;
388393
bool running_nested_loop_;

test/inspector/test-inspector.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,13 @@ function testInspectScope(session) {
141141
}
142142
}, setupExpectValue(1002)
143143
],
144+
[
145+
{
146+
'method': 'Runtime.evaluate', 'params': {
147+
'expression': '5 * 5'
148+
}
149+
}, (message) => assert.strictEqual(25, message['result']['value'])
150+
],
144151
]);
145152
}
146153

0 commit comments

Comments
 (0)