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

7024 Commits

Author SHA1 Message Date
Joyee Cheung
a38e9c438a
lib: require globals instead of using the global proxy
In addition, use process.stderr instead of console.error when
there is no need to swallow the error.

PR-URL: https://github.com/nodejs/node/pull/27112
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2019-04-16 04:24:26 +08:00
Ruben Bridgewater
9dcc9b6a6b
process: add --unhandled-rejections flag
This adds a flag to define the default behavior for unhandled
rejections. Three modes exist: `none`, `warn` and `strict`. The first
is going to silence all unhandled rejection warnings. The second
behaves identical to the current default with the excetion that no
deprecation warning will be printed and the last is going to throw
an error for each unhandled rejection, just as regular exceptions do.
It is possible to intercept those with the `uncaughtException` hook
as with all other exceptions as well.

This PR has no influence on the existing `unhandledRejection` hook.
If that is used, it will continue to function as before.

PR-URL: https://github.com/nodejs/node/pull/26599
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Matheus Marchini <mat@mmarchini.me>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
2019-04-15 18:29:07 +02:00
Ruben Bridgewater
90e958aa4d
util: only sort weak entries once
This makes sure weak entries are only sorted once, while using the
sorted option.

PR-URL: https://github.com/nodejs/node/pull/27052
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
2019-04-15 17:30:52 +02:00
Ruben Bridgewater
1940114ac3
util: highlight stack frames
Using `util.inspect` on errors is going to highlight userland and
node_module stack frames from now on. This is done by marking Node.js
core frames grey and frames that contain `node_modules` in their path
yellow.

That way it's easy to grasp what frames belong to what code.

PR-URL: https://github.com/nodejs/node/pull/27052
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
2019-04-15 17:30:50 +02:00
Ruben Bridgewater
693401d0dd
buffer: use stricter range checks
This validates the input to make sure the arguments do not overflow.
Before, if the input would overflow, it would cause the write to be
performt in the wrong spot / result in unexpected behavior.
Instead, just use a strict number validation.

PR-URL: https://github.com/nodejs/node/pull/27045
Fixes: https://github.com/nodejs/node/issues/27043
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2019-04-15 17:21:34 +02:00
Joyee Cheung
914d6c9ab8
lib: use primordials in domexception.js
PR-URL: https://github.com/nodejs/node/pull/27171
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2019-04-13 17:53:27 +08:00
Joyee Cheung
3da36d0e94
lib: create primordials in every context
This allows us to use primordials in other per-context scripts.

PR-URL: https://github.com/nodejs/node/pull/27171
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2019-04-13 17:53:25 +08:00
cjihrig
9b6b567bc4
lib,src,doc: add --heapsnapshot-signal CLI flag
This flag allows heap snapshots to be captured without
modifying application code.

PR-URL: https://github.com/nodejs/node/pull/27133
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2019-04-12 17:16:46 -04:00
Ruben Bridgewater
091902ae00 console: remove trace frame
The own function's frame was removed originally. This restors that
behavior.

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

PR-URL: https://github.com/nodejs/node/pull/27159
Reviewed-By: Eugene Ostroukhov <eostroukhov@google.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
2019-04-12 19:29:24 +08:00
Michaël Zasso
908292cf1f lib: enforce the use of Object from primordials
PR-URL: https://github.com/nodejs/node/pull/27146
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
2019-04-12 05:38:45 +02:00
ZYSzys
9ad5106934 child_process: harden fork arguments validation
Ensure that the first argument `modulePath` of `fork` method
must be provided and be of type string.

PR-URL: https://github.com/nodejs/node/pull/27039
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2019-04-12 08:54:13 +08:00
Luigi Pinca
655c90b287 net: inline maybeDestroy()
`maybeDestroy()` is only called from the listener of the `'end'` event.
That event is only emitted after the socket is connected (after `UV_EOF`
is read) and after `socket.readable` is set to `false`.

PR-URL: https://github.com/nodejs/node/pull/27136
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2019-04-11 07:53:30 +02:00
Anatoli Papirovski
47f5cc1ad1 lib: faster FreeList
Make FreeList faster by using Reflect.apply and not using
is_reused_symbol, but rather just checking whether any
items are present in the list prior to calling alloc.

