Extracted from the QUIC PR. Not specific to QUIC even if the
behavior is currently only used there.
Signed-off-by: James M Snell <jasnell@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/33107
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Extracted from the QUIC PR. Not specific to QUIC.
Signed-off-by: James M Snell <jasnell@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/33107
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
This is a largely cosmetic change suggested for easier
maintainability of the builtinLibs list. While the
QUIC PR no longer modifies this list, the original version
of the PR did and the fact that all of the entries were
bundled up into the same lines meant that adding one
forced a larger change to all. With this PR, when we
want to add a new built-in, it won't impact any of the
others.
PR-URL: https://github.com/nodejs/node/pull/33106
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Extracted from the [QUIC PR](https://github.com/nodejs/node/pull/32379)
So far, this is only used by the QUIC PR directly but the change itself
is independent of QUIC, even if not used directly by anything else yet.
Separated out per request.
Signed-off-by: James M Snell <jasnell@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/33104
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Throws `ERR_STREAM_NULL_VALUES` error if a null value is passed to
`Readable.from`. Also added docs for the same.
Co-Authored-By: 扩散性百万甜面包 <himself65@outlook.com>
Fixes: https://github.com/nodejs/node/issues/32845
PR-URL: https://github.com/nodejs/node/pull/32873
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Mostly, this introduces a pattern that makes sure that if a custom
error is reported, `stopped_` will be set to `true` correctly in
every cast, which was previously missing for the
`NewContext().IsEmpty()` case (which led to a hard crash from the
`Worker` destructor).
This also leaves TODO comments for a few cases in which
`ERR_WORKER_OUT_OF_MEMORY` was not used in accordance with the
documentation for that error code (or according to its intention).
Fixing that is semver-major.
PR-URL: https://github.com/nodejs/node/pull/33084
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Fix the 'uncaugth' typo in the test name.
PR-URL: https://github.com/nodejs/node/pull/33083
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
In the worker pool example, the 'kWorkerFreedEvent' should be emitted
in case of error as well. After adding new worker in the error handler,
the pending tasks should be notified of an available worker.
PR-URL: https://github.com/nodejs/node/pull/33082
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/33081
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Instead of reimplementing Writable properties, fetch them
from the Writable prototype.
PR-URL: https://github.com/nodejs/node/pull/33079
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
PR-URL: https://github.com/nodejs/node/pull/32996
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
uv_idle_init(), uv_idle_start() and uv_idle_stop() always succeed.
Remove the superfluous error handling.
Refs: https://github.com/libuv/libuv/pull/2803
PR-URL: https://github.com/nodejs/node/pull/32997
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/33077
Reviewed-By: Zeyu Yang <himself65@outlook.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
It's possible to pass in the prime and generator params as buffers
but that mode of input wasn't as rigorously checked as numeric input.
PR-URL: https://github.com/nodejs/node/pull/32739
Fixes: https://github.com/nodejs/node/issues/32738
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Zeyu Yang <himself65@outlook.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
The JS code accepted any value where `typeof sizeOrKey === 'number'`
was true but the C++ code checked that `args[0]->IsInt32()` and
subsequently aborted.
Fixes: https://github.com/nodejs/node/issues/32738
PR-URL: https://github.com/nodejs/node/pull/32739
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Zeyu Yang <himself65@outlook.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Avoid sending multiple `exitedAfterDisconnect` messages when
concurrently calling `disconnect()` and/or `destroy()` from the worker
so `ERR_IPC_DISCONNECTED` errors are not generated.
Fixes: https://github.com/nodejs/node/issues/32106
PR-URL: https://github.com/nodejs/node/pull/32793
Reviewed-By: Zeyu Yang <himself65@outlook.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Some small fixes on HTTP/2 and its documentation:
- Add a note that, on server streams, it's not necessary
to start data flow.
- Set EOF flag if we have marked all data for sending:
there's no need to wait until the queue is
actually empty (and send a separate, empty DATA).
(Note that, even with this change, a separate DATA
frame will always be sent, because the streams
layer waits until data has been flushed before
dispatching EOF)
PR-URL: https://github.com/nodejs/node/pull/28044
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Test name test-worker-message-port-message-before-close is too long for
a commit message description.
Refs: https://github.com/nodejs/node/issues/31280
PR-URL: https://github.com/nodejs/node/pull/32849
Refs: https://github.com/nodejs/node/issues/28803
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Refs: https://github.com/nodejs/node/issues/28803
PR-URL: https://github.com/nodejs/node/pull/32849
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
PR-URL: https://github.com/nodejs/node/pull/32861
Fixes: https://github.com/nodejs/node/issues/32857
Reviewed-By: Zeyu Yang <himself65@outlook.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Instead of holding shared pointers to ArrayBuffers, simplify
the code by using AliasedBuffers directly which allows the
binding to own the buffers.
PR-URL: https://github.com/nodejs/node/pull/32929
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
This release focuses on improving the robustness of the path
resolution and sandboxing, including adding support for relative
preopen paths.
PR-URL: https://github.com/nodejs/node/pull/33078
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
_start() and _initialize() shouldn't be called from the same
function, as they have different behavior. Furthermore, Node
should throw if both are provided. This commit updates the
implementation, docs, and tests accordingly.
PR-URL: https://github.com/nodejs/node/pull/33073
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Gus Caplan <me@gus.host>
Upstream WASI has renamed __wasi_unstable_reactor_start() to
_initialize(). This commit updates Node's WASI implementation to
reflect that change.
PR-URL: https://github.com/nodejs/node/pull/33073
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Gus Caplan <me@gus.host>
The links for the ArrayBufferView and WebAssembly.Instance types
appear to be broken. This commit updates them to point to the
correct MDN locations.
PR-URL: https://github.com/nodejs/node/pull/33068
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Readable stream could emit 'end' after 'close'.
PR-URL: https://github.com/nodejs/node/pull/33076
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Validate encoding passed to write(chunk, encoding, cb) and
throw if it is invalid.
PR-URL: https://github.com/nodejs/node/pull/33075
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
When cherry-picking release commits for LTS releases into master,
the `REPLACEME` metadata can be taken over as well, to give users
a more accurate view of what is being released on which release line.
This addresses this problem for all previous LTS releases for which
this has not been done.
Fixes: https://github.com/nodejs/node/issues/33001
PR-URL: https://github.com/nodejs/node/pull/33041
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Shelley Vohr <codebytere@gmail.com>
napi_async_context should be an opaque type and not be used as same as
node::async_context.
PR-URL: https://github.com/nodejs/node/pull/32928
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Currently, the URL docs for the WHATWG URL spec support are
somewhat lacking in their code example of how to access the
new URL constructor that lives inside the core url package.
PR-URL: https://github.com/nodejs/node/pull/32782
Reviewed-By: Anna Henningsen <anna@addaleax.net>
The previous error was wrongly redirecting users
to the ICU installation steps, which is unrelated to
missing Visual Studio.
PR-URL: https://github.com/nodejs/node/pull/32658
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
It used to have some `cd` commands that if done literally would
invalidate the subsequent commands. Modify them to be more accurate,
which also simplifies pasting them directly into the console from the
guide while doing an update.
PR-URL: https://github.com/nodejs/node/pull/32977
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Extract the "Cherry-pick the Release Commit to master" part to its own
section and be more precise about what should be done to handle
conflicts.
PR-URL: https://github.com/nodejs/node/pull/33042
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
Reviewed-By: Beth Griggs <Bethany.Griggs@uk.ibm.com>
PR-URL: https://github.com/nodejs/node/pull/33051
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>