Skip to content

Commit fee02db

Browse files
committed
Re-apply commit e307468.
The V8 assert got triggered by a missing HandleScope::Close().
1 parent 0581afe commit fee02db

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

src/node.cc

+3-3
Original file line numberDiff line numberDiff line change
@@ -1959,8 +1959,8 @@ static Handle<Value> EnvGetter(Local<String> property,
19591959
return scope.Close(String::New(reinterpret_cast<uint16_t*>(buffer), result));
19601960
}
19611961
#endif
1962-
// Not found
1963-
return Undefined();
1962+
// Not found. Fetch from prototype.
1963+
return scope.Close(info.Data().As<Object>()->Get(property));
19641964
}
19651965

19661966

@@ -2210,7 +2210,7 @@ Handle<Object> SetupProcessObject(int argc, char *argv[]) {
22102210
EnvQuery,
22112211
EnvDeleter,
22122212
EnvEnumerator,
2213-
Undefined());
2213+
Object::New());
22142214
Local<Object> env = envTemplate->NewInstance();
22152215
process->Set(String::NewSymbol("env"), env);
22162216

test/simple/test-process-env.js

+10
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,18 @@ if (process.argv[2] == 'you-are-the-child') {
4747
// failed assertion results in process exiting with status code 1
4848
assert.equal(false, 'NODE_PROCESS_ENV_DELETED' in process.env);
4949
assert.equal(42, process.env.NODE_PROCESS_ENV);
50+
assert.equal('asdf', process.env.hasOwnProperty);
51+
var hasOwnProperty = Object.prototype.hasOwnProperty;
52+
var has = hasOwnProperty.call(process.env, 'hasOwnProperty');
53+
assert.equal(true, has);
5054
process.exit(0);
5155
} else {
56+
assert.equal(Object.prototype.hasOwnProperty, process.env.hasOwnProperty);
57+
var has = process.env.hasOwnProperty('hasOwnProperty');
58+
assert.equal(false, has);
59+
60+
process.env.hasOwnProperty = 'asdf';
61+
5262
process.env.NODE_PROCESS_ENV = 42;
5363
assert.equal(42, process.env.NODE_PROCESS_ENV);
5464

0 commit comments

Comments
 (0)