Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
Re-apply commit e307468.
Browse files Browse the repository at this point in the history
The V8 assert got triggered by a missing HandleScope::Close().
  • Loading branch information
bnoordhuis committed Jun 29, 2012
1 parent 0581afe commit fee02db
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1959,8 +1959,8 @@ static Handle<Value> EnvGetter(Local<String> property,
return scope.Close(String::New(reinterpret_cast<uint16_t*>(buffer), result));
}
#endif
// Not found
return Undefined();
// Not found. Fetch from prototype.
return scope.Close(info.Data().As<Object>()->Get(property));
}


Expand Down Expand Up @@ -2210,7 +2210,7 @@ Handle<Object> SetupProcessObject(int argc, char *argv[]) {
EnvQuery,
EnvDeleter,
EnvEnumerator,
Undefined());
Object::New());
Local<Object> env = envTemplate->NewInstance();
process->Set(String::NewSymbol("env"), env);

Expand Down
10 changes: 10 additions & 0 deletions test/simple/test-process-env.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,18 @@ if (process.argv[2] == 'you-are-the-child') {
// failed assertion results in process exiting with status code 1
assert.equal(false, 'NODE_PROCESS_ENV_DELETED' in process.env);
assert.equal(42, process.env.NODE_PROCESS_ENV);
assert.equal('asdf', process.env.hasOwnProperty);
var hasOwnProperty = Object.prototype.hasOwnProperty;
var has = hasOwnProperty.call(process.env, 'hasOwnProperty');
assert.equal(true, has);
process.exit(0);
} else {
assert.equal(Object.prototype.hasOwnProperty, process.env.hasOwnProperty);
var has = process.env.hasOwnProperty('hasOwnProperty');
assert.equal(false, has);

process.env.hasOwnProperty = 'asdf';

process.env.NODE_PROCESS_ENV = 42;
assert.equal(42, process.env.NODE_PROCESS_ENV);

Expand Down

0 comments on commit fee02db

Please sign in to comment.