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

n-api: make changes for source compatibility #16102

Closed

Conversation

gabrielschulhof
Copy link
Contributor

These changes are necessary in order to retain source compatibility
with older versions of node.

The removal of module_version from napi_module_register() is
reverted from the flag removal PR, because it should not have been a
part of it.

CallbackWrapper::NewTarget() is renamed to
CallbackWrapper::GetNewTarget() to distinguish it from V8's native
method, thus allowing for a macro which reduces NewTarget() to
This() on V8 versions where it was not yet available.

AsyncResource is constructed with a C string rather than a V8 string
because the former is available on all versions of node.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines
Affected core subsystem(s)

n-api

These changes are necessary in order to retain source compatibility
with older versions of node.

The removal of `module_version` from `napi_module_register()` is
reverted from the flag removal PR, because it should not have been a
part of it.

`CallbackWrapper::NewTarget()` is renamed to
`CallbackWrapper::GetNewTarget()` to distinguish it from V8's native
method, thus allowing for a macro which reduces `NewTarget()` to
`This()` on V8 versions where it was not yet available.

`AsyncResource` is constructed with a C string rather than a V8 string
because the former is available on all versions of node.
@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. dont-land-on-v4.x node-api Issues and PRs related to the Node-API. labels Oct 9, 2017
@gabrielschulhof
Copy link
Contributor Author

@Trott
Copy link
Member

Trott commented Oct 11, 2017

Lint error in CI is unrelated and fixed in #16145

@gabrielschulhof
Copy link
Contributor Author

node-test-commit-arm also seems unrelated:

stderr: fatal: Unable to create '/home/iojs/build/workspace/node-test-commit-arm@2/.git/index.lock': File exists.

@gabrielschulhof
Copy link
Contributor Author

@rvagg you stopped https://ci.nodejs.org/job/node-test-commit-freebsd/12236/nodes=freebsd10-64/. All other errors are unrelated. Is it OK to land this PR then?

@gabrielschulhof
Copy link
Contributor Author

I guess it's a pretty trivial PR. I'll land it.

@gabrielschulhof
Copy link
Contributor Author

Landed in 4957726.

gabrielschulhof pushed a commit to gabrielschulhof/node that referenced this pull request Oct 11, 2017
These changes are necessary in order to retain source compatibility
with older versions of node.

The removal of `module_version` from `napi_module_register()` is
reverted from the flag removal PR, because it should not have been a
part of it.

`CallbackWrapper::NewTarget()` is renamed to
`CallbackWrapper::GetNewTarget()` to distinguish it from V8's native
method, thus allowing for a macro which reduces `NewTarget()` to
`This()` on V8 versions where it was not yet available.

`AsyncResource` is constructed with a C string rather than a V8 string
because the former is available on all versions of node.

PR-URL: nodejs#16102
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jason Ginchereau <jasongin@microsoft.com>
@gabrielschulhof gabrielschulhof deleted the napi-rename-new-target branch October 11, 2017 19:31
addaleax pushed a commit to addaleax/ayo that referenced this pull request Oct 12, 2017
These changes are necessary in order to retain source compatibility
with older versions of node.

The removal of `module_version` from `napi_module_register()` is
reverted from the flag removal PR, because it should not have been a
part of it.

`CallbackWrapper::NewTarget()` is renamed to
`CallbackWrapper::GetNewTarget()` to distinguish it from V8's native
method, thus allowing for a macro which reduces `NewTarget()` to
`This()` on V8 versions where it was not yet available.

`AsyncResource` is constructed with a C string rather than a V8 string
because the former is available on all versions of node.

PR-URL: nodejs/node#16102
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jason Ginchereau <jasongin@microsoft.com>
targos pushed a commit that referenced this pull request Oct 18, 2017
These changes are necessary in order to retain source compatibility
with older versions of node.

The removal of `module_version` from `napi_module_register()` is
reverted from the flag removal PR, because it should not have been a
part of it.

`CallbackWrapper::NewTarget()` is renamed to
`CallbackWrapper::GetNewTarget()` to distinguish it from V8's native
method, thus allowing for a macro which reduces `NewTarget()` to
`This()` on V8 versions where it was not yet available.

`AsyncResource` is constructed with a C string rather than a V8 string
because the former is available on all versions of node.

PR-URL: #16102
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jason Ginchereau <jasongin@microsoft.com>
targos pushed a commit that referenced this pull request Oct 18, 2017
These changes are necessary in order to retain source compatibility
with older versions of node.

The removal of `module_version` from `napi_module_register()` is
reverted from the flag removal PR, because it should not have been a
part of it.

`CallbackWrapper::NewTarget()` is renamed to
`CallbackWrapper::GetNewTarget()` to distinguish it from V8's native
method, thus allowing for a macro which reduces `NewTarget()` to
`This()` on V8 versions where it was not yet available.

`AsyncResource` is constructed with a C string rather than a V8 string
because the former is available on all versions of node.

PR-URL: #16102
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jason Ginchereau <jasongin@microsoft.com>
gabrielschulhof pushed a commit to gabrielschulhof/node that referenced this pull request Apr 16, 2018
These changes are necessary in order to retain source compatibility
with older versions of node.

The removal of `module_version` from `napi_module_register()` is
reverted from the flag removal PR, because it should not have been a
part of it.

`CallbackWrapper::NewTarget()` is renamed to
`CallbackWrapper::GetNewTarget()` to distinguish it from V8's native
method, thus allowing for a macro which reduces `NewTarget()` to
`This()` on V8 versions where it was not yet available.

`AsyncResource` is constructed with a C string rather than a V8 string
because the former is available on all versions of node.

PR-URL: nodejs#16102
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jason Ginchereau <jasongin@microsoft.com>
MylesBorins pushed a commit that referenced this pull request Apr 16, 2018
These changes are necessary in order to retain source compatibility
with older versions of node.

The removal of `module_version` from `napi_module_register()` is
reverted from the flag removal PR, because it should not have been a
part of it.

`CallbackWrapper::NewTarget()` is renamed to
`CallbackWrapper::GetNewTarget()` to distinguish it from V8's native
method, thus allowing for a macro which reduces `NewTarget()` to
`This()` on V8 versions where it was not yet available.

`AsyncResource` is constructed with a C string rather than a V8 string
because the former is available on all versions of node.

Backport-PR-URL: #19447
PR-URL: #16102
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jason Ginchereau <jasongin@microsoft.com>
@MylesBorins MylesBorins mentioned this pull request Apr 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ Issues and PRs that require attention from people who are familiar with C++. node-api Issues and PRs related to the Node-API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants