Skip to content

Commit

Permalink
debugger: assign Environment to DebugContext too
Browse files Browse the repository at this point in the history
  • Loading branch information
indutny committed May 2, 2014
1 parent 9479399 commit 8398bf9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3093,6 +3093,9 @@ static void EnableDebug(Isolate* isolate, bool wait_connect) {
if (env == NULL)
return; // Still starting up.

// Assign environment to the debugger's context
env->AssignToContext(v8::Debug::GetDebugContext());

Context::Scope context_scope(env->context());
Local<Object> message = Object::New(env->isolate());
message->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "cmd"),
Expand Down Expand Up @@ -3594,6 +3597,11 @@ int Start(int argc, char** argv) {
Locker locker(node_isolate);
Environment* env =
CreateEnvironment(node_isolate, argc, argv, exec_argc, exec_argv);
// Assign env to the debugger's context
if (debugger_running) {
HandleScope scope(env->isolate());
env->AssignToContext(v8::Debug::GetDebugContext());
}
// This Context::Scope is here so EnableDebug() can look up the current
// environment with Environment::GetCurrentChecked().
// TODO(bnoordhuis) Reorder the debugger initialization logic so it can
Expand Down
11 changes: 10 additions & 1 deletion test/debugger/test-debugger-repl.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,13 @@ addTest('c', [
/\d/, /\d/, /\d/, /\d/, /\d/
]);

addTest('quit', []);
// REPL and process.env regression
addTest('repl', [
/Ctrl/
]);

addTest('for (var i in process.env) delete process.env[i]', []);

addTest('process.env', [
/\{\}/
]);

0 comments on commit 8398bf9

Please sign in to comment.