Skip to content

Commit

Permalink
src: use more appropriate context-entered check
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
addaleax authored and targos committed Oct 18, 2017
1 parent 419876a commit c8db023
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1376,7 +1376,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()) {
failed_ = DomainEnter(env, object_);
Expand Down
8 changes: 8 additions & 0 deletions test/inspector/test-scriptparsed-context.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ const script = `
vm.runInNewContext('Array', {});
debugger;
vm.runInNewContext('debugger', {});
`;

async function getContext(session) {
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit c8db023

Please sign in to comment.