Commit Graph

32463 Commits (4a6200e28947af3a7e1f65a332f3d391bc967a67)

Author SHA1 Message Date
Chinmoy Chakraborty 4a6200e289
doc: add issue reference to github pr template
The PR template should include a Reference isssue (Fixes #issue_number)
so the PR can be tracked back to the issue easily.For a beginner trying
to read PRs to become comfortable with the codebase,it is really helpful
if one can directly reach the issue the PR fixes.

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

PR-URL: https://github.com/nodejs/node/pull/36440
Reviewed-By: James M Snell <jasnell@gmail.com>
2020-12-16 10:39:24 -08:00
Rock b558075738
doc: update url.md
Add missing 's' to example URL.

PR-URL: https://github.com/nodejs/node/pull/36147
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Harshitha K P <harshitha014@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2020-12-16 10:37:13 -08:00
Danny Sonnenschein 3bd9b81da0 deps: update to c-ares 1.17.1
PR-URL: https://github.com/nodejs/node/pull/36207
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Shelley Vohr <codebytere@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2020-12-16 05:48:29 -08:00
Rich Trott 44243e59df test: specify global object for globals
Be explicit about using `global.externalizeString()` etc. in
test-fs-write instead of disabling the `no-undef` ESLint rule.

PR-URL: https://github.com/nodejs/node/pull/36498
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2020-12-16 05:21:54 -08:00
Richard Lau 0b3caadad3 doc: make explicit reverting node_version.h changes
Add an explicit command to revert changes to `node_version.h` when
cherry-picking the release commit to the `master` branch.

PR-URL: https://github.com/nodejs/node/pull/36461
Refs: https://github.com/nodejs/node/pull/36460
Refs: https://github.com/nodejs/node/pull/36385
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Danielle Adams <adamzdanielle@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Shelley Vohr <codebytere@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2020-12-16 10:57:56 +00:00
Beth Griggs a150926177
2020-12-15, Version 14.15.2 'Fermium' (LTS)
Notable Changes:

- **deps**:
  - upgrade npm to 6.14.9 (Myles Borins)
    https://github.com/nodejs/node/pull/36450
  - update acorn to v8.0.4 (Michaël Zasso)
    https://github.com/nodejs/node/pull/35791
- **doc**: add release key for Danielle Adams (Danielle Adams)
    https://github.com/nodejs/node/pull/35545
- **http2**: check write not scheduled in scope destructor (David Halls)
    https://github.com/nodejs/node/pull/36241
- **stream**: fix regression on duplex end (Momtchil Momtchev)
    https://github.com/nodejs/node/pull/35941

PR-URL: https://github.com/nodejs/node/pull/36476
2020-12-15 23:48:00 +00:00
FrankQiu 91fe3de5e6 doc: add license info to the README
PR-URL: https://github.com/nodejs/node/pull/36278
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
2020-12-16 00:27:32 +01:00
Zijian Liu a9c0077493 test: increase coverage for fs/dir read
test invalid callback case for fs/dir read

Refs: https://coverage.nodejs.org/coverage-f7dd330ba0e7bfa9/lib/internal/fs/dir.js.html#L91

PR-URL: https://github.com/nodejs/node/pull/36388
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2020-12-15 22:49:32 +00:00
raisinten 5a637e9d36 src: remove empty name check in node_env_var.cc
The empty name check has been removed since this has landed:
https://github.com/libuv/libuv/pull/2473

PR-URL: https://github.com/nodejs/node/pull/36133
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2020-12-15 15:53:37 +00:00
ZiJian Liu 6837a6de97 stream: accept iterable as a valid first argument
Fixes: https://github.com/nodejs/node/issues/36437

PR-URL: https://github.com/nodejs/node/pull/36479
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2020-12-15 13:40:40 +00:00
Zijian Liu 45dbcbef90 readline: cursorTo throw error on NaN
Fixes: https://github.com/nodejs/node/issues/36301

PR-URL: https://github.com/nodejs/node/pull/36379
Reviewed-By: Zeyu Yang <himself65@outlook.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2020-12-15 14:26:51 +01:00
Antoine du Hamel 0a5969c62a lib: make safe primordials safe to iterate
PR-URL: https://github.com/nodejs/node/pull/36391
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2020-12-15 13:25:55 +00:00
Rich Trott 7c808170f5 test: remove test-http2-client-upload as flaky
The test has not failed in quite some time (as far as I can tell) on CI.
Optimistically removing it.

Refs: https://github.com/nodejs/node/pull/29889

PR-URL: https://github.com/nodejs/node/pull/36496
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2020-12-15 03:40:55 -08:00
Rich Trott 850c4668ba doc: revise addon mulitple initializations text
PR-URL: https://github.com/nodejs/node/pull/36457
Reviewed-By: Harshitha K P <harshitha014@gmail.com>
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
2020-12-15 03:29:08 -08:00
Ruy Adorno 752991d27d build: fix make test-npm
Fixes running npm tests with `make test-npm`

PR-URL: https://github.com/nodejs/node/pull/36369
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2020-12-14 22:50:12 +00:00
Danielle Adams 04e5418934
doc: add v15.4.0 link to CHANGELOG.md
PR-URL: https://github.com/nodejs/node/pull/36456
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Beth Griggs <bgriggs@redhat.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: Shelley Vohr <codebytere@gmail.com>
2020-12-14 15:02:05 -05:00
Anna Henningsen 67643e1c2e
worker: fix broadcast channel SharedArrayBuffer passing
Make sure that `SharedArrayBuffer`s can be deserialized on multiple
receiving ends. As a drive-by, also fix the condition of the
internal assertion that should occur if there are transferables
passed to multiple destinations.

PR-URL: https://github.com/nodejs/node/pull/36501
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: James M Snell <jasnell@gmail.com>
2020-12-14 16:50:23 +01:00
Pooja D P 68b6c1a30d doc: add PoojaDurgad to collaborators
Fixes: https://github.com/nodejs/node/issues/36367

PR-URL: https://github.com/nodejs/node/pull/36511
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
2020-12-14 06:14:56 -08:00
Zijian Liu ed3a4c8bca test: increase coverage for net/blocklist
1. test new BlockList with invalid args
Refs: https://coverage.nodejs.org/coverage-f7dd330ba0e7bfa9/lib/internal/blocklist.js.html#L34

2. test addRange with invalid start and end
https://coverage.nodejs.org/coverage-f7dd330ba0e7bfa9/lib/internal/blocklist.js.html#L78

3. test blocklist addSubnet with invalid args
Refs: https://coverage.nodejs.org/coverage-f7dd330ba0e7bfa9/lib/internal/blocklist.js.html#L81

4. test blocklist check with invalid args
Refs: https://coverage.nodejs.org/coverage-f7dd330ba0e7bfa9/lib/internal/blocklist.js.html#L107

5. test util.inspect case
Refs: https://coverage.nodejs.org/coverage-f7dd330ba0e7bfa9/lib/internal/blocklist.js.html#L39

PR-URL: https://github.com/nodejs/node/pull/36405
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
2020-12-14 06:03:41 -08:00
Rich Trott f43d1ca3b0 util: simplify constructor retrieval in inspect()
Instead of looping through a list of typed arrays, use
TypedArrayPrototypeGetSymbolToStringTag.

PR-URL: https://github.com/nodejs/node/pull/36466
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
2020-12-14 05:42:06 -08:00
Daniel Bevenius 903998aced src: remove duplicate V macros in node_v8.cc
PR-URL: https://github.com/nodejs/node/pull/36454
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2020-12-14 08:01:13 +01:00
Shelley Vohr 2cd8350185
test: make executable name more general
PR-URL: https://github.com/nodejs/node/pull/36489
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2020-12-13 20:37:43 -08:00
Michaël Zasso 2ef9a76ece
http: use objects with null prototype in Agent
Fixes: https://github.com/nodejs/node/issues/36364

PR-URL: https://github.com/nodejs/node/pull/36409
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2020-12-13 22:16:18 +01:00
Anna Henningsen c6c8337402
src: use correct outer Context’s microtask queue
Fall back to using the outer context’s microtask queue, rather than
the Isolate’s default one. This would otherwise result in surprising
behavior if an embedder specified a custom microtask queue for the
main Node.js context.

PR-URL: https://github.com/nodejs/node/pull/36482
Refs: 4bf051d536
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2020-12-13 22:03:45 +01:00
Anna Henningsen a91a95f820
deps: V8: backport 4bf051d536a1
Original commit message:

    [api] Add Context::GetMicrotaskQueue method

    Add a method that returns the microtask queue that is being used
    by the `v8::Context`.

    This is helpful in non-monolithic embedders like Node.js, which
    accept Contexts created by its own embedders like Electron, or
    for native Node.js addons. In particular, it enables:

    1. Making sure that “nested” `Context`s use the correct microtask
       queue, i.e. the one from the outer Context.
    2. Enqueueing microtasks into the correct microtask queue.

    Previously, these things only worked when the microtask queue for
    a given Context was the Isolate’s default queue.

    As an alternative, I considered adding a way to make new `Context`s
    inherit the queue from the `Context` that was entered at the time
    of their creation, but that seemed a bit more “magic”, less flexible,
    and didn’t take care of concern 2 listed above.

    Change-Id: I15ed796df90f23c97a545a8e1b30a3bf4a5c4320
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2579914
    Reviewed-by: Toon Verwaest <verwaest@chromium.org>
    Commit-Queue: Toon Verwaest <verwaest@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#71710}

Refs: 4bf051d536

PR-URL: https://github.com/nodejs/node/pull/36482
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2020-12-13 22:03:41 +01:00
Anna Henningsen d313bf7d47 src: add way to get IsolateData and allocator from Environment
Add a way to get the current `IsolateData*` and, from it, the current
Node.js `ArrayBufferAllocator` if there is one. This can be useful
for re-using either one of these structures as an embedder.

PR-URL: https://github.com/nodejs/node/pull/36441
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2020-12-13 15:03:19 +00:00
Anna Henningsen 7069d22343 src: guard against env != null in node_errors.cc
Otherwise
`TriggerUncaughtException()`
→ `PrintException()`
→ `GetErrorSource()`
can crash.

PR-URL: https://github.com/nodejs/node/pull/36414
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Shelley Vohr <codebytere@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2020-12-13 14:28:21 +00:00
Anna Henningsen 88dfecc44b worker: refactor MessagePort entanglement management
This addresses the `TODO` left on my request in 9e446b3e9. :)

