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

30630 Commits

Author SHA1 Message Date
Juan José Arboleda
39ceb6ae78 src: remove unused headers in src/util.h
PR-URL: https://github.com/nodejs/node/pull/33070
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
2020-05-21 18:29:10 -07:00
Anna Henningsen
c45313b3ad worker: perform initial port.unref() before preload modules
The refcount of the internal communication port is relevant for
stdio, but the `port.unref()` call effectively resets any `.ref()`
calls happening during stdio operations happening before it.

Therefore, do the `.unref()` call before loading preload modules,
which may cause stdio operations.

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

PR-URL: https://github.com/nodejs/node/pull/33455
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
2020-05-21 17:50:04 -07:00
Anna Henningsen
b6b82cba27 src: use enum for refed flag on native immediates
Refs: https://github.com/nodejs/node/pull/33320#discussion_r423141443

PR-URL: https://github.com/nodejs/node/pull/33444
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Zeyu Yang <himself65@outlook.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2020-05-21 17:47:56 -07:00
Anna Henningsen
6f6bf010a7 src: use symbol to store AsyncWrap resource
Use a symbol on the bindings object to store the public resource object,
rather than a `v8::Global` Persistent. This has several advantages:

- It’s harder to inadvertently create memory leaks this way.
  The garbage collector sees the `AsyncWrap` →  resource link like
  a regular JS property, and can collect the objects as a group,
  even if the resource object should happen to point back to the
  `AsyncWrap` object.
- This will make it easier in the future to use `owner_symbol` for
  this purpose, which is generally the direction we should be moving
  the `async_hooks` API into (i.e. using more public objects instead
  of letting internal wires stick out).

PR-URL: https://github.com/nodejs/node/pull/31745
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
2020-05-21 17:45:09 -07:00
Bartosz Sosnowski
a4e273baf4 win,fs: use namespaced path in absolute symlinks
Use the namespaced (with the \\?\ prefix) paths for symlink targets when
the path is absolute. This allows creation of symlinks to files with
long filenames.

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

PR-URL: https://github.com/nodejs/node/pull/33351
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2020-05-21 14:12:42 +02:00
Bradley Farias
cd4985c488 esm: doc & validate source values for formats
PR-URL: https://github.com/nodejs/node/pull/32202
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Geoffrey Booth <webmaster@geoffreybooth.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Zeyu Yang <himself65@outlook.com>
2020-05-21 12:59:50 +08:00
Ruben Bridgewater
19d9e2003e repl: simplify repl autocompletion
This refactors the repl autocompletion code for simplicity and
readability.

Signed-off-by: Ruben Bridgewater <ruben@bridgewater.de>

PR-URL: https://github.com/nodejs/node/pull/33450
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2020-05-20 17:31:47 +02:00
Ruben Bridgewater
76c5dc995e repl: support optional chaining during autocompletion
This makes sure the autocompletion is able to handle optional
chaining notations.

Signed-off-by: Ruben Bridgewater <ruben@bridgewater.de>

PR-URL: https://github.com/nodejs/node/pull/33450
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2020-05-20 17:31:47 +02:00
Ruben Bridgewater
9de08f773e
lib: update TODO comments
This removes one TODO comment and adds another that indicates that
readline is currently not able to trigger specific escape sequences.

Signed-off-by: Ruben Bridgewater <ruben@bridgewater.de>

PR-URL: https://github.com/nodejs/node/pull/33361
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
2020-05-20 17:05:06 +02:00
Ruben Bridgewater
da7be6979e
doc: fix readline key binding documentation
The documentation for two key bindings was not correct.

Signed-off-by: Ruben Bridgewater <ruben@bridgewater.de>

PR-URL: https://github.com/nodejs/node/pull/33361
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
2020-05-20 17:05:01 +02:00
Michael Dawson
4c4c226359 src: prefer make_unique
In most of the code base we use make_unique instead of
new unique_ptr. Update node_platform.cc to be consistent
with that.

Signed-off-by: Michael Dawson <michael_dawson@ca.ibm.com>

PR-URL: https://github.com/nodejs/node/pull/33378
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Zeyu Yang <himself65@outlook.com>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
2020-05-20 09:17:57 -04:00
Shelley Vohr
81216a349d
doc: claim ABI version 85 for Electron 11
PR-URL: https://github.com/nodejs/node/pull/33375
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2020-05-20 13:26:45 +02:00
Daniel Bevenius
37b4717728 src: remove unnecessary else in base_object-inl.h
This commit removes two unnecessary else statements in
base_object-inl.h. It also tries to make the if statements consistent
with regards to braces.

