7 Commits
Author SHA1 Message Date
Christian Aurich ed6f3bc756 test: deflake node-api test-free-called
`node-api/test_worker_buffer_callback/test-free-called` checks that
`getFreeCallCount()` is 0 on a line that runs after `new Worker()`. The
worker thread can load the addon and run its finalizer before the main
thread reaches that line, in which case the counter is already 1 and the
assertion fails. The zero check is only a baseline, so it does not need
the worker to exist.

Move it above the worker creation. The equivalent test under
test/addons/worker-buffer-callback was changed the same way in
64f7d0e0bd.

Signed-off-by: Christian Aurich <christian.aurichzm@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/65948
Refs: https://github.com/nodejs/node/pull/51013
Refs: https://github.com/nodejs/reliability/blob/e457f5b68957d1502256488977bc33b4346d8a4b/reports/2026-09-10.md
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
2026-09-12 09:36:45 +02:00
Vladimir Morozov 53b3c83ed4 node-api: use Node-API in comments
PR-URL: https://github.com/nodejs/node/pull/61320
Reviewed-By: Aviv Keller <me@aviv.sh>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
2026-01-16 16:00:54 +00:00
Chengzhong Wu 64549731b6 src: throw DataCloneError on transfering untransferable objects
The HTML StructuredSerializeWithTransfer algorithm defines that when
an untransferable object is in the transfer list, a DataCloneError is
thrown.
An array buffer that is already transferred is also considered as
untransferable.

PR-URL: https://github.com/nodejs/node/pull/47604
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
2023-05-05 11:22:42 +00:00
Gabriel Schulhof 4b7f23f868 test: rename n-api to node-api
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 <midawson@redhat.com>
Reviewed-By: Beth Griggs <bgriggs@redhat.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2021-02-06 05:03:38 -08:00
Anna Henningsen 8698dd98bb test: fix out-of-bound reads from invalid sizeof usage
`sizeof(data)` does not return the correct result here, as it measures
the size of the `data` variable, not what it points to.

PR-URL: https://github.com/nodejs/node/pull/33115
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2020-04-30 04:56:11 +02:00
Thang Tran 4f523c2c1a src: migrate to new V8 ArrayBuffer API
ArrayBuffer without BackingStore will soon be deprecated.

Fixes:https://github.com/nodejs/node/issues/30529

PR-URL: https://github.com/nodejs/node/pull/30782
Fixes: https://github.com/nodejs/node/issues/30529
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2019-12-12 10:05:44 -05:00
Anna Henningsen f4f8ec2b65 test: port worker + buffer test to N-API
This ports `test/addons/worker-buffer-callback` to N-API,
with the small exception of using external `ArrayBuffer`s rather
than external Node.js `Buffer`s.

PR-URL: https://github.com/nodejs/node/pull/30551
Reviewed-By: Gabriel Schulhof <gabriel.schulhof@intel.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
2019-11-30 02:02:52 +01:00