Refs: https://github.com/nodejs/node/pull/36271

PR-URL: https://github.com/nodejs/node/pull/36345
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2020-12-13 14:28:12 +00:00
Rich Trott e28f23f39f doc: edit addon text about event loop blocking
PR-URL: https://github.com/nodejs/node/pull/36448
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Shelley Vohr <codebytere@gmail.com>
2020-12-13 05:39:58 -08:00
Shelley Vohr 7c702f8db6
test: increased externalized string length
PR-URL: https://github.com/nodejs/node/pull/36451
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
2020-12-12 22:24:33 -08:00
Alba Mendez 78d1f8db5d tls: forward new SecureContext options
We have a few places where we individually forward each
parameter to tls.createSecureContext(). In #28973 and others,
we added new SecureContext options but forgot to keep these
places up to date.

As per https.Agent#getName, I understand that at least
`privateKeyIdentifier` and `privateKeyEngine` should be
added too, since they're a substitute for `key`. I've
also added sigalgs.

Fixes: https://github.com/nodejs/node/issues/36322
Refs: https://github.com/nodejs/node/pull/28973

PR-URL: https://github.com/nodejs/node/pull/36416
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2020-12-12 23:59:58 +01:00
Darcy Clarke 5a3c411330 deps: upgrade npm to 7.1.2
PR-URL: https://github.com/nodejs/node/pull/36487
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: Ruy Adorno <ruyadorno@github.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2020-12-12 22:28:37 +00:00
Ruben Bridgewater 1e665095c8 util: fix instanceof checks with null prototypes during inspection
Signed-off-by: Ruben Bridgewater <ruben@bridgewater.de>

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

PR-URL: https://github.com/nodejs/node/pull/36178
Fixes: https://github.com/nodejs/node/issues/36151
Refs: https://github.com/nodejs/node/pull/35754
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2020-12-12 20:58:02 +00:00
Ruben Bridgewater f78da00ab7 util: fix module prefixes during inspection
Signed-off-by: Ruben Bridgewater <ruben@bridgewater.de>

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

PR-URL: https://github.com/nodejs/node/pull/36178
Fixes: https://github.com/nodejs/node/issues/35730
Refs: https://github.com/nodejs/node/pull/35754
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2020-12-12 20:58:01 +00:00
Benjamin Gruenbaum 738cd60418 child_process: add signal support to spawn
PR-URL: https://github.com/nodejs/node/pull/36432
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2020-12-12 16:46:24 +00:00
kai zhu d50b2ff583 doc: note v15.0.0 changed default --unhandled-rejections=throw
PR-URL: https://github.com/nodejs/node/pull/36361
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Mary Marchini <oss@mmarchini.me>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2020-12-12 05:26:35 -08:00
Shelley Vohr 743ee9d2c0
src: allow preventing SetPrepareStackTraceCallback
Node.js sets a stack trace handler specific to the v8::Context
corresponding to the current Environment. When Electron is running in a
non-Node.js v8::Context (e.g in the renderer process with
contextIsolation enabled), there will be no correspondent Environment -
we therefore need to prevent this handler being set so that Blink falls
back to its default handling and displays the correct stacktrace.

