Commit Graph

8 Commits (24ed8da48ee11b0d4130f1c71a448db59c83f607)

Author SHA1 Message Date
Jithil P Ponnan 64f7d0e0bd
test: fix flakiness in worker*.test-free-called
The issue arises from the `getFreeCallCount()` function yielding the
initial value of 0. Upon instantiation of the `Worker` object, it
increments to 1. In the case of this flaky test, if the creation of the
`Worker` object is faster, the subsequent `getFreeCallCount()` call
always returns 1 instead of the expected 0.

Fixes: https://github.com/nodejs/node/issues/51003
PR-URL: https://github.com/nodejs/node/pull/51013
Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2023-12-19 17:11:27 +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
Rich Trott 5122456883 test: fix comment misspellings of transferred
PR-URL: https://github.com/nodejs/node/pull/36360
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Zeyu Yang <himself65@outlook.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
2020-12-07 07:31:58 -08:00
Anna Henningsen a038199265
src,doc,test: remove String::New default parameter
`kNormal` has been the implicit default for a while now (since V8 7.6).

Refs: e0d7f81699

PR-URL: https://github.com/nodejs/node/pull/34248
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
2020-07-14 15:13:34 +02: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 b7ef593744
buffer: release buffers with free callbacks on env exit
Invoke the free callback for a given `Buffer` if it was created
with one, and mark the underlying `ArrayBuffer` as detached.

This makes sure that the memory is released e.g. when addons inside
Workers create such `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:50 +01:00
Anna Henningsen 6cb8e4b12c
src: mark ArrayBuffers with free callbacks as untransferable
More precisely, make them untransferable if they were created through
*our* APIs, because those do not follow the improved free callback
mechanism that V8 uses now. All other ArrayBuffers can be transferred
between threads now, the assumption being that they were created in a
clean way that follows the V8 API on this.

This addresses a TODO comment.

Refs: https://github.com/nodejs/node/pull/30339#issuecomment-552225353

PR-URL: https://github.com/nodejs/node/pull/30475
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
2019-11-19 14:01:32 +01:00