0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
Commit Graph

10834 Commits

Author SHA1 Message Date
Kirill Fomichev
018c3e8949
perf_hooks: add property flags to GCPerformanceEntry
PR-URL: https://github.com/nodejs/node/pull/29547
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
2020-02-04 17:41:44 +01:00
Rusty Conover
ee9e689df2 net: track state of setNoDelay() and prevent unnecessary system calls
The state of .setNoDelay() is now tracked and code will prevent repeated
system calls to setsockopt() when the value has already been set to the
desired value for the socket.

Change and expand the appropriate test.

PR-URL: https://github.com/nodejs/node/pull/31543
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2020-02-03 15:15:24 -08:00
bcoe
3f70d77203
fs: set path when mkdir recursive called on file
PR-URL: https://github.com/nodejs/node/pull/31607
Fixes: https://github.com/nodejs/node/issues/28015
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
2020-02-03 14:32:20 -08:00
Anna Henningsen
d435dc47f3
test: unset NODE_OPTIONS for cctest
The test may fail otherwise because of behaviour changes caused
by setting the environment variable.

Fixes: https://github.com/nodejs/node/issues/31585

PR-URL: https://github.com/nodejs/node/pull/31594
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2020-02-03 12:11:06 -08:00
ConorDavenport
d4660aba63
src: change Fill() to use ParseArrayIndex()
Changed Fill() to use ParseArrayIndex() when getting start and end
of buffers instead of Uint32Value, supporting buffers of greater
than 2**32

Fixes: https://github.com/nodejs/node/issues/31514
Co-Authored-By: Rich Trott <rtrott@gmail.com>

PR-URL: https://github.com/nodejs/node/pull/31591
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2020-02-03 12:00:41 -08:00
Guy Bedford
0f96dc266f esm: import.meta.resolve with nodejs: builtins
PR-URL: https://github.com/nodejs/node/pull/31032
Reviewed-By: Jan Krems <jan.krems@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
2020-02-03 18:31:02 +02:00
Anna Henningsen
875a4d1a58 worker: add ability to take heap snapshot from parent thread
PR-URL: https://github.com/nodejs/node/pull/31569
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2020-02-03 07:04:13 -08:00
Sam Roberts
dbaa4ca166 test: simplify test-https-simple.js
It had an unused `Agent` option (no such option exists), and some code
that common.must(Not)Call makes redundant.

PR-URL: https://github.com/nodejs/node/pull/31584
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2020-02-02 19:43:36 -08:00
Denys Otrishko
aec9ad8f6c
src: fix console debug output on Windows
The FWrite function on Windows assumed that MultiByteToWideChar
automatically null-terminates the resulting string, but it will only do
so if the size of the source was passed as -1 or null character was
explicitly counted in the size. The FWrite uses std::string and its
`.size()` method which doesn't count the null character even though the
`.data()` method adds it to the resulting string.

https://docs.microsoft.com/en-us/windows/win32/api/stringapiset/nf-stringapiset-multibytetowidechar#remarks
> MultiByteToWideChar does not null-terminate an output string if the
  input string length is explicitly specified without a terminating null
  character. To null-terminate an output string for this function, the
  application should pass in -1 or explicitly count the terminating null
  character for the input string.

PR-URL: https://github.com/nodejs/node/pull/31580
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2020-02-02 14:12:23 +01:00
Ben Noordhuis
dbe881b64c
test: show child stderr output in largepages test
The test starts child processes. A recent change is suspected of causing
flaky crashes on one of the alpine buildbots but we can't know for sure
because the test hides the child's stderr.

Refs: https://github.com/nodejs/node/pull/31547#issuecomment-581076515

PR-URL: https://github.com/nodejs/node/pull/31612
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2020-02-02 13:41:37 +01:00
Anna Henningsen
9528f95336 test: mark additional tests as flaky on Windows
Basically, any of the tests that failed in the runs for
https://github.com/nodejs/node/pull/31602 which was not already
marked as flaky.

PR-URL: https://github.com/nodejs/node/pull/31606
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
2020-02-01 22:58:56 +01:00
Anna Henningsen
06deb94714
test: fix flaky test-memory-usage
abe6a2e3d1 introduced a test that verifies that ArrayBuffer
allocations are tracked. However, V8 supports concurrent freeing
of such allocations on background threads, meaning that the results
may be subject to race conditions sometimes.

Disabling concurrent freeing makes the test pass consistently.

Refs: https://github.com/nodejs/node/pull/31550

PR-URL: https://github.com/nodejs/node/pull/31602
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2020-02-01 21:15:40 +01:00
Dylan Coakley
cb210110e9 test: verify threadId in reports
PR-URL: https://github.com/nodejs/node/pull/31556
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
2020-01-31 19:15:46 -08:00
Harshitha KP
25c3f7c61a test: remove --experimental-worker flag comment
worker is stable in the master branch. The flag is no longer required.

