Commit Graph
32953 Commits
Author SHA1 Message Date
raisinten a48e2d6ec7 repl: refactor to avoid unsafe array iteration
PR-URL: https://github.com/nodejs/node/pull/36663
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2021-09-01 23:24:50 +02:00
Antoine du Hamel 20ffadf437 repl: refactor to use more primordials
PR-URL: https://github.com/nodejs/node/pull/36264
Reviewed-By: Rich Trott <rtrott@gmail.com>
2021-09-01 23:24:50 +02:00
Nitzan Uziely b68b13acb3 child_process: add timeout to spawn and fork
Add support for timeout to spawn and fork.

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

PR-URL: https://github.com/nodejs/node/pull/37256
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2021-09-01 23:24:50 +02:00
Darshan Sen a7833c7ce6 doc: refactor signal info in child_process.md
* Since exec calls execFile and execFile internally calls spawn with
  options.signal, the signal parameter has been documented under exec
  as well.
* Refactor the description of signal under all the functions.
* Add examples of usage of signal under all the functions and add
  missing requires in the other examples.

PR-URL: https://github.com/nodejs/node/pull/37528
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2021-09-01 23:24:49 +02:00
Nitzan Uziely 0bcaf9c4d1 child_process: fix spawn and fork abort behavior
Fix AbortSignal in Spawn which doesn't actually abort
the process, and fork can emit an AbortError even if
the process was already exited. Add documentation
For killSignal.

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

PR-URL: https://github.com/nodejs/node/pull/37325
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2021-09-01 23:21:33 +02:00
Nitzan Uziely 8010c83180 child_process: fix bad abort signal leak
Move abort signal validation to before spawn is executed
so that the file is not leaked.

PR-URL: https://github.com/nodejs/node/pull/37257
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2021-09-01 23:21:33 +02:00
James M Snell 9f6bc58da8 worker: add setEnvironmentData/getEnvironmentData
These APIs allow arbitrary, cloneable JavaScript values to be set and
passed to all new Worker instances spawned from the current context.
It is similar to `workerData` except that environment data is set
independently of the `new Worker()` constructor, and the the value is
passed automatically to all new Workers.

This is a *partial* fix of https://github.com/nodejs/node/issues/30992
but does not implement a complete fix.

Signed-off-by: James M Snell <jasnell@gmail.com>

PR-URL: https://github.com/nodejs/node/pull/37486
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
2021-09-01 23:21:32 +02:00
James M Snell fe12cc07b3 fs: add fsPromises.watch()
An alternative to `fs.watch()` that returns an `AsyncIterator`

```js
const { watch } = require('fs/promises');

(async () => {

  const ac = new AbortController();
  const { signal } = ac;
  setTimeout(() => ac.abort(), 10000);

  const watcher = watch('file.txt', { signal });

  for await (const { eventType, filename } of watcher) {
    console.log(eventType, filename);
  }

})()
```

Signed-off-by: James M Snell <jasnell@gmail.com>

PR-URL: https://github.com/nodejs/node/pull/37179
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2021-09-01 23:21:32 +02:00
Antoine du Hamel f5b2fe1204 doc: change lang info string in fs JS snippets
Refs: https://github.com/nodejs/remark-preset-lint-node/pull/176

PR-URL: https://github.com/nodejs/node/pull/37605
Refs: https://github.com/nodejs/node/pull/37162
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Danielle Adams <adamzdanielle@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2021-09-01 23:15:56 +02:00
Michaël Zasso 307c1d817f doc: refactor fs docs structure
* Convert examples to esm to help promote that pattern with users
* Make Promises APIs more prominent to help promite that pattern
* Separate callback/sync apis into distinct sections to make those
  more consistent with the Promises api
* Improve other bits and pieces

Signed-off-by: James M Snell <jasnell@gmail.com>

