node/lib
Joyee Cheung 1f6b681bf2 src: fix timing of snapshot serialize callback
Previously the addAfterUserSerailizeCallback() wasn't
ready to be used for building the built-in snapshot.
This patch initializes the callbacks at the time
lib/internal/v8/start_snapshot.js is loaded, so that
these callbacks get run correctly when building the
built-in snapshot.

Currently when building the built-in snapshot,
addAfterUserSerializeCallback() is only used by createUnsafeBuffer(),
other usages can only come from user-land snapshots,
which is covered by tests, but what gets run by the
built-in snapshot building process is less visible, and the
path used by createUnsafeBuffer() isn't reliably visible in user
land either. This adds an internal usage counter in debug builds
to verify this path when building the built-in snapshot.

PR-URL: https://github.com/nodejs/node/pull/60434
Fixes: https://github.com/nodejs/node/issues/60423
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Richard Lau <richard.lau@ibm.com>
2025-10-28 00:15:55 +00:00
..
assert assert: add assert/strict alias module 2020-06-25 08:37:48 -07:00
dns dns: make promise API fully constructed from lib/internal/dns/promises 2022-06-20 19:58:45 +01:00
fs fs: add fs/promises alias module 2020-02-18 22:15:50 -08:00
inspector lib: revert to using default derived class constructors 2025-08-30 14:28:10 +00:00
internal src: fix timing of snapshot serialize callback 2025-10-28 00:15:55 +00:00
path path: add path/posix and path/win32 alias modules 2020-10-20 14:27:31 +00:00
readline lib: revert to using default derived class constructors 2025-08-30 14:28:10 +00:00
stream stream: add pipeline() for webstreams 2023-02-02 19:45:42 +00:00
test test_runner: do not expose internal loader 2024-08-13 15:17:50 +02:00
timers lib: remove unnecessary optional chaining 2024-11-07 15:59:12 +00:00
util util: add util/types alias module 2020-10-21 01:26:34 +02:00
_http_agent.js http: add Agent.agentKeepAliveTimeoutBuffer option 2025-08-13 02:32:30 +00:00
_http_client.js http: fix http client leaky with double response 2025-10-13 15:58:26 +00:00
_http_common.js http: fix http client leaky with double response 2025-10-13 15:58:26 +00:00
_http_incoming.js http: add optimizeEmptyRequests server option 2025-10-14 12:17:53 +00:00
_http_outgoing.js http: lazy allocate cookies array 2025-10-27 14:01:06 +00:00
_http_server.js http: add optimizeEmptyRequests server option 2025-10-14 12:17:53 +00:00
_stream_duplex.js lib: add module to use in module deprecation warnings 2025-05-26 14:39:25 +00:00
_stream_passthrough.js lib: add module to use in module deprecation warnings 2025-05-26 14:39:25 +00:00
_stream_readable.js lib: add module to use in module deprecation warnings 2025-05-26 14:39:25 +00:00
_stream_transform.js lib: add module to use in module deprecation warnings 2025-05-26 14:39:25 +00:00
_stream_wrap.js lib: add module to use in module deprecation warnings 2025-05-26 14:39:25 +00:00
_stream_writable.js lib: add module to use in module deprecation warnings 2025-05-26 14:39:25 +00:00
_tls_common.js lib: add module to use in module deprecation warnings 2025-05-26 14:39:25 +00:00
_tls_wrap.js lib: add module to use in module deprecation warnings 2025-05-26 14:39:25 +00:00
assert.js assert: allow printf-style messages as assertion error 2025-10-17 20:15:17 +00:00
async_hooks.js async_hooks: move asyncResource property on bound function to EOL 2025-06-09 15:20:30 +00:00
buffer.js meta: enable jsdoc/check-tag-names rule 2025-07-18 09:28:21 +00:00
child_process.js lib: use validators for argument validation 2025-09-21 02:47:14 +00:00
cluster.js cluster: use ObjectPrototypeHasOwnProperty 2023-05-25 16:04:19 +00:00
console.js
constants.js lib: flatten access to primordials 2019-11-25 10:28:15 +01:00
crypto.js crypto: support ML-KEM, DHKEM, and RSASVE key encapsulation mechanisms 2025-08-20 14:30:58 +00:00
dgram.js dgram: restore buffer optimization in fixBufferList 2025-09-21 17:50:41 +00:00
diagnostics_channel.js diagnostics_channel: fix race condition with diagnostics_channel and GC 2025-09-19 07:28:39 +00:00
dns.js dns: move falsy hostname in lookup to end-of-life 2025-06-13 12:47:23 +00:00
domain.js domain: remove deprecated API call 2025-08-05 03:51:16 +00:00
eslint.config_partial.mjs lib: expose global ErrorEvent 2025-08-18 08:14:54 +00:00
events.js lib: prefer AsyncIteratorPrototype primordial 2025-07-29 21:54:16 +00:00
fs.js fs: port SonicBoom module to fs module as Utf8Stream 2025-07-28 20:27:07 -07:00
http.js http: expose websockets 2024-07-08 15:55:43 +00:00
http2.js http2: add server handshake utility 2024-01-12 16:09:48 +00:00
https.js http,https: handle IPv6 with proxies 2025-09-22 23:19:26 +00:00
inspector.js inspector: initial support websocket inspection 2025-08-19 10:09:14 +00:00
module.js lib: allow skipping source maps in node_modules 2025-01-23 22:44:10 +00:00
net.js lib: make ERM functions into wrappers returning undefined 2025-05-25 13:44:43 +00:00
os.js meta: enable jsdoc/check-tag-names rule 2025-07-18 09:28:21 +00:00
path.js path: refactor path joining logic for clarity and performance 2025-09-08 18:44:18 +00:00
perf_hooks.js perf_hooks: move non-standard performance properties to perf_hooks 2025-10-28 00:23:50 +01:00
process.js src: disambiguate terms used to refer to builtins and addons 2022-08-09 01:36:49 +08:00
punycode.js punycode: limit deprecation warning 2025-01-18 18:01:54 +00:00
querystring.js meta: enable jsdoc/check-tag-names rule 2025-07-18 09:28:21 +00:00
quic.js quic: continue working on quic api bits 2025-10-07 14:04:53 +00:00
readline.js lib: prefer logical assignment 2024-10-09 06:42:16 +00:00
repl.js repl: move completion logic to internal module 2025-10-08 07:37:22 +00:00
sea.js sea: implement sea.getAssetKeys() 2025-09-04 11:58:50 +00:00
sqlite.js sqlite: cleanup ERM support and export Session class 2025-05-30 17:21:30 -07:00
stream.js stream: change stream to use index instead of for...of 2024-08-23 07:31:55 +00:00
string_decoder.js meta: enable jsdoc/check-tag-names rule 2025-07-18 09:28:21 +00:00
sys.js lib: add node: prefix in sys module deprecation warning 2025-05-26 14:39:25 +00:00
test.js test_runner: add assert.register() API 2025-01-04 18:30:04 +00:00
timers.js lib: remove redundant destroyHook checks 2025-10-08 12:11:43 +00:00
tls.js tls: only do off-thread certificate loading on loading tls 2025-09-18 18:54:14 +00:00
trace_events.js trace_events: use private fields instead of symbols for Tracing 2023-12-28 23:20:22 +00:00
tty.js tty: initialize winSize array with values 2024-08-11 06:32:13 +00:00
url.js url: replaced slice with at 2025-09-14 00:39:32 +00:00
util.js lib: fix constructor in _errnoException stack tree 2025-10-13 14:25:09 +00:00
v8.js v8: add cpu profile 2025-10-11 17:20:57 +00:00
vm.js lib: add validation for options in compileFunction 2024-12-06 06:53:06 +00:00
wasi.js lib: expose setupInstance method on WASI class 2025-07-07 08:41:16 -07:00
worker_threads.js worker: add name for worker 2025-08-05 13:45:41 +00:00
zlib.js zlib: add dictionary support to zstdCompress and zstdDecompress 2025-08-04 16:13:57 +00:00