Skip to content

Commit c8db023

Browse files
addaleaxtargos
authored andcommitted
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: #15691 Fixes: #15672 Ref: #15428 Ref: f27b5e4 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Eugene Ostroukhov <eostroukhov@google.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
1 parent 419876a commit c8db023

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
@@ -1376,7 +1376,7 @@ InternalCallbackScope::InternalCallbackScope(Environment* env,
13761376

13771377
HandleScope handle_scope(env->isolate());
13781378
// If you hit this assertion, you forgot to enter the v8::Context first.
1379-
CHECK_EQ(env->context(), env->isolate()->GetCurrentContext());
1379+
CHECK_EQ(Environment::GetCurrent(env->isolate()), env);
13801380

13811381
if (env->using_domains() && !object_.IsEmpty()) {
13821382
failed_ = 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)