PR-URL: https://github.com/nodejs/node/pull/37170
Backport-PR-URL: https://github.com/nodejs/node/pull/39706
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2021-09-01 23:15:26 +02:00
Stephen Belanger 327838dd96 deps: V8: backport c9224589cf53
Original commit message:

    [PATCH] Reland "[d8] Add d8 global variable"

    This is a reland of 6798619a69dfe3e244f85b83c4a327d94d426b32

    Original change's description:
    > [d8] Add d8 global variable
    >
    > - Add a a "d8" global variable where d8 can provide helpers.
    >   This in in preparation of adding d8.log for testing our log parsers
    >   written in JavaScript.
    >
    > - Separate d8 helper creation into individual functions.
    >
    > Bug: v8:10668
    > Change-Id: I84e434452463afb93ae403f890d8841b20b00703
    > Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2400990
    > Reviewed-by: Toon Verwaest <verwaest@chromium.org>
    > Commit-Queue: Camillo Bruni <cbruni@chromium.org>
    > Cr-Commit-Position: refs/heads/master@{#69801}

    Tbr: verwaest@chromium.org
    Bug: v8:10668
    Change-Id: If3256ec4e11f01ef1dc5c2e61fa33ed6d7a6aee3
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2409274
    Reviewed-by: Camillo Bruni <cbruni@chromium.org>
    Commit-Queue: Camillo Bruni <cbruni@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#69867}

Refs: https://github.com/v8/v8/commit/c9224589cf538d722ee1adccf378bbacef80eccc

PR-URL: https://github.com/nodejs/node/pull/39743
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2021-08-31 10:55:09 -04:00
Stephen Belanger 89c1bbd7b2 deps: V8: cherry-pick 81814ed44574
Original commit message:

    [promise] Avoid stack overflow with context promise hooks in C++

    This was handled in JS but not in C++.

    Bug: chromium:236703, v8:11025
    Change-Id: Ic9adc4ceb4d2af2614427fec459c3e950654572f
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3074460
    Commit-Queue: Camillo Bruni <cbruni@chromium.org>
    Reviewed-by: Victor Gomes <victorgomes@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#76125}

Refs: https://github.com/v8/v8/commit/81814ed44574dbdb19ad22857220ac81fba5c107

PR-URL: https://github.com/nodejs/node/pull/39719
Backport-PR-URL: https://github.com/nodejs/node/pull/39743
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2021-08-31 10:55:08 -04:00
Stephen Belanger 1737352580 lib: comment explaining special-case handling of promises
Promise handling is special-cased for domains and trace_events.
Domains must not add the `domain` property to promises in other
contexts, and trace_events must be emitted from JavaScript as
promises no longer have an AsyncWrap type attached to them.

PR-URL: https://github.com/nodejs/node/pull/39135
Backport-PR-URL: https://github.com/nodejs/node/pull/39742
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
2021-08-31 10:55:08 -04:00
Stephen Belanger 5500ae9236 domain: do not add domain to promise from other context
PR-URL: https://github.com/nodejs/node/pull/39135
Backport-PR-URL: https://github.com/nodejs/node/pull/39742
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
2021-08-31 10:55:08 -04:00
Stephen Belanger fc29ddb38e async_hooks: emit promise trace events from JS
PR-URL: https://github.com/nodejs/node/pull/39135
Backport-PR-URL: https://github.com/nodejs/node/pull/39742
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
2021-08-31 10:55:08 -04:00
Stephen Belanger 13296d1abf async_hooks: eliminate native PromiseHook
PR-URL: https://github.com/nodejs/node/pull/39135
Backport-PR-URL: https://github.com/nodejs/node/pull/39742
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
2021-08-31 10:55:08 -04:00
ZiJian Liu 922dacebfb test: increase coverage for Blob
Refs: https://coverage.nodejs.org/coverage-68e6673224365120/lib/internal/blob.js.html#L132

PR-URL: https://github.com/nodejs/node/pull/38515
Backport-PR-URL: https://github.com/nodejs/node/pull/39704
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
2021-08-31 10:55:08 -04:00
Shelley Vohr 9433c28c14 src: remove more extra semis from member fns
PR-URL: https://github.com/nodejs/node/pull/38744
Backport-PR-URL: https://github.com/nodejs/node/pull/39704
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2021-08-31 10:55:07 -04:00
James M Snell 8484ab2a6c buffer: avoid creating the backing store in the thread
Fixes: https://github.com/nodejs/node/issues/37030

PR-URL: https://github.com/nodejs/node/pull/37052
Backport-PR-URL: https://github.com/nodejs/node/pull/39704
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2021-08-31 10:55:07 -04:00
Joyee Cheung bad990c934 src: use BaseObject::kInteralFieldCount in Blob
Instead of hard-coding the field count.

PR-URL: https://github.com/nodejs/node/pull/36991
Backport-PR-URL: https://github.com/nodejs/node/pull/39704
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
2021-08-31 10:55:07 -04:00
Michaël Zasso c8d039a872 buffer: make Blob's constructor more spec-compliant
PR-URL: https://github.com/nodejs/node/pull/37361
Backport-PR-URL: https://github.com/nodejs/node/pull/39704
Fixes: https://github.com/nodejs/node/issues/37352
Fixes: https://github.com/nodejs/node/issues/37356
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2021-08-31 10:55:07 -04:00
Michaël Zasso 05d73ac286 buffer: make Blob's slice method more spec-compliant
PR-URL: https://github.com/nodejs/node/pull/37361
Backport-PR-URL: https://github.com/nodejs/node/pull/39704
Fixes: https://github.com/nodejs/node/issues/37335
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2021-08-31 10:55:06 -04:00
cjihrig e7cf2efc60 buffer: add @@toStringTag to Blob
This commit adds the toStringTag to the Blob class to match
the behavior of Chrome and Firefox.

PR-URL: https://github.com/nodejs/node/pull/37336
Backport-PR-URL: https://github.com/nodejs/node/pull/39704
Fixes: https://github.com/nodejs/node/issues/37337
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2021-08-31 10:55:06 -04:00
cjihrig f90b22d351 util: add internal createDeferredPromise()
The pattern of resolving/rejecting a Promise from outside of its
executor happens numerous times throughout the codebase (more than
what is updated here in fact). This commit abstracts that logic
into an internal utility function.

PR-URL: https://github.com/nodejs/node/pull/37095
Backport-PR-URL: https://github.com/nodejs/node/pull/39704
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Zijian Liu <lxxyxzj@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2021-08-31 10:55:06 -04:00
Michaël Zasso 72ef41c72b test: add wpt tests for Blob
PR-URL: https://github.com/nodejs/node/pull/36811
Backport-PR-URL: https://github.com/nodejs/node/pull/39704
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2021-08-31 10:55:06 -04:00
James M Snell df37c106a7 buffer: introduce Blob
The `Blob` object is an immutable data buffer. This is a first step
towards alignment with the `Blob` Web API.

Signed-off-by: James M Snell <jasnell@gmail.com>

PR-URL: https://github.com/nodejs/node/pull/36811
Backport-PR-URL: https://github.com/nodejs/node/pull/39704
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2021-08-31 10:55:06 -04:00
Filip Skokan 223494c548 buffer: add base64url encoding option
Backport parts of https://github.com/nodejs/node/commit/dae283d96fd31ad0f30840a7e55ac97294f505ac

PR-URL: https://github.com/nodejs/node/pull/36952
Backport-PR-URL: https://github.com/nodejs/node/pull/39702
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2021-08-31 10:55:05 -04:00
Kevin Locke 298a16a2e7 doc: update emitClose default for fs streams
The default for the `emitClose` option was changed from `false` to
`true` by nodejs/node#31408 which landed in f0d2df4 for v14.0.0.
This commit updates the fs doc to match the current behavior.

Signed-off-by: Kevin Locke <kevin@kevinlocke.name>

PR-URL: https://github.com/nodejs/node/pull/36653
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
2021-08-31 10:55:05 -04:00
James M Snell 4a88ddeeca perf_hooks: introduce createHistogram
Adds a new `perf_hooks.createHistogram()` API for creating histogram
instances that allow user recording.

Makes Histogram instances cloneable via MessagePort. This allows, for
instance, an event loop delay monitor to be running on the main thread
while the histogram data can be monitored actively from a worker thread.

Signed-off-by: James M Snell <jasnell@gmail.com>

PR-URL: https://github.com/nodejs/node/pull/37155
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2021-08-31 10:55:05 -04:00
Mattias Runge-Broberg 32de361d70 readline: add history event and option to set initial history
Add a history event which is emitted when the history has
been changed. This enables persisting of the history in
some way but also to allows a listener to alter the
history. One use-case could be to prevent passwords from
ending up in the history.

A constructor option is also added to allow for setting
an initial history list when creating a Readline interface.

PR-URL: https://github.com/nodejs/node/pull/33662
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2021-08-31 10:55:05 -04:00
Gabriel SchulhofandMichael Dawson b421d99a48 node-api: allow retrieval of add-on file name
Unlike JS-only modules, native add-ons are always associated with a
dynamic shared object from which they are loaded. Being able to
retrieve its absolute path is important to native-only add-ons, i.e.
add-ons that are not themselves being loaded from a JS-only module
located in the same package as the native add-on itself.

Currently, the file name is obtained at environment construction time
from the JS `module.filename`. Nevertheless, the presence of `module`
is not required, because the file name could also be passed in via a
private property added onto `exports` from the `process.dlopen`
binding.

As an attempt at future-proofing, the file name is provided as a URL,
i.e. prefixed with the `file://` protocol.

Fixes: https://github.com/nodejs/node-addon-api/issues/449
PR-URL: https://github.com/nodejs/node/pull/37195
Backport-PR-URL: https://github.com/nodejs/node/pull/37327
Co-authored-by: Michael Dawson <mdawson@devrus.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
2021-08-31 10:55:04 -04:00
Joyee Cheung c6ab19895d test: account for OOM risks in heapsnapshot-near-heap-limit tests
PR-URL: https://github.com/nodejs/node/pull/37761
Fixes: https://github.com/nodejs/node/issues/36961
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2021-08-31 10:55:04 -04:00
Rich Trott 971d5be57c test: split heap snapshot limit tests
test/parallel/test-heapsnapshot-near-heap-limit.js is timing out in CI
on low-memory and slow-CPU devices. Split off the worker test to its own
test file to allow the test to finish in time.

Refs: https://github.com/nodejs/node/issues/36961
PR-URL: https://github.com/nodejs/node/pull/37189
Reviewed-By: Ash Cripps <acripps@redhat.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
2021-08-31 10:55:04 -04:00
Joyee Cheung 6d06ac2202 src: add --heapsnapshot-near-heap-limit option
This patch adds a --heapsnapshot-near-heap-limit CLI option
that takes heap snapshots when the V8 heap is approaching
the heap size limit. It will try to write the snapshots
to disk before the program crashes due to OOM.

PR-URL: https://github.com/nodejs/node/pull/33010
Refs: https://github.com/nodejs/node/issues/27552
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
2021-08-31 10:55:04 -04:00
Anna Henningsen 6544cfb4b9 http2: add support for sensitive headers
Add support for “sensitive”/“never-indexed” HTTP2 headers.

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

PR-URL: https://github.com/nodejs/node/pull/34145
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
2021-08-31 10:55:04 -04:00
Antoine du Hamel 98259dc527 module: improve support of data: URLs
Add support for loading modules using percent-encoded URLs.

PR-URL: https://github.com/nodejs/node/pull/37392
Backport-PR-URL: https://github.com/nodejs/node/pull/39669
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Bradley Farias <bradley.meck@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: Jan Krems <jan.krems@gmail.com>
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Zijian Liu <lxxyxzj@gmail.com>
2021-08-31 10:55:03 -04:00
Rich Trott 815d59a7b3 test: fix test-memory-usage.js for IBMi
Newly added process.memoryUsage.rss() will presumably return 0 on IBMi
the same way process.memoryUsage().rss does. Allow IBMi to skip the new
assertion.

The test was using a mix of `assert()` and `assert.ok()`. This change
makes it consistently use `assert.ok()`.

PR-URL: https://github.com/nodejs/node/pull/36758
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
2021-08-31 10:55:03 -04:00
Rich Trott 0c469b3f77 doc: revise process.memoryUsage() text
Some general edits, but also adding an explanation of why one might
choose process.memoryUsage.rss() over process.memoryUsage().rss.

PR-URL: https://github.com/nodejs/node/pull/36757
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Yash Ladha <yash@yashladha.in>
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
2021-08-31 10:55:03 -04:00
Rich Trott 1ebe7d70ea doc: fix punctuation in v8.md
Two minor punctuation fixes for v8.md.

PR-URL: https://github.com/nodejs/node/pull/36192
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
2021-08-31 10:55:03 -04:00
Rich Trott 591a05b637 doc: add link for v8.takeCoverage()
PR-URL: https://github.com/nodejs/node/pull/36135
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Harshitha K P <harshitha014@gmail.com>
2021-08-31 10:55:03 -04:00
Joyee Cheung 84fcdc3074 v8: implement v8.stopCoverage()
Add a v8.stopCoverage() API to stop the coverage collection
started by NODE_V8_COVERAGE - this would be useful in
conjunction with v8.takeCoverage() if the user don't want
to emit the coverage at the process exit but still want
to collect it on demand at some point.

PR-URL: https://github.com/nodejs/node/pull/33807
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Ben Coe <bencoe@gmail.com>
2021-08-31 10:55:02 -04:00
Joyee Cheung b238b6bf17 v8: implement v8.takeCoverage()
Add an v8.takeCoverage() API that allows the user to write the
coverage started by NODE_V8_COVERAGE to disk on demand.
The coverage can be written multiple times during the lifetime
of the process, each time the execution counter will be reset.
When the process is about to exit, one last coverage will
still be written to disk.

Also refactors the internal profiler connection code
so that we use the inspector response id to identify
the profile response instead of using an ad-hoc flag in C++.

PR-URL: https://github.com/nodejs/node/pull/33807
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Ben Coe <bencoe@gmail.com>
2021-08-31 10:55:02 -04:00
cjihrig 0a759dff52 src: compare IPv4 addresses in host byte order
This commit updates compare_ipv4() to use the host byte
order.

PR-URL: https://github.com/nodejs/node/pull/39096
Fixes: https://github.com/nodejs/node/issues/39074
Reviewed-By: Khaidi Chu <i@2333.moe>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2021-08-31 10:55:02 -04:00
James M Snell 76d4f22bab net: allow net.BlockList to use net.SocketAddress objects
Signed-off-by: James M Snell <jasnell@gmail.com>

PR-URL: https://github.com/nodejs/node/pull/37917
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2021-08-31 10:55:02 -04:00
James M Snell 4091eb9db7 src: move node_binding to modern THROW_ERR*
Signed-off-by: James M Snell <jasnell@gmail.com>

PR-URL: https://github.com/nodejs/node/pull/35469
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
2021-08-31 10:55:01 -04:00
James M Snell 82363d864d net: add SocketAddress class
Signed-off-by: James M Snell <jasnell@gmail.com>

PR-URL: https://github.com/nodejs/node/pull/37917
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2021-08-31 10:55:01 -04:00
ZiJian Liu 7f54cccb6c lib: refactor to use validateString
PR-URL: https://github.com/nodejs/node/pull/37006
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2021-08-31 10:55:01 -04:00
James M Snell 0202ba46b8 net: make net.BlockList cloneable
Signed-off-by: James M Snell <jasnell@gmail.com>

PR-URL: https://github.com/nodejs/node/pull/37917
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2021-08-31 10:55:01 -04:00
James M Snell d73181f243 src: reduce duplicated boilerplate with new env utility fn
Signed-off-by: James M Snell <jasnell@gmail.com>

PR-URL: https://github.com/nodejs/node/pull/36536
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
2021-08-31 10:55:01 -04:00
ZiJian Liu 9aba2888a1 net: throw ERR_OUT_OF_RANGE if blockList.addSubnet prefix is NaN
Fixes: https://github.com/nodejs/node/issues/36731

PR-URL: https://github.com/nodejs/node/pull/36732
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2021-08-31 10:55:00 -04:00