PR-URL: https://github.com/nodejs/node/pull/27021
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2019-04-11 05:40:59 +02:00
cjihrig
44a3acb627
report: improve signal name validation
PR-URL: https://github.com/nodejs/node/pull/27137
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2019-04-10 20:36:10 -04:00
cjihrig
5b9e57012a
lib: add signal name validator
PR-URL: https://github.com/nodejs/node/pull/27137
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2019-04-10 20:35:54 -04:00
Marcos Casagrande
1a67c9948c
stream: remove dead code
Remove unreachable code. `state.ended` is always set to true
in this part of the code. The `else` clause can't be executed.

PR-URL: https://github.com/nodejs/node/pull/27125
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
2019-04-10 23:40:39 +02:00
szabolcsit
2a51ae424a
test: cover thenables when we check for promises
Added tests that cover the issue when assert.rejects() and
assert.doesNotReject() should not accept Thenables without
a `catch` method or any Thenable function with `catch` and
`then` methods attached.

PR-URL: https://github.com/nodejs/node/pull/24219
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2019-04-10 23:37:41 +02:00
dnlup
d6317d0a45
module: remove usage of require('util')
Use `require('internal/util/debuglog').debuglog` instead of
`require('util').debuglog` in
`lib/internal/modules/esm/create_dynamic_module.js`.

PR-URL: https://github.com/nodejs/node/pull/26803
Refs: https://github.com/nodejs/node/issues/26546
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
2019-04-10 23:21:59 +02:00
Ruben Bridgewater
c9fece38c8
util: change inspect compact and breakLength default
This changes the `compact` default from `true` to `3`. That mode
changes arrays to be grouped together, it alignes multiple small
entries on a single line in similar to `compact` true but only for
the most inner three depth levels and the closing brackets are
always on the same indentation as the openeing of the object instead
of at the same line as another property.

Big strings will be naturally broken into multiple lines instead of
having one huge line that is not well readable.

The output size mainly stays the same that way while it will be
smaller in case of big arrays.

Increasing the `breakLength` to 80 adjusts for most terminals that
support at least 80 characters in a single line and improves the
general output that way. A lot of calculations use the `breakLength`
to determine the concrete behavior.

PR-URL: https://github.com/nodejs/node/pull/27109
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2019-04-10 17:59:14 +02:00
Ruben Bridgewater
892c51f330
util: improve inspect edge cases
This makes sure `compact` number mode causes small proxies and map
entries to be printed on a single line.

It also fixed the line break calculation for `compact` mode when not
set to `true`. It now also adds the additional whitespace, comma and
quotes to the formula to prevent exceeding the `breakLength`.

PR-URL: https://github.com/nodejs/node/pull/27109
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2019-04-10 17:59:12 +02:00
cjihrig
bd9109c241
lib: move DEP0021 to end of life
Server.listenFD() has been runtime deprecated since
Node 0.7.12. This commit moves the deprecation to
end-of-life.

PR-URL: https://github.com/nodejs/node/pull/27127
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
2019-04-10 08:25:50 -04:00
kohta ito
eb8a51a35c child_process: use non-infinite maxBuffer defaults
Set the default maxBuffer size to 204,800 bytes for execSync,
execFileSync, and spawnSync.

APIs that return the child output as a string should have non-infinite
defaults for maxBuffer sizes to avoid out-of-memory error conditions. A
non-infinite default used to be the documented behaviour for all
relevant APIs, but the implemented behaviour for execSync, execFileSync
and spawnSync was to have no maxBuffer limits.

PR-URL: https://github.com/nodejs/node/pull/23027
Refs: https://github.com/nodejs/node/pull/22894
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2019-04-09 13:57:04 -07:00
cjihrig
b925379f50
fs: warn on non-portable mkdtemp() templates
Refs: https://github.com/nodejs/node/issues/26435
PR-URL: https://github.com/nodejs/node/pull/26980
Reviewed-By: James M Snell <jasnell@gmail.com>
2019-04-08 21:16:56 -04:00
Ruben Bridgewater
d11c4beb4b
module: remove dead code
This removes a lot of code that has no functionality anymore. All
Node.js internal code calls `_resolveLookupPaths` with two arguments.

The code that validates `index.js` is not required at all as we check
for these files anyway, so it's just redundant code that should be
removed.