PR-URL: https://github.com/nodejs/node/pull/33413
Reviewed-By: Zeyu Yang <himself65@outlook.com>
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: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
2020-05-20 12:38:25 +02:00
Anna Henningsen
d2a6f06dce
worker: use _writev in internal communication
PR-URL: https://github.com/nodejs/node/pull/33454
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2020-05-20 12:37:25 +02:00
Jan Krems
6961c7f804
deps: update node-inspect to v2.0.0
Highlights:

* Remove use of `process.binding` on modern node (@addaleax)
* Increase timeout for port checking (@yilmazdurmaz)
* Auto-resume on start when `NODE_INSPECT_RESUME_ON_START`
  is set (@dolsem)

Compare: https://github.com/nodejs/node-inspect/compare/v1.11.6...v2.0.0

PR-URL: https://github.com/nodejs/node/pull/33447
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Matheus Marchini <mat@mmarchini.me>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2020-05-20 12:36:34 +02:00
rickyes
1a12b82396
fs: refactor the import of internalUtil
PR-URL: https://github.com/nodejs/node/pull/33296
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Zeyu Yang <himself65@outlook.com>
2020-05-20 12:34:54 +02:00
Pranshu Srivastava
08308c7111
http2: do not modify explicity set date headers
Fixes: https://github.com/nodejs/node/issues/30894
Refs: https://github.com/nodejs/node/issues/29829

PR-URL: https://github.com/nodejs/node/pull/33160
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2020-05-20 12:33:50 +02:00
Ruben Bridgewater
3a5158878b
util: mark classes while inspecting them
This outlines the basic class setup when inspecting a class.

Signed-off-by: Ruben Bridgewater <ruben@bridgewater.de>

PR-URL: https://github.com/nodejs/node/pull/32332
Fixes: https://github.com/nodejs/node/issues/32270
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
2020-05-20 12:32:22 +02:00
Daniel Bevenius
ff016fbd83 lib: update executionAsyncId/triggerAsyncId comment
This commit updates the comment referring to the
executionAsyncId/triggerAsyncId pair being stored in a std::stack.

