Convert all anonymous callback functions in `test/async-hooks/*.js`
to use arrow functions.
`writing-tests.md` states to use arrow functions when appropriate.
PR-URL: https://github.com/nodejs/node/pull/30137
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
test-benchmark-streams is currently failing because the `sync` option is
not specified in the test, resulting in too many benchmarks running.
PR-URL: https://github.com/nodejs/node/pull/30757
Reviewed-By: Beth Griggs <Bethany.Griggs@uk.ibm.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Update REAMDE.md to be consistent with the
active/maintenance times (12/18) outlined in
https://github.com/nodejs/Release#release-plan. This was missed
when the times were swapped in the Node.js 12 timeframe.
PR-URL: https://github.com/nodejs/node/pull/30707
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Edit text for clarity and readability.
PR-URL: https://github.com/nodejs/node/pull/30723
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
It is trivially possible to cause an internal assertion error with
tls.createSecurePair(). Throw a friendly error instead. Reserve internal
assertions for things that we believe to be impossible.
PR-URL: https://github.com/nodejs/node/pull/30718
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
test-http-max-http-headers seems to run fine in parallel, even with
`tools/test.py -j 96 --repeat 192
test/parallel/test-http-max-http-headers.js`.
The same applies to `test-set-http-max-http-headers.js` which (as
written) depends on `test-http-max-http-headers.js` being in the same
directory. So that is being moved too.
PR-URL: https://github.com/nodejs/node/pull/30712
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
In test-http-max-http-headers, a comment asks why we are subtracting 32
from the length of the invalid-length-by-1 headers instead of just 1.
Subtracting 1 seems to be correct and works.
PR-URL: https://github.com/nodejs/node/pull/30712
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Use an array literal instead of using split() on a very short string.
PR-URL: https://github.com/nodejs/node/pull/30712
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
The ESM loader does not accept a directory as the referrer, it requires
a path within the directory. Add `/repl` to ensure relative dynamic
imports can succeed.
Fixes: https://github.com/nodejs/node/issues/19570
PR-URL: https://github.com/nodejs/node/pull/30609
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Coe <bencoe@gmail.com>
Make `maxHeaderSize` a.k.a. `--max-header-size` configurable now that
the legacy parser is gone (which only supported a single global value).
Refs: https://github.com/nodejs/node/pull/30567
PR-URL: https://github.com/nodejs/node/pull/30570
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
Improve performance and reduce memory usage when a writable stream
is written to with the same callback (which is the most common case)
and when the write operation finishes synchronously (which is also
often the case).
confidence improvement accuracy (*) (**) (***)
streams/writable-manywrites.js sync='no' n=2000000 0.99 % ±3.20% ±4.28% ±5.61%
streams/writable-manywrites.js sync='yes' n=2000000 *** 710.69 % ±19.65% ±26.47% ±35.09%
Refs: https://github.com/nodejs/node/issues/18013
Refs: https://github.com/nodejs/node/issues/18367
PR-URL: https://github.com/nodejs/node/pull/30710
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Original commit message:
[coverage] Fix coverage with default arguments
In the presence of default arguments, the body of the function gets
wrapped into another block. This caused our trailing-range-after-return
optimization to not apply, because the wrapper block had no source
range assigned. This CL correctly assignes a source range to that block,
which allows already present code to handle it correctly.
Note that this is not a real coverage bug; we've just been reporting
whitespace as uncovered. We're fixing it for consistency.
Originally reported on github.com/bcoe/c8/issues/66
Bug: v8:9952
Change-Id: Iab3905f558eb99126e0dad8072d03d0a312fdcd3
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1903430
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Reviewed-by: Jakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#64836}
Refs: 0dfd9ea512
PR-URL: https://github.com/nodejs/node/pull/30713
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
This bit me in a personal project since I had no reason to read the
`buf.byteOffset` docs, so point readers there explicitly.
PR-URL: https://github.com/nodejs/node/pull/29651
Reviewed-By: Anna Henningsen <anna@addaleax.net>
This commit introduces additional stage in the process of generating
html docs from markdown files. Plugin transforms links to *.md files
in the respository to links to *.html files in the online documentation.
Fixes: https://github.com/nodejs/node/issues/28689
PR-URL: https://github.com/nodejs/node/pull/29946
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Convert all anonymous callback functions in `test/addons/**/*.js`
to use arrow functions, except for those in
`test/addons/make-callback/test.js` (which reference `this`)
`writing-tests.md` states to use arrow functions when appropriate.
PR-URL: https://github.com/nodejs/node/pull/30131
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
State that the 'error' event is emitted on the underlying socket, not
the IncomingMessage object.
PR-URL: https://github.com/nodejs/node/pull/30255
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
If the process was not spawned with an IPC channel, `process.send`
will be undefined and calling it as `process.send()` would throw error
PR-URL: https://github.com/nodejs/node/pull/30277
Reviewed-By: Anna Henningsen <anna@addaleax.net>
FreeBSD provides more up to date compilers than
the one provided by the system.
PR-URL: https://github.com/nodejs/node/pull/30325
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Rod Vagg <rod@vagg.org>
Reviewed-By: James M Snell <jasnell@gmail.com>
As its actual release stage.
PR-URL: https://github.com/nodejs/node/pull/30703
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
The ability to pause input processing was added in 8a4a193 but
introduced a session memory accounting mismatch leading to potential
NGHTTP2_ENHANCE_YOUR_CALM errors.
After pausing
(f36331c1bf/src/node_http2.cc (L871)),
the early return on line 873 skips the
DecrementCurrentSessionMemory(stream_buf_.len) call below (line 878).
When we later finished processing the input chunk
(f36331c1bf/src/node_http2.cc (L1858)),
we were calling DecrementCurrentSessionMemory(stream_buf_offset_) [line
1875] which was a no-op since we just set stream_buf_offset_ to 0 [line
1873].
The correct amount to decrement by is still stream_buf_.len, since
that's the amount we skipped previously (line 878).
Fixes: https://github.com/nodejs/node/issues/29223
Refs: 164ac5b241
PR-URL: https://github.com/nodejs/node/pull/30684
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
Upcoming lint rule will require a blank line between consecutive
functions. Add it in the places where we don't have it already.
PR-URL: https://github.com/nodejs/node/pull/30696
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
- Move inline functions into an `-inl.h` file
- Move override function definitions into `.cc` files
- Remove `using` statements from header files
- Make data fields of classes private
- Mark classes at the end of hierarchies as `final`
This is also partially being done in an attempt to avoid
a particular internal compiler error, see
https://github.com/nodejs/node/pull/30475#issuecomment-554740850
for details.
PR-URL: https://github.com/nodejs/node/pull/30530
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/30267
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Fixes: https://github.com/nodejs/node/issues/30420
PR-URL: https://github.com/nodejs/node/pull/30459
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Rely on the length reported by C-Ares rather than `\0`-termination
for creating the JS string for a dns TXT response.
Fixes: https://github.com/nodejs/node/issues/30688
PR-URL: https://github.com/nodejs/node/pull/30690
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
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>
Make sure that `ArrayBuffer`s created using
`napi_create_external_arraybuffer` are rendered unusable
after its memory has been released.
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>
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>
Edit note in about `onread` option to `socket.connect()` for clarity.
PR-URL: https://github.com/nodejs/node/pull/30691
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>