Skip to content
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

Closed
wants to merge 1 commit into from
Closed

vm: migrate isContext to internal/errors #19268

wants to merge 1 commit into from

Conversation

dustinnewman
Copy link
Contributor

Refs: #18106

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. vm Issues and PRs related to the vm subsystem. labels Mar 9, 2018
@TimothyGu
Copy link
Member

Copy link
Member

@joyeecheung joyeecheung left a 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) {
Copy link
Member

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()”

@joyeecheung joyeecheung added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Mar 12, 2018
throw new ERR_MISSING_ARGS('sandbox');
}

if (typeof sandbox !== 'object' && typeof sandbox !== 'function' ||
Copy link
Member

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?

Copy link
Member

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.

@targos targos added the semver-major PRs that contain breaking changes and should be released in the next major version. label Mar 17, 2018
@joyeecheung
Copy link
Member

joyeecheung commented Mar 19, 2018

@targos
Copy link
Member

targos commented Mar 21, 2018

targos pushed a commit that referenced this pull request Mar 22, 2018
PR-URL: #19268
Refs: #18106
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Jon Moss <me@jonathanmoss.me>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Yuta Hiroto <hello@hiroppy.me>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
@targos
Copy link
Member

targos commented Mar 22, 2018

Landed in 49b2969

@targos targos closed this Mar 22, 2018
TimothyGu added a commit to TimothyGu/node that referenced this pull request Mar 29, 2018
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)
@MylesBorins
Copy link
Contributor

was CITGM run against this?

@TimothyGu
Copy link
Member

No, I don't think anyone thought about running it. Is CITGM broken right now?

@MylesBorins
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. c++ Issues and PRs that require attention from people who are familiar with C++. semver-major PRs that contain breaking changes and should be released in the next major version. vm Issues and PRs related to the vm subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.