n-api: tighten null-checking and clean up last error#12539
Closed
gabrielschulhof wants to merge 1 commit intonodejs:masterfrom
Closed
n-api: tighten null-checking and clean up last error#12539gabrielschulhof wants to merge 1 commit intonodejs:masterfrom
gabrielschulhof wants to merge 1 commit intonodejs:masterfrom
Conversation
cjihrig
requested changes
Apr 20, 2017
src/node_api.cc
Outdated
Contributor
There was a problem hiding this comment.
This change throws off the indentation of the following lines.
59bfa18 to
5e803d4
Compare
jasongin
approved these changes
Apr 20, 2017
3 tasks
Member
|
This would need a rebase, and since #12366 most of the internals here are wrapped in an anonymous namespace so the |
We left out null-checks for many of the parameters passed to our APIs. In particular, arguments of type `napi_value` were often accepted without a null-check, even though they should never be null. Additionally, many APIs simply returned `napi_ok` on success. This leaves in place an error that may have occurred in a previous N-API call. Others (those which perform `NAPI_PREAMBLE(env)` at the top) OTOH explicitly clear the last error before proceeding. With this modification all APIs explicitly clear the last error on success. Fixes nodejs/abi-stable-node#227
5e803d4 to
2aeadeb
Compare
Contributor
Author
|
@addaleax rebased. I believe the |
addaleax
approved these changes
Apr 23, 2017
Contributor
Author
|
@cjihrig all good now? |
Contributor
Author
Member
|
Ran out of time today, will plan to land tomorrow (Tuesday) |
cjihrig
approved these changes
Apr 25, 2017
Member
Member
|
CI good landing. |
Member
Member
|
Landed in ba7bac5 |
addaleax
pushed a commit
that referenced
this pull request
Apr 25, 2017
We left out null-checks for many of the parameters passed to our APIs. In particular, arguments of type `napi_value` were often accepted without a null-check, even though they should never be null. Additionally, many APIs simply returned `napi_ok` on success. This leaves in place an error that may have occurred in a previous N-API call. Others (those which perform `NAPI_PREAMBLE(env)` at the top) OTOH explicitly clear the last error before proceeding. With this modification all APIs explicitly clear the last error on success. Fixes: nodejs/abi-stable-node#227 PR-URL: #12539 Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Member
|
Just got back after lunch and tried to push seeing the CI green, but see @addaleax already has. |
gabrielschulhof
pushed a commit
to gabrielschulhof/node
that referenced
this pull request
Apr 10, 2018
We left out null-checks for many of the parameters passed to our APIs. In particular, arguments of type `napi_value` were often accepted without a null-check, even though they should never be null. Additionally, many APIs simply returned `napi_ok` on success. This leaves in place an error that may have occurred in a previous N-API call. Others (those which perform `NAPI_PREAMBLE(env)` at the top) OTOH explicitly clear the last error before proceeding. With this modification all APIs explicitly clear the last error on success. Fixes: nodejs/abi-stable-node#227 PR-URL: nodejs#12539 Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
MylesBorins
pushed a commit
that referenced
this pull request
Apr 16, 2018
We left out null-checks for many of the parameters passed to our APIs. In particular, arguments of type `napi_value` were often accepted without a null-check, even though they should never be null. Additionally, many APIs simply returned `napi_ok` on success. This leaves in place an error that may have occurred in a previous N-API call. Others (those which perform `NAPI_PREAMBLE(env)` at the top) OTOH explicitly clear the last error before proceeding. With this modification all APIs explicitly clear the last error on success. Fixes: nodejs/abi-stable-node#227 Backport-PR-URL: #19447 PR-URL: #12539 Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We left out null-checks for many of the parameters passed to our APIs.
In particular, arguments of type
napi_valuewere often acceptedwithout a null-check, even though they should never be null.
Additionally, many APIs simply returned
napi_okon success. Thisleaves in place an error that may have occurred in a previous N-API
call. Others (those which perform
NAPI_PREAMBLE(env)at the top)OTOH explicitly clear the last error before proceeding. With this
modification all APIs explicitly clear the last error on success.
Fixes nodejs/abi-stable-node#227
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passesAffected core subsystem(s)
n-api