It looks like this was changed from std::stack to AliasedFloat64Array in
Commit 83e5215a4e ("async_hooks: use
typed array stack as fast path").

PR-URL: https://github.com/nodejs/node/pull/33396
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2020-05-20 11:31:14 +02:00
delvedor
daa65fba7d http: added scheduling option to http agent
In some cases, it is preferable to use a lifo scheduling strategy
for the free sockets instead of default one, which is fifo.
This commit introduces a scheduling option to add the ability
to choose which strategy best fits your needs.

PR-URL: https://github.com/nodejs/node/pull/33278
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2020-05-20 11:00:14 +02:00
Antoine du Hamel
a82001a387
doc: document module.path
Refs: https://github.com/nodejs/node/pull/26970
Fixes: https://github.com/nodejs/node/issues/33270

PR-URL: https://github.com/nodejs/node/pull/33323
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2020-05-20 00:09:19 +02:00
Ethan Arrowood
38f444060b
doc: add fs.open() multiple constants example
PR-URL: https://github.com/nodejs/node/pull/33281
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2020-05-20 00:04:43 +02:00
Tobias Nießen
1786504afa
doc: fix typos in handle scope descriptions
PR-URL: https://github.com/nodejs/node/pull/33267
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: Masashi Hirano <shisama07@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2020-05-20 00:00:40 +02:00
Pranshu Srivastava
ee8756760c
http2: comment on usage of Object.create(null)
Refs: https://github.com/nodejs/node/issues/29829

PR-URL: https://github.com/nodejs/node/pull/33183
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2020-05-19 23:58:10 +02:00
Anna Henningsen
0e92ae64f0
worker: fix race condition in node_messaging.cc
`AddToIncomingQueue()` relies on `owner_` only being modified with
`mutex_` being locked, but in these two places, that didn’t happen.

Modify them to use `Detach()` instead, which has the same effect
as setting `owner_ = nullptr` here, but does it with proper locking.

This race condition probably only shows up in practice when Node.js
is compiled in debug mode, because the compiler eliminates the
duplicate load in `AddToIncomingQueue()` when compiling with
optimizations enabled.

PR-URL: https://github.com/nodejs/node/pull/33429
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2020-05-19 23:56:57 +02:00
Daniel Bevenius
61189d3981
src: reduce duplication in RegisterHandleCleanups
This commit suggest using a lambda for the RegisterHandlerCleanup calls
in RegisterHandleCleanups.

The motivation is to reduce some duplication and to make it a little
easier to read as all of the calls pass in the same arguments, apart
from casting the uv handle.

PR-URL: https://github.com/nodejs/node/pull/33421
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Zeyu Yang <himself65@outlook.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
2020-05-19 23:56:16 +02:00
Anna Henningsen
7c755b06ce
build: run full test suite in ASAN action
Refs: https://github.com/nodejs/node/pull/32776

PR-URL: https://github.com/nodejs/node/pull/33170
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Matheus Marchini <mat@mmarchini.me>
2020-05-19 23:33:41 +02:00
Shelley Vohr
c841f516d5
2020-05-19, Version 14.3.0 (Current)
Notable changes:

async_hooks:
  * (SEMVER-MINOR) move PromiseHook handler to JS (Stephen Belanger) https://github.com/nodejs/node/pull/32891
cli:
  * (SEMVER-MINOR) add `--trace-atomics-wait` flag (Anna Henningsen) https://github.com/nodejs/node/pull/33292
fs:
  * (SEMVER-MINOR) add .ref() and .unref() methods to watcher classes (rickyes) https://github.com/nodejs/node/pull/33134
http:
  * (SEMVER-MINOR) expose http.validate-header-name/value (osher) https://github.com/nodejs/node/pull/33119
repl:
  * (SEMVER-MINOR) deprecate repl._builtinLibs (Ruben Bridgewater) https://github.com/nodejs/node/pull/33294
  * (SEMVER-MINOR) deprecate repl.inputStream and repl.outputStream (Ruben Bridgewater) https://github.com/nodejs/node/pull/33294
  * (SEMVER-MINOR) show reference errors during preview (Ruben Bridgewater) https://github.com/nodejs/node/pull/33282
  * (SEMVER-MINOR) improve repl preview (Ruben Bridgewater) https://github.com/nodejs/node/pull/33282
src:
  * add support for TLA (Gus Caplan) https://github.com/nodejs/node/pull/30370

PR-URL: https://github.com/nodejs/node/pull/33452
2020-05-19 14:28:43 -07:00
Richard Townsend
8833551257 build,win: add support for MSVC cross-compilation
* Fixes cases in icutools where commands were issued without .exe
* Changes to build scripts
* Add /fp:strict flag so that MSVC's floating point behaves correctly
* Enables marmasm

PR-URL: https://github.com/nodejs/node/pull/32867
Reviewed-By: Christian Clauss <cclauss@me.com>
Reviewed-By: João Reis <reis@janeasystems.com>
2020-05-19 19:30:40 +01:00
Richard Townsend
66807e995d tools,gyp: add support for MSVC cross-compilation
This change means that GYP can now generate two sets of projects: one
exclusively for a host x64 machine and one containing a mix of x64 and
Arm targets. The names of host targets are fixed up to end with
_host.exe, and any actions involving them are fixed up. This allows
compilation of Node on an x64 server for a Windows on Arm target.

PR-URL: https://github.com/nodejs/node/pull/32867
Reviewed-By: Christian Clauss <cclauss@me.com>
Reviewed-By: João Reis <reis@janeasystems.com>
2020-05-19 19:27:25 +01:00
Jonathan Buhacoff
d093e788d1
doc: update function description for decipher.setAAD
According to the
[NodeJS CCM example](https://nodejs.org/docs/latest-v14.x/api/crypto.html#crypto_ccm_mode],
when decrypting the `plaintextLength` parameter actually refers to the
ciphertext length, not the plaintext length:

```
decipher.setAAD(aad, {
  plaintextLength: ciphertext.length
});
```

The same can be seen in the
[OpenSSL docs](https://wiki.openssl.org/index.php/EVP_Authenticated_Encryption_and_Decryption)
where a call to `EVP_DecryptUpdate` passes the ciphertext length:

```
/* Provide the total ciphertext length */
    if(1 != EVP_DecryptUpdate(ctx, NULL, &len, NULL, ciphertext_len))
        handleErrors();
```

This parameter probably should have been called `inputLength` or
`bufferLength` instead of `plaintextLength`, so that it makes sense
both when encrypting and decrypting, but at least we can correct the
sentence in the documentation for now to refer to the correct value.

PR-URL: https://github.com/nodejs/node/pull/33095
Reviewed-By: Ujjwal Sharma <ryzokuken@disroot.org>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2020-05-19 19:28:36 +02:00
Benjamin Gruenbaum
b51d1cfbf2
doc: add comment about highWaterMark limit
Add a comment regarding memory limits and setting highWaterMark

PR-URL: https://github.com/nodejs/node/pull/33432
Reviewd-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>

Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2020-05-19 19:20:51 +02:00
cjihrig
3abb52fdb6
deps: update to uvwasi 0.0.9
Notable changes:

- A `DEBUG()` macro and `UVWASI_DEBUG_LOG` build option have been
  added to improve debugging.
- Path length restrictions have been removed across the codebase.
- Initial support for `poll_oneoff()` has been added on all
  platforms. The implementation is based on `uv_poll_t`'s.
- A new `uvwasi_size_t` has been introduced across the WASI system
  call API. This provides consistent 32-bit `size_t`'s.
- The cmake test targets are now only generated if uvwasi is the
  root project to avoid conflicts with targets from embedders.
- `uv.h` has been removed from the public headers.
- A serialization/deserialization API has been added to simplify
  the process of working with WASM memory. This also hides many
  WASI <--> WASM interfacing implementation details from
  embedders.
- A memory corruption bug on Windows related to path resolution
  has been fixed.

PR-URL: https://github.com/nodejs/node/pull/33445
Fixes: https://github.com/nodejs/node/issues/33403
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
2020-05-19 19:19:39 +02:00
cjihrig
227ad25cc6
deps: upgrade to libuv 1.38.0
Notable changes:

- `uv_library_shutdown()` has been added.
- `uv_udp_init_ex()` now accepts `UV_UDP_RECVMMSG`, although it
  is a no-op.
- Obsolete `MAX_PATH` restrictions have been removed on Windows,
  and Windows is now long path aware.
- Windows environment variables longer than 32,767 characters are
  now supported.
- Linux `cpu_times` are now reported as milliseconds to match
  other platforms.
- A memory leak resulting from `uv_loop_init()` failures has
  been fixed.

PR-URL: https://github.com/nodejs/node/pull/33446
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
2020-05-19 19:18:35 +02:00
Shelley Vohr
ed9be3ab47
deps: update icu to include tzdata2020a
PR-URL: https://github.com/nodejs/node/pull/33362
Reviewed-By: Steven R Loomis <srloomis@us.ibm.com>
2020-05-19 08:38:06 -07:00
Joyee Cheung
8b0bdc918e
doc: clarify about the Node.js-only extensions in perf_hooks
- Add clarifications for Node.js-only extensions
- Explain the Web Performance APIs implemented in Node.js and
  clarify that perf_hooks also include other non-Web APIs.
- Prefix exposed interfaces with `perf_hooks.` to distinguish
  them from internal classes.

PR-URL: https://github.com/nodejs/node/pull/33199
Refs: https://github.com/nodejs/node/issues/28635
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2020-05-19 22:16:10 +08:00
Andrew Paprocki
fe1b9e09a8
doc: document ICU time zone data update process
Updates the "Maintaining ICU" document and describes the process
to update an existing ICU `.dat` file with updated binary time
zone data files corresponding to new IANA `tzdata` releases.

Requested in nodejs/node#30211 by @srl295

PR-URL: https://github.com/nodejs/node/pull/30364
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: Steven R Loomis <srloomis@us.ibm.com>
2020-05-18 19:35:20 -07:00
Robert Nagy
2361b5c041 stream: forward writableObjectMode
Duplex did not properly forward writableObjectMode.

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

PR-URL: https://github.com/nodejs/node/pull/33390
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2020-05-19 00:02:32 +02:00
Anna Henningsen
0e5b975873
src: add default: case to silence compiler warning
This fails compilation on at least one platform because there is no
`default:` case, despite all currently possible enum values being
listed.

Fix that by adding a default message that won’t be used unless V8
introduces new enum values.

Refs: c7eeef568c (commitcomment-39228519)

PR-URL: https://github.com/nodejs/node/pull/33451
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
2020-05-18 05:50:44 -04:00
Daniel Bevenius
ef1eb8d439 src: remove unused IsolateSettings variable
PR-URL: https://github.com/nodejs/node/pull/33417
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
2020-05-18 07:13:45 +02:00
Daniel Bevenius
ebffd229a1 src: remove unused misc variable
This commit removes the unused 'misc' variable from one of the
NodeMainInstance constructors.

Another option could be to add a default argument to
SetIsolateMiscHandlers but I'd like to hear what others think about that
first.

PR-URL: https://github.com/nodejs/node/pull/33417
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
2020-05-18 07:13:33 +02:00
Daniel Bevenius
b477ac83e6 src: add promise_resolve to SetupHooks comment
This commit adds promise_resolve to the list of callbacks mentioned in
the comment. It also fixes a minor typo, every -> ever.

PR-URL: https://github.com/nodejs/node/pull/33365
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
2020-05-18 06:16:04 +02:00
Antoine du HAMEL
a12a2d892f repl: update deprecation codes
Refs: https://github.com/nodejs/node/pull/33294

PR-URL: https://github.com/nodejs/node/pull/33430
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2020-05-18 03:20:40 +02:00
Thomas
1c619143eb errors: skip fatal error highlighting on windows
Some consoles do not convert ANSI escape sequences to colors,
rather display them directly to the stdout. On those consoles,
libuv emulates colors by intercepting stdout stream and calling
corresponding Windows API functions for setting console colors.
However, fatal error are handled differently and we cannot easily
highlight them.

PR-URL: https://github.com/nodejs/node/pull/33132
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2020-05-18 02:31:30 +02:00
Rich Trott
b3ca8869a6 tools: update dependencies for markdown linting
PR-URL: https://github.com/nodejs/node/pull/33412
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
2020-05-16 22:02:14 -07:00
Rich Trott
bea0ee8033 doc: prepare 14.x changelog for remark update
Add a comment to disable a rule in the 14.x changelog that will be
needed once we update remark lint dependencies. This comment appears in
the other changelogs.

Refs: https://github.com/nodejs/remark-preset-lint-node/pull/89#issuecomment-628978791

PR-URL: https://github.com/nodejs/node/pull/33412
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
2020-05-16 22:02:11 -07:00
Gus Caplan
b46bbf2e19
doc: fix extension in esm example
PR-URL: https://github.com/nodejs/node/pull/33408
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
2020-05-16 21:09:12 -05:00
Anna Henningsen
c1ee70ec16
buffer,n-api: release external buffers from BackingStore callback
Release `Buffer` and `ArrayBuffer` instances that were created through
our addon APIs and have finalizers attached to them only after V8 has
called the deleter callback passed to the `BackingStore`, instead of
relying on our own GC callback(s).

This fixes the following race condition:

1. Addon code allocates pointer P via `malloc`.
2. P is passed into `napi_create_external_buffer` with a finalization
   callback which calls `free(P)`. P is inserted into V8’s global array
   buffer table for tracking.
3. The finalization callback is executed on GC. P is freed and returned
   to the allocator. P is not yet removed from V8’s global array
   buffer table. (!)
4. Addon code attempts to allocate memory once again. The allocator
   returns P, as it is now available.
5. P is passed into `napi_create_external_buffer`. P still has not been
   removed from the v8 global array buffer table.
6. The world ends with `Check failed: result.second`.

Since our API contract is to call the finalizer on the JS thread on
which the `ArrayBuffer` was created, but V8 may call the `BackingStore`
deleter callback on another thread, fixing this requires posting
a task back to the JS thread.

Refs: https://github.com/nodejs/node/issues/32463#issuecomment-625877175
Fixes: https://github.com/nodejs/node/issues/32463

PR-URL: https://github.com/nodejs/node/pull/33321
Reviewed-By: James M Snell <jasnell@gmail.com>
2020-05-16 12:15:07 +02:00
Anna Henningsen
e3462614db
src: distinguish refed/unrefed threadsafe Immediates
In some situations, it can be useful to use threadsafe callbacks
on an `Environment` to perform cleanup operations that should run
even when the process would otherwise be ending.

PR-URL: https://github.com/nodejs/node/pull/33320
Reviewed-By: James M Snell <jasnell@gmail.com>
2020-05-16 12:14:15 +02:00
Anna Henningsen
48b159562d
worker: fix crash when .unref() is called during exit
To be more precise, fix a crash when `worker.unref()` is called
from a message on the Worker that is not emitted before the Worker
thread has stopped.

PR-URL: https://github.com/nodejs/node/pull/33394
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2020-05-16 11:13:30 +02:00