-
Notifications
You must be signed in to change notification settings - Fork 34
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
Last exception should be per-isolate #198
Comments
Fwiw, the question of whether Node will eventually support multiple isolates out of the box hasn’t really been settled yet, but I suspect this would be cool to have for embedders like Electron. |
I think if the last exception is per-isolate then so should |
Yes, every napi call should take a napi_env so that we always have that flexibility. Looks like napi_get_last_error_info is the only one where we missed that. |
@gabrielschulhof is submitting a PR to add napi_env as a paratmeter to nap_get_last_error_info() something you can add to your list ? That is something I think we want in before the PR lands in the core repo. |
1. We define struct napi_env__ to include the isolate, the last exception, and the info about the last error. 2. We instantiate one struct napi_env__ during module registration, but only if there isn't one already attached to the isolate, perhaps from the registration of a pervious module. 3. the last exception and the info about the last error are stored in the napi_env__ struct which is associated with the isolate via v8::Isolate::SetData(). Fixes nodejs#198
1. We define struct napi_env__ to include the isolate, the last exception, and the info about the last error. 2. We instantiate one struct napi_env__ during module registration, but only if there isn't one already attached to the isolate, perhaps from the registration of a pervious module. 3. the last exception and the info about the last error are stored in the napi_env__ struct which is associated with the isolate via v8::Isolate::SetData(). Fixes nodejs#198 Closes nodejs#206
@gabrielschulhof I think this is a great PR- however, my suggestion is to break it up into 2 PRs. The first one would change the signature of napi_get_last_error_info, but otherwise leave things as is. The second one would contain the rest of the implementation from this PR. My vote is to land the first one in the PR opened against nodejs/master currently, and land the second one after that PR lands, just to make the review of the larger PR smoother. Thoughts? |
Fwiw so far it looks like I’m the only one actively reviewing the nodejs/master PR, and I don’t mind reviewing #206 as a single chunk (I’ll try to keep on top of the discussions here, too) |
@addaleax ok! Was trying to not make your life harder 😄 |
1. We define struct napi_env__ to include the isolate, the last exception, and the info about the last error. 2. We instantiate one struct napi_env__ during module registration, but only if there isn't one already attached to the isolate, perhaps from the registration of a pervious module. 3. the last exception and the info about the last error are stored in the napi_env__ struct which is associated with the isolate via v8::Isolate::SetData(). Fixes nodejs#198 Closes nodejs#206
1. We define struct napi_env__ to include the isolate, the last exception, and the info about the last error. 2. We instantiate one struct napi_env__ during module registration, but only if there isn't one already attached to the isolate, perhaps from the registration of a pervious module. 3. the last exception and the info about the last error are stored in the napi_env__ struct which is associated with the isolate via v8::Isolate::SetData(). Fixes nodejs#198 Closes nodejs#206
1. We define struct napi_env__ to include the isolate, the last exception, and the info about the last error. 2. We instantiate one struct napi_env__ during module registration, but only if there isn't one already attached to the isolate, perhaps from the registration of a pervious module. 3. the last exception and the info about the last error are stored in the napi_env__ struct which is associated with the isolate via v8::Isolate::SetData(). Fixes nodejs#198 Closes nodejs#206
1. We define struct napi_env__ to include the isolate, the last exception, and the info about the last error. 2. We instantiate one struct napi_env__ during module registration and we pass it into the FunctionCallbackInfo for all subsequent entries into N-API when we create functions/accessors/finalizers. Once module unloading will be supported we shall have to delete the napi_env we create during module init. Fixes nodejs#198 Closes nodejs#208
This makes it necessary to pass napi_env to napi_get_last_error_info() thereby ensuring that errors can be tied to the napi_env in the future. Re nodejs#198
This makes it necessary to pass napi_env to napi_get_last_error_info() thereby ensuring that errors can be tied to the napi_env in the future. Re #198
This makes it necessary to pass napi_env to napi_get_last_error_info() thereby ensuring that errors can be tied to the napi_env in the future. Re nodejs/abi-stable-node#198
1. We define struct napi_env__ to include the isolate, the last exception, and the info about the last error. 2. We instantiate one struct napi_env__ during module registration and we pass it into the FunctionCallbackInfo for all subsequent entries into N-API when we create functions/accessors/finalizers. Once module unloading will be supported we shall have to delete the napi_env we create during module init. Fixes nodejs#198 Closes nodejs#208
1. We define struct napi_env__ to include the isolate, the last exception, and the info about the last error. 2. We instantiate one struct napi_env__ during module registration and we pass it into the FunctionCallbackInfo for all subsequent entries into N-API when we create functions/accessors/finalizers. Once module unloading will be supported we shall have to delete the napi_env we create during module init. Fixes nodejs#198 Closes nodejs#208
1. We define struct napi_env__ to include the isolate, the last exception, and the info about the last error. 2. We instantiate one struct napi_env__ during module registration and we pass it into the FunctionCallbackInfo for all subsequent entries into N-API when we create functions/accessors/finalizers. Once module unloading will be supported we shall have to delete the napi_env we create during module init. Fixes nodejs#198 Closes nodejs#208
1. We define struct napi_env__ to include the isolate, the last exception, and the info about the last error. 2. We instantiate one struct napi_env__ during module registration and we pass it into the FunctionCallbackInfo for all subsequent entries into N-API when we create functions/accessors/finalizers. Once module unloading will be supported we shall have to delete the napi_env we create during module init. There is a clear separation between public and private API wrt. env: 1. Public APIs assert that env is not nullptr as their first action. 2. Private APIs need not validate env. They assume it's not nullptr. Fixes nodejs#198 Closes nodejs#208
1. We define struct napi_env__ to include the isolate, the last exception, and the info about the last error. 2. We instantiate one struct napi_env__ during module registration and we pass it into the FunctionCallbackInfo for all subsequent entries into N-API when we create functions/accessors/finalizers. Once module unloading will be supported we shall have to delete the napi_env we create during module init. There is a clear separation between public and private API wrt. env: 1. Public APIs assert that env is not nullptr as their first action. 2. Private APIs need not validate env. They assume it's not nullptr. Fixes nodejs#198 Closes nodejs#208
1. We define struct napi_env__ to include the isolate, the last exception, and the info about the last error. 2. We instantiate one struct napi_env__ during module registration and we pass it into the FunctionCallbackInfo for all subsequent entries into N-API when we create functions/accessors/finalizers. Once module unloading will be supported we shall have to delete the napi_env we create during module init. There is a clear separation between public and private API wrt. env: 1. Public APIs assert that env is not nullptr as their first action. 2. Private APIs need not validate env. They assume it's not nullptr. Fixes: nodejs#198
1. We define struct napi_env__ to include the isolate, the last exception, and the info about the last error. 2. We instantiate one struct napi_env__ during module registration and we pass it into the FunctionCallbackInfo for all subsequent entries into N-API when we create functions/accessors/finalizers. Once module unloading will be supported we shall have to delete the napi_env we create during module init. There is a clear separation between public and private API wrt. env: 1. Public APIs assert that env is not nullptr as their first action. 2. Private APIs need not validate env. They assume it's not nullptr. Fixes: nodejs#198
1. We define struct napi_env__ to include the isolate, the last exception, and the info about the last error. 2. We instantiate one struct napi_env__ during module registration and we pass it into the FunctionCallbackInfo for all subsequent entries into N-API when we create functions/accessors/finalizers. Once module unloading will be supported we shall have to delete the napi_env we create during module init. There is a clear separation between public and private API wrt. env: 1. Public APIs assert that env is not nullptr as their first action. 2. Private APIs need not validate env. They assume it's not nullptr. Fixes: nodejs#198
1. We define struct napi_env__ to include the isolate, the last exception, and the info about the last error. 2. We instantiate one struct napi_env__ during module registration and we pass it into the FunctionCallbackInfo for all subsequent entries into N-API when we create functions/accessors/finalizers. Once module unloading will be supported we shall have to delete the napi_env we create during module init. There is a clear separation between public and private API wrt. env: 1. Public APIs assert that env is not nullptr as their first action. 2. Private APIs need not validate env. They assume it's not nullptr. Fixes: nodejs/abi-stable-node#198
1. We define struct napi_env__ to include the isolate, the last exception, and the info about the last error. 2. We instantiate one struct napi_env__ during module registration and we pass it into the FunctionCallbackInfo for all subsequent entries into N-API when we create functions/accessors/finalizers. Once module unloading will be supported we shall have to delete the napi_env we create during module init. There is a clear separation between public and private API wrt. env: 1. Public APIs assert that env is not nullptr as their first action. 2. Private APIs need not validate env. They assume it's not nullptr. PR-URL: nodejs#12195 Fixes: nodejs/abi-stable-node#198 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
1. We define struct napi_env__ to include the isolate, the last exception, and the info about the last error. 2. We instantiate one struct napi_env__ during module registration and we pass it into the FunctionCallbackInfo for all subsequent entries into N-API when we create functions/accessors/finalizers. Once module unloading will be supported we shall have to delete the napi_env we create during module init. There is a clear separation between public and private API wrt. env: 1. Public APIs assert that env is not nullptr as their first action. 2. Private APIs need not validate env. They assume it's not nullptr. Backport-PR-URL: #19447 PR-URL: #12195 Fixes: nodejs/abi-stable-node#198 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Currently in the N-API V8 implementation, the last exception is stored as a global. But that won't be correct when Node supports multiple isolates in the process. Then the last exception should be per-isolate.
The text was updated successfully, but these errors were encountered: