debugger: assign Environment to DebugContext too

fix #7517
This commit is contained in:
Fedor Indutny 2014-04-27 12:42:43 +04:00
parent 9479399d3b
commit 8398bf9128
2 changed files with 18 additions and 1 deletions

View File

@ -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"),
@ -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

View File

@ -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', [
/\{\}/
]);