ExE Boss and Antoine du Hamel
346fc0ac21
lib: support returning Safe collections from C++
...
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/36989
Refs: https://github.com/nodejs/node/pull/36652
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-06-11 09:29:57 +02:00
ZiJian Liu
726ef40fcb
perf_hooks: throw ERR_INVALID_ARG_VALUE if histogram.percentile param is NaN
...
Fixes: https://github.com/nodejs/node/issues/36936
PR-URL: https://github.com/nodejs/node/pull/36937
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2021-06-11 09:29:57 +02:00
Antoine du Hamel
77c7d979b6
module: simplify tryStatSync with throwIfNoEntry option
...
PR-URL: https://github.com/nodejs/node/pull/36971
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-06-11 09:29:57 +02:00
cjihrig
25eb720b4d
tools: update ESLint to 7.18.0
...
Update ESLint to 7.18.0
PR-URL: https://github.com/nodejs/node/pull/36955
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com >
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com >
Reviewed-By: Jiawen Geng <technicalcute@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
2021-06-11 09:29:57 +02:00
Juan José Arboleda
f43fc6b6cc
test: improve coverage for Module getters
...
PR-URL: https://github.com/nodejs/node/pull/36950
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2021-06-11 09:29:57 +02:00
Juan José Arboleda
a45d280c18
test: improve coverage on worker threads
...
PR-URL: https://github.com/nodejs/node/pull/36910
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2021-06-11 09:29:56 +02:00
Juan José Arboleda
ec4d79e259
test: improve coverage at lib/internal/vm/module.js
...
PR-URL: https://github.com/nodejs/node/pull/36898
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Michael Dawson <midawson@redhat.com >
2021-06-11 09:29:56 +02:00
Antoine du Hamel
8912caba64
lib: expose primordials object
...
Expose the internal `primordials` object to help with Node.js core
development.
```console
$ node --expose-internals -r internal/test/binding lib/fs.js
(node:5299) internal/test/binding: These APIs are for internal testing
only. Do not use them.
(Use `node --trace-warnings ...` to show where the warning was created)
```
PR-URL: https://github.com/nodejs/node/pull/36872
Reviewed-By: Bradley Farias <bradley.meck@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-06-11 09:29:56 +02:00
Antoine du Hamel
46c019b988
lib: refactor source_map to use more primordials
...
PR-URL: https://github.com/nodejs/node/pull/36733
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-06-11 09:29:56 +02:00
Antoine du Hamel
459fe6864e
zlib: refactor to avoid unsafe array iteration
...
PR-URL: https://github.com/nodejs/node/pull/36722
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Pooja D P <Pooja.D.P@ibm.com >
2021-06-11 09:29:56 +02:00
Antoine du Hamel
cf9556d8f7
lib: refactor source_map to avoid unsafe array iteration
...
PR-URL: https://github.com/nodejs/node/pull/36734
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Pooja D P <Pooja.D.P@ibm.com >
2021-06-11 09:29:55 +02:00
Antoine du Hamel
3aee77d279
vm: refactor to avoid unsafe array iteration
...
PR-URL: https://github.com/nodejs/node/pull/36752
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-06-11 09:29:55 +02:00
ExE Boss
6eaf357f49
lib: simplify primordials.uncurryThis
...
PR-URL: https://github.com/nodejs/node/pull/36866
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Pooja D P <Pooja.D.P@ibm.com >
2021-06-11 09:29:55 +02:00
Rich Trott
2907848fc9
doc: clarify event.isTrusted text
...
PR-URL: https://github.com/nodejs/node/pull/36827
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-06-11 09:29:55 +02:00
ZiJian Liu and Antoine du Hamel
18e5c0f3e2
events: refactor to use optional chaining
...
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/36763
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2021-06-11 09:29:55 +02:00
Rohan Chougule
740638de0f
zlib: refactor to use primordial instead of <string>.startsWith
...
PR-URL: https://github.com/nodejs/node/pull/36718
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Pooja D P <Pooja.D.P@ibm.com >
2021-06-11 09:29:55 +02:00
Antoine du Hamel
716076e389
tty: refactor to avoid unsafe array iteration
...
PR-URL: https://github.com/nodejs/node/pull/36771
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Pooja D P <Pooja.D.P@ibm.com >
2021-06-11 09:29:54 +02:00
Antoine du Hamel
0dea86634d
wasi: refactor to avoid unsafe array iteration
...
PR-URL: https://github.com/nodejs/node/pull/36724
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2021-06-11 09:29:54 +02:00
Michaël Zasso
c34de75687
test: guard large string decoder allocation
...
Use common.enoughTestMem to avoid "Array buffer allocation failed"
error on low memory devices.
Fixes: https://github.com/nodejs/node/issues/36792
PR-URL: https://github.com/nodejs/node/pull/36795
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
Reviewed-By: Pooja D P <Pooja.D.P@ibm.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2021-06-11 09:29:54 +02:00
Antoine du Hamel
4686f4f41b
perf_hooks: refactor to avoid unsafe array iteration
...
PR-URL: https://github.com/nodejs/node/pull/36723
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2021-06-11 09:29:54 +02:00
Antoine du Hamel
9338759b01
lib: remove v8_prof_polyfill from eslint ignore list
...
PR-URL: https://github.com/nodejs/node/pull/36537
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
2021-06-11 09:29:54 +02:00
Antoine du Hamel
dcd221ce69
errors: refactor to use more primordials
...
PR-URL: https://github.com/nodejs/node/pull/36651
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Yash Ladha <yash@yashladha.in >
2021-06-11 09:29:54 +02:00
Michaël Zasso
1dc4dea215
string_decoder: throw ERR_STRING_TOO_LONG for UTF-8
...
String::NewFromUtf8 doesn't generate an exception in V8 when the string
is too long but is guaranteed to return an empty MaybeLocal only in
that case. Generate a Node.js exception when it happens.
Fixes: https://github.com/nodejs/node/issues/35676
PR-URL: https://github.com/nodejs/node/pull/36661
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-06-11 09:29:53 +02:00
Rich Trott
3215a58843
test: add already-aborted-controller test for spawn()
...
PR-URL: https://github.com/nodejs/node/pull/36644
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com >
2021-06-11 09:29:53 +02:00
Rich Trott
e5fae63108
child_process: reduce abort handler code duplication
...
Move duplicate abort handler logic into a separate function.
PR-URL: https://github.com/nodejs/node/pull/36644
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com >
2021-06-11 09:29:53 +02:00
Rich Trott
598d2bdf09
child_process: treat already-aborted controller as aborting
...
If an AbortController passed to execfile() is already aborted, use the
same behavior as if the controller was aborted after calling execfile().
This mimics the behavior of fetch in the browser.
PR-URL: https://github.com/nodejs/node/pull/36644
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com >
2021-06-11 09:29:53 +02:00
Rich Trott
c3b116795b
test: add test for reused AbortController with execfile()
...
Test that reusing an aborted AbortController with execfile() results in
immediate SIGTERM.
PR-URL: https://github.com/nodejs/node/pull/36644
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com >
2021-06-11 09:29:53 +02:00
Robert Nagy
ab130e929a
stream: only use legacy close listeners if not willEmitClose
...
Some streams that willEmitClose unecessarily fallback to legacy
events.
PR-URL: https://github.com/nodejs/node/pull/36649
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2021-06-11 09:29:53 +02:00
Brian White
c9861a344a
lib: remove unused code
...
PR-URL: https://github.com/nodejs/node/pull/36632
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2021-06-11 09:29:52 +02:00
Antoine du Hamel
c90f1dbeb3
https: refactor to use more primordials
...
PR-URL: https://github.com/nodejs/node/pull/36195
Reviewed-By: Andrey Pechkurov <apechkurov@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
2021-06-11 09:29:52 +02:00
raisinten
01a71dd393
lib: refactor to use more primordials in internal/encoding.js
...
PR-URL: https://github.com/nodejs/node/pull/36480
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Pooja D P <Pooja.D.P@ibm.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2021-06-11 09:29:52 +02:00
Michaël Zasso
4983ef205e
tools: update gyp-next to v0.7.0
...
Refs: https://github.com/nodejs/gyp-next/releases/tag/v0.7.0
PR-URL: https://github.com/nodejs/node/pull/36580
Reviewed-By: Richard Lau <rlau@redhat.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Ujjwal Sharma <ryzokuken@disroot.org >
2021-06-11 09:29:52 +02:00
ZiJian Liu
e6c0877604
lib: refactor to use primordials in internal/priority_queue.js
...
PR-URL: https://github.com/nodejs/node/pull/36560
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Pooja D P <Pooja.D.P@ibm.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2021-06-11 09:29:52 +02:00
Antoine du Hamel
c8b22185f7
url: refactor to use more primordials
...
PR-URL: https://github.com/nodejs/node/pull/36316
Reviewed-By: Rich Trott <rtrott@gmail.com >
2021-06-11 09:29:52 +02:00
Antoine du Hamel
9ae2a27d44
buffer: make FastBuffer safe to construct
...
Using an explicit constructor is necessary to avoid relying on
`Array.prototype[Symbol.iterator]` and `%ArrayIteratorPrototype%.next`,
which can be mutated by users.
PR-URL: https://github.com/nodejs/node/pull/36587
Refs: https://github.com/nodejs/node/pull/36428
Refs: https://github.com/nodejs/node/pull/36532
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2021-06-11 09:29:51 +02:00
Antoine du Hamel
6e3a2ffb98
lib: add primordials.SafeStringIterator
...
PR-URL: https://github.com/nodejs/node/pull/36526
Reviewed-By: Rich Trott <rtrott@gmail.com >
2021-06-11 09:29:51 +02:00
Antoine du Hamel
bf0738bc07
lib: make safe primordials safe to construct
...
PR-URL: https://github.com/nodejs/node/pull/36428
Reviewed-By: Rich Trott <rtrott@gmail.com >
2021-06-11 09:29:51 +02:00
Antoine du Hamel
7ebc18f293
lib: make safe primordials safe to iterate
...
PR-URL: https://github.com/nodejs/node/pull/36391
Backport-PR-URL: https://github.com/nodejs/node/pull/38703
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-06-11 09:29:51 +02:00
Darshan Sen
8a60ae2161
src: fix compiler warnings in node_buffer.cc
...
The variables could be initialized to `0` to avoid the warnings from
`-Wmaybe-uninitialized`.
Fixes: https://github.com/nodejs/node/issues/38718
PR-URL: https://github.com/nodejs/node/pull/38722
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Richard Lau <rlau@redhat.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com >
2021-06-11 09:29:51 +02:00
Anna Henningsen
78cde14c45
src: fix compiler warning in env.cc
...
../src/env.cc:1227:22: error: lambda capture 'this' is not used [-Werror,-Wunused-lambda-capture]
ForEachBaseObject([this](BaseObject* obj) {
^~~~
PR-URL: https://github.com/nodejs/node/pull/35547
Backport-PR-URL: https://github.com/nodejs/node/pull/38786
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Shelley Vohr <codebytere@gmail.com >
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
Reviewed-By: Jiawen Geng <technicalcute@gmail.com >
2021-06-11 09:29:50 +02:00
Anna Henningsen
ea311a41cc
src: add check against non-weak BaseObjects at process exit
...
When a process exits cleanly, i.e. because the event loop ends up
without things to wait for, the Node.js objects that are left on
the heap should be:
1. weak, i.e. ready for garbage collection once no longer
referenced, or
2. detached, i.e. scheduled for destruction once no longer
referenced, or
3. an unrefed libuv handle, i.e. does not keep the event loop
alive, or
4. an inactive libuv handle (essentially the same here)
There are a few exceptions to this rule, but generally,
if there are C++-backed Node.js objects on the heap
that do not fall into the above categories, we may be looking
at a potential memory leak. Most likely, the cause is a missing
`MakeWeak()` call on the corresponding object.
In order to avoid this kind of problem, we check the list
of BaseObjects for these criteria. In this commit, we only do so
when explicitly instructed to or when in debug mode
(where --verify-base-objects is always-on).
In particular, this avoids the kinds of memory leak issues
that were fixed in the PRs referenced below.
Refs: https://github.com/nodejs/node/pull/35488
Refs: https://github.com/nodejs/node/pull/35487
Refs: https://github.com/nodejs/node/pull/35481
PR-URL: https://github.com/nodejs/node/pull/35490
Backport-PR-URL: https://github.com/nodejs/node/pull/38786
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2021-06-11 09:29:50 +02:00
Michaël Zasso
6035492c8f
deps: update ICU to 69.1
...
Refs: https://github.com/unicode-org/icu/releases/tag/release-69-1
Backport-PR-URL: https://github.com/nodejs/node/pull/38397
PR-URL: https://github.com/nodejs/node/pull/38178
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Richard Lau <rlau@redhat.com >
Reviewed-By: Jiawen Geng <technicalcute@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-06-11 09:29:50 +02:00
Michaël Zasso
51dad8cabb
deps: V8: cherry-pick 035c305ce776
...
Original commit message:
[Intl] call new ListFormatter::createInstance
The one we currently using is now marked as internal and to be removed
for 68. Migrating to the style which already avaiable in ICU 67-1.
Bug: v8:11031
Change-Id: I668382a2e1b8602ddca02bf231c5008a6c92bf2d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2477751
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org >
Commit-Queue: Frank Tang <ftang@chromium.org >
Cr-Commit-Position: refs/heads/master@{#70638}
Refs: https://github.com/v8/v8/commit/035c305ce7761f51328b45f1bd83e26aef267c9d
PR-URL: https://github.com/nodejs/node/pull/38497
Reviewed-By: Jiawen Geng <technicalcute@gmail.com >
2021-06-11 09:29:50 +02:00
Antoine du Hamel
4fdcbae583
events: refactor to use more primordials
...
PR-URL: https://github.com/nodejs/node/pull/36304
Reviewed-By: Rich Trott <rtrott@gmail.com >
2021-06-11 09:29:50 +02:00
Benjamin Coe
a467125c8d
deps: V8: cherry-pick dfcdf7837e23
...
Original commit message:
[coverage] fix greedy nullish coalescing
The SourceRangeScope helper was consuming too many characters, instead
explicitly create SourceRange, based on scanner position.
Bug: v8:11231
Change-Id: I852d211227abacf867e8f1ab3e3ab06dbdba2a9b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2576006
Reviewed-by: Toon Verwaest <verwaest@chromium.org >
Commit-Queue: Toon Verwaest <verwaest@chromium.org >
Cr-Commit-Position: refs/heads/master@{#71765}
Refs: https://github.com/v8/v8/commit/dfcdf7837e23cc0da31f9b2d4211f856413d13af
PR-URL: https://github.com/nodejs/node/pull/36573
Fixes: https://github.com/nodejs/node/issues/36619
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Michael Dawson <midawson@redhat.com >
Reviewed-By: Jiawen Geng <technicalcute@gmail.com >
2021-06-11 09:29:49 +02:00
Michael Dawson
7efa020892
doc: expand openssl instructions
...
Refs: https://github.com/nodejs/node/pull/36541
Expand the instructions to cover what is needed when
updates are required across all active release lines
PR-URL: https://github.com/nodejs/node/pull/36554
Reviewed-By: Richard Lau <rlau@redhat.com >
Reviewed-By: Myles Borins <myles.borins@gmail.com >
2021-06-11 09:29:49 +02:00
Antoine du Hamel
1551b40d01
v8: refactor to use more primordials
...
PR-URL: https://github.com/nodejs/node/pull/36527
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Pooja D P <Pooja.D.P@ibm.com >
2021-06-11 09:29:49 +02:00
raisinten and Antoine du Hamel
e12dbc8519
lib: refactor to use more primordials in internal/histogram.js
...
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/36455
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-06-11 09:29:49 +02:00
cjihrig
613378da1e
tools: update ESLint to 7.17.0
...
Update ESLint to 7.17.0
PR-URL: https://github.com/nodejs/node/pull/36726
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Yash Ladha <yash@yashladha.in >
2021-06-11 09:29:49 +02:00
zhangyongsheng
e6d01f6545
tools: update ESLint to 7.16.0
...
PR-URL: https://github.com/nodejs/node/pull/36579
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2021-06-11 09:29:48 +02:00