Skip to content

Commit dc9f711

Browse files
committed
src: use more appropriate context-entered check
Make the context check in `MakeCallback` match what the comment says (and what actually makes sense). PR-URL: nodejs/node#15691 Fixes: nodejs/node#15672 Ref: nodejs/node#15428 Ref: f27b5e4bdaafc73a830a0451ee3c641b8bcd08fe Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Eugene Ostroukhov <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Timothy Gu <[email protected]> Reviewed-By: Tobias Nießen <[email protected]>
1 parent c2e90ed commit dc9f711

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/node.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1415,7 +1415,7 @@ InternalCallbackScope::InternalCallbackScope(Environment* env,
14151415

14161416
HandleScope handle_scope(env->isolate());
14171417
// If you hit this assertion, you forgot to enter the v8::Context first.
1418-
CHECK_EQ(env->context(), env->isolate()->GetCurrentContext());
1418+
CHECK_EQ(Environment::GetCurrent(env->isolate()), env);
14191419

14201420
if (env->using_domains() && !object_.IsEmpty()) {
14211421
DomainEnter(env, object_);

test/inspector/test-scriptparsed-context.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ const script = `
3737
3838
vm.runInNewContext('Array', {});
3939
debugger;
40+
41+
vm.runInNewContext('debugger', {});
4042
`;
4143

4244
async function getContext(session) {
@@ -92,6 +94,12 @@ async function runTests() {
9294
await checkScriptContext(session, thirdContext);
9395
await session.waitForBreakOnLine(33, '[eval]');
9496

97+
console.error('[test]', 'vm.runInNewContext can contain debugger statements');
98+
await session.send({ 'method': 'Debugger.resume' });
99+
const fourthContext = await getContext(session);
100+
await checkScriptContext(session, fourthContext);
101+
await session.waitForBreakOnLine(0, 'evalmachine.<anonymous>');
102+
95103
await session.runToCompletion();
96104
assert.strictEqual(0, (await instance.expectShutdown()).exitCode);
97105
}

0 commit comments

Comments
 (0)