PR-URL: https://github.com/nodejs/node/pull/26983
Refs: https://github.com/nodejs/node/pull/25362
Reviewed-By: Jan Krems <jan.krems@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2019-04-08 18:56:17 +02:00
Michaël Zasso
112cc7c275 lib: use safe methods from primordials
This changes the primordials to expose built-in prototypes with their
methods already uncurried.
The uncurryThis function is therefore moved to the primordials.
All uses of uncurryThis on built-ins are changed to import the relevant
prototypes from primordials.
All uses of Function.call.bind are also changed to use primordials.

PR-URL: https://github.com/nodejs/node/pull/27096
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
2019-04-08 11:23:09 +02:00
Tobias Nießen
969bd1eb7b crypto: add support for RSA-PSS keys
This commit adds support for RSA-PSS keys, including
- KeyObjects of type rsa-pss,
- key pair generation for RSA-PSS, and
- signing and verification using RSA-PSS keys.

PR-URL: https://github.com/nodejs/node/pull/26960
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
2019-04-08 09:22:32 +02:00
Ruben Bridgewater
d834275a48 buffer: fix custom inspection with extra properties
This broke due to a recent change that prevents exposing inspect
internals. It now relies on the public API instead and should be a
bit more robust due to that.

PR-URL: https://github.com/nodejs/node/pull/27074
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
2019-04-08 08:55:46 +02:00
Vse Mozhet Byt
5a8c55f078 lib: fix outdated comment
PR-URL: https://github.com/nodejs/node/pull/27122
Refs: 7e2088f773
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2019-04-08 06:03:33 +02:00
Ruben Bridgewater
75463a9004
assert: fix rejects stack trace and operator
This makes sure the stack trace is not removed due to a wrong stack
start function being used. It also fixes the wrong operator caused
by the same reason. This only applies in case an validation object
was used to validate the rejection passed to `assert.reject()` as
first argument.

PR-URL: https://github.com/nodejs/node/pull/27047
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2019-04-07 20:25:32 +02:00
Ruben Bridgewater
eb2d4161f5
fs: improve readFile performance
This increases the maximum buffer size per read to 512kb when using
`fs.readFile`. This is important to improve the read performance for
bigger files.

PR-URL: https://github.com/nodejs/node/pull/27063
Refs: https://github.com/nodejs/node/issues/25741
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jamie Davis <davisjam@vt.edu>
2019-04-07 11:28:15 +02:00
Nikolai Vavilov
3d8532f851 buffer: add {read|write}Big[U]Int64{BE|LE} methods
PR-URL: https://github.com/nodejs/node/pull/19691
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2019-04-06 19:30:23 +02:00
Michaël Zasso
dd89a1182f
tools: print a better message for unexpected use of globals
PR-URL: https://github.com/nodejs/node/pull/27083
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2019-04-06 16:15:28 +02:00
Joyee Cheung
de23055536
lib: remove env: node in eslint config for lib files
This patch removes the redundant `require-globals` custom
eslint rule by removing `env: node` in the eslint config
and whitelist the globals that can be accessed in native
modules instead of black listing them. This makes sense
for our `lib/` files because here we are creating the
Node.js environment instead of running in a normal user
land Node.js environment.

PR-URL: https://github.com/nodejs/node/pull/27082
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2019-04-06 12:04:36 +08:00
Joyee Cheung
864860e9f3
src: port coverage serialization to C++
This patch moves the serialization of coverage profiles into
C++. With this we no longer need to patch `process.reallyExit`
and hook into the exit events, but instead hook into relevant
places in C++ which are safe from user manipulation. This also
makes the code easier to reuse for other types of profiles.

PR-URL: https://github.com/nodejs/node/pull/26874
Reviewed-By: Ben Coe <bencoe@gmail.com>
2019-04-06 12:01:45 +08:00
Anatoli Papirovski
2c49e8b537 lib: make queueMicrotask faster
No longer create an additional scope within queueMicrotask
in order to improve performance.

PR-URL: https://github.com/nodejs/node/pull/27032
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
2019-04-05 05:37:11 +02:00
Anatoli Papirovski
d3d4e10107 async_hooks: improve AsyncResource performance
Accessing symbols is generally quite expensive and so is emitInit,
only do both when actually required.

PR-URL: https://github.com/nodejs/node/pull/27032
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
2019-04-05 05:37:01 +02:00
Tobias Nießen
2f1ed5c063 crypto: remove legacy native handles
PR-URL: https://github.com/nodejs/node/pull/27011
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2019-04-04 16:45:41 +02:00
Anatoli Papirovski
04355eff5b
async_hooks: minor cleanup and improvements
Cleanup some code and make the emit hooks very slightly faster.