PR-URL: https://github.com/nodejs/node/pull/36447
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2020-12-11 15:05:17 -08:00
Ruy Adorno f51a0e4b85
deps: upgrade npm to 7.1.1
PR-URL: https://github.com/nodejs/node/pull/36459
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
2020-12-11 17:59:18 -05:00
Myles Borins 7faeddf23a
tools: update ini in tools/node-lint-md-cli-rollup
Refs: https://github.com/nodejs/node/pull/36473
Refs: https://github.com/advisories/GHSA-qqgx-2p2h-9c37

PR-URL: https://github.com/nodejs/node/pull/36474
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2020-12-11 11:32:46 -05:00
ZauberNerd ef0f5b185d test: add test for async contexts in PerformanceObserver
This test proves that the PerformanceObserver callback gets called with
the async context of the callsite of performance.mark()/measure() and
therefore AsyncLocalStorage can be used inside a PerformanceObserver.

PR: https://github.com/nodejs/node/pull/36343

PR-URL: https://github.com/nodejs/node/pull/36343
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2020-12-11 04:46:11 -08:00
Nicolai Stange 1ea4b83912 Revert "perf_hooks: make PerformanceObserver an AsyncResource"
This reverts commit 009e41826f.

AFAIU the discussion at [1], PerformanceObserver had been made to
inherit from AsyncResource more or less as a band-aid in lack of a
better async_context candidate to invoke it in. In order to enable
access to AsyncLocalStores from PerformanceObservers invoked
synchronously through e.g. measure() or mark(), the current
async_context, if any, should be retained.

Note that this is a breaking change, but
- as has been commented at [1], PerformanceObserver being derived from
  AsyncResource is a "minor divergence from the spec" anyway,
- to my knowledge this is an internal implementation detail which has
  never been documented and
- I can't think of a good reason why existing PerformanceObserver
  implementations would possibly rely on it.

OTOH, it's probably worthwhile to not potentially invoke before() and
after() async_hooks for each and every PerformanceObserver notification.

[1] https://github.com/nodejs/node/pull/18789

Co-Authored-By: ZauberNerd <zaubernerd@zaubernerd.de>

