-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
vm: migrate isContext to internal/errors #19268
Conversation
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 with an suggestion
@@ -97,6 +100,19 @@ function getContextOptions(options) { | |||
return {}; | |||
} | |||
|
|||
function isContext(sandbox) { | |||
if (arguments.length < 1) { |
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.
Do we need this one though? If sandbox is undefined, it will show up as a ERR_INVALID_ARG_TYPE as well, it seems rare that someone would just do “isContext()”
throw new ERR_MISSING_ARGS('sandbox'); | ||
} | ||
|
||
if (typeof sandbox !== 'object' && typeof sandbox !== 'function' || |
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.
I'm not sure we want to accept functions?
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.
I believe that’s just for compatibility: the original ->IsObject()
test accepts functions.
PR-URL: #19268 Refs: #18106 Reviewed-By: Tiancheng "Timothy" Gu <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Gus Caplan <[email protected]> Reviewed-By: Jon Moss <[email protected]> Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Yuta Hiroto <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
Landed in 49b2969 |
The documentation states: > This is only used for strict compliance with the API specification > (which in some cases may accept func(undefined) but not func()). In > most native Node.js APIs, func(undefined) and func() are treated > identically, and the ERR_INVALID_ARG_TYPE error code may be used > instead. Refs: nodejs#19268 (comment)
was CITGM run against this? |
No, I don't think anyone thought about running it. Is CITGM broken right now? |
we should generally run for semver-major. Have not checked yet but noticed that a related PR #19398 was breaking stuff. Have not checked citgm against master in a while myself. Can take a peek this week |
Refs: #18106
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes