Move the C++ `process.emit` and `process.emitWarning` methods
from `node.cc` into into `node_process_events.cc`, and
reuse the implementation in other places that need to do
`process.emit` in C++.
PR-URL: https://github.com/nodejs/node/pull/25397
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Instead of in node_internals.h. Also move process property
accessors that are not reused into node_process_object.cc
and make them static.
PR-URL: https://github.com/nodejs/node/pull/25397
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Changes `SetupProcessObject` to `CreateProessObject` which creates
the process object from scratch and return it to `Environment::Start`
to be stored in the Environment object.
PR-URL: https://github.com/nodejs/node/pull/25397
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
This commit updates the custom crypto-check ESLint rule to
detect require() calls that come before any hasCrypto
checks.
PR-URL: https://github.com/nodejs/node/pull/25399
Refs: https://github.com/nodejs/node/pull/25388
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
This removes a special casing for this data type in the main function.
PR-URL: https://github.com/nodejs/node/pull/25255
Reviewed-By: James M Snell <jasnell@gmail.com>
Remove some dead code plus some minor refactoring for readability.
The constructor can not be an empty string anymore, so just remove
that check.
PR-URL: https://github.com/nodejs/node/pull/25255
Reviewed-By: James M Snell <jasnell@gmail.com>
This makes sure the counter goes up instead of going down. This allows
to properly track the current inspection depth no matter what the
`depth` option was set to.
PR-URL: https://github.com/nodejs/node/pull/25255
Reviewed-By: James M Snell <jasnell@gmail.com>
This makes the STL variant of `node::Init()` a bit more
suitable for inclusion in a proper embedder API, as errors
or other output are reported to the caller rather than
directly being printed, and the process is not exited
directly either.
PR-URL: https://github.com/nodejs/node/pull/25370
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Currently, when specifying the --openssl-fips flag without any path
, or an empty path, does not generate an error. If a path is specified
then the following error is generated:
ERROR: FIPS is not supported in this version of Node.js
This commit adds a check so that the error is generated even if the
path is empty.
PR-URL: https://github.com/nodejs/node/pull/25391
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Currently, test-https-client-override-global-agent.js fails with the
following error when configured --without-ssl:
Error [ERR_NO_CRYPTO]:
Node.js is not compiled with OpenSSL crypto support
at Object.assertCrypto (internal/util.js:101:11)
...
at Object.<anonymous>
(/node/test/parallel/test-https-client-override-global-agent.js:5:15)
This commit moves the require statement to after the crypto check.
PR-URL: https://github.com/nodejs/node/pull/25388
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Currently, there is a new popup asking to accept incoming connections
for openssl-cli when running tests on macos. I believe the reason
for this not being noticed before is that test-tls-securepair-client.js
was moved recently from the pummel directory to sequential.
This commit adds openssl-cli to the firewall script.
PR-URL: https://github.com/nodejs/node/pull/25385
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
test/pummel/test-net-connect-econnrefused.js was failing because
`console.log()` resulted in an extra handle being returned by
`process._getActiveHandles()`. Remove the unnecessary `console.log()`.
PR-URL: https://github.com/nodejs/node/pull/25389
Reviewed-By: Beth Griggs <Bethany.Griggs@uk.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
test-http-client-reconnect-bug depends on `http.createClient()` which
was removed in Node.js 7.0.0. The test was added way back in commit
30b0522157 for a bug fixed in Node.js
0.1.27 in early 2010. We've apparently been fine with it failing since
at least Node.js 7.0.0 which at this time is more than 2 years ago.
Remove this test.
PR-URL: https://github.com/nodejs/node/pull/25387
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Support `small-icu` and `full-icu` requirements, where `full-icu`
implies `small-icu`.
PR-URL: https://github.com/nodejs/node/pull/25321
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
The 'readable' event assumes that calls to readable.read() happens
within that event handler until readable.read() returns null.
Fixes: https://github.com/nodejs/node/issues/20503
PR-URL: https://github.com/nodejs/node/pull/25375
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Instead of exposing the Buffer prototype methods through an
object in `internal/buffer.js` and then iterating over it
to put the methods on the prototype, create a function
in `internal/buffer.js` to do this.
Also moves the creaton of the `FastBuffer` class into
`internal/buffer.js` and expose it directly instead of
writing it onto that module later.
PR-URL: https://github.com/nodejs/node/pull/25292
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Instead of exposing it in `lib/internal/buffer.js` after deleting
it from the binding and then do the initialization in
`lib/buffer.js`, which results in an implicit dependency on
the order in which these modules are loaded.
PR-URL: https://github.com/nodejs/node/pull/25292
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
The test was duplicating some functionality in the `tmpdir` module.
PR-URL: https://github.com/nodejs/node/pull/25386
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
test-fs-watch-non-recursive was loading the `common/tmpdir` module as if
it were a built-in and was failing because of it. Fix the path. The test
now works.
PR-URL: https://github.com/nodejs/node/pull/25386
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
test-fs-watch-file.js fails for two reasons. First, there are cases
where it is checking the error message for an error whose message has
changed since the test was written. Change these instances to check for
an error code instead.
Second, there is an instance where it tries to remove a listener but
fails because `common.mustNotCall()` returns a differnet instance of a
function on each call. Store the function in a variable name so it can
be removed as a listener on a file.
PR-URL: https://github.com/nodejs/node/pull/25384
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
https://github.com/nodejs/node/pull/25213 proposes setting umask in the
Python test runner to avoid spurious test failures when running from a
shell with a restrictive umask. This is a good idea, but will only fix
the issue for tests run with the Python runner. Set it in
`common/index.js` as well so that it fixes it even when tests are run
directly with a `node` binary, bypassing the Python test runner.
PR-URL: https://github.com/nodejs/node/pull/25229
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
One test did not cause an assertion. By changing the test to use
`assert.throws()` all tests have to throw, otherwise the test will
fail.
PR-URL: https://github.com/nodejs/node/pull/25250
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
The `actual` and `expected` properties on an instance of
`AssertionError` is now a getter to prevent inspecting these when
inspecting the error. These values will be visible in the error
message and showing them otherwise would decrease the readability
of the error.
PR-URL: https://github.com/nodejs/node/pull/25250
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
The current API is somewhat confusing at times and simpler usage is
possible. This overloads the arguments further to accept objects
with deprecation codes as property keys. It also adds documentation
for the different possible styles.
Besides that it is now going to validate for the code being present
in case of deprecations but not for other cases. The former validation
was not consistent as it only validated some cases and accepted
undefined instead of `common.noWarnCode`. This check is removed due to
the lack of consistency. `common.noWarnCode` is completely removed
due to just being sugar for `undefined`.
This also verifies that the warning order is identical to the order
in which they are triggered.
PR-URL: https://github.com/nodejs/node/pull/25251
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
test-fs-largefile.js calls `fs.close()` without a callback which results
in an error as of Node.js 10.0.0. Add a `common.mustCall()` callback so
the test passes again.
PR-URL: https://github.com/nodejs/node/pull/25372
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
stream.md was the only YAML in doc/api that was using `>` for line
continuation, and only used it for a few descriptions, most used the
same wrapping style the rest of the documentation does.
Also added punctuation and capitialization to a few description
sentences.
Fixes: https://github.com/nodejs/node/pull/25413#discussion_r246451003
PR-URL: https://github.com/nodejs/node/pull/25419
Fixes: https://github.com/nodejs/node/issues/25413
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Original commit message:
[turbofan] Fix -0 check for subnormals.
Previously we'd check `x` for -0 by testing `(1.0 / x) == -Infinity`,
but this will yield the wrong results when `x` is a subnormal, i.e.
really close to 0.
In CSA we already perform bit checks to test for -0, so teach TurboFan
to do the same for comparisons to -0 (via `Object.is`). We introduce a
new NumberIsMinusZero simplified operator to handle the case where
SimplifiedLowering already knows that the input is a number.
Bug: chromium:903043, v8:6882
Change-Id: I0cb7c568029b461a92fc183104d5f359b4bfe7f4
Reviewed-on: https://chromium-review.googlesource.com/c/1328802
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: Sigurd Schneider <sigurds@chromium.org>
Cr-Commit-Position: refs/heads/master@{#57382}
PR-URL: https://github.com/nodejs/node/pull/25269
Refs: 56f6a763c2
Fixes: https://github.com/nodejs/node/issues/25268
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit moves InternalMakeCallback and MakeCallback into
callback_scope.cc. Since these are just wrappers on top of
`InternalCallbackScope`, this makes the implementations easier to find.
https://github.com/nodejs/node/pull/25299
PR-URL: https://github.com/nodejs/node/pull/25299
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Document current behaviour where some methods can be called
when an exception is pending, while others cannot and explain
the behaviour.
PR-URL: https://github.com/nodejs/node/pull/25339
Refs: https://github.com/nodejs/abi-stable-node/issues/356
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Fixes: https://github.com/nodejs/node/issues/25328
PR-URL: https://github.com/nodejs/node/pull/25333
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Beth Griggs <Bethany.Griggs@uk.ibm.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Benchmark for arrays no longer exists, but it was still referenced in
documentation.
Refs: https://github.com/nodejs/node/pull/21831
PR-URL: https://github.com/nodejs/node/pull/25367
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
child_process.exec has Symbol('util.promisify.custom') in its keys
and no longer has Symbol('customPromisifyArgs') in its keys, but it was
still used as an example of funtions with
Symbol('customPromisifyArgs').
PR-URL: https://github.com/nodejs/node/pull/25323
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
Reviewed-By: Yuta Hiroto <hello@hiroppy.me>
Reviewed-By: Masashi Hirano <shisama07@gmail.com>
Initialize primitive members of `Environment` in the class definition
for clarity.
PR-URL: https://github.com/nodejs/node/pull/25369
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
Reviewed-By: Matheus Marchini <mat@mmarchini.me>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
PR-URL: https://github.com/nodejs/node/pull/25371
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>