PR-URL: https://github.com/nodejs/node/pull/36343
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2020-12-11 04:45:29 -08:00
Nicolai Stange c53ba1f618 perf_hooks: invoke performance_entry_callback via MakeSyncCallback()
It's desirable to retain async_contexts active at callsites of
perf_hooks.performance.mark() and alike in the subsequent
PerformanceObserver invocations such that the latter can access e.g.
associated AsyncLocalStorage instances.

In working towards this goal replace the node::MakeCallback(...,
async_context{0, 0}) in PerformanceEntry::doNotify() by the new
node::MakeSyncCallback() introduced specifically for this purpose.

This change will retain the original async_context, if any, in
perf_hook's observersCallback() and thus, for the subsequent doNotify()
on unbuffered PerformanceObservers.

Co-Authored-By: ZauberNerd <zaubernerd@zaubernerd.de>

PR-URL: https://github.com/nodejs/node/pull/36343
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2020-12-11 04:45:16 -08:00
Nicolai Stange 348a3adacb src: introduce convenience node::MakeSyncCallback()
There are situations where one wants to invoke a JS callback's ->Call()
from C++ and in particular retain any existing async_context state, but
where it's not obvious that a plain ->Call() would be safe at the point
in question.

Such callsites usually resort to
node::MakeCallback(..., async_context{0, 0}), which unconditionally
pushes the async_context{0, 0} and takes the required provisions for the
->Call() itself such as triggering the tick after its return, if needed.

An example would be the PerformanceObserver invocation from
PerformanceEntry::Notify(): this can get called when coming from JS
through e.g. perf_hooks.performance.mark() and alike, but perhaps also
from nghttp2 (c.f. EmitStatistics() in node_http2.cc).

In the former case, a plain ->Call() would be safe and it would be
desirable to retain the current async_context so that
PerformanceObservers can access it resp. the associated
AsyncLocalStorage. However, in the second case the additional provisions
taken by node::MakeCallback() might potentially be strictly required.

So PerformanceEntry::Notify() bites the bullet and invokes the
PerformanceObservers through node::MakeCallback() unconditionally,
thereby always rendering any possibly preexisting async_context
inaccessible.

Introduce the convenience node::MakeSyncCallback() for such usecases,
which would basically forward to ->Call() if safe and to
node::MakeCallback(..., async_context{0, 0}) otherwise.

Co-Authored-By: ZauberNerd <zaubernerd@zaubernerd.de>

PR-URL: https://github.com/nodejs/node/pull/36343
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2020-12-11 04:43:27 -08:00
Daniel Bevenius f49cef549c src: add typedef for CleanupHookCallback callback
This commit adds a typedef for the callback parameter used in
CleanupHookCallback's constructor, AddCleanupHook, and
RemoveCleanupHook.

PR-URL: https://github.com/nodejs/node/pull/36442
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2020-12-11 07:31:41 +01:00
Michaël Zasso 7e5bf48998 build,lib,test: change whitelist to allowlist
PR-URL: https://github.com/nodejs/node/pull/36406
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
2020-12-10 20:21:26 -05:00
Michael Dawson 72b07e4fcf doc: update terminology
Signed-off-by: Michael Dawson <mdawson@devrus.com>

PR-URL: https://github.com/nodejs/node/pull/36475
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2020-12-10 16:45:39 -05:00
Benjamin Gruenbaum 040a27ae5f stream: support abortsignal in constructor
PR-URL: https://github.com/nodejs/node/pull/36431
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2020-12-10 23:39:18 +02:00
Antoine du Hamel 806588361a inspector: refactor to use more primordials
PR-URL: https://github.com/nodejs/node/pull/36356
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2020-12-10 17:06:03 +00:00
Moshe vilner 5dd58d069f test: increase execFile abort coverage
Verify that if something different than Abortcontroller.signal is passed
to child_process.execFile(), ERR_INVALID_ARG_TYPE is thrown.

PR-URL: https://github.com/nodejs/node/pull/36429
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2020-12-10 05:36:37 -08:00
Rich Trott 8b697246df doc: reword POSIX threads text in addons.md
PR-URL: https://github.com/nodejs/node/pull/36436
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2020-12-09 21:38:03 -08:00