From 9df1e8f10e6a5fc8327b5182bd7e10918d3fa977 Mon Sep 17 00:00:00 2001 From: Matteo Collina Date: Sun, 5 Nov 2017 12:26:27 +0000 Subject: [PATCH 001/110] console: avoid adding infinite error listeners If the console destination is a unix pipe (net.Socket), write() is async. If the destination is broken, we are adding an 'error' event listener to avoid a process crash. This PR makes sure that we are adding that listener only once. Fixes: https://github.com/nodejs/node/issues/16767 PR-URL: https://github.com/nodejs/node/pull/16770 Fixes: https://github.com/nodejs/node/issues/16767 Reviewed-By: James M Snell Reviewed-By: Anna Henningsen Reviewed-By: Colin Ihrig Reviewed-By: Anatoli Papirovski Reviewed-By: Luigi Pinca Reviewed-By: Sam Roberts --- lib/console.js | 5 +++- .../test-console-log-stdio-broken-dest.js | 24 +++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 test/parallel/test-console-log-stdio-broken-dest.js diff --git a/lib/console.js b/lib/console.js index b5ff18fcc1911e..d2562df7c60dd5 100644 --- a/lib/console.js +++ b/lib/console.js @@ -82,7 +82,10 @@ function createWriteErrorHandler(stream) { // an `error` event. Adding a `once` listener will keep that error // from becoming an uncaught exception, but since the handler is // removed after the event, non-console.* writes won’t be affected. - stream.once('error', noop); + // we are only adding noop if there is no one else listening for 'error' + if (stream.listenerCount('error') === 0) { + stream.on('error', noop); + } } }; } diff --git a/test/parallel/test-console-log-stdio-broken-dest.js b/test/parallel/test-console-log-stdio-broken-dest.js new file mode 100644 index 00000000000000..d29e8ee5173be7 --- /dev/null +++ b/test/parallel/test-console-log-stdio-broken-dest.js @@ -0,0 +1,24 @@ +'use strict'; + +const common = require('../common'); +const { Writable } = require('stream'); +const { Console } = require('console'); +const { EventEmitter } = require('events'); + +const stream = new Writable({ + write(chunk, enc, cb) { + cb(); + }, + writev(chunks, cb) { + setTimeout(cb, 10, new Error('kaboom')); + } +}); +const myConsole = new Console(stream, stream); + +process.on('warning', common.mustNotCall); + +stream.cork(); +for (let i = 0; i < EventEmitter.defaultMaxListeners + 1; i++) { + myConsole.log('a message'); +} +stream.uncork(); From 47b1c3b43ca92ed1808c17fdfed185060dd1bd63 Mon Sep 17 00:00:00 2001 From: Ashish Kaila Date: Sat, 21 Oct 2017 00:27:24 -0700 Subject: [PATCH 002/110] test: add test for WrapStream readStop PR-URL: https://github.com/nodejs/node/pull/16356 Reviewed-By: Anna Henningsen Reviewed-By: James M Snell Reviewed-By: Anatoli Papirovski Reviewed-By: Gibson Fahnestock --- .../parallel/test-wrap-js-stream-read-stop.js | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 test/parallel/test-wrap-js-stream-read-stop.js diff --git a/test/parallel/test-wrap-js-stream-read-stop.js b/test/parallel/test-wrap-js-stream-read-stop.js new file mode 100644 index 00000000000000..f51b3ecf524e30 --- /dev/null +++ b/test/parallel/test-wrap-js-stream-read-stop.js @@ -0,0 +1,42 @@ +// Flags: --expose-internals +'use strict'; + +require('../common'); +const assert = require('assert'); +const WrapStream = require('internal/wrap_js_stream'); +const Stream = require('stream'); + +class FakeStream extends Stream { + constructor() { + super(); + this._paused = false; + } + + pause() { + this._paused = true; + } + + resume() { + this._paused = false; + } + + isPaused() { + return this._paused; + } +} + +const fakeStreamObj = new FakeStream(); +const wrappedStream = new WrapStream(fakeStreamObj); + +// Resume by wrapped stream upon construction +assert.strictEqual(fakeStreamObj.isPaused(), false); + +fakeStreamObj.pause(); + +assert.strictEqual(fakeStreamObj.isPaused(), true); + +fakeStreamObj.resume(); + +assert.strictEqual(wrappedStream.readStop(), 0); + +assert.strictEqual(fakeStreamObj.isPaused(), true); From 255fffbbc857ebbe1f97a7eeed27fd3d229c404c Mon Sep 17 00:00:00 2001 From: Joyee Cheung Date: Mon, 30 Oct 2017 17:46:58 +0800 Subject: [PATCH 003/110] src: do not include x.h if x-inl.h is included Fixes: https://github.com/nodejs/node/issues/16519 PR-URL: https://github.com/nodejs/node/pull/16548 Backport-PR-URL: https://github.com/nodejs/node/pull/16609 Reviewed-By: Ben Noordhuis Reviewed-By: Gireesh Punathil Reviewed-By: Daniel Bevenius Reviewed-By: Gibson Fahnestock Reviewed-By: Colin Ihrig --- src/aliased_buffer.h | 1 - src/async-wrap-inl.h | 1 - src/async-wrap.cc | 2 -- src/base-object-inl.h | 2 -- src/cares_wrap.cc | 2 -- src/connect_wrap.cc | 2 -- src/connection_wrap.cc | 2 -- src/env-inl.h | 1 - src/fs_event_wrap.cc | 2 -- src/handle_wrap.cc | 2 -- src/inspector_io.cc | 1 - src/inspector_js_api.cc | 1 - src/inspector_socket.cc | 1 - src/inspector_socket.h | 1 - src/js_stream.cc | 2 -- src/module_wrap.cc | 1 - src/module_wrap.h | 1 - src/node.cc | 2 -- src/node_buffer.cc | 2 -- src/node_config.cc | 2 -- src/node_contextify.cc | 1 - src/node_counters.cc | 1 - src/node_crypto.cc | 2 -- src/node_crypto.h | 4 +--- src/node_crypto_bio.cc | 1 - src/node_crypto_bio.h | 2 -- src/node_crypto_clienthello-inl.h | 1 - src/node_crypto_clienthello.cc | 1 - src/node_dtrace.cc | 1 - src/node_file.cc | 1 - src/node_http2_core.h | 1 - src/node_http_parser.cc | 2 -- src/node_i18n.cc | 3 --- src/node_internals.h | 2 -- src/node_lttng.cc | 1 - src/node_perf.h | 1 - src/node_serdes.cc | 1 - src/node_stat_watcher.cc | 2 -- src/node_url.cc | 1 - src/node_url.h | 1 - src/node_v8.cc | 2 -- src/node_win32_etw_provider.cc | 1 - src/node_zlib.cc | 2 -- src/pipe_wrap.cc | 3 --- src/process_wrap.cc | 2 -- src/req-wrap-inl.h | 2 -- src/signal_wrap.cc | 2 -- src/stream_base-inl.h | 1 - src/stream_base.cc | 3 --- src/stream_base.h | 1 - src/stream_wrap.cc | 3 --- src/string_bytes.h | 1 - src/tcp_wrap.cc | 2 -- src/timer_wrap.cc | 2 -- src/tls_wrap.cc | 4 +--- src/tty_wrap.cc | 3 --- src/udp_wrap.cc | 2 -- src/udp_wrap.h | 1 - src/uv.cc | 1 - 59 files changed, 2 insertions(+), 97 deletions(-) diff --git a/src/aliased_buffer.h b/src/aliased_buffer.h index 2e5598b4757902..21aaeb61141c59 100644 --- a/src/aliased_buffer.h +++ b/src/aliased_buffer.h @@ -3,7 +3,6 @@ #define SRC_ALIASED_BUFFER_H_ #include "v8.h" -#include "util.h" #include "util-inl.h" namespace node { diff --git a/src/async-wrap-inl.h b/src/async-wrap-inl.h index dd947dbd446cac..617d51dc59f037 100644 --- a/src/async-wrap-inl.h +++ b/src/async-wrap-inl.h @@ -25,7 +25,6 @@ #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS #include "async-wrap.h" -#include "base-object.h" #include "base-object-inl.h" #include "node_internals.h" diff --git a/src/async-wrap.cc b/src/async-wrap.cc index 3980293453b4eb..1b1452b69379c7 100644 --- a/src/async-wrap.cc +++ b/src/async-wrap.cc @@ -19,11 +19,9 @@ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. -#include "async-wrap.h" #include "async-wrap-inl.h" #include "env.h" #include "env-inl.h" -#include "util.h" #include "util-inl.h" #include "uv.h" diff --git a/src/base-object-inl.h b/src/base-object-inl.h index 94449819a83239..480edd7463e7f0 100644 --- a/src/base-object-inl.h +++ b/src/base-object-inl.h @@ -25,9 +25,7 @@ #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS #include "base-object.h" -#include "env.h" #include "env-inl.h" -#include "util.h" #include "util-inl.h" #include "v8.h" diff --git a/src/cares_wrap.cc b/src/cares_wrap.cc index e800e0f2fee260..7b8ec12d051e0c 100644 --- a/src/cares_wrap.cc +++ b/src/cares_wrap.cc @@ -21,12 +21,10 @@ #define CARES_STATICLIB #include "ares.h" -#include "async-wrap.h" #include "async-wrap-inl.h" #include "env.h" #include "env-inl.h" #include "node.h" -#include "req-wrap.h" #include "req-wrap-inl.h" #include "util.h" #include "util-inl.h" diff --git a/src/connect_wrap.cc b/src/connect_wrap.cc index e373b5a36e33e6..6a2857ba7e30df 100644 --- a/src/connect_wrap.cc +++ b/src/connect_wrap.cc @@ -1,8 +1,6 @@ #include "connect_wrap.h" -#include "env.h" #include "env-inl.h" -#include "req-wrap.h" #include "req-wrap-inl.h" #include "util.h" #include "util-inl.h" diff --git a/src/connection_wrap.cc b/src/connection_wrap.cc index a7f08ecc19f2d8..b620c387ff1cfc 100644 --- a/src/connection_wrap.cc +++ b/src/connection_wrap.cc @@ -2,11 +2,9 @@ #include "connect_wrap.h" #include "env-inl.h" -#include "env.h" #include "pipe_wrap.h" #include "stream_wrap.h" #include "tcp_wrap.h" -#include "util.h" #include "util-inl.h" namespace node { diff --git a/src/env-inl.h b/src/env-inl.h index e6e189be3dcbab..2cd0046b85475e 100644 --- a/src/env-inl.h +++ b/src/env-inl.h @@ -27,7 +27,6 @@ #include "aliased_buffer.h" #include "env.h" #include "node.h" -#include "util.h" #include "util-inl.h" #include "uv.h" #include "v8.h" diff --git a/src/fs_event_wrap.cc b/src/fs_event_wrap.cc index 8ec8dd6dcfbd76..5a8693c380b822 100644 --- a/src/fs_event_wrap.cc +++ b/src/fs_event_wrap.cc @@ -19,11 +19,9 @@ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. -#include "async-wrap.h" #include "async-wrap-inl.h" #include "env.h" #include "env-inl.h" -#include "util.h" #include "util-inl.h" #include "node.h" #include "handle_wrap.h" diff --git a/src/handle_wrap.cc b/src/handle_wrap.cc index 7d0925e2fd6354..bc4c222deaf5d0 100644 --- a/src/handle_wrap.cc +++ b/src/handle_wrap.cc @@ -20,11 +20,9 @@ // USE OR OTHER DEALINGS IN THE SOFTWARE. #include "handle_wrap.h" -#include "async-wrap.h" #include "async-wrap-inl.h" #include "env.h" #include "env-inl.h" -#include "util.h" #include "util-inl.h" #include "node.h" diff --git a/src/inspector_io.cc b/src/inspector_io.cc index 12a0d20720354a..73f0419ead6545 100644 --- a/src/inspector_io.cc +++ b/src/inspector_io.cc @@ -1,7 +1,6 @@ #include "inspector_io.h" #include "inspector_socket_server.h" -#include "env.h" #include "env-inl.h" #include "node.h" #include "node_crypto.h" diff --git a/src/inspector_js_api.cc b/src/inspector_js_api.cc index 8bd682351a0531..f72517bac18c70 100644 --- a/src/inspector_js_api.cc +++ b/src/inspector_js_api.cc @@ -1,4 +1,3 @@ -#include "base-object.h" #include "base-object-inl.h" #include "inspector_agent.h" #include "inspector_io.h" diff --git a/src/inspector_socket.cc b/src/inspector_socket.cc index 092138a7fa6f90..265b37616138dc 100644 --- a/src/inspector_socket.cc +++ b/src/inspector_socket.cc @@ -1,5 +1,4 @@ #include "inspector_socket.h" -#include "util.h" #include "util-inl.h" #define NODE_WANT_INTERNALS 1 diff --git a/src/inspector_socket.h b/src/inspector_socket.h index ee4bd7835c75ff..f93150d6f9a1cf 100644 --- a/src/inspector_socket.h +++ b/src/inspector_socket.h @@ -2,7 +2,6 @@ #define SRC_INSPECTOR_SOCKET_H_ #include "http_parser.h" -#include "util.h" #include "util-inl.h" #include "uv.h" diff --git a/src/js_stream.cc b/src/js_stream.cc index a279970c1bbfca..9d28b90585048a 100644 --- a/src/js_stream.cc +++ b/src/js_stream.cc @@ -1,10 +1,8 @@ #include "js_stream.h" #include "async-wrap.h" -#include "env.h" #include "env-inl.h" #include "node_buffer.h" -#include "stream_base.h" #include "stream_base-inl.h" #include "v8.h" diff --git a/src/module_wrap.cc b/src/module_wrap.cc index 92dc9cf917934f..c28fe6580e0802 100644 --- a/src/module_wrap.cc +++ b/src/module_wrap.cc @@ -5,7 +5,6 @@ #include "env.h" #include "node_url.h" -#include "util.h" #include "util-inl.h" #include "node_internals.h" diff --git a/src/module_wrap.h b/src/module_wrap.h index ac2f90476d5b59..e0f7ce5bd2dddc 100644 --- a/src/module_wrap.h +++ b/src/module_wrap.h @@ -7,7 +7,6 @@ #include #include #include "node_url.h" -#include "base-object.h" #include "base-object-inl.h" namespace node { diff --git a/src/node.cc b/src/node.cc index e6e3e02c98e5db..4728798d0580a2 100644 --- a/src/node.cc +++ b/src/node.cc @@ -54,14 +54,12 @@ #endif #include "ares.h" -#include "async-wrap.h" #include "async-wrap-inl.h" #include "env.h" #include "env-inl.h" #include "handle_wrap.h" #include "http_parser.h" #include "nghttp2/nghttp2ver.h" -#include "req-wrap.h" #include "req-wrap-inl.h" #include "string_bytes.h" #include "tracing/agent.h" diff --git a/src/node_buffer.cc b/src/node_buffer.cc index d6e4aa9da072db..b39bbbb5d28265 100644 --- a/src/node_buffer.cc +++ b/src/node_buffer.cc @@ -22,11 +22,9 @@ #include "node.h" #include "node_buffer.h" -#include "env.h" #include "env-inl.h" #include "string_bytes.h" #include "string_search.h" -#include "util.h" #include "util-inl.h" #include "v8-profiler.h" #include "v8.h" diff --git a/src/node_config.cc b/src/node_config.cc index a11faaefec37d4..7fa275b8df05cc 100644 --- a/src/node_config.cc +++ b/src/node_config.cc @@ -1,8 +1,6 @@ #include "node.h" #include "node_i18n.h" -#include "env.h" #include "env-inl.h" -#include "util.h" #include "util-inl.h" #include "node_debug_options.h" diff --git a/src/node_contextify.cc b/src/node_contextify.cc index 988de8bb506438..1a44b5e4410294 100644 --- a/src/node_contextify.cc +++ b/src/node_contextify.cc @@ -21,7 +21,6 @@ #include "node_internals.h" #include "node_watchdog.h" -#include "base-object.h" #include "base-object-inl.h" #include "v8-debug.h" diff --git a/src/node_counters.cc b/src/node_counters.cc index c6e9ea50379cb0..06d2b9f68f103e 100644 --- a/src/node_counters.cc +++ b/src/node_counters.cc @@ -21,7 +21,6 @@ #include "node_counters.h" #include "uv.h" -#include "env.h" #include "env-inl.h" #include diff --git a/src/node_crypto.cc b/src/node_crypto.cc index 1c953f093146c7..a576e5e10fec56 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -28,12 +28,10 @@ #include "node_mutex.h" #include "tls_wrap.h" // TLSWrap -#include "async-wrap.h" #include "async-wrap-inl.h" #include "env.h" #include "env-inl.h" #include "string_bytes.h" -#include "util.h" #include "util-inl.h" #include "v8.h" // CNNIC Hash WhiteList is taken from diff --git a/src/node_crypto.h b/src/node_crypto.h index 3abfe973a79ebd..a155411aa8195c 100644 --- a/src/node_crypto.h +++ b/src/node_crypto.h @@ -25,15 +25,13 @@ #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS #include "node.h" -#include "node_crypto_clienthello.h" // ClientHelloParser +// ClientHelloParser #include "node_crypto_clienthello-inl.h" #include "node_buffer.h" #include "env.h" -#include "async-wrap.h" #include "async-wrap-inl.h" -#include "base-object.h" #include "base-object-inl.h" #include "v8.h" diff --git a/src/node_crypto_bio.cc b/src/node_crypto_bio.cc index 00fd0b420c38c5..eb1399f0bffb96 100644 --- a/src/node_crypto_bio.cc +++ b/src/node_crypto_bio.cc @@ -21,7 +21,6 @@ #include "node_crypto_bio.h" #include "openssl/bio.h" -#include "util.h" #include "util-inl.h" #include #include diff --git a/src/node_crypto_bio.h b/src/node_crypto_bio.h index 5deac922323808..6ec256d008153b 100644 --- a/src/node_crypto_bio.h +++ b/src/node_crypto_bio.h @@ -25,9 +25,7 @@ #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS #include "openssl/bio.h" -#include "env.h" #include "env-inl.h" -#include "util.h" #include "util-inl.h" #include "v8.h" diff --git a/src/node_crypto_clienthello-inl.h b/src/node_crypto_clienthello-inl.h index 84cce301547561..019d7188de6cf3 100644 --- a/src/node_crypto_clienthello-inl.h +++ b/src/node_crypto_clienthello-inl.h @@ -25,7 +25,6 @@ #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS #include "node_crypto_clienthello.h" -#include "util.h" #include "util-inl.h" namespace node { diff --git a/src/node_crypto_clienthello.cc b/src/node_crypto_clienthello.cc index 65b5dff7f74447..d4d222f838c5ac 100644 --- a/src/node_crypto_clienthello.cc +++ b/src/node_crypto_clienthello.cc @@ -19,7 +19,6 @@ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. -#include "node_crypto_clienthello.h" #include "node_crypto_clienthello-inl.h" namespace node { diff --git a/src/node_dtrace.cc b/src/node_dtrace.cc index 39014e710577d4..ed063fddfafc49 100644 --- a/src/node_dtrace.cc +++ b/src/node_dtrace.cc @@ -24,7 +24,6 @@ #ifdef HAVE_DTRACE #include "node_provider.h" #elif HAVE_ETW -#include "node_win32_etw_provider.h" #include "node_win32_etw_provider-inl.h" #else #define NODE_HTTP_SERVER_REQUEST(arg0, arg1) diff --git a/src/node_file.cc b/src/node_file.cc index 887dff5a030e06..5039f3ff1e71ff 100644 --- a/src/node_file.cc +++ b/src/node_file.cc @@ -23,7 +23,6 @@ #include "node_internals.h" #include "node_stat_watcher.h" -#include "req-wrap.h" #include "req-wrap-inl.h" #include "string_bytes.h" diff --git a/src/node_http2_core.h b/src/node_http2_core.h index 21df45c42ce8ba..2e885b73dab8f5 100644 --- a/src/node_http2_core.h +++ b/src/node_http2_core.h @@ -3,7 +3,6 @@ #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS -#include "util.h" #include "util-inl.h" #include "uv.h" #include "nghttp2/nghttp2.h" diff --git a/src/node_http_parser.cc b/src/node_http_parser.cc index 11d0aa42b23829..329da616f7cf1a 100644 --- a/src/node_http_parser.cc +++ b/src/node_http_parser.cc @@ -22,12 +22,10 @@ #include "node.h" #include "node_buffer.h" -#include "async-wrap.h" #include "async-wrap-inl.h" #include "env.h" #include "env-inl.h" #include "http_parser.h" -#include "stream_base.h" #include "stream_base-inl.h" #include "util.h" #include "util-inl.h" diff --git a/src/node_i18n.cc b/src/node_i18n.cc index 2e1aeaa4cb07c5..30f421a8b8384b 100644 --- a/src/node_i18n.cc +++ b/src/node_i18n.cc @@ -46,11 +46,8 @@ #include "node.h" #include "node_buffer.h" -#include "env.h" #include "env-inl.h" -#include "util.h" #include "util-inl.h" -#include "base-object.h" #include "base-object-inl.h" #include "v8.h" diff --git a/src/node_internals.h b/src/node_internals.h index e2e81d61e31bd4..85f90a60f8d278 100644 --- a/src/node_internals.h +++ b/src/node_internals.h @@ -25,9 +25,7 @@ #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS #include "node.h" -#include "util.h" #include "util-inl.h" -#include "env.h" #include "env-inl.h" #include "uv.h" #include "v8.h" diff --git a/src/node_lttng.cc b/src/node_lttng.cc index 490beb6e40007d..1f6f4322a5fe79 100644 --- a/src/node_lttng.cc +++ b/src/node_lttng.cc @@ -21,7 +21,6 @@ #define NODE_GC_DONE(arg0, arg1, arg2) #endif -#include "env.h" #include "env-inl.h" namespace node { diff --git a/src/node_perf.h b/src/node_perf.h index 6699272e883367..ba7a326471d695 100644 --- a/src/node_perf.h +++ b/src/node_perf.h @@ -6,7 +6,6 @@ #include "node.h" #include "node_perf_common.h" #include "env.h" -#include "base-object.h" #include "base-object-inl.h" #include "v8.h" diff --git a/src/node_serdes.cc b/src/node_serdes.cc index f477016ec03e9f..4e99513a5fd31c 100644 --- a/src/node_serdes.cc +++ b/src/node_serdes.cc @@ -1,6 +1,5 @@ #include "node_internals.h" #include "node_buffer.h" -#include "base-object.h" #include "base-object-inl.h" namespace node { diff --git a/src/node_stat_watcher.cc b/src/node_stat_watcher.cc index 4b2e4db7bc418c..46414bcbfd7a2c 100644 --- a/src/node_stat_watcher.cc +++ b/src/node_stat_watcher.cc @@ -20,11 +20,9 @@ // USE OR OTHER DEALINGS IN THE SOFTWARE. #include "node_stat_watcher.h" -#include "async-wrap.h" #include "async-wrap-inl.h" #include "env.h" #include "env-inl.h" -#include "util.h" #include "util-inl.h" #include diff --git a/src/node_url.cc b/src/node_url.cc index e7a0b47194e84a..49c005a23bc2c7 100644 --- a/src/node_url.cc +++ b/src/node_url.cc @@ -1,6 +1,5 @@ #include "node_url.h" #include "node_internals.h" -#include "base-object.h" #include "base-object-inl.h" #include "node_i18n.h" diff --git a/src/node_url.h b/src/node_url.h index 503fb21e0d4f30..872f2fbc97f65c 100644 --- a/src/node_url.h +++ b/src/node_url.h @@ -4,7 +4,6 @@ #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS #include "node.h" -#include "env.h" #include "env-inl.h" #include diff --git a/src/node_v8.cc b/src/node_v8.cc index f46bed248ea2d9..8b4d31a880dc0c 100644 --- a/src/node_v8.cc +++ b/src/node_v8.cc @@ -20,9 +20,7 @@ // USE OR OTHER DEALINGS IN THE SOFTWARE. #include "node.h" -#include "env.h" #include "env-inl.h" -#include "util.h" #include "util-inl.h" #include "v8.h" diff --git a/src/node_win32_etw_provider.cc b/src/node_win32_etw_provider.cc index 8a854767d6aed8..11694d7d0e43ea 100644 --- a/src/node_win32_etw_provider.cc +++ b/src/node_win32_etw_provider.cc @@ -19,7 +19,6 @@ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. -#include "node_win32_etw_provider.h" #include "node_etw_provider.h" #include "node_win32_etw_provider-inl.h" diff --git a/src/node_zlib.cc b/src/node_zlib.cc index e48482cdc752f3..2133aac26ce2ae 100644 --- a/src/node_zlib.cc +++ b/src/node_zlib.cc @@ -22,11 +22,9 @@ #include "node.h" #include "node_buffer.h" -#include "async-wrap.h" #include "async-wrap-inl.h" #include "env.h" #include "env-inl.h" -#include "util.h" #include "util-inl.h" #include "v8.h" diff --git a/src/pipe_wrap.cc b/src/pipe_wrap.cc index 72dd99c1e5cc97..b76b31e81df45b 100644 --- a/src/pipe_wrap.cc +++ b/src/pipe_wrap.cc @@ -23,7 +23,6 @@ #include "async-wrap.h" #include "connection_wrap.h" -#include "env.h" #include "env-inl.h" #include "handle_wrap.h" #include "node.h" @@ -32,8 +31,6 @@ #include "connect_wrap.h" #include "stream_wrap.h" #include "util-inl.h" -#include "util.h" - namespace node { using v8::Context; diff --git a/src/process_wrap.cc b/src/process_wrap.cc index d5a408af692111..c1148f9bfb26ff 100644 --- a/src/process_wrap.cc +++ b/src/process_wrap.cc @@ -19,11 +19,9 @@ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. -#include "env.h" #include "env-inl.h" #include "handle_wrap.h" #include "node_wrap.h" -#include "util.h" #include "util-inl.h" #include diff --git a/src/req-wrap-inl.h b/src/req-wrap-inl.h index e21fb1bdad9363..045cb298e46344 100644 --- a/src/req-wrap-inl.h +++ b/src/req-wrap-inl.h @@ -4,11 +4,9 @@ #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS #include "req-wrap.h" -#include "async-wrap.h" #include "async-wrap-inl.h" #include "env.h" #include "env-inl.h" -#include "util.h" #include "util-inl.h" namespace node { diff --git a/src/signal_wrap.cc b/src/signal_wrap.cc index 048a3de4beaece..d5bbddc8a025e7 100644 --- a/src/signal_wrap.cc +++ b/src/signal_wrap.cc @@ -19,12 +19,10 @@ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. -#include "async-wrap.h" #include "async-wrap-inl.h" #include "env.h" #include "env-inl.h" #include "handle_wrap.h" -#include "util.h" #include "util-inl.h" #include "v8.h" diff --git a/src/stream_base-inl.h b/src/stream_base-inl.h index 562af2a53325dd..667c0a9ffbd50d 100644 --- a/src/stream_base-inl.h +++ b/src/stream_base-inl.h @@ -6,7 +6,6 @@ #include "stream_base.h" #include "node.h" -#include "env.h" #include "env-inl.h" #include "v8.h" diff --git a/src/stream_base.cc b/src/stream_base.cc index a923fc669fd13c..c6aca1694f9568 100644 --- a/src/stream_base.cc +++ b/src/stream_base.cc @@ -1,14 +1,11 @@ -#include "stream_base.h" #include "stream_base-inl.h" #include "stream_wrap.h" #include "node.h" #include "node_buffer.h" -#include "env.h" #include "env-inl.h" #include "js_stream.h" #include "string_bytes.h" -#include "util.h" #include "util-inl.h" #include "v8.h" diff --git a/src/stream_base.h b/src/stream_base.h index 1b486e61db150e..9833a82636d28e 100644 --- a/src/stream_base.h +++ b/src/stream_base.h @@ -5,7 +5,6 @@ #include "env.h" #include "async-wrap.h" -#include "req-wrap.h" #include "req-wrap-inl.h" #include "node.h" #include "util.h" diff --git a/src/stream_wrap.cc b/src/stream_wrap.cc index 0107cbad2d9196..c2915ac453ea33 100644 --- a/src/stream_wrap.cc +++ b/src/stream_wrap.cc @@ -20,7 +20,6 @@ // USE OR OTHER DEALINGS IN THE SOFTWARE. #include "stream_wrap.h" -#include "stream_base.h" #include "stream_base-inl.h" #include "env-inl.h" @@ -29,11 +28,9 @@ #include "node_buffer.h" #include "node_counters.h" #include "pipe_wrap.h" -#include "req-wrap.h" #include "req-wrap-inl.h" #include "tcp_wrap.h" #include "udp_wrap.h" -#include "util.h" #include "util-inl.h" #include // abort() diff --git a/src/string_bytes.h b/src/string_bytes.h index e46fa8227b7236..0e38e017ab2f41 100644 --- a/src/string_bytes.h +++ b/src/string_bytes.h @@ -28,7 +28,6 @@ #include "v8.h" #include "node.h" -#include "env.h" #include "env-inl.h" #include "util.h" diff --git a/src/tcp_wrap.cc b/src/tcp_wrap.cc index fdb8244bf6ac24..ce86108cb0acbb 100644 --- a/src/tcp_wrap.cc +++ b/src/tcp_wrap.cc @@ -22,14 +22,12 @@ #include "tcp_wrap.h" #include "connection_wrap.h" -#include "env.h" #include "env-inl.h" #include "handle_wrap.h" #include "node_buffer.h" #include "node_wrap.h" #include "connect_wrap.h" #include "stream_wrap.h" -#include "util.h" #include "util-inl.h" #include diff --git a/src/timer_wrap.cc b/src/timer_wrap.cc index e398a471e74242..08701b4ff08d55 100644 --- a/src/timer_wrap.cc +++ b/src/timer_wrap.cc @@ -19,12 +19,10 @@ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. -#include "async-wrap.h" #include "async-wrap-inl.h" #include "env.h" #include "env-inl.h" #include "handle_wrap.h" -#include "util.h" #include "util-inl.h" #include diff --git a/src/tls_wrap.cc b/src/tls_wrap.cc index 63e3494047a21e..3315267330afa2 100644 --- a/src/tls_wrap.cc +++ b/src/tls_wrap.cc @@ -20,16 +20,14 @@ // USE OR OTHER DEALINGS IN THE SOFTWARE. #include "tls_wrap.h" -#include "async-wrap.h" #include "async-wrap-inl.h" #include "node_buffer.h" // Buffer #include "node_crypto.h" // SecureContext #include "node_crypto_bio.h" // NodeBIO -#include "node_crypto_clienthello.h" // ClientHelloParser +// ClientHelloParser #include "node_crypto_clienthello-inl.h" #include "node_counters.h" #include "node_internals.h" -#include "stream_base.h" #include "stream_base-inl.h" namespace node { diff --git a/src/tty_wrap.cc b/src/tty_wrap.cc index ca84008785829d..872a126c6d4ee4 100644 --- a/src/tty_wrap.cc +++ b/src/tty_wrap.cc @@ -21,15 +21,12 @@ #include "tty_wrap.h" -#include "env.h" #include "env-inl.h" #include "handle_wrap.h" #include "node_buffer.h" #include "node_wrap.h" -#include "req-wrap.h" #include "req-wrap-inl.h" #include "stream_wrap.h" -#include "util.h" #include "util-inl.h" namespace node { diff --git a/src/udp_wrap.cc b/src/udp_wrap.cc index b8c53534052f70..54f1b610238ff9 100644 --- a/src/udp_wrap.cc +++ b/src/udp_wrap.cc @@ -20,11 +20,9 @@ // USE OR OTHER DEALINGS IN THE SOFTWARE. #include "udp_wrap.h" -#include "env.h" #include "env-inl.h" #include "node_buffer.h" #include "handle_wrap.h" -#include "req-wrap.h" #include "req-wrap-inl.h" #include "util.h" #include "util-inl.h" diff --git a/src/udp_wrap.h b/src/udp_wrap.h index 5be603d62e31e2..fe9256bcc63a05 100644 --- a/src/udp_wrap.h +++ b/src/udp_wrap.h @@ -27,7 +27,6 @@ #include "async-wrap.h" #include "env.h" #include "handle_wrap.h" -#include "req-wrap.h" #include "req-wrap-inl.h" #include "uv.h" #include "v8.h" diff --git a/src/uv.cc b/src/uv.cc index 3e345374a2ef74..fbe61c9b0164d7 100644 --- a/src/uv.cc +++ b/src/uv.cc @@ -21,7 +21,6 @@ #include "uv.h" #include "node.h" -#include "env.h" #include "env-inl.h" namespace node { From a2fd9a3cf2178a43fd37c696845637266821cc2c Mon Sep 17 00:00:00 2001 From: Joyee Cheung Date: Fri, 27 Oct 2017 16:30:31 +0800 Subject: [PATCH 004/110] doc: add *-inl.h include rule to C++ style guide PR-URL: https://github.com/nodejs/node/pull/16548 Backport-PR-URL: https://github.com/nodejs/node/pull/16609 Reviewed-By: Ben Noordhuis Reviewed-By: Gireesh Punathil Reviewed-By: Daniel Bevenius Reviewed-By: Gibson Fahnestock Reviewed-By: Colin Ihrig --- CPP_STYLE_GUIDE.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/CPP_STYLE_GUIDE.md b/CPP_STYLE_GUIDE.md index 3e7319c1f8e8f7..3bea5bb107586f 100644 --- a/CPP_STYLE_GUIDE.md +++ b/CPP_STYLE_GUIDE.md @@ -127,6 +127,21 @@ class FancyContainer { What it says in the title. +## Do not include `*.h` if `*-inl.h` has already been included + +Do + +```cpp +#include "util-inl.h" // already includes util.h +``` + +instead of + +```cpp +#include "util.h" +#include "util-inl.h" +``` + ## Avoid throwing JavaScript errors in nested C++ methods If you need to throw JavaScript errors from a C++ binding method, try to do it From cecd1e3def47589816f10809909b0c5cc30aee83 Mon Sep 17 00:00:00 2001 From: Joyee Cheung Date: Tue, 31 Oct 2017 20:27:18 +0800 Subject: [PATCH 005/110] src: fix etw provider include on Windows PR-URL: https://github.com/nodejs/node/pull/16639 Backport-PR-URL: https://github.com/nodejs/node/pull/16609 Reviewed-By: Anna Henningsen Reviewed-By: James M Snell --- src/node_win32_etw_provider.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/src/node_win32_etw_provider.cc b/src/node_win32_etw_provider.cc index 11694d7d0e43ea..8a854767d6aed8 100644 --- a/src/node_win32_etw_provider.cc +++ b/src/node_win32_etw_provider.cc @@ -19,6 +19,7 @@ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. +#include "node_win32_etw_provider.h" #include "node_etw_provider.h" #include "node_win32_etw_provider-inl.h" From 981a1ef0c221606e19a27e506f40c20e421fb035 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20Nie=C3=9Fen?= Date: Fri, 10 Nov 2017 19:18:12 +0100 Subject: [PATCH 006/110] test: use ES6 classes instead of util.inherits PR-URL: https://github.com/nodejs/node/pull/16938 Backport-PR-URL: https://github.com/nodejs/node/pull/16946 Reviewed-By: Refael Ackermann Reviewed-By: Anna Henningsen Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Gireesh Punathil --- .../test-crypto-lazy-transform-writable.js | 11 +- test/parallel/test-crypto-stream.js | 30 +++--- test/parallel/test-event-emitter-listeners.js | 4 +- .../test-http-client-read-in-error.js | 46 ++++---- test/parallel/test-http-client-readable.js | 50 ++++----- ...tgoing-message-data-emitted-after-ended.js | 6 +- test/parallel/test-readline-interface.js | 13 +-- test/parallel/test-readline-keys.js | 7 +- test/parallel/test-stream-big-packet.js | 31 +++--- test/parallel/test-stream-events-prepend.js | 29 +++-- test/parallel/test-stream-pipe-after-end.js | 45 ++++---- test/parallel/test-stream-push-strings.js | 46 ++++---- ...stream-writable-change-default-encoding.js | 21 ++-- .../test-stream-writable-decoded-encoding.js | 21 ++-- test/parallel/test-stream-writable-null.js | 19 ++-- test/parallel/test-stream2-basic.js | 101 +++++++++--------- test/parallel/test-stream2-compatibility.js | 48 ++++----- .../test-stream2-pipe-error-once-listener.js | 29 ++--- test/parallel/test-stream2-set-encoding.js | 59 +++++----- test/parallel/test-stream2-unpipe-drain.js | 33 +++--- test/parallel/test-stream2-unpipe-leak.js | 30 +++--- test/parallel/test-stream2-writable.js | 31 +++--- test/parallel/test-util-format.js | 17 +-- test/pummel/test-tls-server-large-request.js | 26 ++--- test/sequential/test-stream2-fs.js | 33 +++--- 25 files changed, 364 insertions(+), 422 deletions(-) diff --git a/test/parallel/test-crypto-lazy-transform-writable.js b/test/parallel/test-crypto-lazy-transform-writable.js index f12243b9f4d17c..94240321bd755e 100644 --- a/test/parallel/test-crypto-lazy-transform-writable.js +++ b/test/parallel/test-crypto-lazy-transform-writable.js @@ -7,7 +7,6 @@ if (!common.hasCrypto) const assert = require('assert'); const crypto = require('crypto'); const Stream = require('stream'); -const util = require('util'); const hasher1 = crypto.createHash('sha256'); const hasher2 = crypto.createHash('sha256'); @@ -18,12 +17,12 @@ hasher1.end(); const expected = hasher1.read().toString('hex'); -function OldStream() { - Stream.call(this); - - this.readable = true; +class OldStream extends Stream { + constructor() { + super(); + this.readable = true; + } } -util.inherits(OldStream, Stream); const stream = new OldStream(); diff --git a/test/parallel/test-crypto-stream.js b/test/parallel/test-crypto-stream.js index 1c3b8bbcbb1c41..0464829f74caed 100644 --- a/test/parallel/test-crypto-stream.js +++ b/test/parallel/test-crypto-stream.js @@ -26,26 +26,26 @@ if (!common.hasCrypto) const assert = require('assert'); const stream = require('stream'); -const util = require('util'); const crypto = require('crypto'); -// Small stream to buffer converter -function Stream2buffer(callback) { - stream.Writable.call(this); +if (!common.hasFipsCrypto) { + // Small stream to buffer converter + class Stream2buffer extends stream.Writable { + constructor(callback) { + super(); - this._buffers = []; - this.once('finish', function() { - callback(null, Buffer.concat(this._buffers)); - }); -} -util.inherits(Stream2buffer, stream.Writable); + this._buffers = []; + this.once('finish', function() { + callback(null, Buffer.concat(this._buffers)); + }); + } -Stream2buffer.prototype._write = function(data, encodeing, done) { - this._buffers.push(data); - return done(null); -}; + _write(data, encodeing, done) { + this._buffers.push(data); + return done(null); + } + } -if (!common.hasFipsCrypto) { // Create an md5 hash of "Hallo world" const hasher1 = crypto.createHash('md5'); hasher1.pipe(new Stream2buffer(common.mustCall(function end(err, hash) { diff --git a/test/parallel/test-event-emitter-listeners.js b/test/parallel/test-event-emitter-listeners.js index 9fe4626cd8d81d..0736e3103e9e9e 100644 --- a/test/parallel/test-event-emitter-listeners.js +++ b/test/parallel/test-event-emitter-listeners.js @@ -24,12 +24,9 @@ require('../common'); const assert = require('assert'); const events = require('events'); -const util = require('util'); function listener() {} function listener2() {} -class TestStream { constructor() { } } -util.inherits(TestStream, events.EventEmitter); { const ee = new events.EventEmitter(); @@ -81,6 +78,7 @@ util.inherits(TestStream, events.EventEmitter); } { + class TestStream extends events.EventEmitter {} const s = new TestStream(); assert.deepStrictEqual(s.listeners('foo'), []); } diff --git a/test/parallel/test-http-client-read-in-error.js b/test/parallel/test-http-client-read-in-error.js index 69b24f73771d41..dbf103013175d3 100644 --- a/test/parallel/test-http-client-read-in-error.js +++ b/test/parallel/test-http-client-read-in-error.js @@ -2,38 +2,34 @@ require('../common'); const net = require('net'); const http = require('http'); -const util = require('util'); -function Agent() { - http.Agent.call(this); -} -util.inherits(Agent, http.Agent); - -Agent.prototype.createConnection = function() { - const self = this; - const socket = new net.Socket(); +class Agent extends http.Agent { + createConnection() { + const socket = new net.Socket(); - socket.on('error', function() { - socket.push('HTTP/1.1 200\r\n\r\n'); - }); + socket.on('error', function() { + socket.push('HTTP/1.1 200\r\n\r\n'); + }); - socket.on('newListener', function onNewListener(name) { - if (name !== 'error') - return; - socket.removeListener('newListener', onNewListener); + let onNewListener; + socket.on('newListener', onNewListener = (name) => { + if (name !== 'error') + return; + socket.removeListener('newListener', onNewListener); - // Let other listeners to be set up too - process.nextTick(function() { - self.breakSocket(socket); + // Let other listeners to be set up too + process.nextTick(() => { + this.breakSocket(socket); + }); }); - }); - return socket; -}; + return socket; + } -Agent.prototype.breakSocket = function breakSocket(socket) { - socket.emit('error', new Error('Intentional error')); -}; + breakSocket(socket) { + socket.emit('error', new Error('Intentional error')); + } +} const agent = new Agent(); diff --git a/test/parallel/test-http-client-readable.js b/test/parallel/test-http-client-readable.js index b381455e3699a5..c35ab259f25f2b 100644 --- a/test/parallel/test-http-client-readable.js +++ b/test/parallel/test-http-client-readable.js @@ -23,41 +23,37 @@ const common = require('../common'); const assert = require('assert'); const http = require('http'); -const util = require('util'); const Duplex = require('stream').Duplex; -function FakeAgent() { - http.Agent.call(this); -} -util.inherits(FakeAgent, http.Agent); - -FakeAgent.prototype.createConnection = function() { - const s = new Duplex(); - let once = false; +class FakeAgent extends http.Agent { + createConnection() { + const s = new Duplex(); + let once = false; - s._read = function() { - if (once) - return this.push(null); - once = true; + s._read = function() { + if (once) + return this.push(null); + once = true; - this.push('HTTP/1.1 200 Ok\r\nTransfer-Encoding: chunked\r\n\r\n'); - this.push('b\r\nhello world\r\n'); - this.readable = false; - this.push('0\r\n\r\n'); - }; + this.push('HTTP/1.1 200 Ok\r\nTransfer-Encoding: chunked\r\n\r\n'); + this.push('b\r\nhello world\r\n'); + this.readable = false; + this.push('0\r\n\r\n'); + }; - // Blackhole - s._write = function(data, enc, cb) { - cb(); - }; + // Blackhole + s._write = function(data, enc, cb) { + cb(); + }; - s.destroy = s.destroySoon = function() { - this.writable = false; - }; + s.destroy = s.destroySoon = function() { + this.writable = false; + }; - return s; -}; + return s; + } +} let received = ''; diff --git a/test/parallel/test-pipe-outgoing-message-data-emitted-after-ended.js b/test/parallel/test-pipe-outgoing-message-data-emitted-after-ended.js index 1614955be829c8..0bd823908a6107 100644 --- a/test/parallel/test-pipe-outgoing-message-data-emitted-after-ended.js +++ b/test/parallel/test-pipe-outgoing-message-data-emitted-after-ended.js @@ -2,17 +2,13 @@ const common = require('../common'); const http = require('http'); const assert = require('assert'); -const util = require('util'); const stream = require('stream'); // Verify that when piping a stream to an `OutgoingMessage` (or a type that // inherits from `OutgoingMessage`), if data is emitted after the // `OutgoingMessage` was closed - a `write after end` error is raised -function MyStream() { - stream.call(this); -} -util.inherits(MyStream, stream); +class MyStream extends stream {} const server = http.createServer(common.mustCall(function(req, res) { const myStream = new MyStream(); diff --git a/test/parallel/test-readline-interface.js b/test/parallel/test-readline-interface.js index d58420e5c45985..03ea05dd2a44a5 100644 --- a/test/parallel/test-readline-interface.js +++ b/test/parallel/test-readline-interface.js @@ -27,17 +27,14 @@ const assert = require('assert'); const readline = require('readline'); const internalReadline = require('internal/readline'); const EventEmitter = require('events').EventEmitter; -const inherits = require('util').inherits; const { Writable, Readable } = require('stream'); -function FakeInput() { - EventEmitter.call(this); +class FakeInput extends EventEmitter { + resume() {} + pause() {} + write() {} + end() {} } -inherits(FakeInput, EventEmitter); -FakeInput.prototype.resume = () => {}; -FakeInput.prototype.pause = () => {}; -FakeInput.prototype.write = () => {}; -FakeInput.prototype.end = () => {}; function isWarned(emitter) { for (const name in emitter) { diff --git a/test/parallel/test-readline-keys.js b/test/parallel/test-readline-keys.js index 1b05b06f58f04f..62d5ab24b85cef 100644 --- a/test/parallel/test-readline-keys.js +++ b/test/parallel/test-readline-keys.js @@ -2,14 +2,9 @@ const common = require('../common'); const PassThrough = require('stream').PassThrough; const assert = require('assert'); -const inherits = require('util').inherits; const Interface = require('readline').Interface; - -function FakeInput() { - PassThrough.call(this); -} -inherits(FakeInput, PassThrough); +class FakeInput extends PassThrough {} function extend(k) { return Object.assign({ ctrl: false, meta: false, shift: false }, k); diff --git a/test/parallel/test-stream-big-packet.js b/test/parallel/test-stream-big-packet.js index 8575c3e43a46ee..18b9b7ee4fc348 100644 --- a/test/parallel/test-stream-big-packet.js +++ b/test/parallel/test-stream-big-packet.js @@ -22,31 +22,26 @@ 'use strict'; require('../common'); const assert = require('assert'); -const util = require('util'); const stream = require('stream'); let passed = false; -function PassThrough() { - stream.Transform.call(this); +class PassThrough extends stream.Transform { + _transform(chunk, encoding, done) { + this.push(chunk); + done(); + } } -util.inherits(PassThrough, stream.Transform); -PassThrough.prototype._transform = function(chunk, encoding, done) { - this.push(chunk); - done(); -}; -function TestStream() { - stream.Transform.call(this); -} -util.inherits(TestStream, stream.Transform); -TestStream.prototype._transform = function(chunk, encoding, done) { - if (!passed) { - // Char 'a' only exists in the last write - passed = chunk.toString().includes('a'); +class TestStream extends stream.Transform { + _transform(chunk, encoding, done) { + if (!passed) { + // Char 'a' only exists in the last write + passed = chunk.toString().includes('a'); + } + done(); } - done(); -}; +} const s1 = new PassThrough(); const s2 = new PassThrough(); diff --git a/test/parallel/test-stream-events-prepend.js b/test/parallel/test-stream-events-prepend.js index 254d9a3690aee5..80fedf8faee570 100644 --- a/test/parallel/test-stream-events-prepend.js +++ b/test/parallel/test-stream-events-prepend.js @@ -1,26 +1,23 @@ 'use strict'; const common = require('../common'); const stream = require('stream'); -const util = require('util'); -function Writable() { - this.writable = true; - stream.Writable.call(this); - this.prependListener = undefined; +class Writable extends stream.Writable { + constructor() { + super(); + this.prependListener = undefined; + } + + _write(chunk, end, cb) { + cb(); + } } -util.inherits(Writable, stream.Writable); -Writable.prototype._write = function(chunk, end, cb) { - cb(); -}; -function Readable() { - this.readable = true; - stream.Readable.call(this); +class Readable extends stream.Readable { + _read() { + this.push(null); + } } -util.inherits(Readable, stream.Readable); -Readable.prototype._read = function() { - this.push(null); -}; const w = new Writable(); w.on('pipe', common.mustCall()); diff --git a/test/parallel/test-stream-pipe-after-end.js b/test/parallel/test-stream-pipe-after-end.js index 02792b44554348..d0d0a19bd6074a 100644 --- a/test/parallel/test-stream-pipe-after-end.js +++ b/test/parallel/test-stream-pipe-after-end.js @@ -24,36 +24,33 @@ const common = require('../common'); const assert = require('assert'); const Readable = require('_stream_readable'); const Writable = require('_stream_writable'); -const util = require('util'); -util.inherits(TestReadable, Readable); -function TestReadable(opt) { - if (!(this instanceof TestReadable)) - return new TestReadable(opt); - Readable.call(this, opt); - this._ended = false; +class TestReadable extends Readable { + constructor(opt) { + super(opt); + this._ended = false; + } + + _read() { + if (this._ended) + this.emit('error', new Error('_read called twice')); + this._ended = true; + this.push(null); + } } -TestReadable.prototype._read = function() { - if (this._ended) - this.emit('error', new Error('_read called twice')); - this._ended = true; - this.push(null); -}; +class TestWritable extends Writable { + constructor(opt) { + super(opt); + this._written = []; + } -util.inherits(TestWritable, Writable); -function TestWritable(opt) { - if (!(this instanceof TestWritable)) - return new TestWritable(opt); - Writable.call(this, opt); - this._written = []; + _write(chunk, encoding, cb) { + this._written.push(chunk); + cb(); + } } -TestWritable.prototype._write = function(chunk, encoding, cb) { - this._written.push(chunk); - cb(); -}; - // this one should not emit 'end' until we read() from it later. const ender = new TestReadable(); diff --git a/test/parallel/test-stream-push-strings.js b/test/parallel/test-stream-push-strings.js index 2c2d2ec4676913..c2383f3de1de4f 100644 --- a/test/parallel/test-stream-push-strings.js +++ b/test/parallel/test-stream-push-strings.js @@ -24,32 +24,32 @@ require('../common'); const assert = require('assert'); const Readable = require('stream').Readable; -const util = require('util'); -util.inherits(MyStream, Readable); -function MyStream(options) { - Readable.call(this, options); - this._chunks = 3; -} +class MyStream extends Readable { + constructor(options) { + super(options); + this._chunks = 3; + } -MyStream.prototype._read = function(n) { - switch (this._chunks--) { - case 0: - return this.push(null); - case 1: - return setTimeout(function() { - this.push('last chunk'); - }.bind(this), 100); - case 2: - return this.push('second to last chunk'); - case 3: - return process.nextTick(function() { - this.push('first chunk'); - }.bind(this)); - default: - throw new Error('?'); + _read(n) { + switch (this._chunks--) { + case 0: + return this.push(null); + case 1: + return setTimeout(function() { + this.push('last chunk'); + }.bind(this), 100); + case 2: + return this.push('second to last chunk'); + case 3: + return process.nextTick(function() { + this.push('first chunk'); + }.bind(this)); + default: + throw new Error('?'); + } } -}; +} const ms = new MyStream(); const results = []; diff --git a/test/parallel/test-stream-writable-change-default-encoding.js b/test/parallel/test-stream-writable-change-default-encoding.js index f6da1d301d6847..6081222e8b2e2a 100644 --- a/test/parallel/test-stream-writable-change-default-encoding.js +++ b/test/parallel/test-stream-writable-change-default-encoding.js @@ -24,19 +24,18 @@ require('../common'); const assert = require('assert'); const stream = require('stream'); -const util = require('util'); -function MyWritable(fn, options) { - stream.Writable.call(this, options); - this.fn = fn; -} - -util.inherits(MyWritable, stream.Writable); +class MyWritable extends stream.Writable { + constructor(fn, options) { + super(options); + this.fn = fn; + } -MyWritable.prototype._write = function(chunk, encoding, callback) { - this.fn(Buffer.isBuffer(chunk), typeof chunk, encoding); - callback(); -}; + _write(chunk, encoding, callback) { + this.fn(Buffer.isBuffer(chunk), typeof chunk, encoding); + callback(); + } +} (function defaultCondingIsUtf8() { const m = new MyWritable(function(isBuffer, type, enc) { diff --git a/test/parallel/test-stream-writable-decoded-encoding.js b/test/parallel/test-stream-writable-decoded-encoding.js index 5e433c9db1b5c6..578208a84bdec0 100644 --- a/test/parallel/test-stream-writable-decoded-encoding.js +++ b/test/parallel/test-stream-writable-decoded-encoding.js @@ -24,19 +24,18 @@ require('../common'); const assert = require('assert'); const stream = require('stream'); -const util = require('util'); -function MyWritable(fn, options) { - stream.Writable.call(this, options); - this.fn = fn; -} - -util.inherits(MyWritable, stream.Writable); +class MyWritable extends stream.Writable { + constructor(fn, options) { + super(options); + this.fn = fn; + } -MyWritable.prototype._write = function(chunk, encoding, callback) { - this.fn(Buffer.isBuffer(chunk), typeof chunk, encoding); - callback(); -}; + _write(chunk, encoding, callback) { + this.fn(Buffer.isBuffer(chunk), typeof chunk, encoding); + callback(); + } +} { const m = new MyWritable(function(isBuffer, type, enc) { diff --git a/test/parallel/test-stream-writable-null.js b/test/parallel/test-stream-writable-null.js index 58b61bfdc1e8cf..70297ff8128960 100644 --- a/test/parallel/test-stream-writable-null.js +++ b/test/parallel/test-stream-writable-null.js @@ -3,18 +3,17 @@ require('../common'); const assert = require('assert'); const stream = require('stream'); -const util = require('util'); -function MyWritable(options) { - stream.Writable.call(this, options); -} - -util.inherits(MyWritable, stream.Writable); +class MyWritable extends stream.Writable { + constructor(opt) { + super(opt); + } -MyWritable.prototype._write = function(chunk, encoding, callback) { - assert.notStrictEqual(chunk, null); - callback(); -}; + _write(chunk, encoding, callback) { + assert.notStrictEqual(chunk, null); + callback(); + } +} assert.throws(() => { const m = new MyWritable({ objectMode: true }); diff --git a/test/parallel/test-stream2-basic.js b/test/parallel/test-stream2-basic.js index f544321f9b7778..21bd1f69313f66 100644 --- a/test/parallel/test-stream2-basic.js +++ b/test/parallel/test-stream2-basic.js @@ -25,67 +25,66 @@ const common = require('../common'); const R = require('_stream_readable'); const assert = require('assert'); -const util = require('util'); const EE = require('events').EventEmitter; -function TestReader(n) { - R.apply(this); - this._buffer = Buffer.alloc(n || 100, 'x'); - this._pos = 0; - this._bufs = 10; -} +class TestReader extends R { + constructor(n) { + super(); + this._buffer = Buffer.alloc(n || 100, 'x'); + this._pos = 0; + this._bufs = 10; + } -util.inherits(TestReader, R); + _read(n) { + const max = this._buffer.length - this._pos; + n = Math.max(n, 0); + const toRead = Math.min(n, max); + if (toRead === 0) { + // simulate the read buffer filling up with some more bytes some time + // in the future. + setTimeout(() => { + this._pos = 0; + this._bufs -= 1; + if (this._bufs <= 0) { + // read them all! + if (!this.ended) + this.push(null); + } else { + // now we have more. + // kinda cheating by calling _read, but whatever, + // it's just fake anyway. + this._read(n); + } + }, 10); + return; + } -TestReader.prototype._read = function(n) { - const max = this._buffer.length - this._pos; - n = Math.max(n, 0); - const toRead = Math.min(n, max); - if (toRead === 0) { - // simulate the read buffer filling up with some more bytes some time - // in the future. - setTimeout(function() { - this._pos = 0; - this._bufs -= 1; - if (this._bufs <= 0) { - // read them all! - if (!this.ended) - this.push(null); - } else { - // now we have more. - // kinda cheating by calling _read, but whatever, - // it's just fake anyway. - this._read(n); - } - }.bind(this), 10); - return; + const ret = this._buffer.slice(this._pos, this._pos + toRead); + this._pos += toRead; + this.push(ret); } - - const ret = this._buffer.slice(this._pos, this._pos + toRead); - this._pos += toRead; - this.push(ret); -}; +} ///// -function TestWriter() { - EE.apply(this); - this.received = []; - this.flush = false; -} - -util.inherits(TestWriter, EE); +class TestWriter extends EE { + constructor() { + super(); + this.received = []; + this.flush = false; + } -TestWriter.prototype.write = function(c) { - this.received.push(c.toString()); - this.emit('write', c); - return true; -}; + write(c) { + this.received.push(c.toString()); + this.emit('write', c); + return true; + } -TestWriter.prototype.end = function(c) { - if (c) this.write(c); - this.emit('end', this.received); -}; + end(c) { + if (c) this.write(c); + this.emit('end', this.received); + } +} { // Test basic functionality diff --git a/test/parallel/test-stream2-compatibility.js b/test/parallel/test-stream2-compatibility.js index 45834ee99e5961..bd0314ec1a9918 100644 --- a/test/parallel/test-stream2-compatibility.js +++ b/test/parallel/test-stream2-compatibility.js @@ -25,25 +25,23 @@ const R = require('_stream_readable'); const W = require('_stream_writable'); const assert = require('assert'); -const util = require('util'); - let ondataCalled = 0; -function TestReader() { - R.apply(this); - this._buffer = Buffer.alloc(100, 'x'); - - this.on('data', function() { - ondataCalled++; - }); -} +class TestReader extends R { + constructor() { + super(); + this._buffer = Buffer.alloc(100, 'x'); -util.inherits(TestReader, R); + this.on('data', () => { + ondataCalled++; + }); + } -TestReader.prototype._read = function(n) { - this.push(this._buffer); - this._buffer = Buffer.alloc(0); -}; + _read(n) { + this.push(this._buffer); + this._buffer = Buffer.alloc(0); + } +} const reader = new TestReader(); setImmediate(function() { @@ -52,17 +50,17 @@ setImmediate(function() { reader.push(null); }); -function TestWriter() { - W.apply(this); - this.write('foo'); - this.end(); -} - -util.inherits(TestWriter, W); +class TestWriter extends W { + constructor() { + super(); + this.write('foo'); + this.end(); + } -TestWriter.prototype._write = function(chunk, enc, cb) { - cb(); -}; + _write(chunk, enc, cb) { + cb(); + } +} const writer = new TestWriter(); diff --git a/test/parallel/test-stream2-pipe-error-once-listener.js b/test/parallel/test-stream2-pipe-error-once-listener.js index 71ce19b36062e5..003e78e64f68cf 100644 --- a/test/parallel/test-stream2-pipe-error-once-listener.js +++ b/test/parallel/test-stream2-pipe-error-once-listener.js @@ -22,30 +22,21 @@ 'use strict'; require('../common'); -const util = require('util'); const stream = require('stream'); - -function Read() { - stream.Readable.call(this); +class Read extends stream.Readable { + _read(size) { + this.push('x'); + this.push(null); + } } -util.inherits(Read, stream.Readable); - -Read.prototype._read = function(size) { - this.push('x'); - this.push(null); -}; - -function Write() { - stream.Writable.call(this); +class Write extends stream.Writable { + _write(buffer, encoding, cb) { + this.emit('error', new Error('boom')); + this.emit('alldone'); + } } -util.inherits(Write, stream.Writable); - -Write.prototype._write = function(buffer, encoding, cb) { - this.emit('error', new Error('boom')); - this.emit('alldone'); -}; const read = new Read(); const write = new Write(); diff --git a/test/parallel/test-stream2-set-encoding.js b/test/parallel/test-stream2-set-encoding.js index 5b2e35fd01f642..f60e8df9e15a85 100644 --- a/test/parallel/test-stream2-set-encoding.js +++ b/test/parallel/test-stream2-set-encoding.js @@ -23,40 +23,37 @@ const common = require('../common'); const assert = require('assert'); const R = require('_stream_readable'); -const util = require('util'); -util.inherits(TestReader, R); - -function TestReader(n, opts) { - R.call(this, opts); - - this.pos = 0; - this.len = n || 100; +class TestReader extends R { + constructor(n, opts) { + super(opts); + this.pos = 0; + this.len = n || 100; + } + + _read(n) { + setTimeout(() => { + if (this.pos >= this.len) { + // double push(null) to test eos handling + this.push(null); + return this.push(null); + } + + n = Math.min(n, this.len - this.pos); + if (n <= 0) { + // double push(null) to test eos handling + this.push(null); + return this.push(null); + } + + this.pos += n; + const ret = Buffer.alloc(n, 'a'); + + return this.push(ret); + }, 1); + } } -TestReader.prototype._read = function(n) { - setTimeout(function() { - - if (this.pos >= this.len) { - // double push(null) to test eos handling - this.push(null); - return this.push(null); - } - - n = Math.min(n, this.len - this.pos); - if (n <= 0) { - // double push(null) to test eos handling - this.push(null); - return this.push(null); - } - - this.pos += n; - const ret = Buffer.alloc(n, 'a'); - - return this.push(ret); - }.bind(this), 1); -}; - { // Verify utf8 encoding const tr = new TestReader(100); diff --git a/test/parallel/test-stream2-unpipe-drain.js b/test/parallel/test-stream2-unpipe-drain.js index 6bb55531ae2dab..582ab61b06fb96 100644 --- a/test/parallel/test-stream2-unpipe-drain.js +++ b/test/parallel/test-stream2-unpipe-drain.js @@ -24,30 +24,27 @@ require('../common'); const assert = require('assert'); const stream = require('stream'); -const util = require('util'); -function TestWriter() { - stream.Writable.call(this); +class TestWriter extends stream.Writable { + _write(buffer, encoding, callback) { + console.log('write called'); + // super slow write stream (callback never called) + } } -util.inherits(TestWriter, stream.Writable); - -TestWriter.prototype._write = function(buffer, encoding, callback) { - console.log('write called'); - // super slow write stream (callback never called) -}; const dest = new TestWriter(); -function TestReader(id) { - stream.Readable.call(this); - this.reads = 0; -} -util.inherits(TestReader, stream.Readable); +class TestReader extends stream.Readable { + constructor() { + super(); + this.reads = 0; + } -TestReader.prototype._read = function(size) { - this.reads += 1; - this.push(Buffer.alloc(size)); -}; + _read(size) { + this.reads += 1; + this.push(Buffer.alloc(size)); + } +} const src1 = new TestReader(); const src2 = new TestReader(); diff --git a/test/parallel/test-stream2-unpipe-leak.js b/test/parallel/test-stream2-unpipe-leak.js index 391ee385320ff6..27cad3d5f575c6 100644 --- a/test/parallel/test-stream2-unpipe-leak.js +++ b/test/parallel/test-stream2-unpipe-leak.js @@ -26,29 +26,27 @@ const stream = require('stream'); const chunk = Buffer.from('hallo'); -const util = require('util'); - -function TestWriter() { - stream.Writable.call(this); +class TestWriter extends stream.Writable { + _write(buffer, encoding, callback) { + callback(null); + } } -util.inherits(TestWriter, stream.Writable); - -TestWriter.prototype._write = function(buffer, encoding, callback) { - callback(null); -}; const dest = new TestWriter(); // Set this high so that we'd trigger a nextTick warning // and/or RangeError if we do maybeReadMore wrong. -function TestReader() { - stream.Readable.call(this, { highWaterMark: 0x10000 }); -} -util.inherits(TestReader, stream.Readable); +class TestReader extends stream.Readable { + constructor() { + super({ + highWaterMark: 0x10000 + }); + } -TestReader.prototype._read = function(size) { - this.push(chunk); -}; + _read(size) { + this.push(chunk); + } +} const src = new TestReader(); diff --git a/test/parallel/test-stream2-writable.js b/test/parallel/test-stream2-writable.js index 2af3f683a23478..712440368c48c6 100644 --- a/test/parallel/test-stream2-writable.js +++ b/test/parallel/test-stream2-writable.js @@ -26,24 +26,23 @@ const W = require('_stream_writable'); const D = require('_stream_duplex'); const assert = require('assert'); -const util = require('util'); -util.inherits(TestWriter, W); - -function TestWriter() { - W.apply(this, arguments); - this.buffer = []; - this.written = 0; +class TestWriter extends W { + constructor(opts) { + super(opts); + this.buffer = []; + this.written = 0; + } + + _write(chunk, encoding, cb) { + // simulate a small unpredictable latency + setTimeout(() => { + this.buffer.push(chunk.toString()); + this.written += chunk.length; + cb(); + }, Math.floor(Math.random() * 10)); + } } -TestWriter.prototype._write = function(chunk, encoding, cb) { - // simulate a small unpredictable latency - setTimeout(function() { - this.buffer.push(chunk.toString()); - this.written += chunk.length; - cb(); - }.bind(this), Math.floor(Math.random() * 10)); -}; - const chunks = new Array(50); for (let i = 0; i < chunks.length; i++) { chunks[i] = 'x'.repeat(i); diff --git a/test/parallel/test-util-format.js b/test/parallel/test-util-format.js index c601a64d48dc38..fd686cb6d355ad 100644 --- a/test/parallel/test-util-format.js +++ b/test/parallel/test-util-format.js @@ -249,15 +249,16 @@ assert.strictEqual(util.format('abc%', 1), 'abc% 1'); // Errors const err = new Error('foo'); assert.strictEqual(util.format(err), err.stack); -function CustomError(msg) { - Error.call(this); - Object.defineProperty(this, 'message', - { value: msg, enumerable: false }); - Object.defineProperty(this, 'name', - { value: 'CustomError', enumerable: false }); - Error.captureStackTrace(this, CustomError); +class CustomError extends Error { + constructor(msg) { + super(); + Object.defineProperty(this, 'message', + { value: msg, enumerable: false }); + Object.defineProperty(this, 'name', + { value: 'CustomError', enumerable: false }); + Error.captureStackTrace(this, CustomError); + } } -util.inherits(CustomError, Error); const customError = new CustomError('bar'); assert.strictEqual(util.format(customError), customError.stack); // Doesn't capture stack trace diff --git a/test/pummel/test-tls-server-large-request.js b/test/pummel/test-tls-server-large-request.js index a99c142d53c818..5d3a0615bad6e2 100644 --- a/test/pummel/test-tls-server-large-request.js +++ b/test/pummel/test-tls-server-large-request.js @@ -28,7 +28,6 @@ const assert = require('assert'); const tls = require('tls'); const fixtures = require('../common/fixtures'); const stream = require('stream'); -const util = require('util'); const request = Buffer.from('ABCD'.repeat(1024 * 256 - 1)); // 1mb @@ -37,21 +36,22 @@ const options = { cert: fixtures.readKey('agent1-cert.pem') }; -function Mediator() { - stream.Writable.call(this); - this.buf = ''; -} -util.inherits(Mediator, stream.Writable); +class Mediator extends stream.Writable { + constructor() { + super(); + this.buf = ''; + } -Mediator.prototype._write = function _write(data, enc, cb) { - this.buf += data; - setTimeout(cb, 0); + _write(data, enc, cb) { + this.buf += data; + setTimeout(cb, 0); - if (this.buf.length >= request.length) { - assert.strictEqual(this.buf, request.toString()); - server.close(); + if (this.buf.length >= request.length) { + assert.strictEqual(this.buf, request.toString()); + server.close(); + } } -}; +} const mediator = new Mediator(); diff --git a/test/sequential/test-stream2-fs.js b/test/sequential/test-stream2-fs.js index e2da2dca645dce..3d06abc9214089 100644 --- a/test/sequential/test-stream2-fs.js +++ b/test/sequential/test-stream2-fs.js @@ -34,27 +34,26 @@ const size = fs.statSync(file).size; const expectLengths = [1024]; -const util = require('util'); const Stream = require('stream'); -util.inherits(TestWriter, Stream); +class TestWriter extends Stream { + constructor() { + super(); + this.buffer = []; + this.length = 0; + } -function TestWriter() { - Stream.apply(this); - this.buffer = []; - this.length = 0; -} - -TestWriter.prototype.write = function(c) { - this.buffer.push(c.toString()); - this.length += c.length; - return true; -}; + write(c) { + this.buffer.push(c.toString()); + this.length += c.length; + return true; + } -TestWriter.prototype.end = function(c) { - if (c) this.buffer.push(c.toString()); - this.emit('results', this.buffer); -}; + end(c) { + if (c) this.buffer.push(c.toString()); + this.emit('results', this.buffer); + } +} const r = new FSReadable(file); const w = new TestWriter(); From d27ec13cd3b4da00fb22a627f341ab0d7aca7883 Mon Sep 17 00:00:00 2001 From: cPhost <23620441+cPhost@users.noreply.github.com> Date: Sat, 28 Oct 2017 16:19:53 +0000 Subject: [PATCH 007/110] repl: avoid crashing from null and undefined errors When `throw undefined` or `throw null` is executed, the REPL crashes. This change does a check for `null|undefined` before accessing an error's properties to prevent crashing. Fixes: https://github.com/nodejs/node/issues/16545 Fixes: https://github.com/nodejs/node/issues/16607 PR-URL: https://github.com/nodejs/node/pull/16574 Reviewed-By: Luigi Pinca Reviewed-By: Lance Ball Reviewed-By: James M Snell Reviewed-By: Sakthipriyan Vairamani Reviewed-By: Anna Henningsen Reviewed-By: Jeremiah Senkpiel Reviewed-By: Colin Ihrig Reviewed-By: Gireesh Punathil --- lib/repl.js | 5 +++-- .../test-repl-throw-null-or-undefined.js | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 test/parallel/test-repl-throw-null-or-undefined.js diff --git a/lib/repl.js b/lib/repl.js index 111dcc0ced8eb3..bf93ce8a3fbc6c 100644 --- a/lib/repl.js +++ b/lib/repl.js @@ -255,12 +255,13 @@ function REPLServer(prompt, } } catch (e) { err = e; - if (err.message === 'Script execution interrupted.') { + + if (err && err.message === 'Script execution interrupted.') { // The stack trace for this case is not very useful anyway. Object.defineProperty(err, 'stack', { value: '' }); } - if (err && process.domain) { + if (process.domain) { debug('not recoverable, send to domain'); process.domain.emit('error', err); process.domain.exit(); diff --git a/test/parallel/test-repl-throw-null-or-undefined.js b/test/parallel/test-repl-throw-null-or-undefined.js new file mode 100644 index 00000000000000..fd2fd202b5bcb6 --- /dev/null +++ b/test/parallel/test-repl-throw-null-or-undefined.js @@ -0,0 +1,18 @@ +'use strict'; +require('../common'); + +// This test ensures that the repl does not +// crash or emit error when throwing `null|undefined` +// ie `throw null` or `throw undefined` + +const assert = require('assert'); +const repl = require('repl'); + +const r = repl.start(); + +assert.doesNotThrow(() => { + r.write('throw null\n'); + r.write('throw undefined\n'); +}, TypeError, 'repl crashes/throw error on `throw null|undefined`'); + +r.write('.exit\n'); From d2e4a873212a5cc28b4d49ee0ff02b3b582bbd94 Mon Sep 17 00:00:00 2001 From: dicearr Date: Mon, 23 Oct 2017 09:28:52 +0200 Subject: [PATCH 008/110] doc: howto decode buffers extending from Writable Improved stream documentation with an example of how to decode buffers to strings within a custom Writable. Fixes: https://github.com/nodejs/node/issues/15369 PR-URL: https://github.com/nodejs/node/pull/16403 Reviewed-By: Matteo Collina Reviewed-By: Benjamin Gruenbaum Reviewed-By: Gireesh Punathil --- doc/api/stream.md | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/doc/api/stream.md b/doc/api/stream.md index 96f67d75b36772..e5515432b0ec25 100644 --- a/doc/api/stream.md +++ b/doc/api/stream.md @@ -1510,6 +1510,47 @@ class MyWritable extends Writable { } ``` +#### Decoding buffers in a Writable Stream + +Decoding buffers is a common task, for instance, when using transformers whose +input is a string. This is not a trivial process when using multi-byte +characters encoding, such as UTF-8. The following example shows how to decode +multi-byte strings using `StringDecoder` and [Writable][]. + +```js +const { Writable } = require('stream'); +const { StringDecoder } = require('string_decoder'); + +class StringWritable extends Writable { + constructor(options) { + super(options); + const state = this._writableState; + this._decoder = new StringDecoder(state.defaultEncoding); + this.data = ''; + } + _write(chunk, encoding, callback) { + if (encoding === 'buffer') { + chunk = this._decoder.write(chunk); + } + this.data += chunk; + callback(); + } + _final(callback) { + this.data += this._decoder.end(); + callback(); + } +} + +const euro = [[0xE2, 0x82], [0xAC]].map(Buffer.from); +const w = new StringWritable(); + +w.write('currency: '); +w.write(euro[0]); +w.end(euro[1]); + +console.log(w.data); // currency: € +``` + ### Implementing a Readable Stream The `stream.Readable` class is extended to implement a [Readable][] stream. From 2f66faf6cf7ddeb4834c877ae0f625912d99dc47 Mon Sep 17 00:00:00 2001 From: Ken Takagi Date: Fri, 6 Oct 2017 10:11:23 -0700 Subject: [PATCH 009/110] test: use fixtures module in test-https-pfx PR-URL: https://github.com/nodejs/node/pull/15895 Reviewed-By: Daijiro Wachi Reviewed-By: Gireesh Punathil Reviewed-By: Joyee Cheung Reviewed-By: Colin Ihrig --- test/parallel/test-https-pfx.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-https-pfx.js b/test/parallel/test-https-pfx.js index d7561f74246286..7cf23a7dfa17f4 100644 --- a/test/parallel/test-https-pfx.js +++ b/test/parallel/test-https-pfx.js @@ -21,14 +21,16 @@ 'use strict'; const common = require('../common'); + if (!common.hasCrypto) common.skip('missing crypto'); +const fixtures = require('../common/fixtures'); + const assert = require('assert'); -const fs = require('fs'); const https = require('https'); -const pfx = fs.readFileSync(`${common.fixturesDir}/test_cert.pfx`); +const pfx = fixtures.readSync('test_cert.pfx'); const options = { host: '127.0.0.1', From 79e1d7719dbfdc4fed377b447c9020499528be20 Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Mon, 30 Oct 2017 08:54:49 +0100 Subject: [PATCH 010/110] src: remove unused includes in string_bytes.h MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/16606 Reviewed-By: Gireesh Punathil Reviewed-By: XadillaX Reviewed-By: Tobias Nießen Reviewed-By: Gibson Fahnestock Reviewed-By: Joyee Cheung Reviewed-By: Colin Ihrig --- src/string_bytes.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/string_bytes.h b/src/string_bytes.h index 0e38e017ab2f41..17bbd80c0ab1c2 100644 --- a/src/string_bytes.h +++ b/src/string_bytes.h @@ -27,9 +27,7 @@ // Decodes a v8::Local or Buffer to a raw char* #include "v8.h" -#include "node.h" -#include "env-inl.h" -#include "util.h" +#include "env.h" namespace node { From 4e848d4afbccdcf3b534159bfea14a3a66b98da0 Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Mon, 30 Oct 2017 13:45:10 +0100 Subject: [PATCH 011/110] build: add missing comma in sources list This commit adds a missing comma in the sources list. This effects at least window which produces the following warning where trace_event.h and src/util.h are concatenated: Warning: Missing input files: src\tracing\trace_event.hsrc\util.h PR-URL: https://github.com/nodejs/node/pull/16613 Reviewed-By: Gireesh Punathil Reviewed-By: Richard Lau Reviewed-By: Colin Ihrig Reviewed-By: Minwoo Jung Reviewed-By: Gibson Fahnestock Reviewed-By: Joyee Cheung Reviewed-By: Anatoli Papirovski --- node.gyp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node.gyp b/node.gyp index acaf822ea83f90..3486d5d21bc269 100644 --- a/node.gyp +++ b/node.gyp @@ -274,7 +274,7 @@ 'src/tracing/agent.h', 'src/tracing/node_trace_buffer.h', 'src/tracing/node_trace_writer.h', - 'src/tracing/trace_event.h' + 'src/tracing/trace_event.h', 'src/util.h', 'src/util-inl.h', 'deps/http_parser/http_parser.h', From b3032d29c9cc1e71e2de47af6da2173645a519f3 Mon Sep 17 00:00:00 2001 From: Rob Paton Date: Fri, 6 Oct 2017 11:48:41 -0700 Subject: [PATCH 012/110] test: increase coverage for ModuleMap Add test for ModuleMap set with ModuleJob but bad url. PR-URL: https://github.com/nodejs/node/pull/16045 Reviewed-By: Stephen Belanger Reviewed-By: Bradley Farias Reviewed-By: James M Snell Reviewed-By: Colin Ihrig Reviewed-By: Joyee Cheung --- test/es-module/test-esm-loader-modulemap.js | 56 +++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 test/es-module/test-esm-loader-modulemap.js diff --git a/test/es-module/test-esm-loader-modulemap.js b/test/es-module/test-esm-loader-modulemap.js new file mode 100644 index 00000000000000..58c76ce960657c --- /dev/null +++ b/test/es-module/test-esm-loader-modulemap.js @@ -0,0 +1,56 @@ +'use strict'; +// Flags: --expose-internals + +// This test ensures that the type checking of ModuleMap throws +// errors appropriately + +const common = require('../common'); + +const { URL } = require('url'); +const Loader = require('internal/loader/Loader'); +const ModuleMap = require('internal/loader/ModuleMap'); +const ModuleJob = require('internal/loader/ModuleJob'); +const { createDynamicModule } = require('internal/loader/ModuleWrap'); + +const stubModuleUrl = new URL('file://tmp/test'); +const stubModule = createDynamicModule(['default'], stubModuleUrl); +const loader = new Loader(); +const moduleMap = new ModuleMap(); +const moduleJob = new ModuleJob(loader, stubModule.module, + () => new Promise(() => {})); + +common.expectsError( + () => moduleMap.get(1), + { + code: 'ERR_INVALID_ARG_TYPE', + type: TypeError, + message: 'The "url" argument must be of type string' + } +); + +common.expectsError( + () => moduleMap.set(1, moduleJob), + { + code: 'ERR_INVALID_ARG_TYPE', + type: TypeError, + message: 'The "url" argument must be of type string' + } +); + +common.expectsError( + () => moduleMap.set('somestring', 'notamodulejob'), + { + code: 'ERR_INVALID_ARG_TYPE', + type: TypeError, + message: 'The "job" argument must be of type ModuleJob' + } +); + +common.expectsError( + () => moduleMap.has(1), + { + code: 'ERR_INVALID_ARG_TYPE', + type: TypeError, + message: 'The "url" argument must be of type string' + } +); From 72c34cf706810093639d27807b5dfcaf3e9e0642 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sun, 29 Oct 2017 19:54:45 -0700 Subject: [PATCH 013/110] test,net: remove scatological terminology PR-URL: https://github.com/nodejs/node/pull/16599 Reviewed-By: James M Snell Reviewed-By: Gireesh Punathil Reviewed-By: Luigi Pinca Reviewed-By: Gibson Fahnestock Reviewed-By: Colin Ihrig Reviewed-By: Anna Henningsen Reviewed-By: Anatoli Papirovski --- lib/net.js | 2 +- test/parallel/test-async-wrap-uncaughtexception.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/net.js b/lib/net.js index 8e4377cb41ae53..4d373bc1e10c33 100644 --- a/lib/net.js +++ b/lib/net.js @@ -317,7 +317,7 @@ function afterShutdown(status, handle, req) { // if the writable side has ended already, then clean everything // up. function onSocketEnd() { - // XXX Should not have to do as much crap in this function. + // XXX Should not have to do as much in this function. // ended should already be true, since this is called *after* // the EOF errno and onread has eof'ed debug('onSocketEnd', this._readableState); diff --git a/test/parallel/test-async-wrap-uncaughtexception.js b/test/parallel/test-async-wrap-uncaughtexception.js index 9427e2fb787a9b..37557b4aacc341 100644 --- a/test/parallel/test-async-wrap-uncaughtexception.js +++ b/test/parallel/test-async-wrap-uncaughtexception.js @@ -42,5 +42,5 @@ process.on('uncaughtException', common.mustCall(() => { require('crypto').randomBytes(1, common.mustCall(() => { assert.strictEqual(call_id, async_hooks.executionAsyncId()); call_log[1]++; - throw new Error('ah crap'); + throw new Error(); })); From 82076ed91fc372a281a6034ed63015a690ad2c5b Mon Sep 17 00:00:00 2001 From: Evan Lucas Date: Tue, 31 Oct 2017 08:31:50 -0500 Subject: [PATCH 014/110] src: pass context to Get() operations for cares_wrap MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Using Get() without the context argument will soon be deprecated. This also passed context to Int32Value() operations as well. PR-URL: https://github.com/nodejs/node/pull/16641 Reviewed-By: Colin Ihrig Reviewed-By: Anna Henningsen Reviewed-By: Anatoli Papirovski Reviewed-By: Tobias Nießen Reviewed-By: James M Snell --- src/cares_wrap.cc | 55 ++++++++++++++++++++++++++++++++--------------- 1 file changed, 38 insertions(+), 17 deletions(-) diff --git a/src/cares_wrap.cc b/src/cares_wrap.cc index 7b8ec12d051e0c..b90b2186959b2e 100644 --- a/src/cares_wrap.cc +++ b/src/cares_wrap.cc @@ -1229,7 +1229,9 @@ class QueryAnyWrap: public QueryWrap { CHECK_EQ(naddrttls, a_count); for (int i = 0; i < a_count; i++) { Local obj = Object::New(env()->isolate()); - obj->Set(context, env()->address_string(), ret->Get(i)).FromJust(); + obj->Set(context, + env()->address_string(), + ret->Get(context, i).ToLocalChecked()).FromJust(); obj->Set(context, env()->ttl_string(), Integer::New(env()->isolate(), addrttls[i].ttl)).FromJust(); @@ -1241,7 +1243,9 @@ class QueryAnyWrap: public QueryWrap { } else { for (int i = 0; i < a_count; i++) { Local obj = Object::New(env()->isolate()); - obj->Set(context, env()->value_string(), ret->Get(i)).FromJust(); + obj->Set(context, + env()->value_string(), + ret->Get(context, i).ToLocalChecked()).FromJust(); obj->Set(context, env()->type_string(), env()->dns_cname_string()).FromJust(); @@ -1270,7 +1274,9 @@ class QueryAnyWrap: public QueryWrap { CHECK_EQ(aaaa_count, naddr6ttls); for (uint32_t i = a_count; i < ret->Length(); i++) { Local obj = Object::New(env()->isolate()); - obj->Set(context, env()->address_string(), ret->Get(i)).FromJust(); + obj->Set(context, + env()->address_string(), + ret->Get(context, i).ToLocalChecked()).FromJust(); obj->Set(context, env()->ttl_string(), Integer::New(env()->isolate(), addr6ttls[i].ttl)).FromJust(); @@ -1297,7 +1303,9 @@ class QueryAnyWrap: public QueryWrap { } for (uint32_t i = old_count; i < ret->Length(); i++) { Local obj = Object::New(env()->isolate()); - obj->Set(context, env()->value_string(), ret->Get(i)).FromJust(); + obj->Set(context, + env()->value_string(), + ret->Get(context, i).ToLocalChecked()).FromJust(); obj->Set(context, env()->type_string(), env()->dns_ns_string()).FromJust(); @@ -1323,7 +1331,9 @@ class QueryAnyWrap: public QueryWrap { status = ParseGeneralReply(env(), buf, len, &type, ret); for (uint32_t i = old_count; i < ret->Length(); i++) { Local obj = Object::New(env()->isolate()); - obj->Set(context, env()->value_string(), ret->Get(i)).FromJust(); + obj->Set(context, + env()->value_string(), + ret->Get(context, i).ToLocalChecked()).FromJust(); obj->Set(context, env()->type_string(), env()->dns_ptr_string()).FromJust(); @@ -1943,10 +1953,14 @@ void GetAddrInfo(const FunctionCallbackInfo& args) { Local req_wrap_obj = args[0].As(); node::Utf8Value hostname(env->isolate(), args[1]); - int32_t flags = (args[3]->IsInt32()) ? args[3]->Int32Value() : 0; + int32_t flags = 0; + if (args[3]->IsInt32()) { + flags = args[3]->Int32Value(env->context()).FromJust(); + } + int family; - switch (args[2]->Int32Value()) { + switch (args[2]->Int32Value(env->context()).FromJust()) { case 0: family = AF_UNSPEC; break; @@ -1990,7 +2004,7 @@ void GetNameInfo(const FunctionCallbackInfo& args) { CHECK(args[2]->IsUint32()); Local req_wrap_obj = args[0].As(); node::Utf8Value ip(env->isolate(), args[1]); - const unsigned port = args[2]->Uint32Value(); + const unsigned port = args[2]->Uint32Value(env->context()).FromJust(); struct sockaddr_storage addr; CHECK(uv_ip4_addr(*ip, port, reinterpret_cast(&addr)) == 0 || @@ -2067,17 +2081,23 @@ void SetServers(const FunctionCallbackInfo& args) { int err; for (uint32_t i = 0; i < len; i++) { - CHECK(arr->Get(i)->IsArray()); + CHECK(arr->Get(env->context(), i).ToLocalChecked()->IsArray()); - Local elm = Local::Cast(arr->Get(i)); + Local elm = + Local::Cast(arr->Get(env->context(), i).ToLocalChecked()); - CHECK(elm->Get(0)->Int32Value()); - CHECK(elm->Get(1)->IsString()); - CHECK(elm->Get(2)->Int32Value()); + CHECK(elm->Get(env->context(), + 0).ToLocalChecked()->Int32Value(env->context()).FromJust()); + CHECK(elm->Get(env->context(), 1).ToLocalChecked()->IsString()); + CHECK(elm->Get(env->context(), + 2).ToLocalChecked()->Int32Value(env->context()).FromJust()); - int fam = elm->Get(0)->Int32Value(); - node::Utf8Value ip(env->isolate(), elm->Get(1)); - int port = elm->Get(2)->Int32Value(); + int fam = elm->Get(env->context(), 0) + .ToLocalChecked()->Int32Value(env->context()).FromJust(); + node::Utf8Value ip(env->isolate(), + elm->Get(env->context(), 1).ToLocalChecked()); + int port = elm->Get(env->context(), 2) + .ToLocalChecked()->Int32Value(env->context()).FromJust(); ares_addr_port_node* cur = &servers[i]; @@ -2127,7 +2147,8 @@ void Cancel(const FunctionCallbackInfo& args) { void StrError(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); - const char* errmsg = ares_strerror(args[0]->Int32Value()); + const char* errmsg = ares_strerror(args[0]->Int32Value(env->context()) + .FromJust()); args.GetReturnValue().Set(OneByteString(env->isolate(), errmsg)); } From 13866b8b1b668cf7ed1854df73232ffeefb4f6b7 Mon Sep 17 00:00:00 2001 From: Andrew Stucki Date: Wed, 18 Oct 2017 12:33:27 -0500 Subject: [PATCH 015/110] doc: add windowsVerbatimArguments docs doc: Add windowsVerbatimArguments docs for child_process spawn, spawnSync, execFile, and fork PR-URL: https://github.com/nodejs/node/pull/16299 Reviewed-By: Colin Ihrig Reviewed-By: James M Snell --- doc/api/child_process.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/doc/api/child_process.md b/doc/api/child_process.md index 547a42aef56075..08af603adcfe58 100755 --- a/doc/api/child_process.md +++ b/doc/api/child_process.md @@ -264,6 +264,8 @@ changes: * `gid` {number} Sets the group identity of the process (see setgid(2)). * `windowsHide` {boolean} Hide the subprocess console window that would normally be created on Windows systems. **Default:** `false`. + * `windowsVerbatimArguments` {boolean} No quoting or escaping of arguments is + done on Windows. Ignored on Unix. **Default:** `false`. * `callback` {Function} Called with the output when process terminates. * `error` {Error} * `stdout` {string|Buffer} @@ -338,6 +340,8 @@ changes: When this option is provided, it overrides `silent`. If the array variant is used, it must contain exactly one item with value `'ipc'` or an error will be thrown. For instance `[0, 1, 2, 'ipc']`. + * `windowsVerbatimArguments` {boolean} No quoting or escaping of arguments is + done on Windows. Ignored on Unix. **Default:** `false`. * `uid` {number} Sets the user identity of the process (see setuid(2)). * `gid` {number} Sets the group identity of the process (see setgid(2)). * Returns: {ChildProcess} @@ -404,6 +408,9 @@ changes: `'/bin/sh'` on UNIX, and `process.env.ComSpec` on Windows. A different shell can be specified as a string. See [Shell Requirements][] and [Default Windows Shell][]. **Default:** `false` (no shell). + * `windowsVerbatimArguments` {boolean} No quoting or escaping of arguments is + done on Windows. Ignored on Unix. This is set to `true` automatically + when `shell` is specified. **Default:** `false`. * `windowsHide` {boolean} Hide the subprocess console window that would normally be created on Windows systems. **Default:** `false`. * Returns: {ChildProcess} @@ -813,6 +820,9 @@ changes: `'/bin/sh'` on UNIX, and `process.env.ComSpec` on Windows. A different shell can be specified as a string. See [Shell Requirements][] and [Default Windows Shell][]. **Default:** `false` (no shell). + * `windowsVerbatimArguments` {boolean} No quoting or escaping of arguments is + done on Windows. Ignored on Unix. This is set to `true` automatically + when `shell` is specified. **Default:** `false`. * `windowsHide` {boolean} Hide the subprocess console window that would normally be created on Windows systems. **Default:** `false`. * Returns: {Object} From 542f3b9cc036d0f4d6470b18628aee9cfc3e12e4 Mon Sep 17 00:00:00 2001 From: Anthony Nandaa Date: Sat, 28 Oct 2017 01:06:52 +0300 Subject: [PATCH 016/110] doc: add details about rss on process.memoryUsage 1. `process.memoryUsage()` returns an object with 4 keys: `rss, heapTotal, headUsed, external`. There were brief explanations for the rest except `rss`. This commit adds this on the docs. 2. A little more clarity on `rss` to help people disambiguate it from the virtual memory size. PR-URL: https://github.com/nodejs/node/pull/16566 Refs: https://github.com/nodejs/node/pull/16566#discussion_r147545405 Reviewed-By: Refael Ackermann Reviewed-By: Gibson Fahnestock Reviewed-By: Gireesh Punathil Reviewed-By: James M Snell Reviewed-By: Luigi Pinca --- doc/api/process.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/doc/api/process.md b/doc/api/process.md index 7a005503c9b2e2..ddc6d94acf31ca 100644 --- a/doc/api/process.md +++ b/doc/api/process.md @@ -1240,7 +1240,13 @@ Will generate: `heapTotal` and `heapUsed` refer to V8's memory usage. `external` refers to the memory usage of C++ objects bound to JavaScript -objects managed by V8. +objects managed by V8. `rss`, Resident Set Size, is the amount of space +occupied in the main memory device (that is a subset of the total allocated +memory) for the process, which includes the _heap_, _code segment_ and _stack_. + +The _heap_ is where objects, strings and closures are stored. Variables are +stored in the _stack_ and the actual JavaScript code resides in the +_code segment_. ## process.nextTick(callback[, ...args]) + +Close the underlying handle. + ### zlib.flush([kind], callback) \n` + - inc + `\n\n`; - input = input.split(include + '\n').join(includeData[fname] + '\n'); + `${inc}\n\n`; + input = input.split(`${include}\n`).join(`${includeData[fname]}\n`); if (incCount === 0) { return cb(null, input); } From b166b6b1b3e4b613965c7e4e46877b4ce4a7e1a5 Mon Sep 17 00:00:00 2001 From: Jimi van der Woning Date: Mon, 6 Nov 2017 17:36:56 +0100 Subject: [PATCH 038/110] test: fix typos in read-buffer tests The offset-exceeding tests for readFloat contained a double test for readFloatLE instead of one for readFloatLE and one for readFloatBE. This is fixed in this commit. PR-URL: https://github.com/nodejs/node/pull/16834 Reviewed-By: Vse Mozhet Byt Reviewed-By: Rich Trott --- test/parallel/test-buffer-read.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-buffer-read.js b/test/parallel/test-buffer-read.js index d3a1c941422e51..5eac575ff5ab81 100644 --- a/test/parallel/test-buffer-read.js +++ b/test/parallel/test-buffer-read.js @@ -59,13 +59,13 @@ read(buf, 'readUIntBE', [2, 0], 0xfd); read(buf, 'readUIntLE', [2, 0], 0x48); // attempt to overflow buffers, similar to previous bug in array buffers -assert.throws(() => Buffer.allocUnsafe(8).readFloatLE(0xffffffff), +assert.throws(() => Buffer.allocUnsafe(8).readFloatBE(0xffffffff), RangeError); assert.throws(() => Buffer.allocUnsafe(8).readFloatLE(0xffffffff), RangeError); // ensure negative values can't get past offset -assert.throws(() => Buffer.allocUnsafe(8).readFloatLE(-1), RangeError); +assert.throws(() => Buffer.allocUnsafe(8).readFloatBE(-1), RangeError); assert.throws(() => Buffer.allocUnsafe(8).readFloatLE(-1), RangeError); // offset checks From cb08f5d6feaf385f92e87eb955e8521828e6e013 Mon Sep 17 00:00:00 2001 From: Vse Mozhet Byt Date: Mon, 6 Nov 2017 20:46:06 +0200 Subject: [PATCH 039/110] tools: remove unneeded parentheses in doc/html.js PR-URL: https://github.com/nodejs/node/pull/16845 Ref: https://github.com/nodejs/node/pull/16801#discussion_r149142120 Reviewed-By: Colin Ihrig Reviewed-By: Jeremiah Senkpiel Reviewed-By: Rich Trott --- tools/doc/html.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/doc/html.js b/tools/doc/html.js index 462de24fd7be59..6729dbba186268 100644 --- a/tools/doc/html.js +++ b/tools/doc/html.js @@ -518,7 +518,7 @@ function getId(text) { text = text.replace(/^_+|_+$/, ''); text = text.replace(/^([^a-z])/, '_$1'); if (idCounters.hasOwnProperty(text)) { - text += `_${(++idCounters[text])}`; + text += `_${++idCounters[text]}`; } else { idCounters[text] = 0; } From 5719beaf83b29af6d71ac2a67deeed2580e7a70b Mon Sep 17 00:00:00 2001 From: Dara Hayes Date: Mon, 6 Nov 2017 15:23:13 +0000 Subject: [PATCH 040/110] test: update test to use fixtures.readKey Use fixtures.readKey() rather than common.fixturesDir in test-regress-GH-1531. PR-URL: https://github.com/nodejs/node/pull/16811 Reviewed-By: Colin Ihrig Reviewed-By: Anatoli Papirovski Reviewed-By: Gireesh Punathil Reviewed-By: Rich Trott --- test/parallel/test-regress-GH-1531.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/test/parallel/test-regress-GH-1531.js b/test/parallel/test-regress-GH-1531.js index 7d1f4a0dbec4c1..a61cc64ab626af 100644 --- a/test/parallel/test-regress-GH-1531.js +++ b/test/parallel/test-regress-GH-1531.js @@ -1,16 +1,20 @@ 'use strict'; const common = require('../common'); +// This test ensures that a http request callback is called +// when the agent option is set +// See https://github.com/nodejs/node-v0.x-archive/issues/1531 + if (!common.hasCrypto) common.skip('missing crypto'); -const https = require('https'); +const fixtures = require('../common/fixtures'); -const fs = require('fs'); +const https = require('https'); const options = { - key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`), - cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`) + key: fixtures.readKey('agent1-key.pem'), + cert: fixtures.readKey('agent1-cert.pem') }; const server = https.createServer(options, function(req, res) { From b307582d1051c44c7a54c0e22ef0efa2c5e0f11b Mon Sep 17 00:00:00 2001 From: "Maring, Damian Lion" Date: Mon, 6 Nov 2017 15:06:30 +0000 Subject: [PATCH 041/110] test: use fixtures module in test-repl PR-URL: https://github.com/nodejs/node/pull/16809 Reviewed-By: Rich Trott Reviewed-By: Gireesh Punathil --- test/parallel/test-repl.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/parallel/test-repl.js b/test/parallel/test-repl.js index 6df856a20ec410..f595e1b298bf64 100644 --- a/test/parallel/test-repl.js +++ b/test/parallel/test-repl.js @@ -21,6 +21,7 @@ 'use strict'; const common = require('../common'); +const fixtures = require('../common/fixtures'); const assert = require('assert'); common.globalCheck = false; @@ -40,7 +41,7 @@ let server_tcp, server_unix, client_tcp, client_unix, replServer; // absolute path to test/fixtures/a.js -const moduleFilename = require('path').join(common.fixturesDir, 'a'); +const moduleFilename = fixtures.path('a'); console.error('repl test'); From 33f2fff52b7708acee7c430c85f5969f3dcb27ab Mon Sep 17 00:00:00 2001 From: Brian O'Connell Date: Mon, 6 Nov 2017 15:15:14 +0000 Subject: [PATCH 042/110] test: refactor tls test to use fixtres.readSync PR-URL: https://github.com/nodejs/node/pull/16816 Reviewed-By: Colin Ihrig Reviewed-By: Gireesh Punathil --- test/parallel/test-tls-hello-parser-failure.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/test/parallel/test-tls-hello-parser-failure.js b/test/parallel/test-tls-hello-parser-failure.js index ed4c4f7b991f47..4a7d8999c78d39 100644 --- a/test/parallel/test-tls-hello-parser-failure.js +++ b/test/parallel/test-tls-hello-parser-failure.js @@ -22,6 +22,10 @@ 'use strict'; const common = require('../common'); +const fixtures = require('../common/fixtures'); + +// This test ensures that the tls parser causes a client error if the client +// sends invalid data. if (!common.hasCrypto) common.skip('missing crypto'); @@ -30,11 +34,10 @@ const assert = require('assert'); const tls = require('tls'); const net = require('net'); -const fs = require('fs'); const options = { - key: fs.readFileSync(`${common.fixturesDir}/test_key.pem`), - cert: fs.readFileSync(`${common.fixturesDir}/test_cert.pem`) + key: fixtures.readSync('test_key.pem'), + cert: fixtures.readSync('test_cert.pem') }; const bonkers = Buffer.alloc(1024 * 1024, 42); From f2a9c024ed5a0d023fc32317f033493f79b6273f Mon Sep 17 00:00:00 2001 From: Luigi Pinca Date: Sat, 4 Nov 2017 09:53:09 +0100 Subject: [PATCH 043/110] doc: fix json generator warnings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Fix `console.countReset()` signature - Fix `console.group()` arguments list PR-URL: https://github.com/nodejs/node/pull/16742 Reviewed-By: Anatoli Papirovski Reviewed-By: Colin Ihrig Reviewed-By: Tobias Nießen Reviewed-By: Daniel Bevenius Reviewed-By: Gireesh Punathil Reviewed-By: James M Snell --- doc/api/console.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/api/console.md b/doc/api/console.md index 6c832fece6a226..2cc16bdc8fc4f1 100644 --- a/doc/api/console.md +++ b/doc/api/console.md @@ -216,7 +216,7 @@ undefined > ``` -### console.countReset([label = 'default']) +### console.countReset([label='default']) @@ -293,7 +293,7 @@ values are concatenated. See [`util.format()`][] for more information. added: v8.5.0 --> -* `label` {any} +* `...label` {any} Increases indentation of subsequent lines by two spaces. From 2bbc76eb1fa6c2c6ccb4ce6d9718b28fc30b772e Mon Sep 17 00:00:00 2001 From: Sascha Tandel Date: Mon, 6 Nov 2017 15:19:09 +0000 Subject: [PATCH 044/110] test: include file mode in assert message If the REPL history file is created with an invalid mode include the failed mode in the error message. PR-URL: https://github.com/nodejs/node/pull/16815 Reviewed-By: Gireesh Punathil Reviewed-By: Joyee Cheung --- test/parallel/test-repl-history-perm.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-repl-history-perm.js b/test/parallel/test-repl-history-perm.js index 5ca8bf57a432b2..9f14ece568dc80 100644 --- a/test/parallel/test-repl-history-perm.js +++ b/test/parallel/test-repl-history-perm.js @@ -1,4 +1,7 @@ 'use strict'; + +// Verifies that the REPL history file is created with mode 0600 + // Flags: --expose_internals const common = require('../common'); @@ -39,9 +42,10 @@ const checkResults = common.mustCall(function(err, r) { r.input.end(); const stat = fs.statSync(replHistoryPath); + const fileMode = stat.mode & 0o777; assert.strictEqual( - stat.mode & 0o777, 0o600, - 'REPL history file should be mode 0600'); + fileMode, 0o600, + `REPL history file should be mode 0600 but was 0${fileMode.toString(8)}`); }); repl.createInternalRepl( From 0ebded4376a69540a0b01aa3802c4d2b33b1a4fb Mon Sep 17 00:00:00 2001 From: Sean Karson Date: Mon, 6 Nov 2017 15:14:16 +0000 Subject: [PATCH 045/110] test: show incorrect value on test failure PR-URL: https://github.com/nodejs/node/pull/16818 Reviewed-By: Colin Ihrig Reviewed-By: Gireesh Punathil Reviewed-By: Rich Trott Reviewed-By: Khaidi Chu --- test/async-hooks/test-promise.promise-before-init-hooks.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/async-hooks/test-promise.promise-before-init-hooks.js b/test/async-hooks/test-promise.promise-before-init-hooks.js index 79bbd1751d83fd..957d1a75e49f70 100644 --- a/test/async-hooks/test-promise.promise-before-init-hooks.js +++ b/test/async-hooks/test-promise.promise-before-init-hooks.js @@ -16,7 +16,7 @@ hooks.enable(); p.then(function afterresolution(val) { assert.strictEqual(val, 5); const as = hooks.activitiesOfTypes('PROMISE'); - assert.strictEqual(as.length, 1, 'one activity'); + assert.strictEqual(as.length, 1); checkInvocations(as[0], { init: 1, before: 1 }, 'after resolution child promise'); return val; From 562d8fca15d3185fcb631841d92e379d1e7f36d3 Mon Sep 17 00:00:00 2001 From: Nicolas Morel Date: Mon, 6 Nov 2017 16:37:55 +0100 Subject: [PATCH 046/110] test: remove custom message from assertion The custom message means that the values involved are not reported. Remove the custom message for a more detailed error message. PR-URL: https://github.com/nodejs/node/pull/16824 Reviewed-By: Colin Ihrig Reviewed-By: Anatoli Papirovski Reviewed-By: Gireesh Punathil Reviewed-By: Rich Trott --- test/addons/async-hooks-promise/test.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/addons/async-hooks-promise/test.js b/test/addons/async-hooks-promise/test.js index 81389378b0701e..a6c48e94a34f07 100644 --- a/test/addons/async-hooks-promise/test.js +++ b/test/addons/async-hooks-promise/test.js @@ -34,8 +34,7 @@ const hook1 = async_hooks.createHook({ // Check that the internal field returns the same PromiseWrap passed to init(). assert.strictEqual( binding.getPromiseField(Promise.resolve(1)), - pwrap, - 'Unexpected PromiseWrap'); + pwrap); hook1.disable(); From ec4c3f577786e7dbc7ebe8eb29c56ce3650f66d2 Mon Sep 17 00:00:00 2001 From: fjau Date: Mon, 6 Nov 2017 17:06:03 +0000 Subject: [PATCH 047/110] test: improve message in test-fs-readfile-pipe-large MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Improve assertion message by including expected and actual values. PR-URL: https://github.com/nodejs/node/pull/16840 Reviewed-By: Anna Henningsen Reviewed-By: Michaël Zasso Reviewed-By: Gireesh Punathil Reviewed-By: Luigi Pinca --- test/parallel/test-fs-readfile-pipe-large.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-fs-readfile-pipe-large.js b/test/parallel/test-fs-readfile-pipe-large.js index 4d278ee0f22093..17831f81f6df83 100644 --- a/test/parallel/test-fs-readfile-pipe-large.js +++ b/test/parallel/test-fs-readfile-pipe-large.js @@ -29,8 +29,16 @@ const node = JSON.stringify(process.execPath); const cmd = `cat ${filename} | ${node} ${f} child`; exec(cmd, { maxBuffer: 1000000 }, function(err, stdout, stderr) { assert.ifError(err); - assert.strictEqual(stdout, dataExpected, 'it reads the file and outputs it'); - assert.strictEqual(stderr, '', 'it does not write to stderr'); + assert.strictEqual( + stdout, + dataExpected, + `expect it reads the file and outputs 999999 'a' but got : ${stdout}` + ); + assert.strictEqual( + stderr, + '', + `expect that it does not write to stderr, but got : ${stderr}` + ); console.log('ok'); }); From fab55980be78eb517b9bcbb673667ee6eb07b172 Mon Sep 17 00:00:00 2001 From: SonaySevik Date: Mon, 6 Nov 2017 16:02:03 +0000 Subject: [PATCH 048/110] doc: add isTTY property documentation PR-URL: https://github.com/nodejs/node/pull/16828 Reviewed-By: Gireesh Punathil Reviewed-By: Colin Ihrig Reviewed-By: Sam Roberts --- doc/api/tty.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/doc/api/tty.md b/doc/api/tty.md index 497f53509d5a16..f91a37a12095e5 100644 --- a/doc/api/tty.md +++ b/doc/api/tty.md @@ -47,6 +47,13 @@ added: v0.7.7 A `boolean` that is `true` if the TTY is currently configured to operate as a raw device. Defaults to `false`. +### readStream.isTTY + + +A `boolean` that is always `true`. + ### readStream.setRawMode(mode) + +A `boolean` that is always `true`. + ### writeStream.rows * {boolean} Set to `true` after `subprocess.kill()` is used to successfully - terminate the child process. + send a signal to the child process. -The `subprocess.killed` property indicates whether the child process was -successfully terminated using `subprocess.kill()`. +The `subprocess.killed` property indicates whether the child process +successfully received a signal from `subprocess.kill()`. The `killed` property +does not indicate that the child process has been terminated. ### subprocess.pid From 360f40354e1a88fd58e219e04082fe2a87c93210 Mon Sep 17 00:00:00 2001 From: Andres Kalle Date: Tue, 7 Nov 2017 20:03:27 +0200 Subject: [PATCH 057/110] doc: fix typo in assert.md PR-URL: https://github.com/nodejs/node/pull/16866 Reviewed-By: Colin Ihrig Reviewed-By: Vse Mozhet Byt Reviewed-By: Bryan English --- doc/api/assert.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/assert.md b/doc/api/assert.md index ca110ecbfc44dc..962097c67ef63e 100644 --- a/doc/api/assert.md +++ b/doc/api/assert.md @@ -299,7 +299,7 @@ assert.fail(1, 2, 'whoops', '>'); // AssertionError [ERR_ASSERTION]: whoops ``` -*Note*: Is the last two cases `actual`, `expected`, and `operator` have no +*Note*: In the last two cases `actual`, `expected`, and `operator` have no influence on the error message. ```js From c1309d6b800e37d28365dd6fed5dd99110193644 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sat, 4 Nov 2017 20:33:31 -0700 Subject: [PATCH 058/110] test: use tmpDir in test-fs-utimes test-fs-utimes was doing some tests against __filename. This made the test unreliable when multiple copies were run simultaneously. In general, tests should use files in either the tmp directory or else fixtures, so change to using `common.tmpDir` instead. Each copy of the test (if using `test.py` harness for parallel runs) will use its own directory, making the test robust again. PR-URL: https://github.com/nodejs/node/pull/16774 Reviewed-By: Gireesh Punathil Reviewed-By: Luigi Pinca Reviewed-By: James M Snell Reviewed-By: Yuta Hiroto --- test/parallel/test-fs-utimes.js | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/test/parallel/test-fs-utimes.js b/test/parallel/test-fs-utimes.js index b72b294a0bd1b1..9bcf6039cd60bc 100644 --- a/test/parallel/test-fs-utimes.js +++ b/test/parallel/test-fs-utimes.js @@ -25,6 +25,8 @@ const assert = require('assert'); const util = require('util'); const fs = require('fs'); +common.refreshTmpDir(); + let tests_ok = 0; let tests_run = 0; @@ -64,9 +66,6 @@ function expect_ok(syscall, resource, err, atime, mtime) { } } -// the tests assume that __filename belongs to the user running the tests -// this should be a fairly safe assumption; testing against a temp file -// would be even better though (node doesn't have such functionality yet) function testIt(atime, mtime, callback) { let fd; @@ -74,8 +73,8 @@ function testIt(atime, mtime, callback) { // test synchronized code paths, these functions throw on failure // function syncTests() { - fs.utimesSync(__filename, atime, mtime); - expect_ok('utimesSync', __filename, undefined, atime, mtime); + fs.utimesSync(common.tmpDir, atime, mtime); + expect_ok('utimesSync', common.tmpDir, undefined, atime, mtime); tests_run++; // some systems don't have futimes @@ -110,17 +109,17 @@ function testIt(atime, mtime, callback) { // // test async code paths // - fs.utimes(__filename, atime, mtime, common.mustCall(function(err) { - expect_ok('utimes', __filename, err, atime, mtime); + fs.utimes(common.tmpDir, atime, mtime, common.mustCall(function(err) { + expect_ok('utimes', common.tmpDir, err, atime, mtime); fs.utimes('foobarbaz', atime, mtime, common.mustCall(function(err) { expect_errno('utimes', 'foobarbaz', err, 'ENOENT'); // don't close this fd if (common.isWindows) { - fd = fs.openSync(__filename, 'r+'); + fd = fs.openSync(common.tmpDir, 'r+'); } else { - fd = fs.openSync(__filename, 'r'); + fd = fs.openSync(common.tmpDir, 'r'); } fs.futimes(fd, atime, mtime, common.mustCall(function(err) { @@ -140,7 +139,7 @@ function testIt(atime, mtime, callback) { tests_run++; } -const stats = fs.statSync(__filename); +const stats = fs.statSync(common.tmpDir); // run tests const runTest = common.mustCall(testIt, 6); @@ -169,7 +168,6 @@ process.on('exit', function() { // Ref: https://github.com/nodejs/node/issues/13255 -common.refreshTmpDir(); const path = `${common.tmpDir}/test-utimes-precision`; fs.writeFileSync(path, ''); From 79006dab878065042fda3e38a7e3a0484f815fc6 Mon Sep 17 00:00:00 2001 From: Joyee Cheung Date: Sun, 29 Oct 2017 14:50:29 +0800 Subject: [PATCH 059/110] tools: don't lint files that have not changed PR-URL: https://github.com/nodejs/node/pull/16581 Reviewed-By: Gireesh Punathil Reviewed-By: Anatoli Papirovski --- Makefile | 36 ++++++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index bc337ab96d90ce..0611dd5188d513 100644 --- a/Makefile +++ b/Makefile @@ -974,6 +974,7 @@ bench-ci: bench lint-md-clean: $(RM) -r tools/remark-cli/node_modules $(RM) -r tools/remark-preset-lint-node/node_modules + $(RM) tools/.*mdlintstamp lint-md-build: @if [ ! -d tools/remark-cli/node_modules ]; then \ @@ -983,10 +984,25 @@ lint-md-build: echo "Markdown linter: installing remark-preset-lint-node into tools/"; \ cd tools/remark-preset-lint-node && ../../$(NODE) ../../$(NPM) install; fi -lint-md: lint-md-build - @echo "Running Markdown linter..." - $(NODE) tools/remark-cli/cli.js -q -f \ - ./*.md doc src lib benchmark tools/doc/ tools/icu/ +LINT_MD_TARGETS = src lib benchmark tools/doc tools/icu +LINT_MD_ROOT_DOCS := $(wildcard *.md) +LINT_MD_FILES := $(shell find $(LINT_MD_TARGETS) -type f \ + -not -path '*node_modules*' -name '*.md') $(LINT_MD_ROOT_DOCS) +LINT_DOC_MD_FILES = $(shell ls doc/**/*.md) + +tools/.docmdlintstamp: $(LINT_DOC_MD_FILES) + @echo "Running Markdown linter on docs..." + @$(NODE) tools/remark-cli/cli.js -q -f $(LINT_DOC_MD_FILES) + @touch $@ + +tools/.miscmdlintstamp: $(LINT_MD_FILES) + @echo "Running Markdown linter on misc docs..." + @$(NODE) tools/remark-cli/cli.js -q -f $(LINT_MD_FILES) + @touch $@ + +tools/.mdlintstamp: tools/.miscmdlintstamp tools/.docmdlintstamp + +lint-md: | lint-md-build tools/.mdlintstamp LINT_JS_TARGETS = benchmark doc lib test tools LINT_JS_CMD = tools/eslint/bin/eslint.js --cache \ @@ -1048,10 +1064,13 @@ LINT_CPP_FILES = $(filter-out $(LINT_CPP_EXCLUDE), $(wildcard \ # and the actual filename is generated so it won't match header guards ADDON_DOC_LINT_FLAGS=-whitespace/ending_newline,-build/header_guard -lint-cpp: +lint-cpp: tools/.cpplintstamp + +tools/.cpplintstamp: $(LINT_CPP_FILES) @echo "Running C++ linter..." - @$(PYTHON) tools/cpplint.py $(LINT_CPP_FILES) + @$(PYTHON) tools/cpplint.py $? @$(PYTHON) tools/check-imports.py + @touch $@ lint-addon-docs: test/addons/.docbuildstamp @echo "Running C++ linter on addon docs..." @@ -1087,6 +1106,10 @@ lint: lint-ci: lint endif +lint-clean: + $(RM) tools/.*lintstamp + $(RM) .eslintcache + .PHONY: $(TARBALL)-headers \ all \ bench \ @@ -1127,6 +1150,7 @@ endif install-bin \ install-includes \ lint \ + lint-clean \ lint-ci \ lint-cpp \ lint-js \ From e66a7ae6e3aff68dddcb5a275a811d5d4099c07c Mon Sep 17 00:00:00 2001 From: woj Date: Mon, 6 Nov 2017 15:24:50 +0000 Subject: [PATCH 060/110] test: replace common.fixtiresDir with fixtures.readKey() Use fixtures module in test/parallel/test-tls-js-stream.js. PR-URL: https://github.com/nodejs/node/pull/16817 Reviewed-By: Rich Trott Reviewed-By: James M Snell --- test/parallel/test-tls-js-stream.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/test/parallel/test-tls-js-stream.js b/test/parallel/test-tls-js-stream.js index f535a46cce593b..908f4c48876a56 100644 --- a/test/parallel/test-tls-js-stream.js +++ b/test/parallel/test-tls-js-stream.js @@ -1,13 +1,15 @@ 'use strict'; const common = require('../common'); + if (!common.hasCrypto) common.skip('missing crypto'); +const fixtures = require('../common/fixtures'); + const assert = require('assert'); -const tls = require('tls'); -const stream = require('stream'); -const fs = require('fs'); const net = require('net'); +const stream = require('stream'); +const tls = require('tls'); const connected = { client: 0, @@ -15,8 +17,8 @@ const connected = { }; const server = tls.createServer({ - key: fs.readFileSync(`${common.fixturesDir}/keys/agent1-key.pem`), - cert: fs.readFileSync(`${common.fixturesDir}/keys/agent1-cert.pem`) + key: fixtures.readKey('agent1-key.pem'), + cert: fixtures.readKey('agent1-cert.pem') }, function(c) { console.log('new client'); connected.server++; From 1b1bd261dc8dc1810ab239036cac31477f91082f Mon Sep 17 00:00:00 2001 From: Adam Jeffery Date: Mon, 6 Nov 2017 15:44:56 +0000 Subject: [PATCH 061/110] test: add values to error message In test-require-extensions-main, include the values that caused the test to fail in the messages reporting the failure. PR-URL: https://github.com/nodejs/node/pull/16831 Reviewed-By: Rich Trott Reviewed-By: Gireesh Punathil --- test/parallel/test-require-extensions-main.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/parallel/test-require-extensions-main.js b/test/parallel/test-require-extensions-main.js index 40a857b8e63614..16fbad6cf7af6e 100644 --- a/test/parallel/test-require-extensions-main.js +++ b/test/parallel/test-require-extensions-main.js @@ -3,11 +3,11 @@ require('../common'); const assert = require('assert'); const fixtures = require('../common/fixtures'); -const fixturesRequire = - require(fixtures.path('require-bin', 'bin', 'req.js')); +const fixturesRequire = require(fixtures.path('require-bin', 'bin', 'req.js')); assert.strictEqual( fixturesRequire, '', - 'test-require-extensions-main failed to import fixture requirements' + 'test-require-extensions-main failed to import fixture requirements: ' + + fixturesRequire ); From 853835413949f71804bd9153ef1271f75207681f Mon Sep 17 00:00:00 2001 From: Joyee Cheung Date: Mon, 6 Nov 2017 01:36:50 +0800 Subject: [PATCH 062/110] tools: add direct anchors for error codes This adds direct anchors for the error codes in errors.html. For example, previously the anchor for ERR_ASSERTION is #errors_err_assertion, now there is also #ERR_ASSERTION. PR-URL: https://github.com/nodejs/node/pull/16779 Reviewed-By: Luigi Pinca Reviewed-By: Yuta Hiroto Reviewed-By: Anatoli Papirovski Reviewed-By: James M Snell --- tools/doc/html.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tools/doc/html.js b/tools/doc/html.js index 6729dbba186268..5534dd03b7441a 100644 --- a/tools/doc/html.js +++ b/tools/doc/html.js @@ -472,6 +472,9 @@ function getSection(lexed) { return ''; } +function getMark(anchor) { + return `#`; +} function buildToc(lexed, filename, cb) { var toc = []; @@ -499,12 +502,15 @@ function buildToc(lexed, filename, cb) { depth = tok.depth; const realFilename = path.basename(realFilenames[0], '.md'); - const id = getId(`${realFilename}_${tok.text.trim()}`); + const apiName = tok.text.trim(); + const id = getId(`${realFilename}_${apiName}`); toc.push(new Array((depth - 1) * 2 + 1).join(' ') + `* ` + `${tok.text}`); - tok.text += `#`; + tok.text += getMark(id); + if (realFilename === 'errors' && apiName.startsWith('ERR_')) { + tok.text += getMark(apiName); + } }); toc = marked.parse(toc.join('\n')); From 7c9aee33484518602a2096103a1b155d90157463 Mon Sep 17 00:00:00 2001 From: Adam Wegrzynek Date: Mon, 6 Nov 2017 16:11:12 +0100 Subject: [PATCH 063/110] test: improve assertion in test-require-dot Include the value that differed from the expected value in an assertion message in test-require-dot. PR-URL: https://github.com/nodejs/node/pull/16805 Reviewed-By: Colin Ihrig Reviewed-By: Gireesh Punathil Reviewed-By: Michael Dawson Reviewed-By: James M Snell Reviewed-By: Rich Trott --- test/parallel/test-require-dot.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-require-dot.js b/test/parallel/test-require-dot.js index e2202efec1df1a..002a7ac988f2a1 100644 --- a/test/parallel/test-require-dot.js +++ b/test/parallel/test-require-dot.js @@ -14,5 +14,8 @@ process.env.NODE_PATH = fixtures.path('module-require', 'relative'); m._initPaths(); const c = require('.'); - -assert.strictEqual(c.value, 42, 'require(".") should honor NODE_PATH'); +assert.strictEqual( + c.value, + 42, + `require(".") should honor NODE_PATH; expected 42, found ${c.value}` +); From 0bc16cd9b67f04b1b499cd993bdeb0aa3cfe1168 Mon Sep 17 00:00:00 2001 From: Katie Stockton Roberts Date: Wed, 8 Nov 2017 12:28:47 +0000 Subject: [PATCH 064/110] test: improve assert messages in stream test In test-stream-pipe-await-train-manual-resume, include unexpected value in error messages. PR-URL: https://github.com/nodejs/node/pull/16884 Reviewed-By: Anna Henningsen Reviewed-By: Gireesh Punathil Reviewed-By: Rich Trott --- .../test-stream-pipe-await-drain-manual-resume.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/test/parallel/test-stream-pipe-await-drain-manual-resume.js b/test/parallel/test-stream-pipe-await-drain-manual-resume.js index bd7332c7fabc50..37acead9969443 100644 --- a/test/parallel/test-stream-pipe-await-drain-manual-resume.js +++ b/test/parallel/test-stream-pipe-await-drain-manual-resume.js @@ -30,11 +30,13 @@ readable.once('pause', common.mustCall(() => { assert.strictEqual( readable._readableState.awaitDrain, 1, - 'awaitDrain doesn\'t increase' + 'Expected awaitDrain to equal 1 but instead got ' + + `${readable._readableState.awaitDrain}` ); // First pause, resume manually. The next write() to writable will still // return false, because chunks are still being buffered, so it will increase // the awaitDrain counter again. + process.nextTick(common.mustCall(() => { readable.resume(); })); @@ -43,7 +45,8 @@ readable.once('pause', common.mustCall(() => { assert.strictEqual( readable._readableState.awaitDrain, 1, - '.resume() does not reset counter' + '.resume() should not reset the counter but instead got ' + + `${readable._readableState.awaitDrain}` ); // Second pause, handle all chunks from now on. Once all callbacks that // are currently queued up are handled, the awaitDrain drain counter should @@ -64,7 +67,8 @@ writable.on('finish', common.mustCall(() => { assert.strictEqual( readable._readableState.awaitDrain, 0, - 'awaitDrain not 0 after all chunks are written' + 'awaitDrain should equal 0 after all chunks are written but instead got' + + `${readable._readableState.awaitDrain}` ); // Everything okay, all chunks were written. })); From 585f8698afa687b38680b1ef8304bb2296e6b9a6 Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Fri, 3 Nov 2017 08:05:11 -0700 Subject: [PATCH 065/110] build: include src\tracing when linting on win This commit excludes src\tracing\trace_event.h and src\tracing\trace_event_common.h from the linter but allows the rest of the files in src\tracing to be examined by the linter which is similar to what the Makefile does. PR-URL: https://github.com/nodejs/node/pull/16720 Reviewed-By: James M Snell --- vcbuild.bat | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/vcbuild.bat b/vcbuild.bat index 7db343d8747a21..aa6e1833c22941 100644 --- a/vcbuild.bat +++ b/vcbuild.bat @@ -501,8 +501,10 @@ goto exit echo %1 | findstr /c:"src\node_root_certs.h" if %errorlevel% equ 0 goto exit -@rem skip subfolders under /src -echo %1 | findstr /r /c:"src\\.*\\.*" +echo %1 | findstr /r /c:"src\\tracing\\trace_event.h" +if %errorlevel% equ 0 goto exit + +echo %1 | findstr /r /c:"src\\tracing\\trace_event_common.h" if %errorlevel% equ 0 goto exit echo %1 | findstr /r /c:"test\\addons\\[0-9].*_.*\.h" From d721c0bb5e6dd53d31098f60f85223eb62628a20 Mon Sep 17 00:00:00 2001 From: Franziska Hinkelmann Date: Tue, 7 Nov 2017 18:22:23 +0100 Subject: [PATCH 066/110] doc: improve documentation for the vm module Add an intro section and example for the vm module. PR-URL: https://github.com/nodejs/node/pull/16867 Reviewed-By: Colin Ihrig Reviewed-By: Gireesh Punathil Reviewed-By: Luigi Pinca --- doc/api/vm.md | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/doc/api/vm.md b/doc/api/vm.md index 230054cba98bd2..4d4b7c9e2c87b6 100644 --- a/doc/api/vm.md +++ b/doc/api/vm.md @@ -7,14 +7,38 @@ The `vm` module provides APIs for compiling and running code within V8 Virtual -Machine contexts. It can be accessed using: +Machine contexts. + +JavaScript code can be compiled and run immediately or +compiled, saved, and run later. + +A common use case is to run the code in a sandboxed environment. +The sandboxed code uses a different V8 Context, meaning that +it has a different global object than the rest of the code. + +One can provide the context by ["contextifying"][contextified] a sandbox +object. The sandboxed code treats any property on the sandbox like a +global variable. Any changes on global variables caused by the sandboxed +code are reflected in the sandbox object. ```js const vm = require('vm'); -``` -JavaScript code can be compiled and run immediately or compiled, saved, and run -later. +const x = 1; + +const sandbox = { x: 2 }; +vm.createContext(sandbox); // Contextify the sandbox. + +const code = 'x += 40; var y = 17;'; +// x and y are global variables in the sandboxed environment. +// Initially, x has the value 2 because that is the value of sandbox.x. +vm.runInContext(code, sandbox); + +console.log(sandbox.x); // 42 +console.log(sandbox.y); // 17 + +console.log(x); // 1; y is not defined. +``` *Note*: The vm module is not a security mechanism. **Do not use it to run untrusted code**. From 1522562ffdc36bea412c67162827c1d0d9adf261 Mon Sep 17 00:00:00 2001 From: Rod Vagg Date: Mon, 23 Oct 2017 18:47:39 +1100 Subject: [PATCH 067/110] test: pass process.env to child processes For variables such as LD_LIBRARY_PATH and DYLD_LIBRARY_PATH that are needed for dynamically linked binaries PR-URL: https://github.com/nodejs/node/pull/16405 Reviewed-By: Refael Ackermann Reviewed-By: Gibson Fahnestock Reviewed-By: Colin Ihrig Reviewed-By: Gireesh Punathil --- benchmark/_http-benchmarkers.js | 8 +++----- benchmark/_test-double-benchmarker.js | 2 +- test/parallel/test-child-process-fork-no-shell.js | 2 +- test/sequential/test-inspector-port-cluster.js | 4 ++-- 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/benchmark/_http-benchmarkers.js b/benchmark/_http-benchmarkers.js index f9359b13d5e9e4..54b7481afaa817 100644 --- a/benchmark/_http-benchmarkers.js +++ b/benchmark/_http-benchmarkers.js @@ -91,11 +91,9 @@ class TestDoubleBenchmarker { create(options) { const child = child_process.fork(this.executable, { silent: true, - env: { - duration: options.duration, - connections: options.connections, - path: `http://127.0.0.1:${options.port}${options.path}` - } + env: Object.assign({}, process.env, { + test_url: `http://127.0.0.1:${options.port}${options.path}` + }) }); return child; } diff --git a/benchmark/_test-double-benchmarker.js b/benchmark/_test-double-benchmarker.js index 0a8c5f9264efc8..8c2f744fbf6e9f 100644 --- a/benchmark/_test-double-benchmarker.js +++ b/benchmark/_test-double-benchmarker.js @@ -2,6 +2,6 @@ const http = require('http'); -http.get(process.env.path, function() { +http.get(process.env.test_url, function() { console.log(JSON.stringify({ throughput: 1 })); }); diff --git a/test/parallel/test-child-process-fork-no-shell.js b/test/parallel/test-child-process-fork-no-shell.js index 7a085913fbf4a3..168f115b0cbcbf 100644 --- a/test/parallel/test-child-process-fork-no-shell.js +++ b/test/parallel/test-child-process-fork-no-shell.js @@ -8,7 +8,7 @@ const expected = common.isWindows ? '%foo%' : '$foo'; if (process.argv[2] === undefined) { const child = cp.fork(__filename, [expected], { shell: true, - env: { foo: 'bar' } + env: Object.assign({}, process.env, { foo: 'bar' }) }); child.on('exit', common.mustCall((code, signal) => { diff --git a/test/sequential/test-inspector-port-cluster.js b/test/sequential/test-inspector-port-cluster.js index 3b2464d81268b4..2428a7844e98c0 100644 --- a/test/sequential/test-inspector-port-cluster.js +++ b/test/sequential/test-inspector-port-cluster.js @@ -311,11 +311,11 @@ function workerProcessMain() { function spawnMaster({ execArgv, workers, clusterSettings = {} }) { return new Promise((resolve) => { childProcess.fork(__filename, { - env: { + env: Object.assign({}, process.env, { workers: JSON.stringify(workers), clusterSettings: JSON.stringify(clusterSettings), testProcess: true - }, + }), execArgv }).on('exit', common.mustCall((code, signal) => { checkExitCode(code, signal); From adb8f08c3643b3e07d188c5d306c737b45c9d619 Mon Sep 17 00:00:00 2001 From: Mamatha J V Date: Fri, 10 Nov 2017 10:12:58 +0530 Subject: [PATCH 068/110] doc: fix a typo in the documentation PR-URL: https://github.com/nodejs/node/pull/16909 Reviewed-By: Anatoli Papirovski Reviewed-By: Gireesh Punathil --- doc/api/deprecations.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index 6b301e01eb3cac..6da72219a95dc2 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -118,7 +118,7 @@ to the `constants` property exposed by the relevant module. For instance, Type: End-of-life Use of the [`crypto.pbkdf2()`][] API without specifying a digest was deprecated -in Node.js 6.0 because the method defaulted to using the non-recommendend +in Node.js 6.0 because the method defaulted to using the non-recommended `'SHA1'` digest. Previously, a deprecation warning was printed. Starting in Node.js 8.0.0, calling `crypto.pbkdf2()` or `crypto.pbkdf2Sync()` with an undefined `digest` will throw a `TypeError`. From 7ba037592da1dd338efc8ebc6c84dd6ea4613734 Mon Sep 17 00:00:00 2001 From: Franziska Hinkelmann Date: Wed, 8 Nov 2017 20:09:54 +0100 Subject: [PATCH 069/110] deps: cherry-pick cc55747 from V8 upstream MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes the flaky message/console test on our CI. Original commit message: [test/message] Allow numbers to have more than one leading digit. The {NUMBER} regexp only allowed one, leading to occasional test failures such as: https://build.chromium.org/p/client.v8/builders/V8%20Mac%20-%20debug/builds/17156 Bug: Change-Id: I25a08b80640d9af19ba70c61c846163685f1cb82 Reviewed-on: https://chromium-review.googlesource.com/753322 Reviewed-by: Franziska Hinkelmann Commit-Queue: Georg Neis Cr-Commit-Position: refs/heads/master@{#49109} PR-URL: https://github.com/nodejs/node/pull/16890 Ref: https://github.com/nodejs/build/issues/936 Reviewed-By: Colin Ihrig Reviewed-By: Michaël Zasso Reviewed-By: Daniel Bevenius Reviewed-By: James M Snell --- deps/v8/include/v8-version.h | 2 +- deps/v8/test/message/testcfg.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/deps/v8/include/v8-version.h b/deps/v8/include/v8-version.h index d3c3a2b76c13ff..f7395e3d6f3c9c 100644 --- a/deps/v8/include/v8-version.h +++ b/deps/v8/include/v8-version.h @@ -11,7 +11,7 @@ #define V8_MAJOR_VERSION 6 #define V8_MINOR_VERSION 1 #define V8_BUILD_NUMBER 534 -#define V8_PATCH_LEVEL 47 +#define V8_PATCH_LEVEL 48 // Use 1 for candidates and 0 otherwise. // (Boolean macro values are not supported by all preprocessors.) diff --git a/deps/v8/test/message/testcfg.py b/deps/v8/test/message/testcfg.py index 0576458af24a4e..1bbb2b16d83472 100644 --- a/deps/v8/test/message/testcfg.py +++ b/deps/v8/test/message/testcfg.py @@ -107,7 +107,7 @@ def IsFailureOutput(self, testcase): expected_lines, actual_lines, fillvalue=''): pattern = re.escape(expected.rstrip() % env) pattern = pattern.replace("\\*", ".*") - pattern = pattern.replace("\\{NUMBER\\}", "\d(?:\.\d*)?") + pattern = pattern.replace("\\{NUMBER\\}", "\d+(?:\.\d*)?") pattern = "^%s$" % pattern if not re.match(pattern, actual): return True From 6c57399c6b66c5795941d0db9b9a0cc31718e287 Mon Sep 17 00:00:00 2001 From: Neil Vass Date: Wed, 8 Nov 2017 12:48:01 +0000 Subject: [PATCH 070/110] test: improve assertion messages Print content of domain stack if it doesn't match expected values PR-URL: https://github.com/nodejs/node/pull/16885 Reviewed-By: James M Snell Reviewed-By: Rich Trott Reviewed-By: Luigi Pinca Reviewed-By: Gireesh Punathil --- test/parallel/test-domain-safe-exit.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/test/parallel/test-domain-safe-exit.js b/test/parallel/test-domain-safe-exit.js index f6c46d3d757cda..3a111107869665 100644 --- a/test/parallel/test-domain-safe-exit.js +++ b/test/parallel/test-domain-safe-exit.js @@ -20,18 +20,21 @@ // USE OR OTHER DEALINGS IN THE SOFTWARE. 'use strict'; +require('../common'); // Make sure the domain stack doesn't get clobbered by un-matched .exit() -require('../common'); const assert = require('assert'); const domain = require('domain'); +const util = require('util'); const a = domain.create(); const b = domain.create(); a.enter(); // push b.enter(); // push -assert.deepStrictEqual(domain._stack, [a, b], 'b not pushed'); +assert.deepStrictEqual(domain._stack, [a, b], 'Unexpected stack shape ' + + `(domain._stack = ${util.inspect(domain._stack)})`); domain.create().exit(); // no-op -assert.deepStrictEqual(domain._stack, [a, b], 'stack mangled!'); +assert.deepStrictEqual(domain._stack, [a, b], 'Unexpected stack shape ' + + `(domain._stack = ${util.inspect(domain._stack)})`); From 26d529e60f7657c1cc0214d8678212a3c27db707 Mon Sep 17 00:00:00 2001 From: cjihrig Date: Thu, 9 Nov 2017 15:36:04 -0500 Subject: [PATCH 071/110] test: cover vm.runInNewContext() There is currently one if branch missing coverage in lib/vm.js. This commit adds a test to cover the case where the third argument to runInNewContext() is a string. PR-URL: https://github.com/nodejs/node/pull/16906 Reviewed-By: Ben Noordhuis Reviewed-By: Luigi Pinca Reviewed-By: Yuta Hiroto Reviewed-By: James M Snell Reviewed-By: Franziska Hinkelmann --- test/parallel/test-vm-run-in-new-context.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/test/parallel/test-vm-run-in-new-context.js b/test/parallel/test-vm-run-in-new-context.js index 2dc9cc5bea55a5..082682f8438c5d 100644 --- a/test/parallel/test-vm-run-in-new-context.js +++ b/test/parallel/test-vm-run-in-new-context.js @@ -73,3 +73,23 @@ const fn = vm.runInNewContext('(function() { obj.p = {}; })', { obj: {} }); global.gc(); fn(); // Should not crash + +{ + // Verify that providing a custom filename as a string argument works. + const code = 'throw new Error("foo");'; + const file = 'test_file.vm'; + + assert.throws(() => { + vm.runInNewContext(code, {}, file); + }, (err) => { + const lines = err.stack.split('\n'); + + assert.strictEqual(lines[0].trim(), `${file}:1`); + assert.strictEqual(lines[1].trim(), code); + // Skip lines[2] and lines[3]. They're just a ^ and blank line. + assert.strictEqual(lines[4].trim(), 'Error: foo'); + assert.strictEqual(lines[5].trim(), `at ${file}:1:7`); + // The rest of the stack is uninteresting. + return true; + }); +} From 0d4f62c85fab668f0094c46d0a6bef232457ec75 Mon Sep 17 00:00:00 2001 From: Refael Ackermann Date: Wed, 8 Nov 2017 18:33:52 -0500 Subject: [PATCH 072/110] tools,build: allow build without `remark-cli` PR-URL: https://github.com/nodejs/node/pull/16893 Reviewed-By: Joyee Cheung --- Makefile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 0611dd5188d513..b2facee41a8442 100644 --- a/Makefile +++ b/Makefile @@ -984,6 +984,7 @@ lint-md-build: echo "Markdown linter: installing remark-preset-lint-node into tools/"; \ cd tools/remark-preset-lint-node && ../../$(NODE) ../../$(NPM) install; fi +ifneq ("","$(wildcard tools/remark-cli/node_modules/)") LINT_MD_TARGETS = src lib benchmark tools/doc tools/icu LINT_MD_ROOT_DOCS := $(wildcard *.md) LINT_MD_FILES := $(shell find $(LINT_MD_TARGETS) -type f \ @@ -1002,7 +1003,12 @@ tools/.miscmdlintstamp: $(LINT_MD_FILES) tools/.mdlintstamp: tools/.miscmdlintstamp tools/.docmdlintstamp -lint-md: | lint-md-build tools/.mdlintstamp +lint-md: | tools/.mdlintstamp +else +lint-md: + @echo "The markdown linter is not installed." + @echo "To install (requires internet access) run: $ make lint-md-build" +endif LINT_JS_TARGETS = benchmark doc lib test tools LINT_JS_CMD = tools/eslint/bin/eslint.js --cache \ From f7411b5df7f41d53917085228994b004dbb1db48 Mon Sep 17 00:00:00 2001 From: Joyee Cheung Date: Tue, 7 Nov 2017 19:28:06 +0800 Subject: [PATCH 073/110] src: make StreamBase prototype accessors robust This PR makes the prototype accessors added by StreamBase::AddMethods nonenumerable and checks the signatures in the accessors so they throw instead of raising assertions when called with incompatible receivers. They could be enumerated when inspecting the prototype with util.inspect or the inspector protocol. PR-URL: https://github.com/nodejs/node/pull/16860 Reviewed-By: Anna Henningsen Reviewed-By: Ben Noordhuis Reviewed-By: James M Snell Reviewed-By: Colin Ihrig --- src/stream_base-inl.h | 15 ++++++++--- ...-base-prototype-accessors-enumerability.js | 19 +++++++++++++ .../test-stream-base-prototype-accessors.js | 27 +++++++++++++++++++ 3 files changed, 57 insertions(+), 4 deletions(-) create mode 100644 test/parallel/test-stream-base-prototype-accessors-enumerability.js create mode 100644 test/parallel/test-stream-base-prototype-accessors.js diff --git a/src/stream_base-inl.h b/src/stream_base-inl.h index 667c0a9ffbd50d..ab07da65081302 100644 --- a/src/stream_base-inl.h +++ b/src/stream_base-inl.h @@ -11,6 +11,7 @@ namespace node { +using v8::AccessorSignature; using v8::External; using v8::FunctionCallbackInfo; using v8::FunctionTemplate; @@ -31,27 +32,33 @@ void StreamBase::AddMethods(Environment* env, HandleScope scope(env->isolate()); enum PropertyAttribute attributes = - static_cast(v8::ReadOnly | v8::DontDelete); + static_cast( + v8::ReadOnly | v8::DontDelete | v8::DontEnum); + Local signature = + AccessorSignature::New(env->isolate(), t); t->PrototypeTemplate()->SetAccessor(env->fd_string(), GetFD, nullptr, env->as_external(), v8::DEFAULT, - attributes); + attributes, + signature); t->PrototypeTemplate()->SetAccessor(env->external_stream_string(), GetExternal, nullptr, env->as_external(), v8::DEFAULT, - attributes); + attributes, + signature); t->PrototypeTemplate()->SetAccessor(env->bytes_read_string(), GetBytesRead, nullptr, env->as_external(), v8::DEFAULT, - attributes); + attributes, + signature); env->SetProtoMethod(t, "readStart", JSMethod); env->SetProtoMethod(t, "readStop", JSMethod); diff --git a/test/parallel/test-stream-base-prototype-accessors-enumerability.js b/test/parallel/test-stream-base-prototype-accessors-enumerability.js new file mode 100644 index 00000000000000..f59aced197c515 --- /dev/null +++ b/test/parallel/test-stream-base-prototype-accessors-enumerability.js @@ -0,0 +1,19 @@ +'use strict'; + +require('../common'); + +// This tests that the prototype accessors added by StreamBase::AddMethods +// are not enumerable. They could be enumerated when inspecting the prototype +// with util.inspect or the inspector protocol. + +const assert = require('assert'); + +// Or anything that calls StreamBase::AddMethods when setting up its prototype +const TTY = process.binding('tty_wrap').TTY; + +{ + assert.strictEqual(TTY.prototype.propertyIsEnumerable('bytesRead'), false); + assert.strictEqual(TTY.prototype.propertyIsEnumerable('fd'), false); + assert.strictEqual( + TTY.prototype.propertyIsEnumerable('_externalStream'), false); +} diff --git a/test/parallel/test-stream-base-prototype-accessors.js b/test/parallel/test-stream-base-prototype-accessors.js new file mode 100644 index 00000000000000..f9e12582a098d8 --- /dev/null +++ b/test/parallel/test-stream-base-prototype-accessors.js @@ -0,0 +1,27 @@ +'use strict'; + +require('../common'); + +// This tests that the prototype accessors added by StreamBase::AddMethods +// do not raise assersions when called with incompatible receivers. + +const assert = require('assert'); + +// Or anything that calls StreamBase::AddMethods when setting up its prototype +const TTY = process.binding('tty_wrap').TTY; + +// Should throw instead of raise assertions +{ + const msg = /TypeError: Method \w+ called on incompatible receiver/; + assert.throws(() => { + TTY.prototype.bytesRead; + }, msg); + + assert.throws(() => { + TTY.prototype.fd; + }, msg); + + assert.throws(() => { + TTY.prototype._externalStream; + }, msg); +} From 0b8a400cada284af345b0d9cbce78c14059a6ef4 Mon Sep 17 00:00:00 2001 From: Vidya Subramanyam Date: Fri, 10 Nov 2017 10:10:25 +0530 Subject: [PATCH 074/110] doc: correct the spelling of omitting in dgram.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/16910 Reviewed-By: Luigi Pinca Reviewed-By: Gireesh Punathil Reviewed-By: James M Snell Reviewed-By: Tobias Nießen Reviewed-By: Colin Ihrig Reviewed-By: Franziska Hinkelmann --- doc/api/dgram.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/dgram.md b/doc/api/dgram.md index 910289b37f9e61..4e57142888b8d3 100644 --- a/doc/api/dgram.md +++ b/doc/api/dgram.md @@ -455,7 +455,7 @@ On IPv4, if `multicastInterface` is a valid address but does not match any interface, or if the address does not match the family then a [`System Error`][] such as `EADDRNOTAVAIL` or `EPROTONOSUP` is thrown. -On IPv6, most errors with specifying or omiting scope will result in the socket +On IPv6, most errors with specifying or omitting scope will result in the socket continuing to use (or returning to) the system's default interface selection. A socket's address family's ANY address (IPv4 `'0.0.0.0'` or IPv6 `'::'`) can be From be920aa3729012ce479b7bc5e1cb98b3318f79f2 Mon Sep 17 00:00:00 2001 From: Tanvi Kini Date: Fri, 10 Nov 2017 05:22:12 +0000 Subject: [PATCH 075/110] test: replace string concatenation with template MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/16913 Reviewed-By: Luigi Pinca Reviewed-By: James M Snell Reviewed-By: Tobias Nießen Reviewed-By: Gireesh Punathil Reviewed-By: Colin Ihrig Reviewed-By: Franziska Hinkelmann --- test/fixtures/guess-hash-seed.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/fixtures/guess-hash-seed.js b/test/fixtures/guess-hash-seed.js index c0d072b23d2e48..18a6f5124dc1d8 100644 --- a/test/fixtures/guess-hash-seed.js +++ b/test/fixtures/guess-hash-seed.js @@ -134,7 +134,7 @@ const slow_str_gen = (function*() { let strgen_i = 0; outer: while (1) { - const str = '#' + (strgen_i++); + const str = `#${strgen_i++}`; for (let i = 0; i < 1000; i++) { if (time_set_lookup(tester_set, str) < tester_set_treshold) continue outer; From 41f905bb0075707efd14e58c9334828f94891abb Mon Sep 17 00:00:00 2001 From: Sabari Lakshmi Krishnamoorthy Date: Fri, 10 Nov 2017 11:43:51 +0530 Subject: [PATCH 076/110] test: replace string concatenation with template MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/16914 Reviewed-By: Luigi Pinca Reviewed-By: Gireesh Punathil Reviewed-By: James M Snell Reviewed-By: Tobias Nießen Reviewed-By: Colin Ihrig Reviewed-By: Franziska Hinkelmann --- test/parallel/test-assert.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-assert.js b/test/parallel/test-assert.js index e42a3dcc60a80d..d0672c8fb58dd0 100644 --- a/test/parallel/test-assert.js +++ b/test/parallel/test-assert.js @@ -634,7 +634,7 @@ try { code: 'ERR_INVALID_ARG_TYPE', type: TypeError, message: 'The "block" argument must be of type function. Received ' + - 'type ' + typeName(block) + `type ${typeName(block)}` })(e); } From 81a6c4f78572e634a51664254cd6139606449673 Mon Sep 17 00:00:00 2001 From: Vipin Menon Date: Fri, 10 Nov 2017 12:00:09 +0530 Subject: [PATCH 077/110] test: enable mustCall() during child exit PR-URL: https://github.com/nodejs/node/pull/16915 Reviewed-By: Khaidi Chu Reviewed-By: Gireesh Punathil Reviewed-By: James M Snell Reviewed-By: Colin Ihrig Reviewed-By: Anatoli Papirovski Reviewed-By: Franziska Hinkelmann --- test/parallel/test-process-raw-debug.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-process-raw-debug.js b/test/parallel/test-process-raw-debug.js index 7b89a8ad18eda7..6f989e123e8916 100644 --- a/test/parallel/test-process-raw-debug.js +++ b/test/parallel/test-process-raw-debug.js @@ -50,10 +50,10 @@ function parent() { console.log('ok - got expected message'); }); - child.on('exit', function(c) { + child.on('exit', common.mustCall(function(c) { assert(!c); console.log('ok - child exited nicely'); - }); + })); } function child() { From ae7106cc75aa5565d5dfb731a927d5d9b020ce3d Mon Sep 17 00:00:00 2001 From: Kabir Islam Date: Fri, 10 Nov 2017 12:20:28 +0530 Subject: [PATCH 078/110] test: replace string concatenation with template MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/16916 Reviewed-By: Vse Mozhet Byt Reviewed-By: James M Snell Reviewed-By: Daniel Bevenius Reviewed-By: Tobias Nießen Reviewed-By: Gireesh Punathil Reviewed-By: Colin Ihrig Reviewed-By: Franziska Hinkelmann --- test/fixtures/cluster-preload-test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/fixtures/cluster-preload-test.js b/test/fixtures/cluster-preload-test.js index 0094fe6657fd7c..570cb83bdc496e 100644 --- a/test/fixtures/cluster-preload-test.js +++ b/test/fixtures/cluster-preload-test.js @@ -2,6 +2,6 @@ const cluster = require('cluster'); if (cluster.isMaster) { cluster.fork(); // one child cluster.on('exit', function(worker, code, signal) { - console.log('worker terminated with code ' + code); + console.log(`worker terminated with code ${code}`); }); } From 134c2f31f27f8eaf85ef8517de115ddcbb778c2f Mon Sep 17 00:00:00 2001 From: subrahmanya chari p Date: Fri, 10 Nov 2017 12:36:21 +0530 Subject: [PATCH 079/110] lib: replace string concatenation with template MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/16917 Reviewed-By: James M Snell Reviewed-By: Daniel Bevenius Reviewed-By: Tobias Nießen Reviewed-By: Gireesh Punathil Reviewed-By: Colin Ihrig Reviewed-By: Franziska Hinkelmann --- lib/_http_agent.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/_http_agent.js b/lib/_http_agent.js index 858e00f0da45e4..6178306f6063ce 100644 --- a/lib/_http_agent.js +++ b/lib/_http_agent.js @@ -127,10 +127,10 @@ Agent.prototype.getName = function getName(options) { // Pacify parallel/test-http-agent-getname by only appending // the ':' when options.family is set. if (options.family === 4 || options.family === 6) - name += ':' + options.family; + name += `:${options.family}`; if (options.socketPath) - name += ':' + options.socketPath; + name += `:${options.socketPath}`; return name; }; From 7164d9a6b8a0750dd7d7d2013b0460606c49fa64 Mon Sep 17 00:00:00 2001 From: Vipin Menon Date: Fri, 10 Nov 2017 13:25:07 +0530 Subject: [PATCH 080/110] test: use template string for concatenation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/16918 Reviewed-By: James M Snell Reviewed-By: Daniel Bevenius Reviewed-By: Tobias Nießen Reviewed-By: Colin Ihrig Reviewed-By: Gireesh Punathil Reviewed-By: Franziska Hinkelmann --- test/parallel/test-whatwg-url-setters.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/parallel/test-whatwg-url-setters.js b/test/parallel/test-whatwg-url-setters.js index 819a835e2ce347..7655e4a2578bb1 100644 --- a/test/parallel/test-whatwg-url-setters.js +++ b/test/parallel/test-whatwg-url-setters.js @@ -46,10 +46,10 @@ function runURLSettersTests(all_test_cases) { var test_cases = all_test_cases[attribute_to_be_set]; for(var i = 0, l = test_cases.length; i < l; i++) { var test_case = test_cases[i]; - var name = "Setting <" + test_case.href + ">." + attribute_to_be_set + - " = '" + test_case.new_value + "'"; + var name = `Setting <${test_case.href}>.${attribute_to_be_set}` + + ` = '${test_case.new_value}'`; if ("comment" in test_case) { - name += " " + test_case.comment; + name += ` ${test_case.comment}`; } test(function() { var url = new URL(test_case.href); @@ -57,7 +57,7 @@ function runURLSettersTests(all_test_cases) { for (var attribute in test_case.expected) { assert_equals(url[attribute], test_case.expected[attribute]) } - }, "URL: " + name) + }, `URL: ${name}`); // test(function() { // var url = document.createElement("a"); // url.href = test_case.href; @@ -93,7 +93,7 @@ startURLSettersTests() let name = `Setting <${testCase.href}>.${attributeToBeSet}` + ` = "${testCase.new_value}"`; if ('comment' in testCase) { - name += ' ' + testCase.comment; + name += ` ${testCase.comment}`; } test(function() { const url = new URL(testCase.href); @@ -101,7 +101,7 @@ startURLSettersTests() for (const attribute in testCase.expected) { assert_equals(url[attribute], testCase.expected[attribute]); } - }, 'URL: ' + name); + }, `URL: ${name}`); } } } From febd1bf519df4f177e555c39cb172471576acda3 Mon Sep 17 00:00:00 2001 From: Suryanarayana Murthy N Date: Fri, 10 Nov 2017 13:36:00 +0530 Subject: [PATCH 081/110] test: change string concatenation to template MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/16919 Reviewed-By: James M Snell Reviewed-By: Tobias Nießen Reviewed-By: Colin Ihrig Reviewed-By: Gireesh Punathil Reviewed-By: Franziska Hinkelmann --- test/fixtures/print-10-lines.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/fixtures/print-10-lines.js b/test/fixtures/print-10-lines.js index d483fe6bff3899..e672ef80cf4a72 100644 --- a/test/fixtures/print-10-lines.js +++ b/test/fixtures/print-10-lines.js @@ -20,5 +20,5 @@ // USE OR OTHER DEALINGS IN THE SOFTWARE. for (var i = 0; i < 10; i++) { - console.log('count ' + i); + console.log(`count ${i}`); } From 6eb550da342d6e257bbc1bd3fc9b8427c439f0d8 Mon Sep 17 00:00:00 2001 From: Vipin Menon Date: Fri, 10 Nov 2017 14:13:17 +0530 Subject: [PATCH 082/110] doc: remove duplicate 'the' from http2 API doc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/16924 Reviewed-By: Vse Mozhet Byt Reviewed-By: James M Snell Reviewed-By: Tobias Nießen Reviewed-By: Colin Ihrig Reviewed-By: Gireesh Punathil Reviewed-By: Franziska Hinkelmann --- doc/api/http2.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/http2.md b/doc/api/http2.md index 2a958c30c3fa15..8d6ebd256fb02f 100644 --- a/doc/api/http2.md +++ b/doc/api/http2.md @@ -1781,7 +1781,7 @@ All additional properties on the settings object are ignored. ### Using `options.selectPadding` When `options.paddingStrategy` is equal to -`http2.constants.PADDING_STRATEGY_CALLBACK`, the the HTTP/2 implementation will +`http2.constants.PADDING_STRATEGY_CALLBACK`, the HTTP/2 implementation will consult the `options.selectPadding` callback function, if provided, to determine the specific amount of padding to use per HEADERS and DATA frame. From 28f036045b1e0e9b284fc69401a3a3df8f5bd468 Mon Sep 17 00:00:00 2001 From: Nayana Das K Date: Fri, 10 Nov 2017 15:29:23 +0530 Subject: [PATCH 083/110] lib: change concatenated string to template MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/16925 Reviewed-By: James M Snell Reviewed-By: Daniel Bevenius Reviewed-By: Tobias Nießen Reviewed-By: Colin Ihrig Reviewed-By: Gireesh Punathil Reviewed-By: Franziska Hinkelmann --- lib/_http_common.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/_http_common.js b/lib/_http_common.js index a1fe29217f59d5..4c8d3c3850b2fa 100644 --- a/lib/_http_common.js +++ b/lib/_http_common.js @@ -78,7 +78,7 @@ function parserOnHeadersComplete(versionMajor, versionMinor, headers, method, parser.incoming = new IncomingMessage(parser.socket); parser.incoming.httpVersionMajor = versionMajor; parser.incoming.httpVersionMinor = versionMinor; - parser.incoming.httpVersion = versionMajor + '.' + versionMinor; + parser.incoming.httpVersion = `${versionMajor}.${versionMinor}`; parser.incoming.url = url; var n = headers.length; From 7168a7e044f1567848b75b3d07b170f641369a46 Mon Sep 17 00:00:00 2001 From: Anawesha Khuntia Date: Fri, 10 Nov 2017 10:54:32 +0530 Subject: [PATCH 084/110] test: change concatenated string to template MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/16912 Reviewed-By: Gireesh Punathil Reviewed-By: Vse Mozhet Byt Reviewed-By: James M Snell Reviewed-By: Tobias Nießen Reviewed-By: Colin Ihrig Reviewed-By: Franziska Hinkelmann --- test/fixtures/loop.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/fixtures/loop.js b/test/fixtures/loop.js index e91b831d01b816..461fb393583e68 100644 --- a/test/fixtures/loop.js +++ b/test/fixtures/loop.js @@ -4,7 +4,7 @@ console.log('A message', 5); while (t > 0) { if (t++ === 1000) { t = 0; - console.log('Outputed message #' + k++); + console.log(`Outputed message #${k++}`); } } process.exit(55); From 6e7a444a91ed01aea38ad707667fa3294dcd9d13 Mon Sep 17 00:00:00 2001 From: Maton Anthony Date: Mon, 6 Nov 2017 21:13:40 +0100 Subject: [PATCH 085/110] doc: outline commit message for breaking changes Add informations to CONTRIBUTING.md requesting the committers and especially the one working on breaking changes to write proper commits messages containing the reason behind the breaking changes, the case during which it can be triggered, and a description of the breaking change in itself. PR-URL: https://github.com/nodejs/node/pull/16846 Reviewed-By: James M Snell Reviewed-By: Franziska Hinkelmann --- CONTRIBUTING.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 99278a843af683..b234f9354883cb 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -334,6 +334,14 @@ use `Refs:`. - `Refs: http://eslint.org/docs/rules/space-in-parens.html` - `Refs: https://github.com/nodejs/node/pull/3615` +5. If your commit introduces a breaking change (`semver-major`), it should +contain an explanation about the reason of the breaking change, which +situation would trigger the breaking change and what is the exact change. + +Breaking changes will be listed in the wiki with the aim to make upgrading +easier. Please have a look at [Breaking Changes](https://github.com/nodejs/node/wiki/Breaking-changes-between-v4-LTS-and-v6-LTS) +for the level of detail that's suitable. + Sample complete commit message: ```txt @@ -625,6 +633,7 @@ Focus first on the most significant aspects of the change: 1. Does this change make sense for Node.js? 2. Does this change make Node.js better, even if only incrementally? 3. Are there clear bugs or larger scale issues that need attending to? +4. Is the commit message readable and correct? If it contains a breaking change is it clear enough? When changes are necessary, *request* them, do not *demand* them, and do not assume that the submitter already knows how to add a test or run a benchmark. From bf9eb04abeb5ed384cb93ccc29b559697c6be2f6 Mon Sep 17 00:00:00 2001 From: Deepthi Sebastian Date: Fri, 10 Nov 2017 17:57:00 +0530 Subject: [PATCH 086/110] test: change concatenated string to template MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/16929 Reviewed-By: Vse Mozhet Byt Reviewed-By: Tobias Nießen Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Anatoli Papirovski Reviewed-By: Gireesh Punathil Reviewed-By: Franziska Hinkelmann --- test/fixtures/net-fd-passing-receiver.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/fixtures/net-fd-passing-receiver.js b/test/fixtures/net-fd-passing-receiver.js index 4279a49becacb4..8559f116c54956 100644 --- a/test/fixtures/net-fd-passing-receiver.js +++ b/test/fixtures/net-fd-passing-receiver.js @@ -36,12 +36,12 @@ receiver = net.createServer(function(socket) { }); passedSocket.on('data', function(data) { - passedSocket.send('[echo] ' + data); + passedSocket.send(`[echo] ${data}`); }); passedSocket.on('close', function() { receiver.close(); }); - passedSocket.send('[greeting] ' + greeting); + passedSocket.send(`[greeting] ${greeting}`); }); }); From 2ad051d62ce760d4be1d986533ee5c76c29bdbde Mon Sep 17 00:00:00 2001 From: Pawan Jangid Date: Fri, 10 Nov 2017 17:54:19 +0530 Subject: [PATCH 087/110] lib: change concatenated string to template MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/16930 Reviewed-By: Tobias Nießen Reviewed-By: James M Snell Reviewed-By: Franziska Hinkelmann --- lib/dns.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/dns.js b/lib/dns.js index aad0ebb17cee12..09076a6b4bbd37 100644 --- a/lib/dns.js +++ b/lib/dns.js @@ -46,7 +46,7 @@ function errnoException(err, syscall, hostname) { } var ex = null; if (typeof err === 'string') { // c-ares error code. - const errHost = hostname ? ' ' + hostname : ''; + const errHost = hostname ? ` ${hostname}` : ''; ex = new Error(`${syscall} ${err}${errHost}`); ex.code = err; ex.errno = err; From 8f0793ff93e215d4f1abd73824243a7cfce6ac86 Mon Sep 17 00:00:00 2001 From: Nikolai Vavilov Date: Thu, 9 Nov 2017 15:55:32 +0200 Subject: [PATCH 088/110] doc: clarify the prerequisites for building with VS2017 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * "Edition" is ambiguous. For example, Visual Studio Team Explorer 2017 is listed under "Visual Studio 2017", but Build Tools for Visual Studio 2017 is listed under "Other Tools and Frameworks". * The listed required components are insufficient. VS2017 also needs "Visual Studio C++ core features", and Build Tools also needs "Visual C++ Build Tools core features". * Installing the workload with the default optional components takes up only about 1GB more space than the minimal set of components, but saves scrolling through the long list of individual components. PR-URL: https://github.com/nodejs/node/pull/16903 Reviewed-By: Refael Ackermann Reviewed-By: James M Snell Reviewed-By: João Reis Reviewed-By: Gireesh Punathil Reviewed-By: Richard Lau --- BUILDING.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/BUILDING.md b/BUILDING.md index 5a8d93356a7150..4f46acd6fbfe65 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -199,9 +199,11 @@ Prerequisites: * [Visual Studio 2015 Update 3](https://www.visualstudio.com/), all editions including the Community edition (remember to select "Common Tools for Visual C++ 2015" feature during installation). - * [Visual Studio 2017](https://www.visualstudio.com/downloads/), any edition (including the Build Tools SKU). - **Required Components:** "MSbuild", "VC++ 2017 v141 toolset" and at least one of the Windows SDKs. - *Note*: For "Windows 10 SDK (10.0.15063.0)" only the "Desktop C++ x86 and x64" flavor is required. + * The "Desktop development with C++" workload from + [Visual Studio 2017](https://www.visualstudio.com/downloads/) or the + "Visual C++ build tools" workload from the + [Build Tools](https://www.visualstudio.com/downloads/#build-tools-for-visual-studio-2017), + with the default optional components. * Basic Unix tools required for some tests, [Git for Windows](http://git-scm.com/download/win) includes Git Bash and tools which can be included in the global `PATH`. From 40880897fe89248a2c20067b97d1fd5711734672 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Sat, 4 Nov 2017 22:25:18 +0100 Subject: [PATCH 089/110] src: use unrefed async for GC tracking Do not let an internal handle keep the event loop alive. PR-URL: https://github.com/nodejs/node/pull/16758 Fixes: https://github.com/node/issues/16210 Reviewed-By: Refael Ackermann Reviewed-By: Rich Trott Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Benjamin Gruenbaum --- src/node_perf.cc | 1 + test/parallel/test-performance-gc.js | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/node_perf.cc b/src/node_perf.cc index f5aafbab63a781..155f1e66e46bb9 100644 --- a/src/node_perf.cc +++ b/src/node_perf.cc @@ -215,6 +215,7 @@ void MarkGarbageCollectionEnd(Isolate* isolate, uv_async_t* async = new uv_async_t(); // coverity[leaked_storage] if (uv_async_init(env->event_loop(), async, PerformanceGCCallback)) return delete async; + uv_unref(reinterpret_cast(async)); async->data = new PerformanceEntry::Data(env, "gc", "gc", performance_last_gc_start_mark_, diff --git a/test/parallel/test-performance-gc.js b/test/parallel/test-performance-gc.js index 1ff4c9ae629942..89a9041c1c1159 100644 --- a/test/parallel/test-performance-gc.js +++ b/test/parallel/test-performance-gc.js @@ -48,4 +48,6 @@ const kinds = [ })); obs.observe({ entryTypes: ['gc'] }); global.gc(); + // Keep the event loop alive to witness the GC async callback happen. + setImmediate(() => setImmediate(() => 0)); } From c3e6491a51285debd2ba0b324f6ec241cfeb1db8 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Sat, 4 Nov 2017 22:36:18 +0100 Subject: [PATCH 090/110] test: unmark flaky test This effectively reverts 5c475a722357b1d4ddf099992e3f5df7e51583e1 and 75095d700137e29ad1413972b8f6eed7c3473a65. PR-URL: https://github.com/nodejs/node/pull/16758 Fixes: https://github.com/node/issues/16210 Reviewed-By: Refael Ackermann Reviewed-By: Rich Trott Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Benjamin Gruenbaum --- test/parallel/parallel.status | 2 -- 1 file changed, 2 deletions(-) diff --git a/test/parallel/parallel.status b/test/parallel/parallel.status index 32b72b3a8ddfe1..2958fad4d0f8fa 100644 --- a/test/parallel/parallel.status +++ b/test/parallel/parallel.status @@ -5,8 +5,6 @@ prefix parallel # sample-test : PASS,FLAKY [true] # This section applies to all platforms -# https://github.com/nodejs/node/issues/16210 -test-async-wrap-uncaughtexception: PASS,FLAKY [$system==win32] From 3a3792b0a07245e738df56e616667dbfaa420eb5 Mon Sep 17 00:00:00 2001 From: Stephan Smith Date: Mon, 6 Nov 2017 15:42:01 +0000 Subject: [PATCH 091/110] test: improve template value for test message Include value that cause failure in error message in test-cluster-master-kill.js. PR-URL: https://github.com/nodejs/node/pull/16826 Reviewed-By: Gireesh Punathil Reviewed-By: James M Snell Reviewed-By: Rich Trott --- test/parallel/test-cluster-master-kill.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/parallel/test-cluster-master-kill.js b/test/parallel/test-cluster-master-kill.js index 417ab193c9bb1f..4e21d8e906cfaf 100644 --- a/test/parallel/test-cluster-master-kill.js +++ b/test/parallel/test-cluster-master-kill.js @@ -81,7 +81,8 @@ if (cluster.isWorker) { process.once('exit', () => { assert.strictEqual(typeof pid, 'number', `got ${pid} instead of a worker pid`); - assert.strictEqual(alive, false, 'worker was alive after master died'); + assert.strictEqual(alive, false, + `worker was alive after master died (alive = ${alive})`); }); } From af8b17a314b8f332312da23ae6c2653ce2660ad9 Mon Sep 17 00:00:00 2001 From: Javier Blanco Date: Mon, 6 Nov 2017 15:13:30 +0000 Subject: [PATCH 092/110] test: use common/fixtures module in hash-seed test Replace `common.fixturesDir` with `fixtures.path()` usage in test/pummel/test-hash-seed.js. PR-URL: https://github.com/nodejs/node/pull/16823 Reviewed-By: Joyee Cheung Reviewed-By: Gireesh Punathil Reviewed-By: James M Snell --- test/pummel/test-hash-seed.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/test/pummel/test-hash-seed.js b/test/pummel/test-hash-seed.js index 05d29fff0b8b90..fd59bbe5e0653c 100644 --- a/test/pummel/test-hash-seed.js +++ b/test/pummel/test-hash-seed.js @@ -1,20 +1,20 @@ 'use strict'; +// Check that spawn child doesn't create duplicated entries +require('../common'); const REPETITIONS = 2; - const assert = require('assert'); -const common = require('../common'); -const cp = require('child_process'); -const path = require('path'); -const targetScript = path.resolve(common.fixturesDir, 'guess-hash-seed.js'); +const fixtures = require('../common/fixtures'); +const { spawnSync } = require('child_process'); +const targetScript = fixtures.path('guess-hash-seed.js'); const seeds = []; for (let i = 0; i < REPETITIONS; ++i) { - const seed = cp.spawnSync(process.execPath, [targetScript], - { encoding: 'utf8' }).stdout.trim(); + const seed = spawnSync(process.execPath, [targetScript], { + encoding: 'utf8' + }).stdout.trim(); seeds.push(seed); } console.log(`Seeds: ${seeds}`); -const hasDuplicates = (new Set(seeds)).size !== seeds.length; -assert.strictEqual(hasDuplicates, false); +assert.strictEqual(new Set(seeds).size, seeds.length); From dc14c25ee943d5a944d117bceffea2bcd8c4270e Mon Sep 17 00:00:00 2001 From: Cyril Lakech <1169286+clakech@users.noreply.github.com> Date: Mon, 6 Nov 2017 10:34:28 +0000 Subject: [PATCH 093/110] loader: test search module PR-URL: https://github.com/nodejs/node/pull/16795 Reviewed-By: James M Snell Reviewed-By: Colin Ihrig Reviewed-By: Anatoli Papirovski Reviewed-By: Gireesh Punathil Reviewed-By: Luigi Pinca --- test/es-module/test-esm-loader-search.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 test/es-module/test-esm-loader-search.js diff --git a/test/es-module/test-esm-loader-search.js b/test/es-module/test-esm-loader-search.js new file mode 100644 index 00000000000000..c8c24f1deb80ae --- /dev/null +++ b/test/es-module/test-esm-loader-search.js @@ -0,0 +1,18 @@ +'use strict'; +// Flags: --expose-internals + +// This test ensures that search throws errors appropriately + +const common = require('../common'); + +const search = require('internal/loader/search'); +const errors = require('internal/errors'); + +common.expectsError( + () => search('target', undefined), + { + code: 'ERR_MISSING_MODULE', + type: errors.Error, + message: 'Cannot find module target' + } +); From 29efb02f1271a0563cd85a4d37a3213c89c78f91 Mon Sep 17 00:00:00 2001 From: James M Snell Date: Fri, 3 Nov 2017 19:48:06 -0700 Subject: [PATCH 094/110] http2: multiple smaller code cleanups * Add Http2Priority utility class * Reduces some code duplication * Other small minor cleanups PR-URL: https://github.com/nodejs/node/pull/16764 Reviewed-By: Anatoli Papirovski --- src/node_http2.cc | 52 +++++++++++++------------------- src/node_http2.h | 14 +++++++++ src/node_http2_core-inl.h | 63 ++++++++++++++------------------------- 3 files changed, 57 insertions(+), 72 deletions(-) diff --git a/src/node_http2.cc b/src/node_http2.cc index cc8afec207ffba..c8aa9e0729d4f7 100644 --- a/src/node_http2.cc +++ b/src/node_http2.cc @@ -180,6 +180,18 @@ inline void Http2Settings::RefreshDefaults(Environment* env) { (1 << IDX_SETTINGS_MAX_FRAME_SIZE); } +Http2Priority::Http2Priority(Environment* env, + Local parent, + Local weight, + Local exclusive) { + Local context = env->context(); + int32_t parent_ = parent->Int32Value(context).ToChecked(); + int32_t weight_ = weight->Int32Value(context).ToChecked(); + bool exclusive_ = exclusive->BooleanValue(context).ToChecked(); + DEBUG_HTTP2("Http2Priority: parent: %d, weight: %d, exclusive: %d\n", + parent_, weight_, exclusive_); + nghttp2_priority_spec_init(&spec, parent_, weight_, exclusive_ ? 1 : 0); +} Http2Session::Http2Session(Environment* env, Local wrap, @@ -258,12 +270,8 @@ ssize_t Http2Session::OnCallbackPadding(size_t frameLen, buffer[PADDING_BUF_RETURN_VALUE] = frameLen; MakeCallback(env()->ongetpadding_string(), 0, nullptr); uint32_t retval = buffer[PADDING_BUF_RETURN_VALUE]; - retval = retval <= maxPayloadLen ? retval : maxPayloadLen; - retval = retval >= frameLen ? retval : frameLen; -#if defined(DEBUG) && DEBUG - CHECK_GE(retval, frameLen); - CHECK_LE(retval, maxPayloadLen); -#endif + retval = std::min(retval, static_cast(maxPayloadLen)); + retval = std::max(retval, static_cast(frameLen)); return retval; } @@ -445,30 +453,18 @@ void Http2Session::SubmitPriority(const FunctionCallbackInfo& args) { ASSIGN_OR_RETURN_UNWRAP(&session, args.Holder()); Local context = env->context(); - nghttp2_priority_spec spec; int32_t id = args[0]->Int32Value(context).ToChecked(); - int32_t parent = args[1]->Int32Value(context).ToChecked(); - int32_t weight = args[2]->Int32Value(context).ToChecked(); - bool exclusive = args[3]->BooleanValue(context).ToChecked(); + Http2Priority priority(env, args[1], args[2], args[3]); bool silent = args[4]->BooleanValue(context).ToChecked(); - DEBUG_HTTP2("Http2Session: submitting priority for stream %d: " - "parent: %d, weight: %d, exclusive: %d, silent: %d\n", - id, parent, weight, exclusive, silent); - -#if defined(DEBUG) && DEBUG - CHECK_GT(id, 0); - CHECK_GE(parent, 0); - CHECK_GE(weight, 0); -#endif + DEBUG_HTTP2("Http2Session: submitting priority for stream %d", id); Nghttp2Stream* stream; if (!(stream = session->FindStream(id))) { // invalid stream return args.GetReturnValue().Set(NGHTTP2_ERR_INVALID_STREAM_ID); } - nghttp2_priority_spec_init(&spec, parent, weight, exclusive ? 1 : 0); - args.GetReturnValue().Set(stream->SubmitPriority(&spec, silent)); + args.GetReturnValue().Set(stream->SubmitPriority(*priority, silent)); } void Http2Session::SubmitSettings(const FunctionCallbackInfo& args) { @@ -524,20 +520,14 @@ void Http2Session::SubmitRequest(const FunctionCallbackInfo& args) { Local headers = args[0].As(); int options = args[1]->IntegerValue(context).ToChecked(); - int32_t parent = args[2]->Int32Value(context).ToChecked(); - int32_t weight = args[3]->Int32Value(context).ToChecked(); - bool exclusive = args[4]->BooleanValue(context).ToChecked(); - - DEBUG_HTTP2("Http2Session: submitting request: headers: %d, options: %d, " - "parent: %d, weight: %d, exclusive: %d\n", headers->Length(), - options, parent, weight, exclusive); + Http2Priority priority(env, args[2], args[3], args[4]); - nghttp2_priority_spec prispec; - nghttp2_priority_spec_init(&prispec, parent, weight, exclusive ? 1 : 0); + DEBUG_HTTP2("Http2Session: submitting request: headers: %d, options: %d\n", + headers->Length(), options); Headers list(isolate, context, headers); - int32_t ret = session->Nghttp2Session::SubmitRequest(&prispec, + int32_t ret = session->Nghttp2Session::SubmitRequest(*priority, *list, list.length(), nullptr, options); DEBUG_HTTP2("Http2Session: request submitted, response: %d\n", ret); diff --git a/src/node_http2.h b/src/node_http2.h index 84cffc613eff64..770bf28075e5db 100644 --- a/src/node_http2.h +++ b/src/node_http2.h @@ -369,6 +369,20 @@ class Http2Settings { MaybeStackBuffer entries_; }; +class Http2Priority { + public: + Http2Priority(Environment* env, + Local parent, + Local weight, + Local exclusive); + + nghttp2_priority_spec* operator*() { + return &spec; + } + private: + nghttp2_priority_spec spec; +}; + class Http2Session : public AsyncWrap, public StreamBase, public Nghttp2Session { diff --git a/src/node_http2_core-inl.h b/src/node_http2_core-inl.h index fa365fee059b4d..5fc0b629ccb205 100644 --- a/src/node_http2_core-inl.h +++ b/src/node_http2_core-inl.h @@ -28,6 +28,13 @@ inline int Nghttp2Session::OnNghttpError(nghttp2_session* session, } #endif +inline int32_t GetFrameID(const nghttp2_frame* frame) { + // If this is a push promise, we want to grab the id of the promised stream + return (frame->hd.type == NGHTTP2_PUSH_PROMISE) ? + frame->push_promise.promised_stream_id : + frame->hd.stream_id; +} + // nghttp2 calls this at the beginning a new HEADERS or PUSH_PROMISE frame. // We use it to ensure that an Nghttp2Stream instance is allocated to store // the state. @@ -35,11 +42,7 @@ inline int Nghttp2Session::OnBeginHeadersCallback(nghttp2_session* session, const nghttp2_frame* frame, void* user_data) { Nghttp2Session* handle = static_cast(user_data); - // If this is a push promise frame, we want to grab the handle of - // the promised stream. - int32_t id = (frame->hd.type == NGHTTP2_PUSH_PROMISE) ? - frame->push_promise.promised_stream_id : - frame->hd.stream_id; + int32_t id = GetFrameID(frame); DEBUG_HTTP2("Nghttp2Session %s: beginning headers for stream %d\n", handle->TypeName(), id); @@ -62,11 +65,7 @@ inline int Nghttp2Session::OnHeaderCallback(nghttp2_session* session, uint8_t flags, void* user_data) { Nghttp2Session* handle = static_cast(user_data); - // If this is a push promise frame, we want to grab the handle of - // the promised stream. - int32_t id = (frame->hd.type == NGHTTP2_PUSH_PROMISE) ? - frame->push_promise.promised_stream_id : - frame->hd.stream_id; + int32_t id = GetFrameID(frame); Nghttp2Stream* stream = handle->FindStream(id); // The header name and value are stored in a reference counted buffer // provided to us by nghttp2. We need to increment the reference counter @@ -418,7 +417,7 @@ inline void Nghttp2Stream::FlushDataChunks() { // see if the END_STREAM flag is set, and will flush the queued data chunks // to JS if the stream is flowing inline void Nghttp2Session::HandleDataFrame(const nghttp2_frame* frame) { - int32_t id = frame->hd.stream_id; + int32_t id = GetFrameID(frame); DEBUG_HTTP2("Nghttp2Session %s: handling data frame for stream %d\n", TypeName(), id); Nghttp2Stream* stream = this->FindStream(id); @@ -436,8 +435,7 @@ inline void Nghttp2Session::HandleDataFrame(const nghttp2_frame* frame) { // The headers are collected as the frame is being processed and sent out // to the JS side only when the frame is fully processed. inline void Nghttp2Session::HandleHeadersFrame(const nghttp2_frame* frame) { - int32_t id = (frame->hd.type == NGHTTP2_PUSH_PROMISE) ? - frame->push_promise.promised_stream_id : frame->hd.stream_id; + int32_t id = GetFrameID(frame); DEBUG_HTTP2("Nghttp2Session %s: handling headers frame for stream %d\n", TypeName(), id); Nghttp2Stream* stream = FindStream(id); @@ -454,7 +452,7 @@ inline void Nghttp2Session::HandleHeadersFrame(const nghttp2_frame* frame) { // Notifies the JS layer that a PRIORITY frame has been received inline void Nghttp2Session::HandlePriorityFrame(const nghttp2_frame* frame) { nghttp2_priority priority_frame = frame->priority; - int32_t id = frame->hd.stream_id; + int32_t id = GetFrameID(frame); DEBUG_HTTP2("Nghttp2Session %s: handling priority frame for stream %d\n", TypeName(), id); @@ -548,39 +546,22 @@ inline int Nghttp2Session::Init(const nghttp2_session_type type, session_type_ = type; DEBUG_HTTP2("Nghttp2Session %s: initializing session\n", TypeName()); destroying_ = false; - int ret = 0; nghttp2_session_callbacks* callbacks = callback_struct_saved[HasGetPaddingCallback() ? 1 : 0].callbacks; - nghttp2_option* opts; - if (options != nullptr) { - opts = options; - } else { - nghttp2_option_new(&opts); - } + CHECK_NE(options, nullptr); - switch (type) { - case NGHTTP2_SESSION_SERVER: - ret = nghttp2_session_server_new3(&session_, - callbacks, - this, - opts, - mem); - break; - case NGHTTP2_SESSION_CLIENT: - ret = nghttp2_session_client_new3(&session_, - callbacks, - this, - opts, - mem); - break; - } - if (opts != options) { - nghttp2_option_del(opts); - } + typedef int (*init_fn)(nghttp2_session** session, + const nghttp2_session_callbacks* callbacks, + void* user_data, + const nghttp2_option* options, + nghttp2_mem* mem); + init_fn fn = type == NGHTTP2_SESSION_SERVER ? + nghttp2_session_server_new3 : + nghttp2_session_client_new3; - return ret; + return fn(&session_, callbacks, this, options, mem); } inline void Nghttp2Session::MarkDestroying() { From ccd36467f8af64926b9805fcd8cc929fd47d2a36 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sun, 1 Oct 2017 08:33:55 -0700 Subject: [PATCH 095/110] doc: reorganize COLLABORATOR_GUIDE.md Based on feedback during a recent collaborator onboarding, move the metadata description closer to where the instructions for editing a commit message are. Indicate which metadata are required and which are optional. Make the punctuation more consistent. Previously, sentences prior to instructions ended in a period, a colon, or no punctuation at all. Colon seems best, so changed the Technical How-To section to use colons. PR-URL: https://github.com/nodejs/node/pull/15710 Reviewed-By: Vse Mozhet Byt Reviewed-By: Benedikt Meurer Reviewed-By: Luigi Pinca Reviewed-By: James M Snell Reviewed-By: Refael Ackermann --- COLLABORATOR_GUIDE.md | 60 +++++++++++++++++++++++-------------------- doc/onboarding.md | 2 +- 2 files changed, 33 insertions(+), 29 deletions(-) diff --git a/COLLABORATOR_GUIDE.md b/COLLABORATOR_GUIDE.md index acbd3fa9b5d8c0..5346f8194516b1 100644 --- a/COLLABORATOR_GUIDE.md +++ b/COLLABORATOR_GUIDE.md @@ -371,25 +371,11 @@ The TSC should serve as the final arbiter where required. * If more than one author has contributed to the PR, keep the most recent author when squashing. -Always modify the original commit message to include additional meta -information regarding the change process: - -- A `PR-URL:` line that references the *full* GitHub URL of the original - pull request being merged so it's easy to trace a commit back to the - conversation that led up to that change. -- A `Fixes: X` line, where _X_ either includes the *full* GitHub URL - for an issue, and/or the hash and commit message if the commit fixes - a bug in a previous commit. Multiple `Fixes:` lines may be added if - appropriate. -- A `Refs:` line referencing a URL for any relevant background. -- A `Reviewed-By: Name ` line for yourself and any - other Collaborators who have reviewed the change. - - Useful for @mentions / contact list if something goes wrong in the PR. - - Protects against the assumption that GitHub will be around forever. - Review the commit message to ensure that it adheres to the guidelines outlined in the [contributing](./CONTRIBUTING.md#commit-message-guidelines) guide. +Add all necessary [metadata](#metadata) to commit messages before landing. + See the commit log for examples such as [this one](https://github.com/nodejs/node/commit/b636ba8186) if unsure exactly how to format your commit messages. @@ -397,34 +383,33 @@ exactly how to format your commit messages. Additionally: - Double check PRs to make sure the person's _full name_ and email address are correct before merging. -- Except when updating dependencies, all commits should be self - contained (meaning every commit should pass all tests). This makes - it much easier when bisecting to find a breaking change. +- All commits should be self-contained (meaning every commit should pass all + tests). This makes it much easier when bisecting to find a breaking change. ### Technical HOWTO -Clear any `am`/`rebase` that may already be underway. +Clear any `am`/`rebase` that may already be underway: ```text $ git am --abort $ git rebase --abort ``` -Checkout proper target branch +Checkout proper target branch: ```text $ git checkout master ``` Update the tree (assumes your repo is set up as detailed in -[CONTRIBUTING.md](CONTRIBUTING.md#step-1-fork)) +[CONTRIBUTING.md](CONTRIBUTING.md#step-1-fork)): ```text $ git fetch upstream $ git merge --ff-only upstream/master ``` -Apply external patches +Apply external patches: ```text $ curl -L https://github.com/nodejs/node/pull/xxx.patch | git am --whitespace=fix @@ -442,21 +427,19 @@ against the original PR carefully and build/test on at least one platform before landing. If the 3-way merge fails, then it is most likely that a conflicting PR has landed since the CI run and you will have to ask the author to rebase. -Check and re-review the changes +Check and re-review the changes: ```text $ git diff upstream/master ``` -Check number of commits and commit messages +Check number of commits and commit messages: ```text $ git log upstream/master...master ``` -If there are multiple commits that relate to the same feature or -one with a feature and separate with a test for that feature, -you'll need to use `squash` or `fixup`: +Squash commits and add metadata: ```text $ git rebase -i upstream/master @@ -512,9 +495,29 @@ Save the file and close the editor. You'll be asked to enter a new commit message for that commit. This is a good moment to fix incorrect commit logs, ensure that they are properly formatted, and add `Reviewed-By` lines. + * The commit message text must conform to the [commit message guidelines](./CONTRIBUTING.md#commit-message-guidelines). + +* Modify the original commit message to include additional metadata regarding + the change process. (If you use Chrome or Edge, [`node-review`][] fetches + the metadata for you.) + + * Required: A `PR-URL:` line that references the *full* GitHub URL of the + original pull request being merged so it's easy to trace a commit back to + the conversation that led up to that change. + * Optional: A `Fixes: X` line, where _X_ either includes the *full* GitHub URL + for an issue, and/or the hash and commit message if the commit fixes + a bug in a previous commit. Multiple `Fixes:` lines may be added if + appropriate. + * Optional: One or more `Refs:` lines referencing a URL for any relevant + background. + * Required: A `Reviewed-By: Name ` line for yourself and any + other Collaborators who have reviewed the change. + * Useful for @mentions / contact list if something goes wrong in the PR. + * Protects against the assumption that GitHub will be around forever. + Run tests (`make -j4 test` or `vcbuild test`). Even though there was a successful continuous integration run, other changes may have landed on master since then, so running the tests one last time locally is a good practice. @@ -678,3 +681,4 @@ LTS working group and the Release team. [Stability Index]: doc/api/documentation.md#stability-index [Enhancement Proposal]: https://github.com/nodejs/node-eps [git-username]: https://help.github.com/articles/setting-your-username-in-git/ +[`node-review`]: https://github.com/evanlucas/node-review diff --git a/doc/onboarding.md b/doc/onboarding.md index d028803aa0ef80..41df0d00bd93b3 100644 --- a/doc/onboarding.md +++ b/doc/onboarding.md @@ -158,7 +158,7 @@ onboarding session. * After one or two approvals, land the PR. * Be sure to add the `PR-URL: ` and appropriate `Reviewed-By:` metadata! * [`core-validate-commit`][] helps a lot with this – install and use it if you can! - * If you use Chrome, [`node-review`][] fetches the metadata for you + * If you use Chrome or Edge, [`node-review`][] fetches the metadata for you. ## Final notes From 4f587e5a305e355ec1f4158aa19ad7671ec5d417 Mon Sep 17 00:00:00 2001 From: Grant Gasparyan Date: Mon, 6 Nov 2017 17:37:28 +0100 Subject: [PATCH 096/110] test: add a test description PR-URL: https://github.com/nodejs/node/pull/16833 Reviewed-By: James M Snell Reviewed-By: Rich Trott Reviewed-By: Vse Mozhet Byt Reviewed-By: Gireesh Punathil --- test/parallel/test-cluster-fork-env.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/parallel/test-cluster-fork-env.js b/test/parallel/test-cluster-fork-env.js index 1591977d2172b9..5dd28163084a21 100644 --- a/test/parallel/test-cluster-fork-env.js +++ b/test/parallel/test-cluster-fork-env.js @@ -21,6 +21,11 @@ 'use strict'; require('../common'); + +// This test checks that arguments provided to cluster.fork() will create +// new environment variables and override existing environment variables +// in the created worker process. + const assert = require('assert'); const cluster = require('cluster'); From 5c8fb6a976eeb48ad19acf1e5ebab75ca1b22960 Mon Sep 17 00:00:00 2001 From: Patrick Heneise Date: Mon, 6 Nov 2017 15:52:33 +0000 Subject: [PATCH 097/110] test: refactor fs.write() test PR-URL: https://github.com/nodejs/node/pull/16827 Reviewed-By: James M Snell Reviewed-By: Matteo Collina Reviewed-By: Gireesh Punathil --- test/parallel/test-fs-write.js | 59 ++++++++++++++++++---------------- 1 file changed, 31 insertions(+), 28 deletions(-) diff --git a/test/parallel/test-fs-write.js b/test/parallel/test-fs-write.js index fd0e6b768da042..e861b183d966f2 100644 --- a/test/parallel/test-fs-write.js +++ b/test/parallel/test-fs-write.js @@ -33,40 +33,43 @@ common.refreshTmpDir(); fs.open(fn, 'w', 0o644, common.mustCall(function(err, fd) { assert.ifError(err); - console.log('open done'); - fs.write(fd, '', 0, 'utf8', function(err, written) { - assert.strictEqual(0, written); - }); - fs.write(fd, expected, 0, 'utf8', common.mustCall(function(err, written) { - console.log('write done'); + + const done = common.mustCall(function(err, written) { assert.ifError(err); assert.strictEqual(Buffer.byteLength(expected), written); fs.closeSync(fd); const found = fs.readFileSync(fn, 'utf8'); - console.log('expected: "%s"', expected); - console.log('found: "%s"', found); fs.unlinkSync(fn); assert.strictEqual(expected, found); - })); + }); + + const written = common.mustCall(function(err, written) { + assert.ifError(err); + assert.strictEqual(0, written); + }); + + fs.write(fd, '', 0, 'utf8', written); + fs.write(fd, expected, 0, 'utf8', done); })); +const args = constants.O_CREAT | constants.O_WRONLY | constants.O_TRUNC; +fs.open(fn2, args, 0o644, common.mustCall((err, fd) => { + assert.ifError(err); -fs.open(fn2, constants.O_CREAT | constants.O_WRONLY | constants.O_TRUNC, 0o644, - common.mustCall((err, fd) => { - assert.ifError(err); - console.log('open done'); - fs.write(fd, '', 0, 'utf8', (err, written) => { - assert.strictEqual(0, written); - }); - fs.write(fd, expected, 0, 'utf8', common.mustCall((err, written) => { - console.log('write done'); - assert.ifError(err); - assert.strictEqual(Buffer.byteLength(expected), written); - fs.closeSync(fd); - const found = fs.readFileSync(fn2, 'utf8'); - console.log('expected: "%s"', expected); - console.log('found: "%s"', found); - fs.unlinkSync(fn2); - assert.strictEqual(expected, found); - })); - })); + const done = common.mustCall((err, written) => { + assert.ifError(err); + assert.strictEqual(Buffer.byteLength(expected), written); + fs.closeSync(fd); + const found = fs.readFileSync(fn2, 'utf8'); + fs.unlinkSync(fn2); + assert.strictEqual(expected, found); + }); + + const written = common.mustCall(function(err, written) { + assert.ifError(err); + assert.strictEqual(0, written); + }); + + fs.write(fd, '', 0, 'utf8', written); + fs.write(fd, expected, 0, 'utf8', done); +})); From 85fd7bb8f7ee342ed1270ecd0738e4f6bea47f0c Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Mon, 23 Oct 2017 11:28:47 +0200 Subject: [PATCH 098/110] tools: fix inspector-check reporting Currently the inspector-check rule does not store the node when the usage of a require('inspector') is done. This means that it is not possible to disable this rule. For example, if you add the following to a test that uses the inspector module: //common.skipIfInspectorDisabled(); /* eslint-disable inspector-check */ This will not disable the check and there will still be a lint error reported. This commit stores the node where the require statement is done which allows for the rule to also be disabled. PR-URL: https://github.com/nodejs/node/pull/16902 Reviewed-By: Ben Noordhuis Reviewed-By: James M Snell Reviewed-By: Colin Ihrig --- tools/eslint-rules/inspector-check.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tools/eslint-rules/inspector-check.js b/tools/eslint-rules/inspector-check.js index f225b34cb6b0ca..e65dd17d768ac2 100644 --- a/tools/eslint-rules/inspector-check.js +++ b/tools/eslint-rules/inspector-check.js @@ -14,12 +14,12 @@ const msg = 'Please add a skipIfInspectorDisabled() call to allow this ' + 'test to be skippped when Node is built \'--without-inspector\'.'; module.exports = function(context) { - var usesInspector = false; + const missingCheckNodes = []; var hasInspectorCheck = false; function testInspectorUsage(context, node) { if (utils.isRequired(node, ['inspector'])) { - usesInspector = true; + missingCheckNodes.push(node); } } @@ -30,8 +30,10 @@ module.exports = function(context) { } function reportIfMissing(context, node) { - if (usesInspector && !hasInspectorCheck) { - context.report(node, msg); + if (!hasInspectorCheck) { + missingCheckNodes.forEach((node) => { + context.report(node, msg); + }); } } From 14f8cee4018f8cb683552c3f6860394ad499b8d2 Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Mon, 25 Sep 2017 09:10:53 +0200 Subject: [PATCH 099/110] lib: guard inspector console using process var Currently the inspector module is always loaded and if it does not return anything the inspector console setup is skipped. This commit uses the process.config.variables.v8_enable_inspector variable to only load the inspector module if it is enabled. PR-URL: https://github.com/nodejs/node/pull/15008 Reviewed-By: Ben Noordhuis Reviewed-By: James M Snell --- lib/internal/bootstrap_node.js | 4 +- .../overwrite-config-preload-module.js | 5 +++ .../test-inspector-overwrite-config.js | 41 +++++++++++++++++++ 3 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 test/fixtures/overwrite-config-preload-module.js create mode 100644 test/sequential/test-inspector-overwrite-config.js diff --git a/lib/internal/bootstrap_node.js b/lib/internal/bootstrap_node.js index 1f202d2335f17a..1ab55a84459e79 100644 --- a/lib/internal/bootstrap_node.js +++ b/lib/internal/bootstrap_node.js @@ -319,10 +319,10 @@ } function setupInspector(originalConsole, wrappedConsole, Module) { - const { addCommandLineAPI, consoleCall } = process.binding('inspector'); - if (!consoleCall) { + if (!process.config.variables.v8_enable_inspector) { return; } + const { addCommandLineAPI, consoleCall } = process.binding('inspector'); // Setup inspector command line API const { makeRequireFunction } = NativeModule.require('internal/module'); const path = NativeModule.require('path'); diff --git a/test/fixtures/overwrite-config-preload-module.js b/test/fixtures/overwrite-config-preload-module.js new file mode 100644 index 00000000000000..21cb966a54988b --- /dev/null +++ b/test/fixtures/overwrite-config-preload-module.js @@ -0,0 +1,5 @@ +'use strict' +const common = require('../common'); +common.skipIfInspectorDisabled(); + +process.config = {}; diff --git a/test/sequential/test-inspector-overwrite-config.js b/test/sequential/test-inspector-overwrite-config.js new file mode 100644 index 00000000000000..ecb14c6638edb5 --- /dev/null +++ b/test/sequential/test-inspector-overwrite-config.js @@ -0,0 +1,41 @@ +// Flags: --require ./test/fixtures/overwrite-config-preload-module.js +'use strict'; + +// This test ensures that overwriting a process configuration +// value does not affect code in bootstrap_node.js. Specifically this tests +// that the inspector console functions are bound even though +// overwrite-config-preload-module.js overwrote the process.config variable. + +// We cannot do a check for the inspector because the configuration variables +// were reset/removed by overwrite-config-preload-module.js. +/* eslint-disable inspector-check */ + +const common = require('../common'); +const assert = require('assert'); +const inspector = require('inspector'); +const msg = 'Test inspector logging'; +let asserted = false; + +async function testConsoleLog() { + const session = new inspector.Session(); + session.connect(); + session.on('inspectorNotification', (data) => { + if (data.method === 'Runtime.consoleAPICalled') { + assert.strictEqual(data.params.args.length, 1); + assert.strictEqual(data.params.args[0].value, msg); + asserted = true; + } + }); + session.post('Runtime.enable'); + console.log(msg); + session.disconnect(); +} + +common.crashOnUnhandledRejection(); + +async function runTests() { + await testConsoleLog(); + assert.ok(asserted, 'log statement did not reach the inspector'); +} + +runTests(); From 4faf2ec7839bbc25bd919401cfa88aa17b06fb81 Mon Sep 17 00:00:00 2001 From: Suryanarayana Murthy N Date: Fri, 10 Nov 2017 18:17:17 +0530 Subject: [PATCH 100/110] lib: replace string concatenation with template PR-URL: https://github.com/nodejs/node/pull/16933 Reviewed-By: Anatoli Papirovski Reviewed-By: Franziska Hinkelmann Reviewed-By: James M Snell Reviewed-By: Colin Ihrig Reviewed-By: Gireesh Punathil --- lib/fs.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/fs.js b/lib/fs.js index 9c72994a72e549..feadde5f7e88ff 100644 --- a/lib/fs.js +++ b/lib/fs.js @@ -101,7 +101,7 @@ function rethrow() { var backtrace = new Error(); return function(err) { if (err) { - backtrace.stack = err.name + ': ' + err.message + + backtrace.stack = `${err.name}: ${err.message}` + backtrace.stack.substr(backtrace.name.length); throw backtrace; } @@ -1843,7 +1843,7 @@ fs.mkdtemp = function(prefix, options, callback) { var req = new FSReqWrap(); req.oncomplete = callback; - binding.mkdtemp(prefix + 'XXXXXX', options.encoding, req); + binding.mkdtemp(`${prefix}XXXXXX`, options.encoding, req); }; @@ -1852,7 +1852,7 @@ fs.mkdtempSync = function(prefix, options) { throw new TypeError('filename prefix is required'); options = getOptions(options, {}); nullCheck(prefix); - return binding.mkdtemp(prefix + 'XXXXXX', options.encoding); + return binding.mkdtemp(`${prefix}XXXXXX`, options.encoding); }; From 315fba8bfdcd69fbb173fc1e079111bea533c7f0 Mon Sep 17 00:00:00 2001 From: Klemen Kogovsek Date: Mon, 6 Nov 2017 15:05:59 +0000 Subject: [PATCH 101/110] test: used fixturesDir from fixtures modules In test-fs-realpath-on-substed-drive, require common/fixtures module and swapped the location of fixturesDir from common to fixtures module. PR-URL: https://github.com/nodejs/node/pull/16813 Reviewed-By: James M Snell Reviewed-By: Rich Trott Reviewed-By: Gireesh Punathil --- test/parallel/test-fs-realpath-on-substed-drive.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/parallel/test-fs-realpath-on-substed-drive.js b/test/parallel/test-fs-realpath-on-substed-drive.js index a3d38d9f279707..4f4181a4aee1be 100644 --- a/test/parallel/test-fs-realpath-on-substed-drive.js +++ b/test/parallel/test-fs-realpath-on-substed-drive.js @@ -4,6 +4,8 @@ const common = require('../common'); if (!common.isWindows) common.skip('Test for Windows only'); +const fixtures = require('../common/fixtures'); + const assert = require('assert'); const fs = require('fs'); const spawnSync = require('child_process').spawnSync; @@ -16,7 +18,7 @@ let drive; let i; for (i = 0; i < driveLetters.length; ++i) { drive = `${driveLetters[i]}:`; - result = spawnSync('subst', [drive, common.fixturesDir]); + result = spawnSync('subst', [drive, fixtures.fixturesDir]); if (result.status === 0) break; } From 891ddad93c3f4a470cbe1a02bd898685e0e01ea6 Mon Sep 17 00:00:00 2001 From: Gus Caplan Date: Mon, 13 Nov 2017 09:16:29 -0600 Subject: [PATCH 102/110] doc: fix typo in http2 doc `Sesssion` -> `Session` PR-URL: https://github.com/nodejs/node/pull/16993 Reviewed-By: Gireesh Punathil Reviewed-By: Colin Ihrig Reviewed-By: Anatoli Papirovski Reviewed-By: Luigi Pinca Reviewed-By: James M Snell --- doc/api/http2.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/http2.md b/doc/api/http2.md index 8d6ebd256fb02f..2f8296270f4c36 100644 --- a/doc/api/http2.md +++ b/doc/api/http2.md @@ -821,7 +821,7 @@ Shortcut for `http2stream.rstStream()` using error code `0x02` (Internal Error). added: v8.4.0 --> -* Value: {Http2Sesssion} +* Value: {Http2Session} A reference to the `Http2Session` instance that owns this `Http2Stream`. The value will be `undefined` after the `Http2Stream` instance is destroyed. From c3c9a8d4bf356498a8ae2364e87a5079acac3bf4 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sun, 12 Nov 2017 16:29:27 -0800 Subject: [PATCH 103/110] doc: recommend node-core-utils for metadata MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/16978 Reviewed-By: Gireesh Punathil Reviewed-By: Luigi Pinca Reviewed-By: Khaidi Chu Reviewed-By: Colin Ihrig Reviewed-By: Tobias Nießen Reviewed-By: Anatoli Papirovski Reviewed-By: James M Snell --- COLLABORATOR_GUIDE.md | 5 ++--- doc/onboarding.md | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/COLLABORATOR_GUIDE.md b/COLLABORATOR_GUIDE.md index 5346f8194516b1..c61aad6e7d4f31 100644 --- a/COLLABORATOR_GUIDE.md +++ b/COLLABORATOR_GUIDE.md @@ -501,8 +501,7 @@ commit logs, ensure that they are properly formatted, and add * Modify the original commit message to include additional metadata regarding - the change process. (If you use Chrome or Edge, [`node-review`][] fetches - the metadata for you.) + the change process. ([`node-core-utils`][] fetches the metadata for you.) * Required: A `PR-URL:` line that references the *full* GitHub URL of the original pull request being merged so it's easy to trace a commit back to @@ -681,4 +680,4 @@ LTS working group and the Release team. [Stability Index]: doc/api/documentation.md#stability-index [Enhancement Proposal]: https://github.com/nodejs/node-eps [git-username]: https://help.github.com/articles/setting-your-username-in-git/ -[`node-review`]: https://github.com/evanlucas/node-review +[`node-core-utils`]: https://github.com/nodejs/node-core-utils diff --git a/doc/onboarding.md b/doc/onboarding.md index 41df0d00bd93b3..09cbb432a2bb85 100644 --- a/doc/onboarding.md +++ b/doc/onboarding.md @@ -158,7 +158,7 @@ onboarding session. * After one or two approvals, land the PR. * Be sure to add the `PR-URL: ` and appropriate `Reviewed-By:` metadata! * [`core-validate-commit`][] helps a lot with this – install and use it if you can! - * If you use Chrome or Edge, [`node-review`][] fetches the metadata for you. + * [`node-core-utils`][] fetches the metadata for you. ## Final notes @@ -180,4 +180,4 @@ onboarding session. [Code of Conduct]: https://github.com/nodejs/TSC/blob/master/CODE_OF_CONDUCT.md [`core-validate-commit`]: https://github.com/evanlucas/core-validate-commit -[`node-review`]: https://github.com/evanlucas/node-review +[`node-core-utils`]: https://github.com/nodejs/node-core-utils From 57937e5746fc77bae74cb2057c4336d850710821 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Thu, 9 Nov 2017 14:27:12 +0000 Subject: [PATCH 104/110] tools: remove unused trailing function arguments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Update tools/doc/html.js and tools/eslint-rules/crypto-check.js to remove unused trailing function arguments in preparation for enabling a lint rule to enforce that practice. PR-URL: https://github.com/nodejs/node/pull/16953 Reviewed-By: Michaël Zasso Reviewed-By: Vse Mozhet Byt Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca Reviewed-By: James M Snell Reviewed-By: Refael Ackermann Reviewed-By: Gireesh Punathil --- tools/doc/html.js | 2 +- tools/eslint-rules/crypto-check.js | 2 +- tools/eslint-rules/inspector-check.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/doc/html.js b/tools/doc/html.js index 5534dd03b7441a..e25192599593f3 100644 --- a/tools/doc/html.js +++ b/tools/doc/html.js @@ -224,7 +224,7 @@ function altDocs(filename) { const host = 'https://nodejs.org'; const href = (v) => `${host}/docs/latest-v${v.num}/api/${filename}.html`; - function li(v, i) { + function li(v) { let html = `
  • ${v.num}`; if (v.lts) diff --git a/tools/eslint-rules/crypto-check.js b/tools/eslint-rules/crypto-check.js index b1b2a03f50e3b6..9d24d3355dce7f 100644 --- a/tools/eslint-rules/crypto-check.js +++ b/tools/eslint-rules/crypto-check.js @@ -54,7 +54,7 @@ module.exports = function(context) { } } - function reportIfMissingCheck(node) { + function reportIfMissingCheck() { if (hasSkipCall) { return; } diff --git a/tools/eslint-rules/inspector-check.js b/tools/eslint-rules/inspector-check.js index e65dd17d768ac2..bb40a98183250c 100644 --- a/tools/eslint-rules/inspector-check.js +++ b/tools/eslint-rules/inspector-check.js @@ -29,7 +29,7 @@ module.exports = function(context) { } } - function reportIfMissing(context, node) { + function reportIfMissing(context) { if (!hasInspectorCheck) { missingCheckNodes.forEach((node) => { context.report(node, msg); From 2b903bff0530235af71b494bb6700a1b6013fa87 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Thu, 9 Nov 2017 14:28:25 +0000 Subject: [PATCH 105/110] tools: enforce no unused trailing arguments tools directory MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use linting to enforce that the final argument for a function must be used. PR-URL: https://github.com/nodejs/node/pull/16953 Reviewed-By: Michaël Zasso Reviewed-By: Vse Mozhet Byt Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca Reviewed-By: James M Snell Reviewed-By: Refael Ackermann Reviewed-By: Gireesh Punathil --- tools/.eslintrc.yaml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 tools/.eslintrc.yaml diff --git a/tools/.eslintrc.yaml b/tools/.eslintrc.yaml new file mode 100644 index 00000000000000..f8b7cc4e41a747 --- /dev/null +++ b/tools/.eslintrc.yaml @@ -0,0 +1,4 @@ +rules: + # Variables + # http://eslint.org/docs/rules/#variables + no-unused-vars: [error, { args: 'after-used' }] From 6ab706d7f0df2b45cb8daee996099c828d43322c Mon Sep 17 00:00:00 2001 From: ChrBergert Date: Mon, 6 Nov 2017 16:04:36 +0000 Subject: [PATCH 106/110] test: refactor comments in test-child-process-spawnsync-maxbuf * remove comment that isn't relevant/important * add comment that explains what the test does PR-URL: https://github.com/nodejs/node/pull/16829 Reviewed-By: Rich Trott Reviewed-By: Joyee Cheung Reviewed-By: Luigi Pinca Reviewed-By: James M Snell --- test/parallel/test-child-process-spawnsync-maxbuf.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-child-process-spawnsync-maxbuf.js b/test/parallel/test-child-process-spawnsync-maxbuf.js index 2d94c338bb7202..022c090c338d13 100644 --- a/test/parallel/test-child-process-spawnsync-maxbuf.js +++ b/test/parallel/test-child-process-spawnsync-maxbuf.js @@ -1,10 +1,12 @@ 'use strict'; require('../common'); + +// This test checks that the maxBuffer option for child_process.spawnSync() +// works as expected. + const assert = require('assert'); const spawnSync = require('child_process').spawnSync; const msgOut = 'this is stdout'; - -// This is actually not os.EOL? const msgOutBuf = Buffer.from(`${msgOut}\n`); const args = [ From 375bec00a48f2730cb5e3b714e0fa38073cb41b9 Mon Sep 17 00:00:00 2001 From: sercan yersen Date: Mon, 6 Nov 2017 16:45:07 +0000 Subject: [PATCH 107/110] test: use fixtures module for path resolve MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/16842 Reviewed-By: James M Snell Reviewed-By: Rich Trott Reviewed-By: Luigi Pinca Reviewed-By: Michaël Zasso Reviewed-By: Colin Ihrig Reviewed-By: Gireesh Punathil --- test/parallel/test-http2-respond-with-fd-errors.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-http2-respond-with-fd-errors.js b/test/parallel/test-http2-respond-with-fd-errors.js index 0bfbd2a3551da1..2fc1eb7102feb1 100644 --- a/test/parallel/test-http2-respond-with-fd-errors.js +++ b/test/parallel/test-http2-respond-with-fd-errors.js @@ -2,10 +2,13 @@ 'use strict'; const common = require('../common'); + if (!common.hasCrypto) common.skip('missing crypto'); + +const fixtures = require('../common/fixtures'); + const http2 = require('http2'); -const path = require('path'); const { constants, @@ -18,7 +21,7 @@ const { // - NGHTTP2_ERR_NOMEM (should emit session error) // - every other NGHTTP2 error from binding (should emit stream error) -const fname = path.resolve(common.fixturesDir, 'elipses.txt'); +const fname = fixtures.path('elipses.txt'); const specificTestKeys = [ 'NGHTTP2_ERR_NOMEM' From efdd7c8caecef379758c5573cc2de488d1ed76ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20Nie=C3=9Fen?= Date: Fri, 10 Nov 2017 18:27:35 +0100 Subject: [PATCH 108/110] test: reuse existing PassThrough implementation PR-URL: https://github.com/nodejs/node/pull/16936 Reviewed-By: Colin Ihrig Reviewed-By: Refael Ackermann Reviewed-By: Anna Henningsen Reviewed-By: James M Snell Reviewed-By: Luigi Pinca --- test/parallel/test-stream-big-packet.js | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/test/parallel/test-stream-big-packet.js b/test/parallel/test-stream-big-packet.js index 18b9b7ee4fc348..ae9bfeed4c2412 100644 --- a/test/parallel/test-stream-big-packet.js +++ b/test/parallel/test-stream-big-packet.js @@ -26,13 +26,6 @@ const stream = require('stream'); let passed = false; -class PassThrough extends stream.Transform { - _transform(chunk, encoding, done) { - this.push(chunk); - done(); - } -} - class TestStream extends stream.Transform { _transform(chunk, encoding, done) { if (!passed) { @@ -43,8 +36,8 @@ class TestStream extends stream.Transform { } } -const s1 = new PassThrough(); -const s2 = new PassThrough(); +const s1 = new stream.PassThrough(); +const s2 = new stream.PassThrough(); const s3 = new TestStream(); s1.pipe(s3); // Don't let s2 auto close which may close s3 From dcb26447633a7e6c99e952cd1a56f32e8e753f6d Mon Sep 17 00:00:00 2001 From: Gibson Fahnestock Date: Tue, 21 Nov 2017 22:47:13 +0000 Subject: [PATCH 109/110] 2017-12-05, Version 8.9.2 'Carbon' (LTS) Notable Changes: - **console**: - avoid adding infinite error listeners (Matteo Collina) [#16770](https://github.com/nodejs/n de/pull/16770) - **http2**: - improve errors thrown in header validation (Joyee Cheung) [#16718](https://github.com/nodej s/node/pull/16718) PR-URL: https://github.com/nodejs/node/pull/17204 --- CHANGELOG.md | 3 +- doc/changelogs/CHANGELOG_V8.md | 122 +++++++++++++++++++++++++++++++++ src/node_version.h | 2 +- 3 files changed, 125 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c7fc83819273eb..76d5b50a934dee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,7 +27,8 @@ release. -8.9.1
    +8.9.2
    +8.9.1
    8.9.0
    8.8.1
    8.8.0
    diff --git a/doc/changelogs/CHANGELOG_V8.md b/doc/changelogs/CHANGELOG_V8.md index 6fb471eaee98a3..4c4c0ae447f705 100644 --- a/doc/changelogs/CHANGELOG_V8.md +++ b/doc/changelogs/CHANGELOG_V8.md @@ -7,6 +7,7 @@ +8.9.2
    8.9.1
    8.9.0
    @@ -44,6 +45,127 @@ [Node.js Long Term Support Plan](https://github.com/nodejs/LTS) and will be supported actively until April 2019 and maintained until December 2019. + +## 2017-12-05, Version 8.9.2 'Carbon' (LTS), @gibfahn + +### Notable Changes + +- **console**: + - avoid adding infinite error listeners (Matteo Collina) [#16770](https://github.com/nodejs/node/pull/16770) +- **http2**: + - improve errors thrown in header validation (Joyee Cheung) [#16718](https://github.com/nodejs/node/pull/16718) + +### Commits + +* [[`1bf6250b99`](https://github.com/nodejs/node/commit/1bf6250b99)] - doc : mention constant-time in crypto doc (Mithun Sasidharan) [#16604](https://github.com/nodejs/node/pull/16604) +* [[`585f8698af`](https://github.com/nodejs/node/commit/585f8698af)] - **build**: include src\tracing when linting on win (Daniel Bevenius) [#16720](https://github.com/nodejs/node/pull/16720) +* [[`d9a18beaa6`](https://github.com/nodejs/node/commit/d9a18beaa6)] - **build**: suppress lint-md output (Gibson Fahnestock) [#16551](https://github.com/nodejs/node/pull/16551) +* [[`4e848d4afb`](https://github.com/nodejs/node/commit/4e848d4afb)] - **build**: add missing comma in sources list (Daniel Bevenius) [#16613](https://github.com/nodejs/node/pull/16613) +* [[`9df1e8f10e`](https://github.com/nodejs/node/commit/9df1e8f10e)] - **console**: avoid adding infinite error listeners (Matteo Collina) [#16770](https://github.com/nodejs/node/pull/16770) +* [[`7ba037592d`](https://github.com/nodejs/node/commit/7ba037592d)] - **deps**: cherry-pick cc55747 from V8 upstream (Franziska Hinkelmann) [#16890](https://github.com/nodejs/node/pull/16890) +* [[`c3c9a8d4bf`](https://github.com/nodejs/node/commit/c3c9a8d4bf)] - **doc**: recommend node-core-utils for metadata (Rich Trott) [#16978](https://github.com/nodejs/node/pull/16978) +* [[`891ddad93c`](https://github.com/nodejs/node/commit/891ddad93c)] - **doc**: fix typo in http2 doc (Gus Caplan) [#16993](https://github.com/nodejs/node/pull/16993) +* [[`ccd36467f8`](https://github.com/nodejs/node/commit/ccd36467f8)] - **doc**: reorganize COLLABORATOR_GUIDE.md (Rich Trott) [#15710](https://github.com/nodejs/node/pull/15710) +* [[`8f0793ff93`](https://github.com/nodejs/node/commit/8f0793ff93)] - **doc**: clarify the prerequisites for building with VS2017 (Nikolai Vavilov) [#16903](https://github.com/nodejs/node/pull/16903) +* [[`6e7a444a91`](https://github.com/nodejs/node/commit/6e7a444a91)] - **doc**: outline commit message for breaking changes (Maton Anthony) [#16846](https://github.com/nodejs/node/pull/16846) +* [[`6eb550da34`](https://github.com/nodejs/node/commit/6eb550da34)] - **doc**: remove duplicate 'the' from http2 API doc (Vipin Menon) [#16924](https://github.com/nodejs/node/pull/16924) +* [[`0b8a400cad`](https://github.com/nodejs/node/commit/0b8a400cad)] - **doc**: correct the spelling of omitting in dgram.md (Vidya Subramanyam) [#16910](https://github.com/nodejs/node/pull/16910) +* [[`adb8f08c36`](https://github.com/nodejs/node/commit/adb8f08c36)] - **doc**: fix a typo in the documentation (Mamatha J V) [#16909](https://github.com/nodejs/node/pull/16909) +* [[`d721c0bb5e`](https://github.com/nodejs/node/commit/d721c0bb5e)] - **doc**: improve documentation for the vm module (Franziska Hinkelmann) [#16867](https://github.com/nodejs/node/pull/16867) +* [[`360f40354e`](https://github.com/nodejs/node/commit/360f40354e)] - **doc**: fix typo in assert.md (Andres Kalle) [#16866](https://github.com/nodejs/node/pull/16866) +* [[`c4634bf506`](https://github.com/nodejs/node/commit/c4634bf506)] - **doc**: update subprocess.killed (cjihrig) [#16748](https://github.com/nodejs/node/pull/16748) +* [[`eafc0a1314`](https://github.com/nodejs/node/commit/eafc0a1314)] - **doc**: fix a link in dgram.md (Vse Mozhet Byt) [#16854](https://github.com/nodejs/node/pull/16854) +* [[`fab55980be`](https://github.com/nodejs/node/commit/fab55980be)] - **doc**: add isTTY property documentation (SonaySevik) [#16828](https://github.com/nodejs/node/pull/16828) +* [[`f2a9c024ed`](https://github.com/nodejs/node/commit/f2a9c024ed)] - **doc**: fix json generator warnings (Luigi Pinca) [#16742](https://github.com/nodejs/node/pull/16742) +* [[`3319b2092f`](https://github.com/nodejs/node/commit/3319b2092f)] - **doc**: update license to include node-inspect (Myles Borins) [#16659](https://github.com/nodejs/node/pull/16659) +* [[`7618567b4f`](https://github.com/nodejs/node/commit/7618567b4f)] - **doc**: add docs for Zlib#close() (Luigi Pinca) [#16592](https://github.com/nodejs/node/pull/16592) +* [[`2cc05e0657`](https://github.com/nodejs/node/commit/2cc05e0657)] - **doc**: add nodejs/gyp team for GYP related issues (Gibson Fahnestock) [#16638](https://github.com/nodejs/node/pull/16638) +* [[`542f3b9cc0`](https://github.com/nodejs/node/commit/542f3b9cc0)] - **doc**: add details about rss on process.memoryUsage (Anthony Nandaa) [#16566](https://github.com/nodejs/node/pull/16566) +* [[`13866b8b1b`](https://github.com/nodejs/node/commit/13866b8b1b)] - **doc**: add windowsVerbatimArguments docs (Andrew Stucki) [#16299](https://github.com/nodejs/node/pull/16299) +* [[`d2e4a87321`](https://github.com/nodejs/node/commit/d2e4a87321)] - **doc**: howto decode buffers extending from Writable (dicearr) [#16403](https://github.com/nodejs/node/pull/16403) +* [[`a2fd9a3cf2`](https://github.com/nodejs/node/commit/a2fd9a3cf2)] - **doc**: add *-inl.h include rule to C++ style guide (Joyee Cheung) [#16548](https://github.com/nodejs/node/pull/16548) +* [[`9b8e2a68d8`](https://github.com/nodejs/node/commit/9b8e2a68d8)] - **http**: use arrow fns for lexical `this` in Agent (Bryan English) [#16475](https://github.com/nodejs/node/pull/16475) +* [[`29efb02f12`](https://github.com/nodejs/node/commit/29efb02f12)] - **http2**: multiple smaller code cleanups (James M Snell) [#16764](https://github.com/nodejs/node/pull/16764) +* [[`658301664f`](https://github.com/nodejs/node/commit/658301664f)] - **http2**: improve errors thrown in header validation (Joyee Cheung) [#16718](https://github.com/nodejs/node/pull/16718) +* [[`8cf8a327c8`](https://github.com/nodejs/node/commit/8cf8a327c8)] - **http2**: refactor settings handling (James M Snell) [#16668](https://github.com/nodejs/node/pull/16668) +* [[`4faf2ec783`](https://github.com/nodejs/node/commit/4faf2ec783)] - **lib**: replace string concatenation with template (Suryanarayana Murthy N) [#16933](https://github.com/nodejs/node/pull/16933) +* [[`14f8cee401`](https://github.com/nodejs/node/commit/14f8cee401)] - **lib**: guard inspector console using process var (Daniel Bevenius) [#15008](https://github.com/nodejs/node/pull/15008) +* [[`2ad051d62c`](https://github.com/nodejs/node/commit/2ad051d62c)] - **lib**: change concatenated string to template (Pawan Jangid) [#16930](https://github.com/nodejs/node/pull/16930) +* [[`28f036045b`](https://github.com/nodejs/node/commit/28f036045b)] - **lib**: change concatenated string to template (Nayana Das K) [#16925](https://github.com/nodejs/node/pull/16925) +* [[`134c2f31f2`](https://github.com/nodejs/node/commit/134c2f31f2)] - **lib**: replace string concatenation with template (subrahmanya chari p) [#16917](https://github.com/nodejs/node/pull/16917) +* [[`dc14c25ee9`](https://github.com/nodejs/node/commit/dc14c25ee9)] - **loader**: test search module (Cyril Lakech) [#16795](https://github.com/nodejs/node/pull/16795) +* [[`d27ec13cd3`](https://github.com/nodejs/node/commit/d27ec13cd3)] - **repl**: avoid crashing from null and undefined errors (cPhost) [#16574](https://github.com/nodejs/node/pull/16574) +* [[`40880897fe`](https://github.com/nodejs/node/commit/40880897fe)] - **src**: use unrefed async for GC tracking (Anna Henningsen) [#16758](https://github.com/nodejs/node/pull/16758) +* [[`f7411b5df7`](https://github.com/nodejs/node/commit/f7411b5df7)] - **src**: make StreamBase prototype accessors robust (Joyee Cheung) [#16860](https://github.com/nodejs/node/pull/16860) +* [[`8d31294b3b`](https://github.com/nodejs/node/commit/8d31294b3b)] - **src**: CHECK() for argument overflow in Spawn() (cjihrig) [#16761](https://github.com/nodejs/node/pull/16761) +* [[`57b377ef93`](https://github.com/nodejs/node/commit/57b377ef93)] - **src**: improve module loader readability (Anna Henningsen) [#16536](https://github.com/nodejs/node/pull/16536) +* [[`82076ed91f`](https://github.com/nodejs/node/commit/82076ed91f)] - **src**: pass context to Get() operations for cares_wrap (Evan Lucas) [#16641](https://github.com/nodejs/node/pull/16641) +* [[`79e1d7719d`](https://github.com/nodejs/node/commit/79e1d7719d)] - **src**: remove unused includes in string_bytes.h (Daniel Bevenius) [#16606](https://github.com/nodejs/node/pull/16606) +* [[`cecd1e3def`](https://github.com/nodejs/node/commit/cecd1e3def)] - **src**: fix etw provider include on Windows (Joyee Cheung) [#16639](https://github.com/nodejs/node/pull/16639) +* [[`255fffbbc8`](https://github.com/nodejs/node/commit/255fffbbc8)] - **src**: do not include x.h if x-inl.h is included (Joyee Cheung) [#16548](https://github.com/nodejs/node/pull/16548) +* [[`efdd7c8cae`](https://github.com/nodejs/node/commit/efdd7c8cae)] - **test**: reuse existing PassThrough implementation (Tobias Nießen) [#16936](https://github.com/nodejs/node/pull/16936) +* [[`375bec00a4`](https://github.com/nodejs/node/commit/375bec00a4)] - **test**: use fixtures module for path resolve (sercan yersen) [#16842](https://github.com/nodejs/node/pull/16842) +* [[`6ab706d7f0`](https://github.com/nodejs/node/commit/6ab706d7f0)] - **test**: refactor comments in test-child-process-spawnsync-maxbuf (ChrBergert) [#16829](https://github.com/nodejs/node/pull/16829) +* [[`315fba8bfd`](https://github.com/nodejs/node/commit/315fba8bfd)] - **test**: used fixturesDir from fixtures modules (Klemen Kogovsek) [#16813](https://github.com/nodejs/node/pull/16813) +* [[`5c8fb6a976`](https://github.com/nodejs/node/commit/5c8fb6a976)] - **test**: refactor fs.write() test (Patrick Heneise) [#16827](https://github.com/nodejs/node/pull/16827) +* [[`4f587e5a30`](https://github.com/nodejs/node/commit/4f587e5a30)] - **test**: add a test description (Grant Gasparyan) [#16833](https://github.com/nodejs/node/pull/16833) +* [[`af8b17a314`](https://github.com/nodejs/node/commit/af8b17a314)] - **test**: use common/fixtures module in hash-seed test (Javier Blanco) [#16823](https://github.com/nodejs/node/pull/16823) +* [[`3a3792b0a0`](https://github.com/nodejs/node/commit/3a3792b0a0)] - **test**: improve template value for test message (Stephan Smith) [#16826](https://github.com/nodejs/node/pull/16826) +* [[`c3e6491a51`](https://github.com/nodejs/node/commit/c3e6491a51)] - **test**: unmark flaky test (Anna Henningsen) [#16758](https://github.com/nodejs/node/pull/16758) +* [[`bf9eb04abe`](https://github.com/nodejs/node/commit/bf9eb04abe)] - **test**: change concatenated string to template (Deepthi Sebastian) [#16929](https://github.com/nodejs/node/pull/16929) +* [[`7168a7e044`](https://github.com/nodejs/node/commit/7168a7e044)] - **test**: change concatenated string to template (Anawesha Khuntia) [#16912](https://github.com/nodejs/node/pull/16912) +* [[`febd1bf519`](https://github.com/nodejs/node/commit/febd1bf519)] - **test**: change string concatenation to template (Suryanarayana Murthy N) [#16919](https://github.com/nodejs/node/pull/16919) +* [[`7164d9a6b8`](https://github.com/nodejs/node/commit/7164d9a6b8)] - **test**: use template string for concatenation (Vipin Menon) [#16918](https://github.com/nodejs/node/pull/16918) +* [[`ae7106cc75`](https://github.com/nodejs/node/commit/ae7106cc75)] - **test**: replace string concatenation with template (Kabir Islam) [#16916](https://github.com/nodejs/node/pull/16916) +* [[`81a6c4f785`](https://github.com/nodejs/node/commit/81a6c4f785)] - **test**: enable mustCall() during child exit (Vipin Menon) [#16915](https://github.com/nodejs/node/pull/16915) +* [[`41f905bb00`](https://github.com/nodejs/node/commit/41f905bb00)] - **test**: replace string concatenation with template (Sabari Lakshmi Krishnamoorthy) [#16914](https://github.com/nodejs/node/pull/16914) +* [[`be920aa372`](https://github.com/nodejs/node/commit/be920aa372)] - **test**: replace string concatenation with template (Tanvi Kini) [#16913](https://github.com/nodejs/node/pull/16913) +* [[`26d529e60f`](https://github.com/nodejs/node/commit/26d529e60f)] - **test**: cover vm.runInNewContext() (cjihrig) [#16906](https://github.com/nodejs/node/pull/16906) +* [[`6c57399c6b`](https://github.com/nodejs/node/commit/6c57399c6b)] - **test**: improve assertion messages (Neil Vass) [#16885](https://github.com/nodejs/node/pull/16885) +* [[`1522562ffd`](https://github.com/nodejs/node/commit/1522562ffd)] - **test**: pass process.env to child processes (Rod Vagg) [#16405](https://github.com/nodejs/node/pull/16405) +* [[`0bc16cd9b6`](https://github.com/nodejs/node/commit/0bc16cd9b6)] - **test**: improve assert messages in stream test (Katie Stockton Roberts) [#16884](https://github.com/nodejs/node/pull/16884) +* [[`7c9aee3348`](https://github.com/nodejs/node/commit/7c9aee3348)] - **test**: improve assertion in test-require-dot (Adam Wegrzynek) [#16805](https://github.com/nodejs/node/pull/16805) +* [[`1b1bd261dc`](https://github.com/nodejs/node/commit/1b1bd261dc)] - **test**: add values to error message (Adam Jeffery) [#16831](https://github.com/nodejs/node/pull/16831) +* [[`e66a7ae6e3`](https://github.com/nodejs/node/commit/e66a7ae6e3)] - **test**: replace common.fixtiresDir with fixtures.readKey() (woj) [#16817](https://github.com/nodejs/node/pull/16817) +* [[`c1309d6b80`](https://github.com/nodejs/node/commit/c1309d6b80)] - **test**: use tmpDir in test-fs-utimes (Rich Trott) [#16774](https://github.com/nodejs/node/pull/16774) +* [[`2f1f7e1de0`](https://github.com/nodejs/node/commit/2f1f7e1de0)] - **test**: remove message argument in cluster setup test (mbornath) [#16838](https://github.com/nodejs/node/pull/16838) +* [[`d64fe485c5`](https://github.com/nodejs/node/commit/d64fe485c5)] - **test**: check session timeout in http2 (Anatoli Papirovski) [#16754](https://github.com/nodejs/node/pull/16754) +* [[`4fcb03c0ae`](https://github.com/nodejs/node/commit/4fcb03c0ae)] - **test**: move test-http-keepalive-maxsockets to sequential (Rich Trott) [#16777](https://github.com/nodejs/node/pull/16777) +* [[`71c11d67f4`](https://github.com/nodejs/node/commit/71c11d67f4)] - **test**: improve assert messages in test-global (Mark McNelis) [#16843](https://github.com/nodejs/node/pull/16843) +* [[`ca278802ff`](https://github.com/nodejs/node/commit/ca278802ff)] - **test**: use default assertion message (jonask) [#16819](https://github.com/nodejs/node/pull/16819) +* [[`ec4c3f5777`](https://github.com/nodejs/node/commit/ec4c3f5777)] - **test**: improve message in test-fs-readfile-pipe-large (fjau) [#16840](https://github.com/nodejs/node/pull/16840) +* [[`562d8fca15`](https://github.com/nodejs/node/commit/562d8fca15)] - **test**: remove custom message from assertion (Nicolas Morel) [#16824](https://github.com/nodejs/node/pull/16824) +* [[`0ebded4376`](https://github.com/nodejs/node/commit/0ebded4376)] - **test**: show incorrect value on test failure (Sean Karson) [#16818](https://github.com/nodejs/node/pull/16818) +* [[`2bbc76eb1f`](https://github.com/nodejs/node/commit/2bbc76eb1f)] - **test**: include file mode in assert message (Sascha Tandel) [#16815](https://github.com/nodejs/node/pull/16815) +* [[`33f2fff52b`](https://github.com/nodejs/node/commit/33f2fff52b)] - **test**: refactor tls test to use fixtres.readSync (Brian O'Connell) [#16816](https://github.com/nodejs/node/pull/16816) +* [[`b307582d10`](https://github.com/nodejs/node/commit/b307582d10)] - **test**: use fixtures module in test-repl (Maring, Damian Lion) [#16809](https://github.com/nodejs/node/pull/16809) +* [[`5719beaf83`](https://github.com/nodejs/node/commit/5719beaf83)] - **test**: update test to use fixtures.readKey (Dara Hayes) [#16811](https://github.com/nodejs/node/pull/16811) +* [[`b166b6b1b3`](https://github.com/nodejs/node/commit/b166b6b1b3)] - **test**: fix typos in read-buffer tests (Jimi van der Woning) [#16834](https://github.com/nodejs/node/pull/16834) +* [[`c4176eb722`](https://github.com/nodejs/node/commit/c4176eb722)] - **test**: replace fixturesDir with usage of fixtures module (Octavian Ionescu) [#16810](https://github.com/nodejs/node/pull/16810) +* [[`af13678889`](https://github.com/nodejs/node/commit/af13678889)] - **test**: clarified assert message for test-require-json.js (Matthias Reis) [#16807](https://github.com/nodejs/node/pull/16807) +* [[`0fa659cdcd`](https://github.com/nodejs/node/commit/0fa659cdcd)] - **test**: replace common.fixturesDir with fixtures module (Dumitru Glavan) [#16803](https://github.com/nodejs/node/pull/16803) +* [[`1e6845d024`](https://github.com/nodejs/node/commit/1e6845d024)] - **test**: replace common.fixturesDir with fixtures.readSync() (Adri Van Houdt) [#16802](https://github.com/nodejs/node/pull/16802) +* [[`7b1491711d`](https://github.com/nodejs/node/commit/7b1491711d)] - **test**: replace `common.fixturesDir` usage (Sascha Tandel) [#16800](https://github.com/nodejs/node/pull/16800) +* [[`480f14a55e`](https://github.com/nodejs/node/commit/480f14a55e)] - **test**: update test to use fixtures (Adam Wegrzynek) [#16799](https://github.com/nodejs/node/pull/16799) +* [[`c52ac92661`](https://github.com/nodejs/node/commit/c52ac92661)] - **test**: fix malformed parallel.status line (Rich Trott) [#16702](https://github.com/nodejs/node/pull/16702) +* [[`a41cc020fd`](https://github.com/nodejs/node/commit/a41cc020fd)] - **test**: fix flaky test-http2-server-rst-stream.js (Anatoli Papirovski) [#16690](https://github.com/nodejs/node/pull/16690) +* [[`1e8a421159`](https://github.com/nodejs/node/commit/1e8a421159)] - **test**: pause child until parent is ready (jBarz) [#15774](https://github.com/nodejs/node/pull/15774) +* [[`b3032d29c9`](https://github.com/nodejs/node/commit/b3032d29c9)] - **test**: increase coverage for ModuleMap (Rob Paton) [#16045](https://github.com/nodejs/node/pull/16045) +* [[`2f66faf6cf`](https://github.com/nodejs/node/commit/2f66faf6cf)] - **test**: use fixtures module in test-https-pfx (Ken Takagi) [#15895](https://github.com/nodejs/node/pull/15895) +* [[`981a1ef0c2`](https://github.com/nodejs/node/commit/981a1ef0c2)] - **test**: use ES6 classes instead of util.inherits (Tobias Nießen) [#16938](https://github.com/nodejs/node/pull/16938) +* [[`47b1c3b43c`](https://github.com/nodejs/node/commit/47b1c3b43c)] - **test**: add test for WrapStream readStop (Ashish Kaila) [#16356](https://github.com/nodejs/node/pull/16356) +* [[`72c34cf706`](https://github.com/nodejs/node/commit/72c34cf706)] - **test,net**: remove scatological terminology (Rich Trott) [#16599](https://github.com/nodejs/node/pull/16599) +* [[`2b903bff05`](https://github.com/nodejs/node/commit/2b903bff05)] - **tools**: enforce no unused trailing arguments tools directory (Rich Trott) [#16953](https://github.com/nodejs/node/pull/16953) +* [[`57937e5746`](https://github.com/nodejs/node/commit/57937e5746)] - **tools**: remove unused trailing function arguments (Rich Trott) [#16953](https://github.com/nodejs/node/pull/16953) +* [[`85fd7bb8f7`](https://github.com/nodejs/node/commit/85fd7bb8f7)] - **tools**: fix inspector-check reporting (Daniel Bevenius) [#16902](https://github.com/nodejs/node/pull/16902) +* [[`8538354139`](https://github.com/nodejs/node/commit/8538354139)] - **tools**: add direct anchors for error codes (Joyee Cheung) [#16779](https://github.com/nodejs/node/pull/16779) +* [[`79006dab87`](https://github.com/nodejs/node/commit/79006dab87)] - **tools**: don't lint files that have not changed (Joyee Cheung) [#16581](https://github.com/nodejs/node/pull/16581) +* [[`cb08f5d6fe`](https://github.com/nodejs/node/commit/cb08f5d6fe)] - **tools**: remove unneeded parentheses in doc/html.js (Vse Mozhet Byt) [#16845](https://github.com/nodejs/node/pull/16845) +* [[`60c918ac7a`](https://github.com/nodejs/node/commit/60c918ac7a)] - **tools**: replace string concatenation with template literals (Kevin Yu) [#16804](https://github.com/nodejs/node/pull/16804) +* [[`aaf7e83d62`](https://github.com/nodejs/node/commit/aaf7e83d62)] - **tools**: replace string concatenation with template literals (Giovanni Lela) [#16806](https://github.com/nodejs/node/pull/16806) +* [[`40fa970914`](https://github.com/nodejs/node/commit/40fa970914)] - **tools**: replace string concetation with templates (Patrick Heneise) [#16801](https://github.com/nodejs/node/pull/16801) +* [[`0d4f62c85f`](https://github.com/nodejs/node/commit/0d4f62c85f)] - **tools,build**: allow build without `remark-cli` (Refael Ackermann) [#16893](https://github.com/nodejs/node/pull/16893) + ## 2017-11-07, Version 8.9.1 'Carbon' (LTS), @gibfahn diff --git a/src/node_version.h b/src/node_version.h index 3a8831b7a202ba..e8a29eb97bc15e 100644 --- a/src/node_version.h +++ b/src/node_version.h @@ -29,7 +29,7 @@ #define NODE_VERSION_IS_LTS 1 #define NODE_VERSION_LTS_CODENAME "Carbon" -#define NODE_VERSION_IS_RELEASE 0 +#define NODE_VERSION_IS_RELEASE 1 #ifndef NODE_STRINGIFY #define NODE_STRINGIFY(n) NODE_STRINGIFY_HELPER(n) From cf9b5579f52ca25e6ea725132f5e80335a3ac2e8 Mon Sep 17 00:00:00 2001 From: Gibson Fahnestock Date: Tue, 5 Dec 2017 21:53:26 +0000 Subject: [PATCH 110/110] Working on v8.9.3 PR-URL: https://github.com/nodejs/node/pull/17204 --- src/node_version.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/node_version.h b/src/node_version.h index e8a29eb97bc15e..f615681cc3bb09 100644 --- a/src/node_version.h +++ b/src/node_version.h @@ -24,12 +24,12 @@ #define NODE_MAJOR_VERSION 8 #define NODE_MINOR_VERSION 9 -#define NODE_PATCH_VERSION 2 +#define NODE_PATCH_VERSION 3 #define NODE_VERSION_IS_LTS 1 #define NODE_VERSION_LTS_CODENAME "Carbon" -#define NODE_VERSION_IS_RELEASE 1 +#define NODE_VERSION_IS_RELEASE 0 #ifndef NODE_STRINGIFY #define NODE_STRINGIFY(n) NODE_STRINGIFY_HELPER(n)