PR-URL: https://github.com/nodejs/node/pull/31563
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2020-01-31 18:48:52 -08:00
bcoe
13fe56bbbb
fs: return first folder made by mkdir recursive
mkdir('/foo/bar', { recursive: true }) and mkdirSync will now return
the path of the first folder created. This matches more closely
mkdirp's behavior, and is useful for setting folder permissions.

PR-URL: https://github.com/nodejs/node/pull/31530
Refs: https://github.com/nodejs/node/issues/31481
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2020-01-31 11:57:19 -08:00
Anna Henningsen
abe6a2e3d1 process: report ArrayBuffer memory in memoryUsage()
Report memory allocations performed by the `ArrayBuffer::Allocator`.

PR-URL: https://github.com/nodejs/node/pull/31550
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
2020-01-30 16:34:03 -08:00
Rich Trott
5cf789e554 test,benchmark: fix test-benchmark-zlib
PR-URL: https://github.com/nodejs/node/pull/31538
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2020-01-29 19:16:16 -08:00
Matteo Collina
24e81d7c5a stream: add regression test for async iteration completion
A test was missing for an async iterator created after the stream
had emitted 'close'. This was regressed by #31314.

See: https://github.com/nodejs/node/pull/31314

PR-URL: https://github.com/nodejs/node/pull/31508
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2020-01-28 22:22:21 -08:00
Matteo Collina
2cd9892425 Revert "stream: fix async iterator destroyed error propagation"
This reverts commit d15b8ea3bd.

PR-URL: https://github.com/nodejs/node/pull/31508
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2020-01-28 22:22:19 -08:00
Brian White
2170259940 buffer: improve concat() performance
PR-URL: https://github.com/nodejs/node/pull/31522
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2020-01-28 19:57:20 -08:00
Rusty Conover
32f63fcf0e src: fix debug crash handling null strings
When internal debug is enabled, output null strings as
"(null)" rather than crashing, matching glibc's behavior.

PR-URL: https://github.com/nodejs/node/pull/31523
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2020-01-28 19:54:43 -08:00
Robert Nagy
b851d7b986 stream: fix finished writable/readable state
writable/readable does not indicate whether as stream is
a Writable/Readable. This implements a better check for
whether a object is a Writable/Readable.

PR-URL: https://github.com/nodejs/node/pull/31527
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2020-01-28 19:49:57 -08:00
Brian White
59a1981a22 crypto: improve randomBytes() performance
PR-URL: https://github.com/nodejs/node/pull/31519
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2020-01-28 06:56:16 -08:00
legendecas
7b7e7bd185
src,lib: make ^C print a JS stack trace
If terminating the process with ctrl-c / SIGINT, prints a JS stacktrace
leading up to the currently executing code.

The feature would be enabled under option `--trace-sigint`.

Conditions of no stacktrace on sigint:

- has (an) active sigint listener(s);
- main thread is idle (i.e. uv polling), a message instead of stacktrace
  would be printed.

PR-URL: https://github.com/nodejs/node/pull/29207
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Christopher Hiller <boneskull@boneskull.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2020-01-28 13:52:27 +08:00
Anna Henningsen
a5d4a397d6
test: make test-http2-buffersize more correct
Previously, this code could have closed the server before the
connection was actually received by the server, as the `'close'`
event on the client side can be emitted before the connection
is established.

The following commit exacerbates this problem, so fix the test first.

PR-URL: https://github.com/nodejs/node/pull/31502
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
2020-01-27 17:16:41 +00:00
bcoe
f2842904c2 fs: bail on permission error in recursive directory creation
When creating directories recursively, the logic should bail
immediately on UV_EACCES and bubble the error to the user.

PR-URL: https://github.com/nodejs/node/pull/31505
Fixes: https://github.com/nodejs/node/issues/31481
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2020-01-26 22:32:33 -08:00
Justin Ridgewell
0214b90308 process: fix two overflow cases in SourceMap VLQ decoding
These both have to do with extremely large numbers, so it's unlikely to
cause a problem in practice. Still, correctness.

First, encoding `-2147483648` in VLQ returns the value `"B"`. When
decoding, we get the value `1` after reading the base64. We then check
if the first bit is set (it is) to see if we should negate it, then we
shift all bits right once. Now, `value` will be `0` and `negate` will
be `true`. So, we'd return `-0`. Which is a bug! `-0` isn't
`-2147483648`, and we've broken a round trip.

