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

26483 Commits

Author SHA1 Message Date
Ruben Bridgewater
805e614ba7
errors: make range mandatory in ERR_OUT_OF_RANGE
So far the range argument was allowed to be undefined. This is not
used in the codebase anymore and therefore it is best to make it
mandatory for the best user experience.

PR-URL: https://github.com/nodejs/node/pull/26924
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2019-03-28 21:45:18 +01:00
cjihrig
afad3b443e test: update postmortem metadata test for V8 7.4
Summary of changes:

- v8dbg_class_FixedTypedArrayBase__external_pointer__Object
  - Type changed in f70bb59b57 (diff-f3f182b0510ba2ee39ae87e421ff110b).
  - Use v8dbg_class_FixedTypedArrayBase__external_pointer__uintptr_t
- v8dbg_class_JSArrayBuffer__backing_store__Object
  - Type changed in f70bb59b57 (diff-f3f182b0510ba2ee39ae87e421ff110b).
  - Use v8dbg_class_JSArrayBuffer__backing_store__uintptr_t
- v8dbg_class_Map__raw_instance_descriptors__DescriptorArray
  - Changed in d7b08b6da2 (diff-59788e25dc5196c356894d5e1fac6425)
  - New constant added to V8: v8dbg_class_Map__instance_descriptors_offset
- v8dbg_PointerSizeLog2
  - Changed in 46d1986812 (diff-f3f182b0510ba2ee39ae87e421ff110b)
  - Refs: https://bugs.chromium.org/p/v8/issues/detail?id=8477
  - Use new constants: v8dbg_SystemPointerSize, v8dbg_SystemPointerSizeLog2,
        v8dbg_TaggedSize, and v8dbg_TaggedSizeLog2

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>
2019-03-28 16:39:35 -04:00
Simon Zünd
63e13fd220 util: only the first line of the error message
V8 extends the error message for JSON#stringify when encountering
circular structures. The first line of the new error message
is equivalent to the old error message and stays the same across
all circular structure errors.

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>
2019-03-28 16:39:25 -04:00
Refael Ackermann
3b5773fee3 build,deps: move gypfiles out 2/2 - moving
* move all used files to `tools/v8_gypfiles` directory
* fix references in node configuration

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>
2019-03-28 16:39:16 -04:00
Refael Ackermann
3d8b844112 deps,build: move gypfiles out 1/2 - required changes
* Add `<(V8_ROOT)` to file paths

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>
2019-03-28 16:39:09 -04:00
Refael Ackermann
fff922afee deps,build: compute torque_outputs in v8.gyp
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>
2019-03-28 16:39:00 -04:00
Refael Ackermann
4507246adc deps,build: refactor v8 gypfiles
* make `generate_snapshot` into a target with no debug symbols on XCode
* cleanup

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>
2019-03-28 16:38:54 -04:00
Michaël Zasso
95e779a6e9 deps: silence irrelevant V8 warning
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>
2019-03-28 16:38:45 -04:00
cjihrig
08efd3060d deps: update postmortem metadata generation script
Update postmortem metadata constants for V8 7.4 in Node.js.

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>
2019-03-28 16:38:36 -04:00
Refael Ackermann
0da7e99f98 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/26685
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
2019-03-28 16:38:27 -04:00
Michaël Zasso
b1015e0de8 deps: V8: cherry-pick 6 commits
Cherry-pick ad49f12.
Original commit message:

    [cleanup] Move Compressed[XXX]Slot definitions to separate header

    ... and fix header includes to please the respective bot.

    Drive-by-fix: decompression implementation is now MSVC friendly.

    Bug: v8:7703, v8:8834
    Change-Id: Iaf589138e5bafb32b0d9feab5cf074b71f241a3c
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1505579
    Commit-Queue: Igor Sheludko <ishell@chromium.org>
    Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#60074}

Refs: ad49f12908

Cherry-pick 14f07a8.
Original commit message:

    [ptr-compr] Define kTaggedPayloadOffset correctly on Big Endian

    smi size is sill 8 bytes when V8_COMPRESS_POINTERS is undefined.

    Bug: v8:7703
    Change-Id: I0d1e757e42e8b1e6b10960420135245e24553175
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1508572
    Commit-Queue: Junliang Yan <jyan@ca.ibm.com>
    Auto-Submit: Junliang Yan <jyan@ca.ibm.com>
    Reviewed-by: Igor Sheludko <ishell@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#60097}

Refs: 14f07a8b30

Cherry-pick 676014b.
Original commit message:

    [ptr-compr] Fix MSVC build

    ... which complained about truncating uintptr_t constant to uint32_t.

    Bug: v8:7703
    Change-Id: I6fae2bf1e5de79e6131479b84a8d8aa5b9de909f
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1508672
    Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
    Commit-Queue: Igor Sheludko <ishell@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#60100}

Refs: 676014b36f

Cherry-pick 4e6a1a7.
Original commit message:

    [heap] Clean-up some weak map entries in scavenger

    This change enables clean-up of weak map entries in the
    scavenger of the weak map is in the young generation.
    With this change, the scavenger treats keys in ephemerons as
    weak instead of strong, but does not implement full ephemeron
    semantics: Values are treated always as strong, independently
    of whether the key is live or not.

    This approach ensures that no value is cleaned up accidentally.
    After scavenging, all entries with dead keys are removed from
    weak maps. After that, some values that are not referenced anywhere
    anymore might still be in the heap, and those can be cleaned up
    in the next scavenge.

    What the scavenger does, amounts to one iteration of the
    fixed-point algorithm required to implement ephemeron semantics.
    We hope that this is a reasonable trade-off between time spent
    tracing and cleaned-up entries.

    This change does not affect weak maps that reside in old space.

    Bug: v8:8557
    Change-Id: Ic5618b3b863ad8c314c87449571150e756fecbf0
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1467182
    Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
    Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#60101}

Refs: 4e6a1a75cd

Cherry-pick afbfd75.
Original commit message:

    [ptr-compr] Fix ptr-compr broken by 4e6a1a75

    (https://chromium-review.googlesource.com/c/v8/v8/+/1467182)

    Bug: v8:7703
    Change-Id: Ia6b74b985735af67bde56b30e4a709247eb591be
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1508674
    Commit-Queue: Igor Sheludko <ishell@chromium.org>
    Commit-Queue: Ulan Degenbaev <ulan@chromium.org>
    Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#60102}

Refs: afbfd7563d

Cherry-pick f792eb8.
Original commit message:

    [ptr-compr][arm64] Update pointer compression arm64's implementation

    Since kTaggedSize got shrinked and we are actually compressing
    the pointers (as oppposed to zeroing their upper bits),
    we need to update the arm64 codebase to accommodate this change.

    Cq-Include-Trybots: luci.v8.try:v8_linux64_arm64_pointer_compression_rel_ng
    Bug: v8:7703
    Change-Id: I890f3ab8c046f47232e80f85830f9ae8f4dbced4
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1499498
    Commit-Queue: Santiago Aboy Solanes <solanes@chromium.org>
    Reviewed-by: Igor Sheludko <ishell@chromium.org>
    Reviewed-by: Ross McIlroy <rmcilroy@chromium.org>
    Reviewed-by: Clemens Hammacher <clemensh@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#60172}

Refs: f792eb83a6

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>
2019-03-28 16:38:20 -04:00
Anna Henningsen
8181811d73 deps: V8: cherry-pick d82c9af
Original commit message:

    [api] Add unique_ptr constructor for StreamedSource

    Since StreamedSource takes ownership of the ExternalSourceStream
    passed into it, it should take it by unique_ptr rather than raw
    pointer to signal this transfer of ownership. The old constructor
    is now deprecated.

    Change-Id: I24681926c2f3141f7dd3664f72019a4c6deabfd7
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1520713
    Commit-Queue: Yang Guo <yangguo@chromium.org>
    Reviewed-by: Yang Guo <yangguo@chromium.org>
    Auto-Submit: Leszek Swirski <leszeks@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#60232}

Refs: d82c9afb8c

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>
2019-03-28 16:38:12 -04:00
Anna Henningsen
1f03fb4d49 deps: V8: cherry-pick e5f01ba
Original commit message:

    [cleanup] Remove unused stack_trace_ member from PromiseRejectMessage

    R=yangguo@chromium.org

    Bug: v8:8742
    Change-Id: I307097021893617ed5178f1e967f9360a55cd929
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1520710
    Auto-Submit: Simon Zünd <szuend@chromium.org>
    Commit-Queue: Yang Guo <yangguo@chromium.org>
    Reviewed-by: Yang Guo <yangguo@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#60221}

Refs: e5f01ba13f

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>
2019-03-28 16:38:06 -04:00
Anna Henningsen
e6af2207a9 deps: V8: cherry-pick d5f08e4
Original commit message:

    [api] Remove unowned Extensions interface

    Extensions are now always passed via unique_ptr and are owned by V8.
    This CL removes the deprecated API where the embedder would own the
    Extension, but has no mechanism for deleting it.

    R=ulan@chromium.org

    Bug: v8:8725
    Change-Id: Icb83660fad9d04c66f8db2265091ebabcbb197c4
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1514493
    Reviewed-by: Yang Guo <yangguo@chromium.org>
    Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#60186}

Refs: d5f08e4e4f

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>
2019-03-28 16:37:58 -04:00
Anna Henningsen
963061bc02 deps: V8: cherry-pick 6b09d21
Original commit message:

    [api] Remove deprecated WasmCompiledModule

    Embedders should use WasmModuleObject instead.

    R=adamk@chromium.org

    Change-Id: Ibe5e4b160bb917bcd9f895be1b954acc40a045d8
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1513616
    Reviewed-by: Adam Klein <adamk@chromium.org>
    Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#60184}

Refs: 6b09d21c8c

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>
2019-03-28 16:37:51 -04:00
Anna Henningsen
b7338b700f deps: V8: cherry-pick f0bb5d2
Original commit message:

    [api] remove LegacyBuildEmbedderGraphCallback

    This should not be used anymore (and it definitely is not by Node.js
    or Chromium).

    Change-Id: I4a1ce1fda98efd197a64ce0969dae5c8b18f6e97
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1511484
    Reviewed-by: Yang Guo <yangguo@chromium.org>
    Commit-Queue: Yang Guo <yangguo@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#60139}

Refs: f0bb5d2fcf

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>
2019-03-28 16:37:44 -04:00
Anna Henningsen
02171949a0 deps: V8: cherry-pick 5b0510d
Original commit message:

    Give the implementation of v8::MicrotaskQueue::New

    This adds the entrypoint to MicrotaskQueue, which used to miss the
    implementation.

    Bug: v8:8124
    Change-Id: I114fb69d975ee75c86b19349ca76789e425ea910
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1505232
    Reviewed-by: Yang Guo <yangguo@chromium.org>
    Commit-Queue: Taiju Tsuiki <tzik@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#60076}

Refs: 5b0510db7c

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>
2019-03-28 16:37:38 -04:00
Anna Henningsen
bf572c7831 deps: V8: cherry-pick 91f0cd0
Original commit message:

    [ubsan] Fix various ClusterFuzz-found issues

    Fixing a few float and int overflows.
    Drive-by fix: with --experimental-wasm-bigint, Number values
    may not be used to initialize i64-typed globals. The existing
    code for doing that relied on UB; since it's a spec violation
    the fix is to throw instead.

    No regression test for 933103 because it will OOM anyway.
    No regression test for 932896 because it would be extremely slow.

    Bug: chromium:927894, chromium:927996, chromium:930086, chromium:932679, chromium:932896, chromium:933103, chromium:933134
    Change-Id: Iae1c1ff1038af4512a52d3e56b8c4b75f2233314
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1495911
    Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
    Reviewed-by: Michael Starzinger <mstarzinger@chromium.org>
    Reviewed-by: Adam Klein <adamk@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#60075}

Refs: 91f0cd0082

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>
2019-03-28 16:37:31 -04:00
Anna Henningsen
09f134fccf deps: V8: cherry-pick 392316d
Original commit message:

    [ptr-compr][x64] Define kTaggedSize as kInt32Size

    ... when pointer compression is enabled and some number of cleanups.

    Bug: v8:7703
    Change-Id: If7344abf68a1c4d54e4a79d066dc185f25055d7d
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1477737
    Commit-Queue: Igor Sheludko <ishell@chromium.org>
    Auto-Submit: Igor Sheludko <ishell@chromium.org>
    Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
    Reviewed-by: Toon Verwaest <verwaest@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#60056}

Refs: 392316ddd1

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>
2019-03-28 16:37:20 -04:00
Anna Henningsen
53ea813d5c deps: V8: cherry-pick 2f79d68
Original commit message:

    Deprecate MicrotasksCompletedCallback in favor to use *WithData version

    This adds overloads of v8::Isolate::{Add,Remove}MicrotaskCompletedCallback,
    that use MicrotasksCompletedCallbackWithData, and marks the original one
    as V8_DEPRECATE_SOON for transition.

    Bug: v8:8124
    Change-Id: I124c3108545e1a2b29cd95620f36901431663c65
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1493766
    Reviewed-by: Yang Guo <yangguo@chromium.org>
    Commit-Queue: Taiju Tsuiki <tzik@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#60045}

Refs: 2f79d68664

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>
2019-03-28 16:37:11 -04:00
Ujjwal Sharma
cc75ba3f14 deps: sync V8 gypfiles with 7.4
Normalized boolean options in the gypfiles for consistency both
internally and with the V8 GN config.

Co-authored-by: Michaël Zasso <targos@protonmail.com>

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>
2019-03-28 16:36:55 -04:00
Ujjwal Sharma
7df9e77236 src: update NODE_MODULE_VERSION to 72
Major V8 updates are usually API/ABI incompatible with previous
versions. This commit adapts NODE_MODULE_VERSION for V8 7.4.

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

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>
2019-03-28 16:36:41 -04:00
Ujjwal Sharma
561327702d build: reset embedder string to "-node.0"
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>
2019-03-28 16:36:28 -04:00
Ujjwal Sharma
f579e11940 deps: update V8 to 7.4.288.13
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>
2019-03-28 16:36:18 -04:00
Michaël Zasso
2c73868b04
2019-03-28, Version 11.13.0 (Current)
Notable changes:

* crypto
  * Allow deriving public from private keys (Tobias Nießen)
    [#26278](https://github.com/nodejs/node/pull/26278).
* events
  * Added a `once` function to use `EventEmitter` with promises
    (Matteo Collina) [#26078](https://github.com/nodejs/node/pull/26078).
* tty
  * Added a `hasColors` method to `WriteStream` (Ruben Bridgewater)
    [#26247](https://github.com/nodejs/node/pull/26247).
  * Added NO_COLOR and FORCE_COLOR support (Ruben Bridgewater)
    [#26485](https://github.com/nodejs/node/pull/26485).
* v8
  * Added `v8.getHeapSnapshot` and `v8.writeHeapSnapshot` to generate snapshots
    in the format used by tools such as Chrome DevTools (James M Snell)
    [#26501](https://github.com/nodejs/node/pull/26501).
* worker
  * Added `worker.moveMessagePortToContext`. This enables using MessagePorts in
    different vm.Contexts, aiding with the isolation that the vm module seeks to
    provide (Anna Henningsen)
    [#26497](https://github.com/nodejs/node/pull/26497).
* C++ API
  * `AddPromiseHook` is now deprecated. This API was added to fill an use case
    that is served by `async_hooks`, since that has `Promise` support
    (Anna Henningsen) [#26529](https://github.com/nodejs/node/pull/26529).
  * Added a `Stop` API to shut down Node.js while it is running
    (Gireesh Punathil) [#21283](https://github.com/nodejs/node/pull/21283).
* meta
  * [Gireesh Punathil](https://github.com/gireeshpunathil) is now a member of
    the Technical Steering Committee
    [#26657](https://github.com/nodejs/node/pull/26657).
  * Added [Yongsheng Zhang](https://github.com/ZYSzys) to collaborators
    [#26730](https://github.com/nodejs/node/pull/26730).

PR-URL: https://github.com/nodejs/node/pull/26949
2019-03-28 20:23:29 +01:00
Tobias Nießen
c35acc0260
crypto: allow undefined for saltLength and padding
PR-URL: https://github.com/nodejs/node/pull/26921
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2019-03-28 14:33:03 +01:00
Matteo Collina
d4eda4d876 process: remove protection for SyncWriteStream destroy in stdio
https://github.com/nodejs/node/pull/26691 introduced an if to protect
against SyncWriteStream not using the default .destroy() mechanism.
This change removes that as SyncWriteStream now use standard .destroy().

See: https://github.com/nodejs/node/pull/26691

PR-URL: https://github.com/nodejs/node/pull/26902
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2019-03-28 13:54:15 +01:00
Ruben Bridgewater
4bfc06f6b5
util: improve proxy inspection
This makes sure the brace is actually handled as any other brace.
It was handled differently so far than any other brace and that had
an impact on how the output would be formatted.

PR-URL: https://github.com/nodejs/node/pull/26919
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
2019-03-28 12:24:51 +01:00
Ruben Bridgewater
3cf1ffebab
path: fix win32 parse regression
This fixes the parse function for single character input that are not
a path separator.

PR-URL: https://github.com/nodejs/node/pull/26912
Fixes: https://github.com/nodejs/node/issues/26911
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2019-03-28 12:22:21 +01:00
Ruben Bridgewater
4c4ad120c5
test: refactor path parse test
Use destructuring and arrow functions and make one test stricter.
Also inline the error object as there's only a sinlge error that can
currently be thrown in the path module.

PR-URL: https://github.com/nodejs/node/pull/26912
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2019-03-28 12:22:17 +01:00
Tobias Nießen
df1c9eb975
crypto: rename generateKeyPairEdDSA
Now that support for X25519 and X448 has been added, this function is
not used exclusively for EdDSA keys anymore.

PR-URL: https://github.com/nodejs/node/pull/26900
Refs: https://github.com/nodejs/node/pull/26774
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
2019-03-28 11:13:08 +01:00
gengjiawen
230f1f2aa4 src: delete useless code in cares_wrap.cc
PR-URL: https://github.com/nodejs/node/pull/26815
Reviewed-By: Refael Ackermann <refack@gmail.com>
2019-03-28 07:37:37 +01:00
gengjiawen
78ae094ed0 src: fix task release in cares_wrap.cc
PR-URL: https://github.com/nodejs/node/pull/26815
Reviewed-By: Refael Ackermann <refack@gmail.com>
2019-03-28 07:37:34 +01:00
gengjiawen
3440cf6a27 src: use deleted function for class BaseObject
PR-URL: https://github.com/nodejs/node/pull/26815
Reviewed-By: Refael Ackermann <refack@gmail.com>
2019-03-28 07:37:30 +01:00
gengjiawen
0601f16a47 src: delete unused field in class ModuleWrap
PR-URL: https://github.com/nodejs/node/pull/26815
Reviewed-By: Refael Ackermann <refack@gmail.com>
2019-03-28 07:37:27 +01:00
gengjiawen
9addfefd84 src: tidy up include headers in env.cc
PR-URL: https://github.com/nodejs/node/pull/26815
Reviewed-By: Refael Ackermann <refack@gmail.com>
2019-03-28 07:37:24 +01:00
gengjiawen
1b10f0d63c src: delete unreachable code in heap_utils.cc
PR-URL: https://github.com/nodejs/node/pull/26815
Reviewed-By: Refael Ackermann <refack@gmail.com>
2019-03-28 07:37:13 +01:00
Daiki Ihara
85546c2a04 test: add test about unencrypted PKCS#8 private key for RSA
PR-URL: https://github.com/nodejs/node/pull/26898
Refs: https://github.com/nodejs/node/issues/24928
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
2019-03-28 05:47:57 +01:00
gengjiawen
8bc7d2a5be src: fix data type when using uv_get_total_memory()
PR-URL: https://github.com/nodejs/node/pull/26886
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2019-03-28 05:34:01 +01:00
Rich Trott
86517c9f8f console: remove unreachable code
In the current code, line 497 checks if `item` is `null` or `undefined`.
However, `item` is guaranteed to be a non-null object or function at
that point.

* Lines 484/485 set `primitive` to `true` if `item` is null or
  undefined.
* Line 486 skips line 497 if `primitive` is true (which it will always
  be if `item` is null or undefined) and `properties` is undefined. So
  the only way to get to line 497 when `item` is null or undefined is if
  `properties` is specified.
* Line 494 skips line 497 if `primitive` is true (which it will always
  be if `item` is null or undefined) and `properties` are specified
  (which will always be the case or else this `else` block is skipped.)

Here are the current lines 484 through 497:

      const primitive = item === null ||
          (typeof item !== 'function' && typeof item !== 'object');
      if (properties === undefined && primitive) {
        hasPrimitives = true;
        valuesKeyArray[i] = _inspect(item);
      } else {
        const keys = properties || ObjectKeys(item);
        for (const key of keys) {
          if (map[key] === undefined)
            map[key] = [];
          if ((primitive && properties) || !hasOwnProperty(item, key))
            map[key][i] = '';
          else
            map[key][i] = item == null ? item : _inspect(item[key]);

This change removes the unnecessary ternary in that final line,
simplifying it to:

            map[key][i] = _inspect(item[key]);

PR-URL: https://github.com/nodejs/node/pull/26906
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Yuta Hiroto <hello@hiroppy.me>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
2019-03-27 17:22:36 -07:00
Ruben Bridgewater
b5ea925c8e
util: don't set the prototype of callbackified functions
Using `util.callbackify()` should not set the prototype for the
returned function to the one from the input function. It could cause
confusion while debugging otherwise.

PR-URL: https://github.com/nodejs/node/pull/26893
Fixes: https://github.com/nodejs/node/issues/26890
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2019-03-27 22:45:20 +01:00
Ruben Bridgewater
46bf0d0f4f
util: rename callbackified function
This makes sure the function returned by `util.callbackify()` has a
new name that is not identical to the inputs function name.

PR-URL: https://github.com/nodejs/node/pull/26893
Fixes: https://github.com/nodejs/node/issues/26890
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2019-03-27 22:42:13 +01:00
Ruben Bridgewater
61d1334e5b
util: increase function length when using callbackify()
The returned function from `util.callbackify()` should increase the
`length` property by one due to the added callback.

PR-URL: https://github.com/nodejs/node/pull/26893
Fixes: https://github.com/nodejs/node/issues/26890
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2019-03-27 22:42:12 +01:00
guybedford
b1094dbe19
esm: phase two of new esm implementation
This PR updates the current `--experimental-modules` implementation
based on the work of the modules team  and reflects Phase 2 of our
new modules plan.

The largest differences from the current implementation include

* `packge.type` which can be either `module` or `commonjs`
  - `type: "commonjs"`:
    - `.js` is parsed as commonjs
    - default for entry point without an extension is commonjs
  - `type: "module"`:
    - `.js` is parsed as esm
    - does not support loading JSON or Native Module by default
    - default for entry point without an extension is esm
* `--entry-type=[mode]`
  - allows you set the type on entry point.
* A new file extension `.cjs`.
  - this is specifically to support importing commonjs in the
    `module` mode.
  - this is only in the esm loader, the commonjs loader remains
    untouched, but the extension will work in the old loader if you use
    the full file path.
* `--es-module-specifier-resolution=[type]`
  - options are `explicit` (default) and `node`
  - by default our loader will not allow for optional extensions in
    the import, the path for a module must include the extension if
    there is one
  - by default our loader will not allow for importing directories that
    have an index file
  - developers can use `--es-module-specifier-resolution=node` to
    enable the commonjs specifier resolution algorithm
  - This is not a “feature” but rather an implementation for
    experimentation. It is expected to change before the flag is
    removed
* `--experimental-json-loader`
  - the only way to import json when `"type": "module"`
  - when enable all `import 'thing.json'` will go through the
    experimental loader independent of mode
  - based on https://github.com/whatwg/html/issues/4315
* You can use `package.main` to set an entry point for a module
  - the file extensions used in main will be resolved based on the
    `type` of the module

Refs: https://github.com/nodejs/modules/blob/master/doc/plan-for-new-modules-implementation.md
Refs: https://github.com/GeoffreyBooth/node-import-file-specifier-resolution-proposal
Refs: https://github.com/nodejs/modules/pull/180
Refs: https://github.com/nodejs/ecmascript-modules/pull/6
Refs: https://github.com/nodejs/ecmascript-modules/pull/12
Refs: https://github.com/nodejs/ecmascript-modules/pull/28
Refs: https://github.com/nodejs/modules/issues/255
Refs: https://github.com/whatwg/html/issues/4315
Refs: https://github.com/w3c/webcomponents/issues/770
Co-authored-by: Myles Borins <MylesBorins@google.com>
Co-authored-by: John-David Dalton <john.david.dalton@gmail.com>
Co-authored-by: Evan Plaice <evanplaice@gmail.com>
Co-authored-by: Geoffrey Booth <webmaster@geoffreybooth.com>
Co-authored-by: Michaël Zasso <targos@protonmail.com>

PR-URL: https://github.com/nodejs/node/pull/26745
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Ben Coe <bencoe@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
2019-03-27 15:52:11 -04:00
Ruben Bridgewater
39141426d4
tools: update capitalize-comments eslint rule
This strictens the rule to apply from 20 characters on instead of
from 30.

PR-URL: https://github.com/nodejs/node/pull/26849
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
2019-03-27 17:20:07 +01:00
Ruben Bridgewater
b08a867d60
benchmark,doc,lib: capitalize more comments
PR-URL: https://github.com/nodejs/node/pull/26849
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
2019-03-27 17:20:06 +01:00
Ruben Bridgewater
fd992e6e36
doc: mark settings as optional and add callback
The settings are currently not required and the callback was not
documented so far.

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

PR-URL: https://github.com/nodejs/node/pull/26894
Refs: https://github.com/nodejs/node/pull/26811
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2019-03-27 17:14:38 +01:00
Ruben Bridgewater
115f0f5a57
module: throw an error for invalid package.json main entries
We currently ignore invalid `main` entries in package.json files.
This does not seem to be very user friendly as it's certainly an
error if the `main` entry is not a valid file name. So instead of
trying to resolve the file otherwise, throw an error immediately to
improve the user experience.
To keep it backwards compatible `index.js` files in the same directory
as the `package.json` will continue to be resolved instead but that
behavior is now deprecated.

PR-URL: https://github.com/nodejs/node/pull/26823
Fixes: https://github.com/nodejs/node/issues/26588
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2019-03-27 17:11:53 +01:00
Ruben Bridgewater
7bddfcc61a
lib: consolidate arrayBufferView validation
There are lots of places that validate for arrayBufferView and we
have multiple functions that do the same thing. Instead, move the
validation into `internal/validators` so all files can use that
instead.

There are more functions throughout the code that do the same but
it takes some more work to fully consolidate all of those.

PR-URL: https://github.com/nodejs/node/pull/26809
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2019-03-27 17:05:19 +01:00
Ruben Bridgewater
751c92d972
crypto: remove obsolete encoding check
This renames the parameters for clarity and removes the check for
undefined encoding. That will always default to `utf8`.

PR-URL: https://github.com/nodejs/node/pull/26809
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2019-03-27 17:05:18 +01:00