Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34.2k
src: allow getting Symbols on process.env#9631
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Conversation
1aa595e introduced a `throw` for accessing `Symbol` properties of `process.env`. However, this breaks `util.inspect(process)` and things like `Object.prototype.toString.call(process.env)`, so this patch changes the behaviour for the getter to just always return `undefined`.
| const PropertyCallbackInfo<Value>& info){ | ||
| Isolate* isolate = info.GetIsolate(); | ||
| if (property->IsSymbol()){ | ||
| return info.GetReturnValue().SetUndefined(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Calling .SetUndefined() explicitly doesn't hurt but it's not strictly necessary as it's the default return value. We don't call it anywhere else.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bnoordhuis I think making the return value explicit is more readable here, that’s all. If you prefer, I have no problem dropping it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this the C++ equivalent of function(){return undefined}? I've no strong feelings, but explicit isn't necessarily more readable, IMHO.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this the C++ equivalent of
function(){return undefined}?
Yup.
I've no strong feelings, but explicit isn't necessarily more readable, IMHO.
I agree, but in this instance I think it makes sense.
mhdawson left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
jasnell commented Nov 18, 2016
Marking as semver-major due to the change in error handling. |
addaleax commented Nov 20, 2016
@jasnell This partially undoes a not-yet-released |
addaleax commented Nov 20, 2016
Landed in 3295a7f, thanks for reviewing everyone! |
1aa595e introduced a `throw` for accessing `Symbol` properties of `process.env`. However, this breaks `util.inspect(process)` and things like `Object.prototype.toString.call(process.env)`, so this patch changes the behaviour for the getter to just always return `undefined`. Ref: #9446Fixes: #9641 PR-URL: #9631 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: James M Snell <[email protected]>
jasnell commented Nov 20, 2016
It's a bit of a grey area On Sat, Nov 19, 2016 at 4:05 PM Anna Henningsen [email protected]
|
1aa595e introduced a `throw` for accessing `Symbol` properties of `process.env`. However, this breaks `util.inspect(process)` and things like `Object.prototype.toString.call(process.env)`, so this patch changes the behaviour for the getter to just always return `undefined`. Ref: nodejs#9446Fixes: nodejs#9641 PR-URL: nodejs#9631 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: James M Snell <[email protected]>
Checklist
make -j8 test(UNIX), orvcbuild test nosign(Windows) passesAffected core subsystem(s)
process
Description of change
1aa595e introduced a
throwfor accessingSymbolproperties ofprocess.env. However, this breaksutil.inspect(process)and things likeObject.prototype.toString.call(process.env), so this patch changes the behaviour for the getter to just always returnundefined./cc @cjihrig