Граф коммитов

22482 Коммитов

Автор SHA1 Сообщение Дата
Anna Henningsen 40fb885ecf
src: more automatic memory management in node_crypto.cc
Prefer custom smart pointers fitted to the OpenSSL data structures
over more manual memory management and lots of `goto`s.

Backport-PR-URL: https://github.com/nodejs/node/pull/20706
PR-URL: https://github.com/nodejs/node/pull/20238
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
2018-05-14 19:18:13 +02:00
Yihong Wang 34d67085d5
crypto: allocate more memory for cipher.update()
For key wrapping algorithms, calling EVP_CipherUpdate() with null output
could obtain the size for the ciphertext. Then use the returned size to
allocate output buffer. Also add a test case to verify des3-wrap.

Signed-off-by: Yihong Wang <yh.wang@ibm.com>
Backport-PR-URL: https://github.com/nodejs/node/pull/20706
PR-URL: https://github.com/nodejs/node/pull/20370
Fixes: https://github.com/nodejs/node/issues/19655
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
2018-05-14 19:18:10 +02:00
Tobias Nießen 2b2ccae390
crypto: support authTagLength in GCM encryption
The authTagLength option can now be used to produce GCM authentication
tags with a specific length.

Backport-PR-URL: https://github.com/nodejs/node/pull/20706
PR-URL: https://github.com/nodejs/node/pull/20235
Refs: https://github.com/nodejs/node/pull/20039
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Yihong Wang <yh.wang@ibm.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2018-05-14 19:18:08 +02:00
Tobias Nießen 1e5de6fe97
crypto: add using directives for v8::Int32, Uint32
Backport-PR-URL: https://github.com/nodejs/node/pull/20706
PR-URL: https://github.com/nodejs/node/pull/20225
Refs: https://github.com/nodejs/node/pull/20039
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2018-05-14 19:18:07 +02:00
Tobias Nießen f5e7010eb9
crypto: use kNoAuthTagLength in InitAuthenticated
Backport-PR-URL: https://github.com/nodejs/node/pull/20706
PR-URL: https://github.com/nodejs/node/pull/20225
Refs: https://github.com/nodejs/node/pull/20039
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2018-05-14 19:18:05 +02:00
Daniel Bevenius eb21a6b7f6
test: remove crypto.DEFAULT_ENCODING usage
This commit removes the usage of the deprectated
crypto.DEFAULT_ENCODING.

Backport-PR-URL: https://github.com/nodejs/node/pull/20706
PR-URL: https://github.com/nodejs/node/pull/20221
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2018-05-14 19:18:03 +02:00
Daniel Bevenius fd5adbc9c3
src: fix node_crypto.cc compiler warnings
Currently the following compiler warnings are issued by clang:

../src/node_crypto.cc:2801:56:
warning: '&&' within '||' [-Wlogical-op-parentheses]
return tag_len == 4 || tag_len == 8 || tag_len >= 12 && tag_len <= 16;
                                    ~~ ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
../src/node_crypto.cc:2801:56:
note: place parentheses around the '&&' expression to silence this
warning
return tag_len == 4 || tag_len == 8 || tag_len >= 12 && tag_len <= 16;
                                                     ^
