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

Test for interaction between scope and exception #228

Closed
gabrielschulhof opened this issue Apr 13, 2017 · 2 comments
Closed

Test for interaction between scope and exception #228

gabrielschulhof opened this issue Apr 13, 2017 · 2 comments

Comments

@gabrielschulhof
Copy link
Collaborator

Enhance test/addons-napi with a test where we pass such a callback from JS into the addon that, when called, will throw. In the addon we call the JS callback from between a scope open/close. The scope close must return napi_ok. We should induce a fatal error, like an abort otherwise.

@gabrielschulhof gabrielschulhof self-assigned this Apr 13, 2017
@jasongin
Copy link
Member

This PR includes such a test: nodejs/node#12524

@gabrielschulhof gabrielschulhof removed their assignment Apr 25, 2017
@gabrielschulhof
Copy link
Collaborator Author

@jasongin I think you got this one with that PR.

gabrielschulhof pushed a commit to gabrielschulhof/node that referenced this issue Apr 10, 2018
N-API is somewhat strict about blocking calls to many APIs while there
is a pending exception. The NAPI_PREAMBLE macro at the beginning of
many API implementations checks for a pending exception. However, a
subset of the APIs (which don't call back into JavaScript) still need
to work while in a pending-exception state. This changes the reference
APIs (equivalent to v8::Persistent) and handle scope APIs so that they
can be used for cleanup up while an exception is pending.

We may decide to similarly enable a few other APIs later, (which would
be a non-breaking change) but we know at least these are needed now
to unblock some specific scenarios.

Fixes: nodejs/abi-stable-node#122
Fixes: nodejs/abi-stable-node#228
PR-URL: nodejs#12524
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Gabriel Schulhof <gabriel.schulhof@intel.com>
MylesBorins pushed a commit to nodejs/node that referenced this issue Apr 16, 2018
N-API is somewhat strict about blocking calls to many APIs while there
is a pending exception. The NAPI_PREAMBLE macro at the beginning of
many API implementations checks for a pending exception. However, a
subset of the APIs (which don't call back into JavaScript) still need
to work while in a pending-exception state. This changes the reference
APIs (equivalent to v8::Persistent) and handle scope APIs so that they
can be used for cleanup up while an exception is pending.

We may decide to similarly enable a few other APIs later, (which would
be a non-breaking change) but we know at least these are needed now
to unblock some specific scenarios.

Fixes: nodejs/abi-stable-node#122
Fixes: nodejs/abi-stable-node#228
Backport-PR-URL: #19447
PR-URL: #12524
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Gabriel Schulhof <gabriel.schulhof@intel.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants