32958 Commits

Author SHA1 Message Date
Sajal Khandelwal
7d5806eee3 async_hooks: set unhandledRejection async context
This commit now executes `process.on('unhandledRejection')` in the
async execution context of the concerned `Promise`.

PR-URL: https://github.com/nodejs/node/pull/37281
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2021-02-13 16:49:21 +02:00
Rich Trott
b4264b53b6 test: re-implement promises.setInterval() test robustly
Fixes: https://github.com/nodejs/node/issues/37226

PR-URL: https://github.com/nodejs/node/pull/37230
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2021-02-13 06:06:32 -08:00
bcoe
88d9268d08
errors: align source-map stacks with spec
Reformat stack traces when --enable-source-maps flag is set to format
more likely to fit https://github.com/tc39/proposal-error-stacks

PR-URL: https://github.com/nodejs/node/pull/37252
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Ian Sutherland <ian@iansutherland.ca>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Zeyu Yang <himself65@outlook.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
2021-02-12 14:09:35 -08:00
Nitzan Uziely
2272713df0 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-02-12 23:38:25 +02:00
Michaël Zasso
5bf2737e13
tools: avoid pending deprecation in doc generator
`unist-util-find` depends on `lodash.iteratee` which uses
`process.binding()`.
Let's remove this dependency which is used in one place to do a very
simple thing.

PR-URL: https://github.com/nodejs/node/pull/37267
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
2021-02-12 21:46:54 +01:00
Daniel Clark
521c08dee1
module: make synthetic module evaluation steps return a Promise to support top level await
Top level await expects that all module script evaluation returns a
Promise. As such, update
ModuleWrap::SyntheticModuleEvaluationStepsCallback to return a
resolved Promise now that V8 has enabled top-level await by default.

Unfortunately I don't have a spec reference that I can point to here
because the Built-in modules proposal isn't yet updated for
top level await.

The corresponding change for Blink is
https://chromium-review.googlesource.com/c/chromium/src/+/2568823.

This will allow a workaround for Node in this V8 bugfix to be removed:
https://chromium-review.googlesource.com/c/v8/v8/+/2673794.

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

PR-URL: https://github.com/nodejs/node/pull/37300
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2021-02-12 10:45:22 -06:00
James M Snell
c65e492ad3
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
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2021-02-12 08:38:44 -08:00
zhangyongsheng
aecd5ebf49 module: only set cache when finding module succeeds
PR-URL: https://github.com/nodejs/node/pull/36642
Fixes: https://github.com/nodejs/node/issues/36638
Reviewed-By: Bradley Farias <bradley.meck@gmail.com>
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2021-02-12 22:08:40 +08:00
Tobias Nießen
f2c26153d7 doc: fix description of hasSubscribers
PR-URL: https://github.com/nodejs/node/pull/37324
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Harshitha K P <harshitha014@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
2021-02-12 14:00:27 +05:30
Michaël Zasso
fa3997d75a
test: mark test-return-on-exit as flaky
It fails sporadically in debug builds because the
"--stress-compaction --gc-interval=100" flags make Node.js crash.

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

PR-URL: https://github.com/nodejs/node/pull/36139
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: Shelley Vohr <codebytere@gmail.com>
2021-02-11 19:11:49 +01:00
cjihrig
896ae96a15
test: mark WASI's test-return-on-exit as flaky
Refs: https://github.com/nodejs/node/pull/36139

PR-URL: https://github.com/nodejs/node/pull/36139
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: Shelley Vohr <codebytere@gmail.com>
2021-02-11 19:11:49 +01:00
Michaël Zasso
79da253473
tools: update V8 gypfiles for 8.8
Co-authored-by: Jiawen Geng <technicalcute@gmail.com>

PR-URL: https://github.com/nodejs/node/pull/36139
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: Shelley Vohr <codebytere@gmail.com>
2021-02-11 19:11:49 +01:00
Matin Zadehdolatabad
530ef91509
deps: V8: cherry-pick 0c8b6e415c30
Original commit message:

    [mac][wasm] Work around MacOS 11.2 code page decommit failures

    MacOS 11.2 refuses to set "no access" permissions on memory that
    we previously used for JIT-compiled code. It is still unclear
    whether this is WAI on the part of the kernel. In the meantime,
    as a workaround, we use madvise(..., MADV_FREE_REUSABLE) instead
    of mprotect(..., NONE) when discarding code pages. This is inspired
    by what Chromium's gin platform does.

    Fixed: v8:11389
    Change-Id: I866586932573b4253002436ae5eee4e0411c45fc
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2679688
    Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
    Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
    Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
    Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#72559}

Refs: 0c8b6e415c
Fixes: https://github.com/nodejs/node/issues/37061
PR-URL: https://github.com/nodejs/node/pull/37276
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Ash Cripps <acripps@redhat.com>
2021-02-11 19:11:49 +01:00
Benjamin Coe
73e0245a16
deps: V8: cherry-pick fe191e8d05cc
Original commit message:

    [coverage] optional chaining coverage

    Implement coverage tracking for optional chains.

    Bug: v8:10060
    Change-Id: I4f29eda64b6d859939f5f58f4fabead649905795
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2573013
    Reviewed-by: Leszek Swirski <leszeks@chromium.org>
    Reviewed-by: Toon Verwaest <verwaest@chromium.org>
    Reviewed-by: Gus Caplan <snek@chromium.org>
    Reviewed-by: Sigurd Schneider <sigurds@chromium.org>
    Commit-Queue: Benjamin Coe <bencoe@google.com>
    Cr-Commit-Position: refs/heads/master@{#72075}

Refs: fe191e8d05

PR-URL: https://github.com/nodejs/node/pull/36956
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2021-02-11 19:10:58 +01:00
Michaël Zasso
577ff9fee5
deps: V8: cherry-pick deb0813166f3
Original commit message:

    [heap] Add proper rebind support to StrongRootBlockAllocator

    MSVC's STL in debug mode rebinds the allocator passed to vectors to
    allocate helper structures, so we need StrongRootBlockAllocator to have
    proper rebind support rather than assuming it always rebinds to Address.

    Bug: v8:11241
    Change-Id: I15688e43fe2c71ec4ff0c287a03e36ca57427417
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2622915
    Auto-Submit: Leszek Swirski <leszeks@chromium.org>
    Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
    Commit-Queue: Leszek Swirski <leszeks@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#72060}

Refs: deb0813166

PR-URL: https://github.com/nodejs/node/pull/36139
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: Shelley Vohr <codebytere@gmail.com>
2021-02-11 19:10:53 +01:00
Michaël Zasso
00e1c7ea83
deps: V8: cherry-pick 9a6a22874c81
Original commit message:

    [heap] Fix DCHECK in TransitionArrayNeedsCompaction

    The dead target check in TransitionArrayNeedsCompaction, confirming that
    Smi (uninitialized) targets imply that no other target is dead, has to
    additionally support Smi entries.

    Bug: v8:11305
    Change-Id: I6f3fa9e7420b1bd0a64a25dae670f439e3f41162
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2622914
    Commit-Queue: Leszek Swirski <leszeks@chromium.org>
    Commit-Queue: Ulan Degenbaev <ulan@chromium.org>
    Auto-Submit: Leszek Swirski <leszeks@chromium.org>
    Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#72040}

Refs: 9a6a22874c

PR-URL: https://github.com/nodejs/node/pull/36139
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: Shelley Vohr <codebytere@gmail.com>
2021-02-11 19:10:48 +01:00
Michaël Zasso
ee01d6b7fc
deps: V8: cherry-pick 2059ee813359
Original commit message:

    [heap] Make CompactTransitionArray deserializer friendly

    Add a pre-loop over transition arrays during compaction, that checks
    whether compaction is needed at all, and whether any of the entries are
    still uninitialized values as part of deserialization (and therefore no
    other targets can be dead). Bails out of compaction early if this is the
    case.

    Bug: v8:11305
    Change-Id: I27af792a8a0bd3df17892f54ac95ed15e4bdfcc0
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2622910
    Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
    Commit-Queue: Leszek Swirski <leszeks@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#72038}

Refs: 2059ee8133

PR-URL: https://github.com/nodejs/node/pull/36139
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: Shelley Vohr <codebytere@gmail.com>
2021-02-11 19:10:42 +01:00
Benjamin Coe
31a46f8490
deps: V8: cherry-pick dfcdf7837e23
Original commit message:

    [coverage] fix greedy nullish coalescing

    The SourceRangeScope helper was consuming too many characters, instead
    explicitly create SourceRange, based on scanner position.

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

Refs: dfcdf7837e

PR-URL: https://github.com/nodejs/node/pull/36573
Fixes: https://github.com/nodejs/node/issues/36619
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
2021-02-11 19:10:40 +01:00
Anna Henningsen
a74b7693e7
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>
2021-02-11 19:10:38 +01:00
Michaël Zasso
2dad8d43cc
deps: V8: cherry-pick bde7ee5473d6
Original commit message:

    cppgc: avoid multiple class declarations

    ConcurrentMarkingState and MarkingStateBase are already defined in the

    This change fixes compilation with MSVC.

    v8: :internal namespace.
    Change-Id: Ib8a1370a0a27a90e385fd69e61036e263e1489e6
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2562671
    Reviewed-by: Omer Katz <omerkatz@chromium.org>
    Commit-Queue: Michaël Zasso <mic.besace@gmail.com>
    Cr-Commit-Position: refs/heads/master@{#71473}

Refs: bde7ee5473

PR-URL: https://github.com/nodejs/node/pull/36139
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: Shelley Vohr <codebytere@gmail.com>
2021-02-11 19:10:33 +01:00
Michaël Zasso
3046131ea0
deps: V8: cherry-pick 9a712984025e
Original commit message:

    Fix SmartOS compilation error

    Refs: https://chromium-review.googlesource.com/c/v8/v8/+/2509594
    Change-Id: I98f55b404c0b2b26fbee0453b976119b39255b31
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2565273
    Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
    Commit-Queue: Joyee Cheung <joyee@igalia.com>
    Cr-Commit-Position: refs/heads/master@{#71681}

Refs: 9a71298402

PR-URL: https://github.com/nodejs/node/pull/36139
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: Shelley Vohr <codebytere@gmail.com>
2021-02-11 19:10:27 +01:00
Michaël Zasso
d178d0738f
deps: V8: cherry-pick 0b96e5b0bfb2
Original commit message:

    Update V8 postmortem metadata script

    This commit updates the gen-postmortem-metadaa.py script to
    incorporate changes in V8 8.5. This removes the need to float a
    patch to the script in Node.js.

    Change-Id: I6532495bee906f51eb2b773ec38ff0a6e404dafe
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2582705
    Reviewed-by: Georg Neis <neis@chromium.org>
    Commit-Queue: Joyee Cheung <joyee@igalia.com>
    Cr-Commit-Position: refs/heads/master@{#71699}

Refs: 0b96e5b0bf

PR-URL: https://github.com/nodejs/node/pull/36139
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: Shelley Vohr <codebytere@gmail.com>
2021-02-11 19:10:18 +01:00
Michaël Zasso
5c71ea151a
deps: V8: cherry-pick fbb28902e049
Original commit message:

    Update V8 postmortem metadata script

    This commit updates the gen-postmortem-metadata.py script to
    incorporate changes in V8 8.4. This removes the need to float a
    patch to the script in Node.js.

    Change-Id: I69da40e792f22748b0eee2952b9009b2f03d13f3
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2565275
    Reviewed-by: Joyee Cheung <joyee@igalia.com>
    Reviewed-by: Georg Neis <neis@chromium.org>
    Commit-Queue: Joyee Cheung <joyee@igalia.com>
    Cr-Commit-Position: refs/heads/master@{#71646}

Refs: fbb28902e0

PR-URL: https://github.com/nodejs/node/pull/36139
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: Shelley Vohr <codebytere@gmail.com>
2021-02-11 19:10:12 +01:00
Benjamin Coe
5c4be1181d
deps: V8: cherry-pick 86991d0587a1
Adds methods for fetching stack trace information about
enclosing function.

Refs #36042

Original commit message:

    Reland "stack-trace-api: implement getEnclosingLine/Column"

    This reverts commit 5557a63beb5a53c93e9b590eaf2933e21bcb3768.

    Reason for revert: Sheriff's mistake, failing test was previously flaking.

    Original change's description:
    > Revert "stack-trace-api: implement getEnclosingLine/Column"
    >
    > This reverts commit c48ae2d96cbfdc2216706a5e9a79ae1dce5a638b.
    >
    > Reason for revert: Breaks a profiling test:
    > https://ci.chromium.org/p/v8/builders/ci/V8%20Win32/30010
    >
    > Original change's description:
    > > stack-trace-api: implement getEnclosingLine/Column
    > >
    > > Introduces getEnclosingColumn and getEnclosingLine on CallSite
    > > so that the position can be used to lookup the original symbol
    > > for function when source maps are used.
    > >
    > > BUG=v8:11157
    > >
    > > Change-Id: I06c4c374d172d206579abb170c7b7a2bd3bb159f
    > > Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2547218
    > > Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
    > > Commit-Queue: Benjamin Coe <bencoe@google.com>
    > > Cr-Commit-Position: refs/heads/master@{#71343}
    >
    > TBR=jkummerow@chromium.org,yangguo@chromium.org,bencoe@google.com
    >
    > Change-Id: Iab5c250c1c4fbdab86971f4a7e40abc8f87cf79c
    > No-Presubmit: true
    > No-Tree-Checks: true
    > No-Try: true
    > Bug: v8:11157
    > Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2555384
    > Reviewed-by: Bill Budge <bbudge@chromium.org>
    > Commit-Queue: Bill Budge <bbudge@chromium.org>
    > Cr-Commit-Position: refs/heads/master@{#71345}

    TBR=bbudge@chromium.org,jkummerow@chromium.org,yangguo@chromium.org,bencoe@google.com

    # Not skipping CQ checks because this is a reland.

    Bug: v8:11157
    Change-Id: I8dba19ceb29a24594469d2cf79626f741dc4cad3
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2555499
    Reviewed-by: Bill Budge <bbudge@chromium.org>
    Commit-Queue: Bill Budge <bbudge@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#71348}

Refs: 86991d0587

PR-URL: https://github.com/nodejs/node/pull/36254
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2021-02-11 19:10:05 +01:00
Michaël Zasso
c8e15cd2c6
deps: V8: cherry-pick 821fb3883a8e
Original commit message:

    [serializer] avoid deferring objects with embedder fields

    JS objects with embedder fields cannot be deferred because the
    serialize/deserialize callbacks need the back reference immediately
    to identify the object.

    Refs: https://github.com/nodejs/node-v8/issues/175
    Bug: v8:11146
    Change-Id: I4292f2ab0041f7b0779620437ed26905c194cd9b
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2531195
    Reviewed-by: Jakob Gruber <jgruber@chromium.org>
    Commit-Queue: Joyee Cheung <joyee@igalia.com>
    Cr-Commit-Position: refs/heads/master@{#71134}

Refs: 821fb3883a

PR-URL: https://github.com/nodejs/node/pull/35700
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Shelley Vohr <codebytere@gmail.com>
2021-02-11 19:10:01 +01:00
cjihrig
b0d67426af
deps: workaround stod() limitations on SmartOS
std::stod() on SmartOS does not currently handle hex strings. This
commit provides a workaround based on strtol() until proper stod()
support is available.

PR-URL: https://github.com/nodejs/node/pull/36139
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: Shelley Vohr <codebytere@gmail.com>
2021-02-11 19:09:53 +01:00
Jiawen Geng
c8a658ac53
deps: fix V8 build issue with inline methods
PR-URL: https://github.com/nodejs/node/pull/35415
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
2021-02-11 19:09:51 +01:00
Matheus Marchini
153b8cea36
deps: patch V8 to run on Xcode 8
Patch V8 (wasm/wasm-module.cc) to remove const qualifier from type
passed to template call of `OwnedVector::Of`. Xcode 8 can't convert
'OwnedVector<unsigned char>' to 'OwnedVector<const unsigned char>' when
returning from a function (which is likely a bug on Xcode, considering
this worked on the prior version of Xcode as well as newer versions).
This workaround shouldn't affect the application, since the const
qualifier is preserved in the AsmJsOffsetInformation::encoded_offset_.

There's also a V8 test passing a const-qualified type to ::Of, but since
we don't test V8 on Xcode 8, it should be fine to leave it as is.

Signed-off-by: Matheus Marchini <mmarchini@netflix.com>

PR-URL: https://github.com/nodejs/node/pull/32116
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2021-02-11 19:09:50 +01:00
Michaël Zasso
a785984133
deps: V8: silence irrelevant warnings
PR-URL: https://github.com/nodejs/node/pull/26685
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>

PR-URL: https://github.com/nodejs/node/pull/32116
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2021-02-11 19:09:44 +01:00
Joao Reis
246c9b8c31
deps: make v8.h compatible with VS2015
There is a bug in the most recent version of VS2015 that affects v8.h
and therefore prevents compilation of addons.

Refs: https://stackoverflow.com/q/38378693

PR-URL: https://github.com/nodejs/node/pull/32116
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2021-02-11 19:09:42 +01:00
Refael Ackermann
96a567f9e9
deps: V8: forward declaration of Rtl*FunctionTable
This should be semver-patch since actual invocation is version
conditional.

PR-URL: https://github.com/nodejs/node/pull/32116
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2021-02-11 19:09:41 +01:00
Refael Ackermann
e74383cecb
deps: V8: patch register-arm64.h
Fixes a compilation issue on some platforms

PR-URL: https://github.com/nodejs/node/pull/32116
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2021-02-11 19:09:40 +01:00
Ujjwal Sharma
732847f1eb
deps: patch V8 to run on older XCode versions
Patch V8 (compiler/js-heap-broker.cc) to remove the use of an optional
property, which is a fairly new C++ feature, since that requires a newer
XCode version than the minimum requirement in BUILDING.md and thus
breaks CI.

PR-URL: https://github.com/nodejs/node/pull/32116
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2021-02-11 19:09:38 +01:00
Refael Ackermann
70171d186f
deps: V8: un-cherry-pick bd019bd
Original commit message:

    [testrunner] delete ancient junit compatible format support

    Testrunner has ancient support for JUnit compatible XML output.

    This CL removes this old feature.

    R=mstarzinger@chromium.org,jgruber@chromium.org,jkummerow@chromium.org
    CC=​machenbach@chromium.org

    Bug: v8:8728
    Change-Id: I7e1beb011dbaec3aa1a27398a5c52abdd778eaf0
    Reviewed-on: https://chromium-review.googlesource.com/c/1430065
    Reviewed-by: Jakob Gruber <jgruber@chromium.org>
    Reviewed-by: Michael Starzinger <mstarzinger@chromium.org>
    Commit-Queue: Tamer Tas <tmrts@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#59045}

Refs: bd019bdb72

PR-URL: https://github.com/nodejs/node/pull/32116
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2021-02-11 19:09:35 +01:00
Michaël Zasso
5259d17309
src: update NODE_MODULE_VERSION to 91
Major V8 updates are usually API/ABI incompatible with previous
versions. This commit adapts NODE_MODULE_VERSION for V8 8.8.

Refs: https://github.com/nodejs/CTC/blob/master/meetings/2016-09-28.md

PR-URL: https://github.com/nodejs/node/pull/36139
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: Shelley Vohr <codebytere@gmail.com>
2021-02-11 19:09:29 +01:00
Michaël Zasso
842389839b
build: reset embedder string to "-node.0"
PR-URL: https://github.com/nodejs/node/pull/36139
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: Shelley Vohr <codebytere@gmail.com>
2021-02-11 19:09:25 +01:00
Michaël Zasso
c7b3292251
deps: update V8 to 8.8.278.17
PR-URL: https://github.com/nodejs/node/pull/36139
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: Shelley Vohr <codebytere@gmail.com>
2021-02-11 19:09:18 +01:00
Matin Zadehdolatabad
6ea9af9906
deps: V8: cherry-pick 0c8b6e415c30
Original commit message:

    [mac][wasm] Work around MacOS 11.2 code page decommit failures

    MacOS 11.2 refuses to set "no access" permissions on memory that
    we previously used for JIT-compiled code. It is still unclear
    whether this is WAI on the part of the kernel. In the meantime,
    as a workaround, we use madvise(..., MADV_FREE_REUSABLE) instead
    of mprotect(..., NONE) when discarding code pages. This is inspired
    by what Chromium's gin platform does.

    Fixed: v8:11389
    Change-Id: I866586932573b4253002436ae5eee4e0411c45fc
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2679688
    Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
    Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
    Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
    Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#72559}

Refs: 0c8b6e415c
Fixes: https://github.com/nodejs/node/issues/37061
PR-URL: https://github.com/nodejs/node/pull/37276
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Ash Cripps <acripps@redhat.com>
2021-02-11 18:59:03 +01:00
Benjamin Gruenbaum
cf5f6af8d6 doc: discourage error event
PR-URL: https://github.com/nodejs/node/pull/37264
Refs: https://github.com/nodejs/node/pull/37237
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2021-02-11 17:09:23 +02:00
raisinten
295e766c27 lib: remove usage of url.parse
Since url.parse() is deprecated, it must not be used inside Node.js.

PR-URL: https://github.com/nodejs/node/pull/36853
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Beth Griggs <bgriggs@redhat.com>
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
2021-02-11 19:30:28 +05:30
Ruy Adorno
ad38be4f6a
2021-02-10, Version 12.20.2 'Erbium' (LTS)
Notable changes:

* deps:
  * upgrade npm to 6.14.11 (Ruy Adorno) [#37173](https://github.com/nodejs/node/pull/37173)

PR-URL: https://github.com/nodejs/node/pull/37286
2021-02-10 15:31:09 -05:00
Darshan Sen
e045ddad54 src: fix return type of method in string_search.h
`Vector::forward()` is supposed to return a `bool`.

PR-URL: https://github.com/nodejs/node/pull/37167
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2021-02-10 18:56:08 +05:30
Qingyu Deng
9d2125e3bf
http: explain the possibilty of refactor unused argument
PR-URL: https://github.com/nodejs/node/pull/37275
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2021-02-10 12:30:16 +01:00
Qingyu Deng
9fa1f68b55
http: explain the unused argument in IncomingMessage._read
PR-URL: https://github.com/nodejs/node/pull/37275
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2021-02-10 12:30:08 +01:00
Gabriel Schulhof
ad3ebed046 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
Co-authored-by: Michael Dawson <mdawson@devrus.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
2021-02-09 23:34:30 -08:00
Daniel Bevenius
79d44baae2 src: add mutex to ManagedEVPPKey class
This commit introduces a mutex field on the ManagedEVPPKey class
intended to be used when multiple threads require access to an OpenSSL
EVP_PKEY object. The motivation for this came from the work being done
to upgrade Node.js to OpenSSL 3.0.

OpenSSL objects, like EVP_PKEY, are not thread safe (see refs for
details). In versions prior to OpenSSL 3.0 this was not noticeable and
did not cause any issues (like incorrect logic or crashes), but with
OpenSSL 3.0 this does cause issues if access to an EVP_PKEY instance is
required from multiple threads without locking.

In OpenSSL 3.0 when the evp_pkey_downgrade function is called, which
downgrades an EVP_PKEY instance to a legacy version, it will clear all
the fields of EVP_PKEY struct except the lock (#13374). But this also
means that keymgmt and keydata will also be cleared, which other parts
of the code base depends on, and those calls will either fail to export
the key (returning null) or crash due to a segment fault.

This same code works with OpenSSL 1.1.1 without locking and I think this
is because there is no downgrade being done in OpenSSL 1.1.1. But even
so, as far as I can tell there are no guarantees that these object are
thread safe in 1.1.1 either and should be protected with a lock.

PR-URL: https://github.com/nodejs/node/pull/36825
Refs: https://github.com/openssl/openssl/pull/13374
Refs: https://github.com/openssl/openssl/pull/13374
Refs: https://github.com/openssl/openssl/issues/2165)
Refs: https://www.openssl.org/blog/blog/2017/02/21/threads
Reviewed-By: James M Snell <jasnell@gmail.com>
2021-02-10 07:25:12 +01:00
Richard Lau
857fbdb13f
2021-02-09, Version 10.23.3 'Dubnium' (LTS)
Notable changes:

The update to npm 6.14.11 has been relanded so that npm correctly reports its version.

PR-URL: https://github.com/nodejs/node/pull/37241
2021-02-09 22:58:32 +00:00
Filip Skokan
51249a11c0 crypto: fix subtle.importKey JWK OKP public key import
PR-URL: https://github.com/nodejs/node/pull/37255
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
2021-02-09 21:26:45 +01:00
marsonya
39d4d144ef
doc: fix misnamed SHASUMS256.txt name in README.md
PR-URL: https://github.com/nodejs/node/pull/37260
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: Beth Griggs <bgriggs@redhat.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
2021-02-09 20:20:45 +00:00
Beth Griggs
4f12215a6b
2021-02-09, Version 14.15.5 'Fermium' (LTS)
Notable changes:

- **deps**:
  - upgrade npm to 6.14.11 (Ruy Adorno)
    (https://github.com/nodejs/node/pull/37173)
  - V8: backport dfcf1e86fac0 (Michaël Zasso)
    (https://github.com/nodejs/node/pull/37245)
    - Note: Node.js is not believed to be vulnerable to CVE-2021-21148.
- **stream,zlib**: do not use \_stream\_\* anymore (Matteo Collina)
  (https://github.com/nodejs/node/pull/36618)

PR-URL: https://github.com/nodejs/node/pull/37074
2021-02-09 16:40:16 +00:00