Second, encoding any number with the 31st bit set, we'd return the
opposite sign. Let's use `1073741824`. Encoding, we get `"ggggggC"`.
When decoding, we get the value `-2147483648` after reading the base64.
Notice, it's already negative (the 32nd bit is set, because the 31st was
set and we shifted everything left once). We'd then check the first bit
(it's not) and shift right. But we used `>>`, which does not shift the
sign bit. We actually wanted `>>>`, which will. Because of that bug, we
get back `-1073741824` instead of the positive `1073741824`. It's even
worse if the 32nd and 31st bits are set, `-1610612736` becomes
`536870912` after a round trip.

I recently fixed the same two bugs in Closure Compiler:
https://github.com/google/closure-compiler/commit/584418eb

PR-URL: https://github.com/nodejs/node/pull/31490
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ben Coe <bencoe@gmail.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
2020-01-26 17:03:39 -08:00
Brian White
886965963a
deps: switch to chromium's zlib implementation
This implementation provides optimizations not included upstream.

PR-URL: https://github.com/nodejs/node/pull/31201
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2020-01-26 18:47:02 -05:00
Robert Nagy
2c54459378 stream: implement throw for async iterator
PR-URL: https://github.com/nodejs/node/pull/31316
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
2020-01-26 17:53:08 +01:00
Robert Nagy
a6d63c44a2 stream: normalize async iterator stream destroy
PR-URL: https://github.com/nodejs/node/pull/31316
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
2020-01-26 17:53:04 +01:00
Robert Nagy
90e6e18f33 stream: add async iterator support for v1 streams
PR-URL: https://github.com/nodejs/node/pull/31316
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
2020-01-26 17:52:57 +01:00
Gabriel Schulhof
42995a3a11 test: cover property n-api null cases
Add test coverage for passing `NULL` to each parameter of
`napi.*(propert|element)` and `napi_set_prototype`. In the case of
`napi_define_properties` also test setting various initializer fields
to `NULL`.

PR-URL: https://github.com/nodejs/node/pull/31488
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2020-01-25 21:23:05 -08:00
Anna Henningsen
278d37d90d test: fix test-heapdump-worker
This test was broken by de2c68c7dd.

Refs: https://github.com/nodejs/node/pull/31386

PR-URL: https://github.com/nodejs/node/pull/31494
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2020-01-25 08:30:51 -08:00
Ruben Bridgewater
725682cc50 util: fix inspection of typed arrays with unusual length
This makes sure `util.inspect()` does not throw in case the typed
array's length property was set to something invalid. Instead,
always use the original information.

PR-URL: https://github.com/nodejs/node/pull/31458
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2020-01-24 21:09:17 -08:00
Eran Levin
67e067eb06 fs: watch signals for recursive incompatibility
This pull request makes fs.watch throw exception,
whenever it is used in an incompatible platform.
For this change following changes were made to api:

1.a new error type has been introduced.
2.fs.watch has been changed accordingly.

Users who use recursive  on
non-windows and osx platforms,
will face a new exception.
For this reason, it's a breaking change.

Fixes: https://github.com/nodejs/node/issues/29901

PR-URL: https://github.com/nodejs/node/pull/29947
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2020-01-24 20:57:27 -08:00
Anna Henningsen
d6f1e395ca
http: make --insecure-http-parser configurable per-stream or per-server
From the issue:

> Some servers deviate from HTTP spec enougth that Node.js can't
> communicate with them, but "work" when `--insecure-http-parser`
> is enabled globally. It would be useful to be able to use this
> mode, as a client, only when connecting to known bad servers.

This is largely equivalent to https://github.com/nodejs/node/pull/31446
in terms of code changes.

Fixes: https://github.com/nodejs/node/issues/31440
Refs: https://github.com/nodejs/node/pull/31446

PR-URL: https://github.com/nodejs/node/pull/31448
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2020-01-24 17:54:23 +01:00
cjihrig
748eae93c6
test: add tests for main() argument handling
This test provides missing coverage for __wasi_args_get() and
__wasi_args_sizes_get(), which translate to argc and argv in
WASI applications.

PR-URL: https://github.com/nodejs/node/pull/31426
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2020-01-24 09:41:46 -05:00
Anna Henningsen
32e7e813e9
src: use custom fprintf alike to write errors to stderr
This allows printing errors that contain nul characters, for example.

Fixes: https://github.com/nodejs/node/issues/28761
Fixes: https://github.com/nodejs/node/issues/31218

PR-URL: https://github.com/nodejs/node/pull/31446
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2020-01-23 22:39:00 +01:00
Anna Henningsen
9cc747bfce
src: add C++-style sprintf utility
Add an utility that handles C++-style strings and objects well.

PR-URL: https://github.com/nodejs/node/pull/31446
Fixes: https://github.com/nodejs/node/issues/28761
Fixes: https://github.com/nodejs/node/issues/31218
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2020-01-23 22:38:58 +01:00
Tobias Nießen
f6c6236d95 crypto: improve errors in DiffieHellmanGroup
1. The DiffieHellmanGroup class is only instantiated from within
   Node.js, which always passes exactly one argument.
2. Use the existing ERR_CRYPTO_UNKNOWN_DH_GROUP error code for the
   existing "Unknown group" error. The message has not been changed
   to prevent breaking existing applications.

PR-URL: https://github.com/nodejs/node/pull/31445
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2020-01-23 15:33:06 -04:00
Tobias Nießen
8c313ceedf crypto: assign and use ERR_CRYPTO_UNKNOWN_CIPHER
PR-URL: https://github.com/nodejs/node/pull/31437
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2020-01-23 11:06:14 -08:00
cjihrig
96058f33a9 test: add wasi test for freopen()
This test provides missing coverage for __wasi_fd_renumber().

PR-URL: https://github.com/nodejs/node/pull/31432
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
2020-01-23 05:22:36 -08:00
Geoffrey Booth
c692568a09 module: drop support for extensionless main entry points in esm
PR-URL: https://github.com/nodejs/node/pull/31415
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Bradley Farias <bradley.meck@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2020-01-22 23:21:11 -08:00
Geoffrey Booth
04d07ed3ab module: revert #31021
reverses baa3621bb1

PR-URL: https://github.com/nodejs/node/pull/31415
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Bradley Farias <bradley.meck@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2020-01-22 23:21:02 -08:00
Rich Trott
dc90f925fb test: remove bluebird remnants from test fixture
The test fixture in test/fixtures/bluebird was largely copied from
bluebird, where a regression in Node.js was discovered. Simplify the
test by removing a lot of things that aren't necessary to replicate the
problem. Change name from bluebird to something less likely to cause
someone to believe that we are actually loading bluebird (as we are
not).

PR-URL: https://github.com/nodejs/node/pull/31435
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: David Carlier <devnexen@gmail.com>
2020-01-22 22:10:05 -08:00
Tobias Nießen
9f22fda646 errors: make use of "cannot" consistent
PR-URL: https://github.com/nodejs/node/pull/31420
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
2020-01-22 23:43:57 -04:00
Anna Henningsen
1046816875
worker: move JoinThread() back into exit callback
de2c68c7dd moved this call to
the destructor, under the assumption that that would essentially
be equivalent to running it as part of the callback since the
worker would be destroyed along with the callback.

However, the actual code in
`Environment::RunAndClearNativeImmediates()` comes with the subtlety
that testing whether a JS exception has been thrown
happens between the invocation of the callback and its destruction,
leaving a possible exception from `JoinThread()` potentially
unhandled (and unintentionally silenced through the `TryCatch`).

This affected exceptions thrown from the `'exit'` event of the
Worker, and made the `parallel/test-worker-message-type-unknown`
test flaky, as the invalid message was sometimes only received
during the Worker thread’s exit handler.

Fix this by moving the `JoinThread()` call back to where it was
before.

Refs: https://github.com/nodejs/node/pull/31386

PR-URL: https://github.com/nodejs/node/pull/31468
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
2020-01-23 02:59:39 +01:00
Ruben Bridgewater
8fb5fe28a4
util: improve unicode support
The array grouping function relies on the width of the characters.
It was not calculated correct so far, since it used the string
length instead.
This improves the unicode output by calculating the mono-spaced
font width (other fonts might differ).

PR-URL: https://github.com/nodejs/node/pull/31319
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Steven R Loomis <srloomis@us.ibm.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
2020-01-22 15:33:03 +01:00
Anna Henningsen
2606e1ed25
report: add support for Workers
Include a report for each sub-Worker of the current Node.js instance.

This adds a feature that is necessary for eventually making the report
feature stable, as was discussed during the last collaborator summit.

Refs: https://github.com/openjs-foundation/summit/pull/240

PR-URL: https://github.com/nodejs/node/pull/31386
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2020-01-21 23:51:38 +01:00
Ben Noordhuis
5005c3c72c lib,src: switch Buffer::kMaxLength to size_t
Change the type of `Buffer::kMaxLength` to size_t because upcoming
changes in V8 will allow typed arrays > 2 GB on 64 bits platforms.

Not all platforms handle file reads and writes > 2 GB though so keep
enforcing the 2 GB typed array limit for I/O operations.

Fixes: https://github.com/nodejs/node/issues/31399
Refs: https://github.com/libuv/libuv/pull/1501

PR-URL: https://github.com/nodejs/node/pull/31406
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Shelley Vohr <codebytere@gmail.com>
2020-01-21 13:55:40 -08:00