<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/node-new.git/test/js-native-api/test_exception, branch main</title>
<subtitle>github.com: nodejs/node.git
</subtitle>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/node-new.git/'/>
<entry>
<title>test: add trailing commas in `test/js-native-api`</title>
<updated>2023-02-03T16:12:18+00:00</updated>
<author>
<name>Antoine du Hamel</name>
<email>duhamelantoine1995@gmail.com</email>
</author>
<published>2023-01-25T06:05:09+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/node-new.git/commit/?id=7079158d2965d012161c37bdc8d91ee0b4b56b95'/>
<id>7079158d2965d012161c37bdc8d91ee0b4b56b95</id>
<content type='text'>
PR-URL: https://github.com/nodejs/node/pull/46385
Reviewed-By: James M Snell &lt;jasnell@gmail.com&gt;
Reviewed-By: Chengzhong Wu &lt;legendecas@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
PR-URL: https://github.com/nodejs/node/pull/46385
Reviewed-By: James M Snell &lt;jasnell@gmail.com&gt;
Reviewed-By: Chengzhong Wu &lt;legendecas@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>test: pass data into napi_create_external</title>
<updated>2022-04-02T22:57:33+00:00</updated>
<author>
<name>Joyee Cheung</name>
<email>joyeec9h3@gmail.com</email>
</author>
<published>2022-04-02T22:57:33+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/node-new.git/commit/?id=7c8d98ea84fc298c5c1d3e84985e3f9b3f861691'/>
<id>7c8d98ea84fc298c5c1d3e84985e3f9b3f861691</id>
<content type='text'>
Since v8 10.1 v8::External::New DCHECKs that the data passed
into it cannot be a nullptr because that's not serializable
as external references. This updates the test to pass a
dummy data pointer to the call - which does not matter for the
test since we only care about whether the finalizer is
called.

Refs: https://chromium-review.googlesource.com/c/v8/v8/+/3513234

PR-URL: https://github.com/nodejs/node/pull/42532
Refs: https://github.com/nodejs/node/pull/42115
Reviewed-By: Rich Trott &lt;rtrott@gmail.com&gt;
Reviewed-By: Antoine du Hamel &lt;duhamelantoine1995@gmail.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Since v8 10.1 v8::External::New DCHECKs that the data passed
into it cannot be a nullptr because that's not serializable
as external references. This updates the test to pass a
dummy data pointer to the call - which does not matter for the
test since we only care about whether the finalizer is
called.

Refs: https://chromium-review.googlesource.com/c/v8/v8/+/3513234

PR-URL: https://github.com/nodejs/node/pull/42532
Refs: https://github.com/nodejs/node/pull/42115
Reviewed-By: Rich Trott &lt;rtrott@gmail.com&gt;
Reviewed-By: Antoine du Hamel &lt;duhamelantoine1995@gmail.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>node-api: rtn pending excep on napi_new_instance</title>
<updated>2021-06-04T20:38:06+00:00</updated>
<author>
<name>legendecas</name>
<email>legendecas@gmail.com</email>
</author>
<published>2021-05-24T15:39:36+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/node-new.git/commit/?id=78af363aa7b8817a575faf1c3de58e47d64a1f8b'/>
<id>78af363aa7b8817a575faf1c3de58e47d64a1f8b</id>
<content type='text'>
When there are any JavaScript exceptions pending,
`napi_pending_exception` should be returned.

PR-URL: https://github.com/nodejs/node/pull/38798
Reviewed-By: Anna Henningsen &lt;anna@addaleax.net&gt;
Reviewed-By: Michael Dawson &lt;midawson@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When there are any JavaScript exceptions pending,
`napi_pending_exception` should be returned.

PR-URL: https://github.com/nodejs/node/pull/38798
Reviewed-By: Anna Henningsen &lt;anna@addaleax.net&gt;
Reviewed-By: Michael Dawson &lt;midawson@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>test: remove unneeded m flag on regular expressions</title>
<updated>2021-04-09T13:35:51+00:00</updated>
<author>
<name>Rich Trott</name>
<email>rtrott@gmail.com</email>
</author>
<published>2021-04-07T06:28:55+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/node-new.git/commit/?id=7e516aaac0ed707a99f1fc304cea10bb40e7fa6c'/>
<id>7e516aaac0ed707a99f1fc304cea10bb40e7fa6c</id>
<content type='text'>
The m flag has no effect on regular expressions that don't match the
start or the end of a line.

PR-URL: https://github.com/nodejs/node/pull/38124
Reviewed-By: Antoine du Hamel &lt;duhamelantoine1995@gmail.com&gt;
Reviewed-By: Luigi Pinca &lt;luigipinca@gmail.com&gt;
Reviewed-By: Darshan Sen &lt;raisinten@gmail.com&gt;
Reviewed-By: James M Snell &lt;jasnell@gmail.com&gt;
Reviewed-By: Anna Henningsen &lt;anna@addaleax.net&gt;
Reviewed-By: Colin Ihrig &lt;cjihrig@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The m flag has no effect on regular expressions that don't match the
start or the end of a line.

PR-URL: https://github.com/nodejs/node/pull/38124
Reviewed-By: Antoine du Hamel &lt;duhamelantoine1995@gmail.com&gt;
Reviewed-By: Luigi Pinca &lt;luigipinca@gmail.com&gt;
Reviewed-By: Darshan Sen &lt;raisinten@gmail.com&gt;
Reviewed-By: James M Snell &lt;jasnell@gmail.com&gt;
Reviewed-By: Anna Henningsen &lt;anna@addaleax.net&gt;
Reviewed-By: Colin Ihrig &lt;cjihrig@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>test: prepare for consistent comma-dangle lint rule</title>
<updated>2021-04-02T06:14:29+00:00</updated>
<author>
<name>Rich Trott</name>
<email>rtrott@gmail.com</email>
</author>
<published>2021-03-26T15:51:08+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/node-new.git/commit/?id=330f25ef822dac6ed8a0afb3422bd920726eb43d'/>
<id>330f25ef822dac6ed8a0afb3422bd920726eb43d</id>
<content type='text'>
Make changes so that tests will pass when the comma-dangle settings
applied to the rest of the code base are also applied to tests.

PR-URL: https://github.com/nodejs/node/pull/37930
Reviewed-By: James M Snell &lt;jasnell@gmail.com&gt;
Reviewed-By: Derek Lewis &lt;DerekNonGeneric@inf.is&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Make changes so that tests will pass when the comma-dangle settings
applied to the rest of the code base are also applied to tests.

PR-URL: https://github.com/nodejs/node/pull/37930
Reviewed-By: James M Snell &lt;jasnell@gmail.com&gt;
Reviewed-By: Derek Lewis &lt;DerekNonGeneric@inf.is&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>test: rename n-api to node-api</title>
<updated>2021-02-06T13:03:38+00:00</updated>
<author>
<name>Gabriel Schulhof</name>
<email>gabriel.schulhof@intel.com</email>
</author>
<published>2021-02-03T20:01:28+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/node-new.git/commit/?id=4b7f23f8689966c50c7b985537a57cf4d8a72fef'/>
<id>4b7f23f8689966c50c7b985537a57cf4d8a72fef</id>
<content type='text'>
This renames the macros used in the tests from `NAPI_*` to
`NODE_API_*`.

PR-URL: https://github.com/nodejs/node/pull/37217
Reviewed-By: Michael Dawson &lt;midawson@redhat.com&gt;
Reviewed-By: Beth Griggs &lt;bgriggs@redhat.com&gt;
Reviewed-By: Rich Trott &lt;rtrott@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This renames the macros used in the tests from `NAPI_*` to
`NODE_API_*`.

PR-URL: https://github.com/nodejs/node/pull/37217
Reviewed-By: Michael Dawson &lt;midawson@redhat.com&gt;
Reviewed-By: Beth Griggs &lt;bgriggs@redhat.com&gt;
Reviewed-By: Rich Trott &lt;rtrott@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>n-api: run all finalizers via SetImmediate()</title>
<updated>2020-07-24T06:28:09+00:00</updated>
<author>
<name>Gabriel Schulhof</name>
<email>gabriel.schulhof@intel.com</email>
</author>
<published>2020-07-15T22:45:53+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/node-new.git/commit/?id=a74a6e3ba131752225a527d915593d7e413b1594'/>
<id>a74a6e3ba131752225a527d915593d7e413b1594</id>
<content type='text'>
Throwing an exception from a finalizer can cause the following fatal
error:

Error: async hook stack has become corrupted (actual: 2, expected: 0)
 1: 0x970b5a node::InternalCallbackScope::~InternalCallbackScope()
    [./node]
 2: 0x99dda0 node::Environment::RunTimers(uv_timer_s*) [./node]
 3: 0x13d8b22  [./node]
 4: 0x13dbe42 uv_run [./node]
 5: 0xa57974 node::NodeMainInstance::Run() [./node]
 6: 0x9dbc17 node::Start(int, char**) [./node]
 7: 0x7f4965417f43 __libc_start_main [/lib64/libc.so.6]
 8: 0x96f4ae _start [./node]

By https://github.com/nodejs/node/issues/34341#issuecomment-658426281,
calling into JS from a finalizer and/or throwing exceptions from there
is not advised, because the stack may or may not be set up for JS
execution. The best solution is to run the user's finalizer from a
`SetImmediate()` callback.

Signed-off-by: Gabriel Schulhof &lt;gabriel.schulhof@intel.com&gt;
Fixes: https://github.com/nodejs/node/issues/34341
PR-URL: https://github.com/nodejs/node/pull/34386
Reviewed-By: James M Snell &lt;jasnell@gmail.com&gt;
Reviewed-By: Anna Henningsen &lt;anna@addaleax.net&gt;
Reviewed-By: Michael Dawson &lt;michael_dawson@ca.ibm.com&gt;
Reviewed-By: Juan José Arboleda &lt;soyjuanarbol@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Throwing an exception from a finalizer can cause the following fatal
error:

Error: async hook stack has become corrupted (actual: 2, expected: 0)
 1: 0x970b5a node::InternalCallbackScope::~InternalCallbackScope()
    [./node]
 2: 0x99dda0 node::Environment::RunTimers(uv_timer_s*) [./node]
 3: 0x13d8b22  [./node]
 4: 0x13dbe42 uv_run [./node]
 5: 0xa57974 node::NodeMainInstance::Run() [./node]
 6: 0x9dbc17 node::Start(int, char**) [./node]
 7: 0x7f4965417f43 __libc_start_main [/lib64/libc.so.6]
 8: 0x96f4ae _start [./node]

By https://github.com/nodejs/node/issues/34341#issuecomment-658426281,
calling into JS from a finalizer and/or throwing exceptions from there
is not advised, because the stack may or may not be set up for JS
execution. The best solution is to run the user's finalizer from a
`SetImmediate()` callback.

Signed-off-by: Gabriel Schulhof &lt;gabriel.schulhof@intel.com&gt;
Fixes: https://github.com/nodejs/node/issues/34341
PR-URL: https://github.com/nodejs/node/pull/34386
Reviewed-By: James M Snell &lt;jasnell@gmail.com&gt;
Reviewed-By: Anna Henningsen &lt;anna@addaleax.net&gt;
Reviewed-By: Michael Dawson &lt;michael_dawson@ca.ibm.com&gt;
Reviewed-By: Juan José Arboleda &lt;soyjuanarbol@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>test: partition N-API tests</title>
<updated>2018-12-04T21:58:17+00:00</updated>
<author>
<name>Gabriel Schulhof</name>
<email>gabriel.schulhof@intel.com</email>
</author>
<published>2018-11-17T20:34:54+00:00</published>
<link rel='alternate' type='text/html' href='http://trove.baserock.org/cgit/delta/node-new.git/commit/?id=938e11882b96e19b443477571455088baaa054d8'/>
<id>938e11882b96e19b443477571455088baaa054d8</id>
<content type='text'>
Partition test/addons-napi into test/js-native-api and test/node-api to
isolate the Node.js-agnostic portion of the N-API tests from the
Node.js-specific portion.

PR-URL: https://github.com/nodejs/node/pull/24557
Reviewed-By: Refael Ackermann &lt;refack@gmail.com&gt;
Reviewed-By: Daniel Bevenius &lt;daniel.bevenius@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Partition test/addons-napi into test/js-native-api and test/node-api to
isolate the Node.js-agnostic portion of the N-API tests from the
Node.js-specific portion.

PR-URL: https://github.com/nodejs/node/pull/24557
Reviewed-By: Refael Ackermann &lt;refack@gmail.com&gt;
Reviewed-By: Daniel Bevenius &lt;daniel.bevenius@gmail.com&gt;
</pre>
</div>
</content>
</entry>
</feed>
