Skip to content

Commit 89988dd

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#15691 Fixes: nodejs#15672 Ref: nodejs#15428 Ref: f27b5e4 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 dae892d commit 89988dd

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/node.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1371,7 +1371,7 @@ InternalCallbackScope::InternalCallbackScope(Environment* env,
13711371

13721372
HandleScope handle_scope(env->isolate());
13731373
// If you hit this assertion, you forgot to enter the v8::Context first.
1374-
CHECK_EQ(env->context(), env->isolate()->GetCurrentContext());
1374+
CHECK_EQ(Environment::GetCurrent(env->isolate()), env);
13751375

13761376
if (env->using_domains() && !object_.IsEmpty()) {
13771377
failed_ = DomainEnter(env, object_);

test/inspector/test-scriptparsed-context.js

+8
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)