PR-URL: https://github.com/nodejs/node/pull/27034
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
2019-04-04 15:55:56 +02:00
Filip Skokan
b2bb6c2b80
crypto: fix crash of encrypted private key export without cipher
PR-URL: https://github.com/nodejs/node/pull/27041
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2019-04-04 15:54:04 +02:00
ZYSzys
b965ac22ca
querystring: simplify stringify method
PR-URL: https://github.com/nodejs/node/pull/26591
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2019-04-04 15:26:06 +02:00
Ruben Bridgewater
4f094c0ae6
buffer: fix concat error message
The list argument may only be of type array, not of any other type
as it actually suggests.

PR-URL: https://github.com/nodejs/node/pull/27050
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
2019-04-04 14:21:11 +02:00
Ruben Bridgewater
0f190a5bed
module: add extra caching layer
This adds an extra modules caching layer that operates on the parent's
`path` property and the current require argument. That together can
be used as unique identifier to speed up loading the same module more
than once. It is a cache on top of the current modules cache.

It has the nice feature that this cache does not only work in the same
file but it works for the whole current directory. So if the same file
is loaded in any other file from the same directory, it will also hit
this cache instead of having to resolve the file again.

To keep it backwards compatible with the old modules cache, it detects
invalidation of that cache.

PR-URL: https://github.com/nodejs/node/pull/26970
Refs: https://github.com/nodejs/node/pull/25362
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2019-04-04 13:03:29 +02:00
Ruben Bridgewater
d0043136e5
module: add path to the module object
This adds the `path` property to the module object. It contains the
current directory as path. That is necessary to add an extra caching
layer.

It also makes sure the `id` uses a default in case it's not set.
Otherwise the `path.dirname(id)` command could fail.

PR-URL: https://github.com/nodejs/node/pull/26970
Refs: https://github.com/nodejs/node/pull/25362
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2019-04-04 13:03:28 +02:00
Ruben Bridgewater
be577615c8
module: inline try catch
Moving `try / catch` into separate functions is not necessary
anymore due to V8 optimizations.

PR-URL: https://github.com/nodejs/node/pull/26970
Refs: https://github.com/nodejs/node/pull/25362
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2019-04-04 13:03:27 +02:00
Ruben Bridgewater
3b044962c4
errors: add more information in case of invalid callbacks
This adds the actual callback that is passed through to the error
message in case an ERR_INVALID_CALLBACK error is thrown.

PR-URL: https://github.com/nodejs/node/pull/27048
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
2019-04-04 12:51:03 +02:00
Ruben Bridgewater
a9bf6652b5
util: use minimal object inspection with %s specifier
This improves `util.format()` by returning more meaningful results
when using `%s` as specifier and any object as value. Besides that
`BigInt` will also be represented with an `n` at the end to indicate
that it's of type `BigInt`.

PR-URL: https://github.com/nodejs/node/pull/26927
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
2019-04-04 12:48:57 +02:00
Joyee Cheung
e1d55a0cbc
src: port bootstrap/cache.js to C++
This allows us to query the categories of modules in C++
so we can implement the code cache generator in C++ that
does not depend on a Node.js binary.

PR-URL: https://github.com/nodejs/node/pull/27046
Refs: https://github.com/nodejs/node/issues/21563
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2019-04-04 11:16:10 +08:00
Gus Caplan
15c0947fee
lib: remove Atomics.wake
PR-URL: https://github.com/nodejs/node/pull/27033
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
2019-04-03 16:55:59 -05:00
Joyee Cheung
9dba96dc1a
process: patch more process properties during pre-execution
Delay the creation of process properties that depend on
runtime states and properties that should not be accessed
during bootstrap and patch them during pre-execution:

- process.argv
- process.execPath
- process.title
- process.pid
- process.ppid
- process.REVERT_*
- process.debugPort

PR-URL: https://github.com/nodejs/node/pull/26945
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2019-04-04 05:14:54 +08:00
Michaël Zasso
0817840f77 lib: force using primordials for JSON, Math and Reflect
Use the "no-restricted-globals" ESLint rule to lint for it.

PR-URL: https://github.com/nodejs/node/pull/27027
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2019-04-03 21:36:08 +08:00