Browse Source

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: https://github.com/nodejs/node/pull/15691
Fixes: https://github.com/nodejs/node/issues/15672
Ref: https://github.com/nodejs/node/pull/15428
Ref: f27b5e4bda
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>
v9.x-staging
Anna Henningsen 8 years ago
parent
commit
037d9085f1
No known key found for this signature in database GPG Key ID: 9C63F3A6CD2AD8F9
  1. 2
      src/node.cc
  2. 8
      test/inspector/test-scriptparsed-context.js

2
src/node.cc

@ -1383,7 +1383,7 @@ InternalCallbackScope::InternalCallbackScope(Environment* env,
HandleScope handle_scope(env->isolate());
// If you hit this assertion, you forgot to enter the v8::Context first.
CHECK_EQ(env->context(), env->isolate()->GetCurrentContext());
CHECK_EQ(Environment::GetCurrent(env->isolate()), env);
if (env->using_domains() && !object_.IsEmpty()) {
DomainEnter(env, object_);

8
test/inspector/test-scriptparsed-context.js

@ -37,6 +37,8 @@ const script = `
vm.runInNewContext('Array', {});
debugger;
vm.runInNewContext('debugger', {});
`;
async function getContext(session) {
@ -92,6 +94,12 @@ async function runTests() {
await checkScriptContext(session, thirdContext);
await session.waitForBreakOnLine(33, '[eval]');
console.error('[test]', 'vm.runInNewContext can contain debugger statements');
await session.send({ 'method': 'Debugger.resume' });
const fourthContext = await getContext(session);
await checkScriptContext(session, fourthContext);
await session.waitForBreakOnLine(0, 'evalmachine.<anonymous>');
await session.runToCompletion();
assert.strictEqual(0, (await instance.expectShutdown()).exitCode);
}

Loading…
Cancel
Save