../src/node_crypto.cc:2925:51:
warning: '&&' within '||' [-Wlogical-op-parentheses]
    if (cipher->auth_tag_len_ != kNoAuthTagLength &&
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
../src/node_crypto.cc:2925:51:
note: place parentheses around the '&&' expression to silence this
warning
    if (cipher->auth_tag_len_ != kNoAuthTagLength &&
                                                  ^

This commit adds parenthesis around these expressions to silence the
warnings.

Backport-PR-URL: https://github.com/nodejs/node/pull/20706
PR-URL: https://github.com/nodejs/node/pull/20216
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2018-05-14 19:18:00 +02:00
Daniel Bevenius 5ea1a58db9
crypto: remove rsaPrivate and rename rsaPublic
This commit renames rsaPublic and removes the rsaPrivate function as the
code in these two functions are identical.

Backport-PR-URL: https://github.com/nodejs/node/pull/20706
PR-URL: https://github.com/nodejs/node/pull/20164
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2018-05-14 19:17:58 +02:00
Daniel Bevenius 503844eb73
crypto: add addCipherPrototypeFunctions function
This commit adds a function named addCipherPrototypeFunctions to avoid
code duplication.

Backport-PR-URL: https://github.com/nodejs/node/pull/20706
PR-URL: https://github.com/nodejs/node/pull/20164
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2018-05-14 19:17:56 +02:00
Daniel Bevenius 72029b8cc7
crypto: add createCipher/WithIV functions
This commit extracts the common code from the Cipher/Cipheriv and
Decipher/Decipheriv constructors into a separate function to avoid
code duplication.

Backport-PR-URL: https://github.com/nodejs/node/pull/20706
PR-URL: https://github.com/nodejs/node/pull/20164
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2018-05-14 19:17:54 +02:00
Tobias Nießen bdd2856152
crypto: allow to restrict valid GCM tag length
This change allows users to restrict accepted GCM authentication tag
lengths to a single value.

Backport-PR-URL: https://github.com/nodejs/node/pull/20706
PR-URL: https://github.com/nodejs/node/pull/20039
Fixes: https://github.com/nodejs/node/issues/17523
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Yihong Wang <yh.wang@ibm.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2018-05-14 19:17:41 +02:00
David Goldstein b6ea5df08a
module: add --preserve-symlinks-main
Add `--preserve-symlinks-main` option which behaves like
`--preserve-symlinks` but for `require.main`.

PR-URL: https://github.com/nodejs/node/pull/19911
Reviewed-By: James M Snell <jasnell@gmail.com>
2018-05-12 23:58:10 +02:00
Anna Henningsen de34cfad58
test: make sure linked lists are inspectable with defaults
Make sure that a long singly-linked list can be passed
to `util.inspect()` without causing a stack overflow.

PR-URL: https://github.com/nodejs/node/pull/20017
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
2018-05-12 17:58:42 +02:00
cjihrig de06115d18
fs: make fs.promises non-enumerable
This prevents the experimental feature warning from being emitted
in cases where fs.promises is not actually used.

PR-URL: https://github.com/nodejs/node/pull/20632
Fixes: https://github.com/nodejs/node/issues/20504
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
2018-05-12 17:52:21 +02:00
musgravejw e06c5874f6
doc: add global node_modules to require.resolve()
PR-URL: https://github.com/nodejs/node/pull/20534
Fixes: https://github.com/nodejs/node/issues/18926
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2018-05-12 17:52:13 +02:00
Michael Dawson 1d7379d641
doc: fix stability text for n-api
While some places list n-api as stable, the reference
in doc/api/addons.md was missed.  This fixes that
instance.

Fixes: https://github.com/nodejs/node/issues/20645
PR-URL: https://github.com/nodejs/node/pull/20659
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.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: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
2018-05-12 17:52:06 +02:00
Gus Caplan 104c3bc443
esm: provide named exports for builtin libs
Provide named exports for all builtin libraries so that the libraries
may be imported in a nicer way for esm users. The default export is left
as the entire namespace (module.exports) and wrapped in a proxy such
that APMs and other behavior are still left intact.

PR-URL: https://github.com/nodejs/node/pull/20403
Reviewed-By: Bradley Farias <bradley.meck@gmail.com>
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Jan Krems <jan.krems@gmail.com>
2018-05-12 17:52:01 +02:00
Rich Trott ebd102e473
tools: use macOS as operating system name
As of 2016, the operating system is macOS. Remove use of "macosx".

PR-URL: https://github.com/nodejs/node/pull/20579
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2018-05-12 17:51:54 +02:00
Gus Caplan 73492233c3
doc: add util.types.isModuleNamespaceObject()
PR-URL: https://github.com/nodejs/node/pull/20616
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
2018-05-12 17:51:25 +02:00
Jeremiah Senkpiel 56530f0844
timers: make timer.refresh() a public API
Originally added in
bb5575aa75
discussions such as
https://github.com/nodejs/node/issues/20261
show the usefulness of this API to the Node.js ecosystem.

PR-URL: https://github.com/nodejs/node/pull/20298

Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
2018-05-12 17:51:18 +02:00
Benjamin Coe 41e1dc09de
test: add regression test for #11257
Refs: https://github.com/nodejs/node/issues/11257

PR-URL: https://github.com/nodejs/node/pull/20391
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
2018-05-12 17:51:10 +02:00
Vse Mozhet Byt 3929516a6f
doc: fix nits in doc/api_assets/style.css
1. Merge rule sets for identical selectors.

2. Delete impossible selector block: we have only stability indexes
   0, 1, and 2, so there can't be `.api_stability_3` class.
   Refs: nodejs.org/api/documentation.html#documentation_stability_index

PR-URL: https://github.com/nodejs/node/pull/20601
Refs: https://nodejs.org/api/documentation.html#documentation_stability_index
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Jon Moss <me@jonathanmoss.me>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
2018-05-12 17:50:56 +02:00
Anna Henningsen db457cb6a0
src: fix typo in util.h comment
PR-URL: https://github.com/nodejs/node/pull/20656
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2018-05-12 17:50:50 +02:00
Ruben Bridgewater bb857d9e71
assert: make sure throws is able to handle primitives
This fixes some possible issues with `assert.throws` and
`assert.rejects` in combination with an validation object. It will
now properly handle primitive values being thrown as error.

It also makes sure the `generatedMessage` property is properly set
if `assert.throws` or `assert.rejects` is used in combination with
an validation object and improves the error performance in such cases
by only creating the error once.

In addition it will fix detecting regular expressions from a different
context such as n-api that are passed through as validator for
`assert.throws` or `assert.rejects`. Until now those were not tested.

PR-URL: https://github.com/nodejs/node/pull/20482
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2018-05-12 17:33:55 +02:00
Anna Henningsen e93726ad10
src: fix nullptr dereference for signal during startup
This fixes a test failure when running
`test/parallel/test-child-process-spawnsync-kill-signal.js`
under load. What would happen is that `SignalExit()` tries
to shutdown the tracing agent, which might not have been set
up by the point that Node.js receives the signal.

PR-URL: https://github.com/nodejs/node/pull/20637
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2018-05-12 17:33:54 +02:00
Ruben Bridgewater c244436707
errors: move functions to error code
This makes sure the functions are actually directly beneath the
specification of an error code.
That way it is not necessary to jump around when looking at the
functionality.

PR-URL: https://github.com/nodejs/node/pull/20486
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2018-05-12 17:33:34 +02:00
Ruben Bridgewater 5d06c1e1ae
assert: move AssertionError into own file
This moves the `assert` parts from `internal/errors` into an own
file. `internal/errors` got bigger and bigger and it was difficult
to keep a good overview of what was going on. While doing so it
also removes the `internalAssert` function and just lazy loads
`assert`.

PR-URL: https://github.com/nodejs/node/pull/20486
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2018-05-12 17:33:24 +02:00
Ruben Bridgewater 01abed1c36
doc: update assert documentation
This adds concrete expected types to the assert documentation.

It also fixes a `changes` entry and improves some minor comments.

PR-URL: https://github.com/nodejs/node/pull/20486
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2018-05-12 17:33:19 +02:00
Ruben Bridgewater a5ee31bba1
assert: accept regular expressions to validate
This makes sure regular expressions on validation objects validate
against strings when used with `assert.throws` and `assert.rejects`.

PR-URL: https://github.com/nodejs/node/pull/20485
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2018-05-12 17:33:09 +02:00
Yulong Wang 08097ccf84
tools: ignore VS compiler output
Add gitignore rules to ignore compiler output under deps/v8/gypfiles.

PR-URL: https://github.com/nodejs/node/pull/20527
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2018-05-12 17:33:01 +02:00
Daniel Bevenius 0824ea9d7b
src: use unqualified names in module_wrap.cc
This commit removes the usage of qualified names for consistency.

PR-URL: https://github.com/nodejs/node/pull/20594
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
2018-05-12 17:32:54 +02:00
Daniel Bevenius 7c13e54ca7
lib: return directly from packageMainCache
This commit updates readPackage to return directly when calling
packageMainCache instead of storing the result in a local var
and returning later.

PR-URL: https://github.com/nodejs/node/pull/20591
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
2018-05-12 17:32:54 +02:00
Anna Henningsen 43ec938634
src: remove static variables from string_search
These variables can as well be stack-allocated. This avoids
relying on global state that is not protected by mutexes.

Thanks to Stephen Belanger for reviewing this change in its original PR.

Refs: https://github.com/ayojs/ayo/pull/82

PR-URL: https://github.com/nodejs/node/pull/20541
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2018-05-12 17:32:53 +02:00
cjihrig f69a823f8e
deps: upgrade to libuv 1.20.3
Refs: https://github.com/nodejs/node/pull/19377
PR-URL: https://github.com/nodejs/node/pull/20585
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
2018-05-12 17:32:36 +02:00
cjihrig c546746396
doc: add util.types.isBig{Int,Uint}64Array()
These methods are exposed, even though the BigInt64Array and
BigUint64Array types are currently behind the --harmony-bigint
command line flag.

PR-URL: https://github.com/nodejs/node/pull/20615
Fixes: https://github.com/nodejs/node/issues/20602
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2018-05-12 17:32:28 +02:00
Gabriel Schulhof d568952b8c
doc: fix missing napi_get_typedarray_info() param
Also, make the type name notation more consistent.

PR-URL: https://github.com/nodejs/node/pull/20631
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
2018-05-12 17:32:27 +02:00
Daniel Bevenius 8604481b2e
vm: move emitExperimentalWarning
This commit moves emitExperimentalWarning into the second object
destructoring of require internal/util.

PR-URL: https://github.com/nodejs/node/pull/20593
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jon Moss <me@jonathanmoss.me>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2018-05-12 17:32:27 +02:00
Anna Henningsen 4873fbaf63
src: remove unused freelist.h header
Always easy enough to re-introduce if we do need it.

PR-URL: https://github.com/nodejs/node/pull/20544
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Matheus Marchini <matheus@sthima.com>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
2018-05-12 17:32:27 +02:00
Anna Henningsen a89cc2886e
src: protect global state with mutexes
Protect environment variables and inherently per-process state with
mutexes, to better accommodate Node’s usage in
multi-threading environments.

Thanks to Stephen Belanger for reviewing this change in its original PR.

Refs: https://github.com/ayojs/ayo/pull/82
PR-URL: https://github.com/nodejs/node/pull/20542
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2018-05-12 17:32:05 +02:00
Anna Henningsen 2df99ac095
src: use lock for c-ares library init/cleanup
This helps embedders wishing to use Node.js in a multi-threaded fashion
and helps pave the way for thread-based worker support.

Thanks to Stephen Belanger for reviewing this commit in its original PR.

Refs: https://github.com/ayojs/ayo/pull/82

PR-URL: https://github.com/nodejs/node/pull/20539
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
2018-05-12 17:32:05 +02:00
Anna Henningsen 5803973206
src: minor refactor to string_search.h
- Use `std::max` instead of a custom variant
- Use member method pointers to avoid an extra layer of indirection
- Stop transferring `Vector` into the `node` namespace

PR-URL: https://github.com/nodejs/node/pull/20546
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
2018-05-12 17:31:51 +02:00
Gus Caplan 105f606202
v8: backport 9fb02b526f1cd3b859a530a01adb08bc0d089f4f
Refs: 9fb02b526f

Original commit message:

    Allow function callbacks to have Proxy as receiver.

    R=verwaest@chromium.org

    Bug: v8:5773
    Change-Id: Ifd29a1116ee8c86b8d8d24485bbfd19e260ab66b
    Reviewed-on: chromium-review.googlesource.com/1046088
    Commit-Queue: Yang Guo <yangguo@chromium.org>
    Reviewed-by: Camillo Bruni <cbruni@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#53015}

PR-URL: https://github.com/nodejs/node/pull/20575
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2018-05-12 17:31:30 +02:00
Daniel Bevenius 1f34c04bd0
net: remove typo in setTimeout comment
This commit removes `lear` from the code comment in setTimeout. I'm not
100% sure this is a typo but I've struggled to think what it could mean.
Hopefully someone else might be able to shed some light on this.

PR-URL: https://github.com/nodejs/node/pull/20576
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2018-05-12 17:31:30 +02:00
Daniel Bevenius 983cb269e0
src: don't create Undefined if not needed
This commit moves the creation of argv and only creates an undefined
value if the passed in status was not 0.

The variable name client_handle was already used in this function but
I've change that usage so that this variable name matches the
onconnection callback functions parameter name clientHandle.

PR-URL: https://github.com/nodejs/node/pull/20573
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2018-05-12 17:31:29 +02:00
Daniel Bevenius e01e060763
src: rename handle parameter object
This commit renames the handle parameter for the BaseObject constructor
to object instead of handle.

The motivation for doing this is that when stepping through an
inheritance chain it can sometimes be a little confusing when
HandleWrap is in involved. HandleWrap has a handle parameter
but calls the object that is passed to AsyncWrap object, but
then when you end up in BaseObject it is named handle.

PR-URL: https://github.com/nodejs/node/pull/20570
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
2018-05-12 17:30:08 +02:00
Daniel Bevenius 9177f734e3
doc: update VM section text
This commit updates the VM section with suggestion for a minor
improvement (hopefully) of the text.

PR-URL: https://github.com/nodejs/node/pull/20595
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2018-05-12 17:29:58 +02:00
Ujjwal Sharma 88bc6da6e9
doc: add parameters for Http2Stream:error event
Add parameters for the callback for the Http2Stream:error event
inline with the pattern in the rest of the documentation.

Refs: https://github.com/nodejs/help/issues/877#issuecomment-381253464

PR-URL: https://github.com/nodejs/node/pull/20610
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2018-05-12 17:29:58 +02:00
Ujjwal Sharma b3b267a87c
doc: add params for ClientHttp2Session:altsvc
Add parameters for the callback for the ClientHttp2Session:altsvc
event inline with the pattern in the rest of the documentation.

Refs: https://github.com/nodejs/help/issues/877#issuecomment-381253464

PR-URL: https://github.com/nodejs/node/pull/20598
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2018-05-12 17:29:57 +02:00
Vse Mozhet Byt 4a7bb406fe
doc, tools: unify stability signatures
PR-URL: https://github.com/nodejs/node/pull/20552
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2018-05-12 17:29:57 +02:00
Shobhit Chittora d327893193
doc: refactor mode constants parts in fs.md
1. removed extra mode constants doc.
2. creates bookmark to the common File Access Contants block.

PR-URL: https://github.com/nodejs/node/pull/20558
Fixes: https://github.com/nodejs/node/issues/20049
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
2018-05-12 17:29:48 +02:00