diff --git a/.travis.yml b/.travis.yml index 3acc282797..fad2e7f0c7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,7 +13,7 @@ matrix: script: - make lint # Lint the first commit in the PR. - - git log HEAD ^$TRAVIS_BRANCH --pretty=format:'%h' --no-merges | tail -1 | xargs npx core-validate-commit --no-validate-metadata + - git log $TRAVIS_COMMIT_RANGE --pretty=format:'%h' --no-merges | tail -1 | xargs npx core-validate-commit --no-validate-metadata - name: "Test Suite" install: - ./configure diff --git a/BUILDING.md b/BUILDING.md index b7a8965e76..b8809b7174 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -1,10 +1,10 @@ # Building Node.js -Depending on what platform or features you require, the build process may -differ slightly. After you've successfully built a binary, running the -test suite to validate that the binary works as intended is a good next step. +Depending on what platform or features you need, the build process may +differ. After you've built a binary, running the +test suite to confirm that the binary works as intended is a good next step. -If you can reproduce a test failure consistently, search for it in the +If you can reproduce a test failure, search for it in the [Node.js issue tracker](https://github.com/nodejs/node/issues) or file a new issue. diff --git a/CHANGELOG.md b/CHANGELOG.md index 5687eed7f8..2be28aa610 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,7 +31,8 @@ release. -10.11.0
+10.12.0
+10.11.0
10.10.0
10.9.0
10.8.0
diff --git a/README.md b/README.md index 1192e6532c..47e178845d 100644 --- a/README.md +++ b/README.md @@ -11,9 +11,8 @@ Node.js is a JavaScript runtime built on Chrome's V8 JavaScript engine. For more information on using Node.js, see the [Node.js Website][]. -Node.js contributions, policies, and releases are managed under an -[open governance model](./GOVERNANCE.md). The [Node.js Foundation][] provides -support for the project. +The Node.js project uses an [open governance model](./GOVERNANCE.md). The +[Node.js Foundation][] provides support for the project. **This project is bound by a [Code of Conduct][].** @@ -96,15 +95,15 @@ Binaries, installers, and source tarballs are available at The [latest](https://nodejs.org/download/release/latest/) directory is an alias for the latest Current release. The latest-_codename_ directory is an -alias for the latest release from an LTS line. For example, - is the latest Carbon -(Node.js version 8) release. +alias for the latest release from an LTS line. For example, the +[latest-carbon](https://nodejs.org/download/release/latest-carbon/) directory +contains the latest Carbon (Node.js 8) release. #### Nightly Releases -Listed under their version string which includes their date (in UTC time) and -the commit SHA at the HEAD of the release. +Each directory name and filename contains a date (in UTC time) and the commit +SHA at the HEAD of the release. #### API Documentation @@ -155,9 +154,8 @@ the file's signature. ## Building Node.js -See [BUILDING.md](BUILDING.md) for instructions on how to build -Node.js from source. The document also contains a list of -officially supported platforms. +See [BUILDING.md](BUILDING.md) for instructions on how to build Node.js from +source and a list of supported platforms. ## Security @@ -608,8 +606,8 @@ gpg --keyserver pool.sks-keyservers.net --recv-keys C4F0DFFF4E8C1A8236409D08E73B gpg --keyserver pool.sks-keyservers.net --recv-keys DD8F2338BAE7501E3DD5AC78C273792F7D83545D ``` -See the section above on [Verifying Binaries](#verifying-binaries) for details -on what to do with these keys to verify that a downloaded file is official. +See the section above on [Verifying Binaries](#verifying-binaries) for how to +use these keys to verify a downloaded file. Previous releases may also have been signed with one of the following GPG keys: diff --git a/benchmark/crypto/get-ciphers.js b/benchmark/crypto/get-ciphers.js index d4c10a2427..5bbe091531 100644 --- a/benchmark/crypto/get-ciphers.js +++ b/benchmark/crypto/get-ciphers.js @@ -10,7 +10,7 @@ const bench = common.createBenchmark(main, { function main({ n, v }) { const method = require(v).getCiphers; var i = 0; - // First call to getChipers will dominate the results + // First call to getCiphers will dominate the results if (n > 1) { for (; i < n; i++) method(); diff --git a/benchmark/http/bench-parser.js b/benchmark/http/bench-parser.js index 087616f44e..8208df1122 100644 --- a/benchmark/http/bench-parser.js +++ b/benchmark/http/bench-parser.js @@ -25,7 +25,7 @@ function main({ len, n }) { bench.start(); for (var i = 0; i < n; i++) { parser.execute(header, 0, header.length); - parser.reinitialize(REQUEST); + parser.reinitialize(REQUEST, i > 0); } bench.end(n); } diff --git a/benchmark/misc/freelist.js b/benchmark/misc/freelist.js index 8c3281cc40..7fa9af4f3d 100644 --- a/benchmark/misc/freelist.js +++ b/benchmark/misc/freelist.js @@ -9,7 +9,7 @@ const bench = common.createBenchmark(main, { }); function main({ n }) { - const FreeList = require('internal/freelist'); + const { FreeList } = require('internal/freelist'); const poolSize = 1000; const list = new FreeList('test', poolSize, Object); var j; diff --git a/deps/uv/AUTHORS b/deps/uv/AUTHORS index 6504800766..2fdfbcd532 100644 --- a/deps/uv/AUTHORS +++ b/deps/uv/AUTHORS @@ -351,3 +351,4 @@ Jeremiah Senkpiel Andy Zhang dmabupt Ryan Liptak +Ali Ijaz Sheikh diff --git a/deps/uv/CMakeLists.txt b/deps/uv/CMakeLists.txt index 4f13efc8e6..6a631a87c1 100644 --- a/deps/uv/CMakeLists.txt +++ b/deps/uv/CMakeLists.txt @@ -193,7 +193,6 @@ if(WIN32) src/win/poll.c src/win/process.c src/win/process-stdio.c - src/win/req.c src/win/signal.c src/win/snprintf.c src/win/stream.c diff --git a/deps/uv/ChangeLog b/deps/uv/ChangeLog index d01b06f08a..7cb675238d 100644 --- a/deps/uv/ChangeLog +++ b/deps/uv/ChangeLog @@ -1,3 +1,41 @@ +2018.10.09, Version 1.23.2 (Stable), 34c12788d2e7308f3ac506c0abcbf74c0d6abd20 + +Changes since version 1.23.1: + +* unix: return 0 retrieving rss on cygwin (cjihrig) + +* unix: initialize uv_interface_address_t.phys_addr (cjihrig) + +* test: handle uv_os_setpriority() windows edge case (cjihrig) + +* tty, win: fix read stop for raw mode (Bartosz Sosnowski) + +* Revert "Revert "unix,fs: fix for potential partial reads/writes"" (Jameson + Nash) + +* unix,readv: always permit partial reads to return (Jameson Nash) + +* win,tty: fix uv_tty_close() (Bartosz Sosnowski) + +* doc: remove extraneous "on" (Ben Noordhuis) + +* unix,win: fix threadpool race condition (Anna Henningsen) + +* unix: rework thread barrier implementation (Ben Noordhuis) + +* aix: switch to libuv's own thread barrier impl (Ben Noordhuis) + +* unix: signal done to last thread barrier waiter (Ben Noordhuis) + +* test: add uv_barrier_wait serial thread test (Ali Ijaz Sheikh) + +* unix: optimize uv_fs_readlink() memory allocation (Ben Noordhuis) + +* win: remove req.c and other cleanup (Carlo Marcelo Arenas Belón) + +* aix: don't EISDIR on read from directory fd (Ben Noordhuis) + + 2018.09.22, Version 1.23.1 (Stable), d2282b3d67821dc53c907c2155fa8c5c6ce25180 Changes since version 1.23.0: diff --git a/deps/uv/Makefile.am b/deps/uv/Makefile.am index a217faab3c..2381425403 100644 --- a/deps/uv/Makefile.am +++ b/deps/uv/Makefile.am @@ -68,7 +68,6 @@ libuv_la_SOURCES += src/win/async.c \ src/win/poll.c \ src/win/process-stdio.c \ src/win/process.c \ - src/win/req.c \ src/win/req-inl.h \ src/win/signal.c \ src/win/stream.c \ @@ -340,8 +339,7 @@ libuv_la_SOURCES += src/unix/aix.c src/unix/aix-common.c endif if ANDROID -uvinclude_HEADERS += include/uv/android-ifaddrs.h \ - include/uv/pthread-barrier.h +uvinclude_HEADERS += include/uv/android-ifaddrs.h libuv_la_SOURCES += src/unix/android-ifaddrs.c \ src/unix/pthread-fixes.c endif @@ -361,8 +359,7 @@ libuv_la_SOURCES += src/unix/cygwin.c \ endif if DARWIN -uvinclude_HEADERS += include/uv/darwin.h \ - include/uv/pthread-barrier.h +uvinclude_HEADERS += include/uv/darwin.h libuv_la_CFLAGS += -D_DARWIN_USE_64_BIT_INODE=1 libuv_la_CFLAGS += -D_DARWIN_UNLIMITED_SELECT=1 libuv_la_SOURCES += src/unix/bsd-ifaddrs.c \ @@ -445,7 +442,6 @@ libuv_la_SOURCES += src/unix/no-proctitle.c \ endif if OS390 -uvinclude_HEADERS += include/uv/pthread-barrier.h libuv_la_CFLAGS += -D_UNIX03_THREADS \ -D_UNIX03_SOURCE \ -D_OPEN_SYS_IF_EXT=1 \ diff --git a/deps/uv/configure.ac b/deps/uv/configure.ac index ce307b1d70..0d9066bb02 100644 --- a/deps/uv/configure.ac +++ b/deps/uv/configure.ac @@ -13,7 +13,7 @@ # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. AC_PREREQ(2.57) -AC_INIT([libuv], [1.23.1], [https://github.com/libuv/libuv/issues]) +AC_INIT([libuv], [1.23.2], [https://github.com/libuv/libuv/issues]) AC_CONFIG_MACRO_DIR([m4]) m4_include([m4/libuv-extra-automake-flags.m4]) m4_include([m4/as_case.m4]) diff --git a/deps/uv/docs/src/design.rst b/deps/uv/docs/src/design.rst index 487d08ba62..001b12334d 100644 --- a/deps/uv/docs/src/design.rst +++ b/deps/uv/docs/src/design.rst @@ -126,7 +126,7 @@ so the current approach is to run blocking file I/O operations in a thread pool. For a thorough explanation of the cross-platform file I/O landscape, checkout `this post `_. -libuv currently uses a global thread pool on which all loops can queue work on. 3 types of +libuv currently uses a global thread pool on which all loops can queue work. 3 types of operations are currently run on this pool: * File system operations diff --git a/deps/uv/include/uv/pthread-barrier.h b/deps/uv/include/uv/pthread-barrier.h deleted file mode 100644 index 07db9b8a6a..0000000000 --- a/deps/uv/include/uv/pthread-barrier.h +++ /dev/null @@ -1,69 +0,0 @@ -/* -Copyright (c) 2016, Kari Tristan Helgason - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ - -#ifndef _UV_PTHREAD_BARRIER_ -#define _UV_PTHREAD_BARRIER_ -#include -#include -#if !defined(__MVS__) -#include /* sem_t */ -#endif - -#define PTHREAD_BARRIER_SERIAL_THREAD 0x12345 -#define UV__PTHREAD_BARRIER_FALLBACK 1 - -/* - * To maintain ABI compatibility with - * libuv v1.x struct is padded according - * to target platform - */ -#if defined(__ANDROID__) -# define UV_BARRIER_STRUCT_PADDING \ - sizeof(pthread_mutex_t) + \ - sizeof(pthread_cond_t) + \ - sizeof(unsigned int) - \ - sizeof(void *) -#elif defined(__APPLE__) -# define UV_BARRIER_STRUCT_PADDING \ - sizeof(pthread_mutex_t) + \ - 2 * sizeof(sem_t) + \ - 2 * sizeof(unsigned int) - \ - sizeof(void *) -#else -# define UV_BARRIER_STRUCT_PADDING 0 -#endif - -typedef struct { - pthread_mutex_t mutex; - pthread_cond_t cond; - unsigned threshold; - unsigned in; - unsigned out; -} _uv_barrier; - -typedef struct { - _uv_barrier* b; - char _pad[UV_BARRIER_STRUCT_PADDING]; -} pthread_barrier_t; - -int pthread_barrier_init(pthread_barrier_t* barrier, - const void* barrier_attr, - unsigned count); - -int pthread_barrier_wait(pthread_barrier_t* barrier); -int pthread_barrier_destroy(pthread_barrier_t *barrier); - -#endif /* _UV_PTHREAD_BARRIER_ */ diff --git a/deps/uv/include/uv/unix.h b/deps/uv/include/uv/unix.h index 74a0d643ce..7208557b56 100644 --- a/deps/uv/include/uv/unix.h +++ b/deps/uv/include/uv/unix.h @@ -66,10 +66,6 @@ # include "uv/posix.h" #endif -#ifndef PTHREAD_BARRIER_SERIAL_THREAD -# include "uv/pthread-barrier.h" -#endif - #ifndef NI_MAXHOST # define NI_MAXHOST 1025 #endif @@ -136,8 +132,28 @@ typedef pthread_rwlock_t uv_rwlock_t; typedef UV_PLATFORM_SEM_T uv_sem_t; typedef pthread_cond_t uv_cond_t; typedef pthread_key_t uv_key_t; -typedef pthread_barrier_t uv_barrier_t; +/* Note: guard clauses should match uv_barrier_init's in src/unix/thread.c. */ +#if defined(_AIX) || !defined(PTHREAD_BARRIER_SERIAL_THREAD) +/* TODO(bnoordhuis) Merge into uv_barrier_t in v2. */ +struct _uv_barrier { + uv_mutex_t mutex; + uv_cond_t cond; + unsigned threshold; + unsigned in; + unsigned out; +}; + +typedef struct { + struct _uv_barrier* b; +# if defined(PTHREAD_BARRIER_SERIAL_THREAD) + /* TODO(bnoordhuis) Remove padding in v2. */ + char pad[sizeof(pthread_barrier_t) - sizeof(struct _uv_barrier*)]; +# endif +} uv_barrier_t; +#else +typedef pthread_barrier_t uv_barrier_t; +#endif /* Platform-specific definitions for uv_spawn support. */ typedef gid_t uv_gid_t; diff --git a/deps/uv/include/uv/version.h b/deps/uv/include/uv/version.h index 9db3d130cd..cc064e2fd8 100644 --- a/deps/uv/include/uv/version.h +++ b/deps/uv/include/uv/version.h @@ -32,7 +32,7 @@ #define UV_VERSION_MAJOR 1 #define UV_VERSION_MINOR 23 -#define UV_VERSION_PATCH 1 +#define UV_VERSION_PATCH 2 #define UV_VERSION_IS_RELEASE 1 #define UV_VERSION_SUFFIX "" diff --git a/deps/uv/src/threadpool.c b/deps/uv/src/threadpool.c index 4875f27beb..4258933c72 100644 --- a/deps/uv/src/threadpool.c +++ b/deps/uv/src/threadpool.c @@ -62,10 +62,10 @@ static void worker(void* arg) { uv_sem_post((uv_sem_t*) arg); arg = NULL; + uv_mutex_lock(&mutex); for (;;) { - uv_mutex_lock(&mutex); + /* `mutex` should always be locked at this point. */ - wait_for_work: /* Keep waiting while either no work is present or only slow I/O and we're at the threshold for that. */ while (QUEUE_EMPTY(&wq) || @@ -93,13 +93,13 @@ static void worker(void* arg) { other work in the queue is done. */ if (slow_io_work_running >= slow_work_thread_threshold()) { QUEUE_INSERT_TAIL(&wq, q); - goto wait_for_work; + continue; } /* If we encountered a request to run slow I/O work but there is none to run, that means it's cancelled => Start over. */ if (QUEUE_EMPTY(&slow_io_pending_wq)) - goto wait_for_work; + continue; is_slow_work = 1; slow_io_work_running++; @@ -122,13 +122,19 @@ static void worker(void* arg) { w->work(w); uv_mutex_lock(&w->loop->wq_mutex); - if (is_slow_work) - slow_io_work_running--; w->work = NULL; /* Signal uv_cancel() that the work req is done executing. */ QUEUE_INSERT_TAIL(&w->loop->wq, &w->wq); uv_async_send(&w->loop->wq_async); uv_mutex_unlock(&w->loop->wq_mutex); + + /* Lock `mutex` since that is expected at the start of the next + * iteration. */ + uv_mutex_lock(&mutex); + if (is_slow_work) { + /* `slow_io_work_running` is protected by `mutex`. */ + slow_io_work_running--; + } } } diff --git a/deps/uv/src/unix/bsd-ifaddrs.c b/deps/uv/src/unix/bsd-ifaddrs.c index 0d02154486..9825b1c4db 100644 --- a/deps/uv/src/unix/bsd-ifaddrs.c +++ b/deps/uv/src/unix/bsd-ifaddrs.c @@ -119,16 +119,13 @@ int uv_interface_addresses(uv_interface_address_t** addresses, int* count) { continue; address = *addresses; + memset(address->phys_addr, 0, sizeof(address->phys_addr)); for (i = 0; i < *count; i++) { if (strcmp(address->name, ent->ifa_name) == 0) { -#if defined(__CYGWIN__) || defined(__MSYS__) - memset(address->phys_addr, 0, sizeof(address->phys_addr)); -#else struct sockaddr_dl* sa_addr; sa_addr = (struct sockaddr_dl*)(ent->ifa_addr); memcpy(address->phys_addr, LLADDR(sa_addr), sizeof(address->phys_addr)); -#endif } address++; } diff --git a/deps/uv/src/unix/cygwin.c b/deps/uv/src/unix/cygwin.c index 9fe4093ef4..9da20e203a 100644 --- a/deps/uv/src/unix/cygwin.c +++ b/deps/uv/src/unix/cygwin.c @@ -38,7 +38,7 @@ int uv_uptime(double* uptime) { int uv_resident_set_memory(size_t* rss) { /* FIXME: read /proc/meminfo? */ *rss = 0; - return UV_ENOSYS; + return 0; } int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) { diff --git a/deps/uv/src/unix/fs.c b/deps/uv/src/unix/fs.c index c3f7951f11..3db5f89c95 100644 --- a/deps/uv/src/unix/fs.c +++ b/deps/uv/src/unix/fs.c @@ -262,17 +262,13 @@ static ssize_t uv__fs_read(uv_fs_t* req) { #if defined(__linux__) static int no_preadv; #endif + unsigned int iovmax; ssize_t result; -#if defined(_AIX) - struct stat buf; - if(fstat(req->file, &buf)) - return -1; - if(S_ISDIR(buf.st_mode)) { - errno = EISDIR; - return -1; - } -#endif /* defined(_AIX) */ + iovmax = uv__getiovmax(); + if (req->nbufs > iovmax) + req->nbufs = iovmax; + if (req->off < 0) { if (req->nbufs == 1) result = read(req->file, req->bufs[0].base, req->bufs[0].len); @@ -291,25 +287,7 @@ static ssize_t uv__fs_read(uv_fs_t* req) { if (no_preadv) retry: # endif { - off_t nread; - size_t index; - - nread = 0; - index = 0; - result = 1; - do { - if (req->bufs[index].len > 0) { - result = pread(req->file, - req->bufs[index].base, - req->bufs[index].len, - req->off + nread); - if (result > 0) - nread += result; - } - index++; - } while (index < req->nbufs && result > 0); - if (nread > 0) - result = nread; + result = pread(req->file, req->bufs[0].base, req->bufs[0].len, req->off); } # if defined(__linux__) else { @@ -327,6 +305,13 @@ static ssize_t uv__fs_read(uv_fs_t* req) { } done: + /* Early cleanup of bufs allocation, since we're done with it. */ + if (req->bufs != req->bufsml) + uv__free(req->bufs); + + req->bufs = NULL; + req->nbufs = 0; + return result; } @@ -391,11 +376,13 @@ static ssize_t uv__fs_pathmax_size(const char* path) { } static ssize_t uv__fs_readlink(uv_fs_t* req) { + ssize_t maxlen; ssize_t len; char* buf; + char* newbuf; - len = uv__fs_pathmax_size(req->path); - buf = uv__malloc(len + 1); + maxlen = uv__fs_pathmax_size(req->path); + buf = uv__malloc(maxlen); if (buf == NULL) { errno = ENOMEM; @@ -403,17 +390,28 @@ static ssize_t uv__fs_readlink(uv_fs_t* req) { } #if defined(__MVS__) - len = os390_readlink(req->path, buf, len); + len = os390_readlink(req->path, buf, maxlen); #else - len = readlink(req->path, buf, len); + len = readlink(req->path, buf, maxlen); #endif - if (len == -1) { uv__free(buf); return -1; } + /* Uncommon case: resize to make room for the trailing nul byte. */ + if (len == maxlen) { + newbuf = uv__realloc(buf, len + 1); + + if (newbuf == NULL) { + uv__free(buf); + return -1; + } + + buf = newbuf; + } + buf[len] = '\0'; req->ptr = buf; @@ -735,25 +733,7 @@ static ssize_t uv__fs_write(uv_fs_t* req) { if (no_pwritev) retry: # endif { - off_t written; - size_t index; - - written = 0; - index = 0; - r = 0; - do { - if (req->bufs[index].len > 0) { - r = pwrite(req->file, - req->bufs[index].base, - req->bufs[index].len, - req->off + written); - if (r > 0) - written += r; - } - index++; - } while (index < req->nbufs && r >= 0); - if (written > 0) - r = written; + r = pwrite(req->file, req->bufs[0].base, req->bufs[0].len, req->off); } # if defined(__linux__) else { @@ -1045,9 +1025,21 @@ static int uv__fs_fstat(int fd, uv_stat_t *buf) { return ret; } +static size_t uv__fs_buf_offset(uv_buf_t* bufs, size_t size) { + size_t offset; + /* Figure out which bufs are done */ + for (offset = 0; size > 0 && bufs[offset].len <= size; ++offset) + size -= bufs[offset].len; + + /* Fix a partial read/write */ + if (size > 0) { + bufs[offset].base += size; + bufs[offset].len -= size; + } + return offset; +} -typedef ssize_t (*uv__fs_buf_iter_processor)(uv_fs_t* req); -static ssize_t uv__fs_buf_iter(uv_fs_t* req, uv__fs_buf_iter_processor process) { +static ssize_t uv__fs_write_all(uv_fs_t* req) { unsigned int iovmax; unsigned int nbufs; uv_buf_t* bufs; @@ -1064,7 +1056,10 @@ static ssize_t uv__fs_buf_iter(uv_fs_t* req, uv__fs_buf_iter_processor process) if (req->nbufs > iovmax) req->nbufs = iovmax; - result = process(req); + do + result = uv__fs_write(req); + while (result < 0 && errno == EINTR); + if (result <= 0) { if (total == 0) total = result; @@ -1074,14 +1069,12 @@ static ssize_t uv__fs_buf_iter(uv_fs_t* req, uv__fs_buf_iter_processor process) if (req->off >= 0) req->off += result; + req->nbufs = uv__fs_buf_offset(req->bufs, result); req->bufs += req->nbufs; nbufs -= req->nbufs; total += result; } - if (errno == EINTR && total == -1) - return total; - if (bufs != req->bufsml) uv__free(bufs); @@ -1098,7 +1091,8 @@ static void uv__fs_work(struct uv__work* w) { ssize_t r; req = container_of(w, uv_fs_t, work_req); - retry_on_eintr = !(req->fs_type == UV_FS_CLOSE); + retry_on_eintr = !(req->fs_type == UV_FS_CLOSE || + req->fs_type == UV_FS_READ); do { errno = 0; @@ -1127,7 +1121,7 @@ static void uv__fs_work(struct uv__work* w) { X(MKDIR, mkdir(req->path, req->mode)); X(MKDTEMP, uv__fs_mkdtemp(req)); X(OPEN, uv__fs_open(req)); - X(READ, uv__fs_buf_iter(req, uv__fs_read)); + X(READ, uv__fs_read(req)); X(SCANDIR, uv__fs_scandir(req)); X(READLINK, uv__fs_readlink(req)); X(REALPATH, uv__fs_realpath(req)); @@ -1138,7 +1132,7 @@ static void uv__fs_work(struct uv__work* w) { X(SYMLINK, symlink(req->path, req->new_path)); X(UNLINK, unlink(req->path)); X(UTIME, uv__fs_utime(req)); - X(WRITE, uv__fs_buf_iter(req, uv__fs_write)); + X(WRITE, uv__fs_write_all(req)); default: abort(); } #undef X diff --git a/deps/uv/src/unix/linux-core.c b/deps/uv/src/unix/linux-core.c index 124a0a57f4..75362eb76d 100644 --- a/deps/uv/src/unix/linux-core.c +++ b/deps/uv/src/unix/linux-core.c @@ -890,6 +890,7 @@ int uv_interface_addresses(uv_interface_address_t** addresses, continue; address = *addresses; + memset(address->phys_addr, 0, sizeof(address->phys_addr)); for (i = 0; i < (*count); i++) { if (strcmp(address->name, ent->ifa_name) == 0) { diff --git a/deps/uv/src/unix/os390.c b/deps/uv/src/unix/os390.c index 5e93178f6f..65e9b70830 100644 --- a/deps/uv/src/unix/os390.c +++ b/deps/uv/src/unix/os390.c @@ -512,7 +512,7 @@ static int uv__interface_addresses_v6(uv_interface_address_t** addresses, /* TODO: Retrieve netmask using SIOCGIFNETMASK ioctl */ address->is_internal = flg.__nif6e_flags & _NIF6E_FLAGS_LOOPBACK ? 1 : 0; - + memset(address->phys_addr, 0, sizeof(address->phys_addr)); address++; } @@ -624,6 +624,7 @@ int uv_interface_addresses(uv_interface_address_t** addresses, int* count) { } address->is_internal = flg.ifr_flags & IFF_LOOPBACK ? 1 : 0; + memset(address->phys_addr, 0, sizeof(address->phys_addr)); address++; } diff --git a/deps/uv/src/unix/thread.c b/deps/uv/src/unix/thread.c index 303bc6ec84..29004707a4 100644 --- a/deps/uv/src/unix/thread.c +++ b/deps/uv/src/unix/thread.c @@ -44,108 +44,119 @@ #undef NANOSEC #define NANOSEC ((uint64_t) 1e9) +#if defined(PTHREAD_BARRIER_SERIAL_THREAD) +STATIC_ASSERT(sizeof(uv_barrier_t) == sizeof(pthread_barrier_t)); +#endif -#if defined(UV__PTHREAD_BARRIER_FALLBACK) -/* TODO: support barrier_attr */ -int pthread_barrier_init(pthread_barrier_t* barrier, - const void* barrier_attr, - unsigned count) { +/* Note: guard clauses should match uv_barrier_t's in include/uv/uv-unix.h. */ +#if defined(_AIX) || !defined(PTHREAD_BARRIER_SERIAL_THREAD) +int uv_barrier_init(uv_barrier_t* barrier, unsigned int count) { + struct _uv_barrier* b; int rc; - _uv_barrier* b; if (barrier == NULL || count == 0) - return EINVAL; - - if (barrier_attr != NULL) - return ENOTSUP; + return UV_EINVAL; b = uv__malloc(sizeof(*b)); if (b == NULL) - return ENOMEM; + return UV_ENOMEM; b->in = 0; b->out = 0; b->threshold = count; - if ((rc = pthread_mutex_init(&b->mutex, NULL)) != 0) + rc = uv_mutex_init(&b->mutex); + if (rc != 0) goto error2; - if ((rc = pthread_cond_init(&b->cond, NULL)) != 0) + + rc = uv_cond_init(&b->cond); + if (rc != 0) goto error; barrier->b = b; return 0; error: - pthread_mutex_destroy(&b->mutex); + uv_mutex_destroy(&b->mutex); error2: uv__free(b); return rc; } -int pthread_barrier_wait(pthread_barrier_t* barrier) { - int rc; - _uv_barrier* b; + +int uv_barrier_wait(uv_barrier_t* barrier) { + struct _uv_barrier* b; + int last; if (barrier == NULL || barrier->b == NULL) - return EINVAL; + return UV_EINVAL; b = barrier->b; - /* Lock the mutex*/ - if ((rc = pthread_mutex_lock(&b->mutex)) != 0) - return rc; + uv_mutex_lock(&b->mutex); - /* Increment the count. If this is the first thread to reach the threshold, - wake up waiters, unlock the mutex, then return - PTHREAD_BARRIER_SERIAL_THREAD. */ if (++b->in == b->threshold) { b->in = 0; - b->out = b->threshold - 1; - rc = pthread_cond_signal(&b->cond); - assert(rc == 0); - - pthread_mutex_unlock(&b->mutex); - return PTHREAD_BARRIER_SERIAL_THREAD; + b->out = b->threshold; + uv_cond_signal(&b->cond); + } else { + do + uv_cond_wait(&b->cond, &b->mutex); + while (b->in != 0); } - /* Otherwise, wait for other threads until in is set to 0, - then return 0 to indicate this is not the first thread. */ - do { - if ((rc = pthread_cond_wait(&b->cond, &b->mutex)) != 0) - break; - } while (b->in != 0); - - /* mark thread exit */ - b->out--; - pthread_cond_signal(&b->cond); - pthread_mutex_unlock(&b->mutex); - return rc; + + last = (--b->out == 0); + if (!last) + uv_cond_signal(&b->cond); /* Not needed for last thread. */ + + uv_mutex_unlock(&b->mutex); + return last; } -int pthread_barrier_destroy(pthread_barrier_t* barrier) { - int rc; - _uv_barrier* b; - if (barrier == NULL || barrier->b == NULL) - return EINVAL; +void uv_barrier_destroy(uv_barrier_t* barrier) { + struct _uv_barrier* b; b = barrier->b; + uv_mutex_lock(&b->mutex); - if ((rc = pthread_mutex_lock(&b->mutex)) != 0) - return rc; + assert(b->in == 0); + assert(b->out == 0); - if (b->in > 0 || b->out > 0) - rc = EBUSY; - - pthread_mutex_unlock(&b->mutex); + if (b->in != 0 || b->out != 0) + abort(); - if (rc) - return rc; + uv_mutex_unlock(&b->mutex); + uv_mutex_destroy(&b->mutex); + uv_cond_destroy(&b->cond); - pthread_cond_destroy(&b->cond); - pthread_mutex_destroy(&b->mutex); uv__free(barrier->b); barrier->b = NULL; - return 0; } + +#else + +int uv_barrier_init(uv_barrier_t* barrier, unsigned int count) { + return UV__ERR(pthread_barrier_init(barrier, NULL, count)); +} + + +int uv_barrier_wait(uv_barrier_t* barrier) { + int rc; + + rc = pthread_barrier_wait(barrier); + if (rc != 0) + if (rc != PTHREAD_BARRIER_SERIAL_THREAD) + abort(); + + return rc == PTHREAD_BARRIER_SERIAL_THREAD; +} + + +void uv_barrier_destroy(uv_barrier_t* barrier) { + if (pthread_barrier_destroy(barrier)) + abort(); +} + #endif @@ -771,25 +782,6 @@ int uv_cond_timedwait(uv_cond_t* cond, uv_mutex_t* mutex, uint64_t timeout) { } -int uv_barrier_init(uv_barrier_t* barrier, unsigned int count) { - return UV__ERR(pthread_barrier_init(barrier, NULL, count)); -} - - -void uv_barrier_destroy(uv_barrier_t* barrier) { - if (pthread_barrier_destroy(barrier)) - abort(); -} - - -int uv_barrier_wait(uv_barrier_t* barrier) { - int r = pthread_barrier_wait(barrier); - if (r && r != PTHREAD_BARRIER_SERIAL_THREAD) - abort(); - return r == PTHREAD_BARRIER_SERIAL_THREAD; -} - - int uv_key_create(uv_key_t* key) { return UV__ERR(pthread_key_create(key, NULL)); } diff --git a/deps/uv/src/win/fs-event.c b/deps/uv/src/win/fs-event.c index 226e6e7aee..25809ea4f2 100644 --- a/deps/uv/src/win/fs-event.c +++ b/deps/uv/src/win/fs-event.c @@ -83,7 +83,7 @@ static void uv_relative_path(const WCHAR* filename, static int uv_split_path(const WCHAR* filename, WCHAR** dir, WCHAR** file) { size_t len, i; - + if (filename == NULL) { if (dir != NULL) *dir = NULL; diff --git a/deps/uv/src/win/fs.c b/deps/uv/src/win/fs.c index 0886d79982..812c1a6de5 100644 --- a/deps/uv/src/win/fs.c +++ b/deps/uv/src/win/fs.c @@ -1517,10 +1517,10 @@ static void fs__fchmod(uv_fs_t* req) { SET_REQ_WIN32_ERROR(req, pRtlNtStatusToDosError(nt_status)); goto fchmod_cleanup; } - + /* Test if the Archive attribute is cleared */ if ((file_info.FileAttributes & FILE_ATTRIBUTE_ARCHIVE) == 0) { - /* Set Archive flag, otherwise setting or clearing the read-only + /* Set Archive flag, otherwise setting or clearing the read-only flag will not work */ file_info.FileAttributes |= FILE_ATTRIBUTE_ARCHIVE; nt_status = pNtSetInformationFile(handle, diff --git a/deps/uv/src/win/pipe.c b/deps/uv/src/win/pipe.c index 382290e69f..9a3cbc8a1e 100644 --- a/deps/uv/src/win/pipe.c +++ b/deps/uv/src/win/pipe.c @@ -2347,7 +2347,7 @@ int uv_pipe_chmod(uv_pipe_t* handle, int mode) { error = GetLastError(); goto clean_sid; } - + memset(&ea, 0, sizeof(EXPLICIT_ACCESS)); if (mode & UV_READABLE) ea.grfAccessPermissions |= GENERIC_READ | FILE_WRITE_ATTRIBUTES; diff --git a/deps/uv/src/win/req.c b/deps/uv/src/win/req.c deleted file mode 100644 index 111cc5e289..0000000000 --- a/deps/uv/src/win/req.c +++ /dev/null @@ -1,25 +0,0 @@ -/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - */ - -#include - -#include "uv.h" -#include "internal.h" diff --git a/deps/uv/src/win/thread.c b/deps/uv/src/win/thread.c index 6e41dcd8a0..56ca41aab0 100644 --- a/deps/uv/src/win/thread.c +++ b/deps/uv/src/win/thread.c @@ -118,7 +118,7 @@ int uv_thread_create(uv_thread_t *tid, void (*entry)(void *arg), void *arg) { ctx->arg = arg; /* Create the thread in suspended state so we have a chance to pass - * its own creation handle to it */ + * its own creation handle to it */ thread = (HANDLE) _beginthreadex(NULL, 0, uv__thread_start, diff --git a/deps/uv/src/win/tty.c b/deps/uv/src/win/tty.c index 7045b11540..32ccf74ca8 100644 --- a/deps/uv/src/win/tty.c +++ b/deps/uv/src/win/tty.c @@ -1033,6 +1033,7 @@ int uv_tty_read_stop(uv_tty_t* handle) { /* Cancel raw read. Write some bullshit event to force the console wait to * return. */ memset(&record, 0, sizeof record); + record.EventType = FOCUS_EVENT; if (!WriteConsoleInputW(handle->handle, &record, 1, &written)) { return GetLastError(); } @@ -2179,14 +2180,14 @@ void uv_process_tty_write_req(uv_loop_t* loop, uv_tty_t* handle, void uv_tty_close(uv_tty_t* handle) { assert(handle->u.fd == -1 || handle->u.fd > 2); + if (handle->flags & UV_HANDLE_READING) + uv_tty_read_stop(handle); + if (handle->u.fd == -1) CloseHandle(handle->handle); else close(handle->u.fd); - if (handle->flags & UV_HANDLE_READING) - uv_tty_read_stop(handle); - handle->u.fd = -1; handle->handle = INVALID_HANDLE_VALUE; handle->flags &= ~(UV_HANDLE_READABLE | UV_HANDLE_WRITABLE); diff --git a/deps/uv/test/runner-win.c b/deps/uv/test/runner-win.c index ce97270547..aa52d7cc5a 100644 --- a/deps/uv/test/runner-win.c +++ b/deps/uv/test/runner-win.c @@ -228,7 +228,7 @@ int process_copy_output(process_info_t* p, FILE* stream) { while (fgets(buf, sizeof(buf), f) != NULL) print_lines(buf, strlen(buf), stream); - + if (ferror(f)) return -1; diff --git a/deps/uv/test/test-barrier.c b/deps/uv/test/test-barrier.c index dfd2dbdef1..89858db571 100644 --- a/deps/uv/test/test-barrier.c +++ b/deps/uv/test/test-barrier.c @@ -104,3 +104,45 @@ TEST_IMPL(barrier_3) { return 0; } + +static void serial_worker(void* data) { + uv_barrier_t* barrier; + + barrier = data; + if (uv_barrier_wait(barrier) > 0) + uv_barrier_destroy(barrier); + + uv_sleep(100); /* Wait a bit before terminating. */ +} + +/* Ensure that uv_barrier_wait returns positive only after all threads have + * exited the barrier. If this value is returned too early and the barrier is + * destroyed prematurely, then this test may see a crash. */ +TEST_IMPL(barrier_serial_thread) { + uv_thread_t threads[4]; + uv_barrier_t barrier; + unsigned i; + + ASSERT(0 == uv_barrier_init(&barrier, ARRAY_SIZE(threads) + 1)); + + for (i = 0; i < ARRAY_SIZE(threads); ++i) + ASSERT(0 == uv_thread_create(&threads[i], serial_worker, &barrier)); + + if (uv_barrier_wait(&barrier) > 0) + uv_barrier_destroy(&barrier); + + for (i = 0; i < ARRAY_SIZE(threads); ++i) + ASSERT(0 == uv_thread_join(&threads[i])); + + return 0; +} + +/* Single thread uv_barrier_wait should return correct return value. */ +TEST_IMPL(barrier_serial_thread_single) { + uv_barrier_t barrier; + + ASSERT(0 == uv_barrier_init(&barrier, 1)); + ASSERT(0 < uv_barrier_wait(&barrier)); + uv_barrier_destroy(&barrier); + return 0; +} diff --git a/deps/uv/test/test-fs.c b/deps/uv/test/test-fs.c index 9c1e8bec20..01f5a7b023 100644 --- a/deps/uv/test/test-fs.c +++ b/deps/uv/test/test-fs.c @@ -26,6 +26,7 @@ #include /* memset */ #include #include +#include /* INT_MAX, PATH_MAX, IOV_MAX */ /* FIXME we shouldn't need to branch in this file */ #if defined(__unix__) || defined(__POSIX__) || \ @@ -120,6 +121,31 @@ static char test_buf[] = "test-buffer\n"; static char test_buf2[] = "second-buffer\n"; static uv_buf_t iov; +#ifdef _WIN32 +int uv_test_getiovmax(void) { + return INT32_MAX; /* Emulated by libuv, so no real limit. */ +} +#else +int uv_test_getiovmax(void) { +#if defined(IOV_MAX) + return IOV_MAX; +#elif defined(_SC_IOV_MAX) + static int iovmax = -1; + if (iovmax == -1) { + iovmax = sysconf(_SC_IOV_MAX); + /* On some embedded devices (arm-linux-uclibc based ip camera), + * sysconf(_SC_IOV_MAX) can not get the correct value. The return + * value is -1 and the errno is EINPROGRESS. Degrade the value to 1. + */ + if (iovmax == -1) iovmax = 1; + } + return iovmax; +#else + return 1024; +#endif +} +#endif + #ifdef _WIN32 /* * This tag and guid have no special meaning, and don't conflict with @@ -2752,19 +2778,44 @@ TEST_IMPL(fs_write_multiple_bufs) { memset(buf, 0, sizeof(buf)); memset(buf2, 0, sizeof(buf2)); + /* Read the strings back to separate buffers. */ + iovs[0] = uv_buf_init(buf, sizeof(test_buf)); + iovs[1] = uv_buf_init(buf2, sizeof(test_buf2)); + ASSERT(lseek(open_req1.result, 0, SEEK_CUR) == 0); + r = uv_fs_read(NULL, &read_req, open_req1.result, iovs, 2, -1, NULL); + ASSERT(r >= 0); + ASSERT(read_req.result == sizeof(test_buf) + sizeof(test_buf2)); + ASSERT(strcmp(buf, test_buf) == 0); + ASSERT(strcmp(buf2, test_buf2) == 0); + uv_fs_req_cleanup(&read_req); + + iov = uv_buf_init(buf, sizeof(buf)); + r = uv_fs_read(NULL, &read_req, open_req1.result, &iov, 1, -1, NULL); + ASSERT(r == 0); + ASSERT(read_req.result == 0); + uv_fs_req_cleanup(&read_req); + /* Read the strings back to separate buffers. */ iovs[0] = uv_buf_init(buf, sizeof(test_buf)); iovs[1] = uv_buf_init(buf2, sizeof(test_buf2)); r = uv_fs_read(NULL, &read_req, open_req1.result, iovs, 2, 0, NULL); ASSERT(r >= 0); - ASSERT(read_req.result >= 0); + if (read_req.result == sizeof(test_buf)) { + /* Infer that preadv is not available. */ + uv_fs_req_cleanup(&read_req); + r = uv_fs_read(NULL, &read_req, open_req1.result, &iovs[1], 1, read_req.result, NULL); + ASSERT(r >= 0); + ASSERT(read_req.result == sizeof(test_buf2)); + } else { + ASSERT(read_req.result == sizeof(test_buf) + sizeof(test_buf2)); + } ASSERT(strcmp(buf, test_buf) == 0); ASSERT(strcmp(buf2, test_buf2) == 0); uv_fs_req_cleanup(&read_req); iov = uv_buf_init(buf, sizeof(buf)); r = uv_fs_read(NULL, &read_req, open_req1.result, &iov, 1, - read_req.result, NULL); + sizeof(test_buf) + sizeof(test_buf2), NULL); ASSERT(r == 0); ASSERT(read_req.result == 0); uv_fs_req_cleanup(&read_req); @@ -2783,12 +2834,15 @@ TEST_IMPL(fs_write_multiple_bufs) { TEST_IMPL(fs_write_alotof_bufs) { - const size_t iovcount = 54321; + size_t iovcount; + size_t iovmax; uv_buf_t* iovs; char* buffer; size_t index; int r; + iovcount = 54321; + /* Setup. */ unlink("test_file"); @@ -2796,6 +2850,7 @@ TEST_IMPL(fs_write_alotof_bufs) { iovs = malloc(sizeof(*iovs) * iovcount); ASSERT(iovs != NULL); + iovmax = uv_test_getiovmax(); r = uv_fs_open(NULL, &open_req1, @@ -2829,7 +2884,10 @@ TEST_IMPL(fs_write_alotof_bufs) { iovs[index] = uv_buf_init(buffer + index * sizeof(test_buf), sizeof(test_buf)); - r = uv_fs_read(NULL, &read_req, open_req1.result, iovs, iovcount, 0, NULL); + ASSERT(lseek(open_req1.result, 0, SEEK_SET) == 0); + r = uv_fs_read(NULL, &read_req, open_req1.result, iovs, iovcount, -1, NULL); + if (iovcount > iovmax) + iovcount = iovmax; ASSERT(r >= 0); ASSERT((size_t)read_req.result == sizeof(test_buf) * iovcount); @@ -2841,13 +2899,14 @@ TEST_IMPL(fs_write_alotof_bufs) { uv_fs_req_cleanup(&read_req); free(buffer); + ASSERT(lseek(open_req1.result, write_req.result, SEEK_SET) == write_req.result); iov = uv_buf_init(buf, sizeof(buf)); r = uv_fs_read(NULL, &read_req, open_req1.result, &iov, 1, - read_req.result, + -1, NULL); ASSERT(r == 0); ASSERT(read_req.result == 0); @@ -2868,14 +2927,19 @@ TEST_IMPL(fs_write_alotof_bufs) { TEST_IMPL(fs_write_alotof_bufs_with_offset) { - const size_t iovcount = 54321; + size_t iovcount; + size_t iovmax; uv_buf_t* iovs; char* buffer; size_t index; int r; int64_t offset; - char* filler = "0123456789"; - int filler_len = strlen(filler); + char* filler; + int filler_len; + + filler = "0123456789"; + filler_len = strlen(filler); + iovcount = 54321; /* Setup. */ unlink("test_file"); @@ -2884,6 +2948,7 @@ TEST_IMPL(fs_write_alotof_bufs_with_offset) { iovs = malloc(sizeof(*iovs) * iovcount); ASSERT(iovs != NULL); + iovmax = uv_test_getiovmax(); r = uv_fs_open(NULL, &open_req1, @@ -2927,6 +2992,10 @@ TEST_IMPL(fs_write_alotof_bufs_with_offset) { r = uv_fs_read(NULL, &read_req, open_req1.result, iovs, iovcount, offset, NULL); ASSERT(r >= 0); + if (r == sizeof(test_buf)) + iovcount = 1; /* Infer that preadv is not available. */ + else if (iovcount > iovmax) + iovcount = iovmax; ASSERT((size_t)read_req.result == sizeof(test_buf) * iovcount); for (index = 0; index < iovcount; ++index) @@ -2940,7 +3009,7 @@ TEST_IMPL(fs_write_alotof_bufs_with_offset) { r = uv_fs_stat(NULL, &stat_req, "test_file", NULL); ASSERT(r == 0); ASSERT((int64_t)((uv_stat_t*)stat_req.ptr)->st_size == - offset + (int64_t)(iovcount * sizeof(test_buf))); + offset + (int64_t)write_req.result); uv_fs_req_cleanup(&stat_req); iov = uv_buf_init(buf, sizeof(buf)); @@ -2949,7 +3018,7 @@ TEST_IMPL(fs_write_alotof_bufs_with_offset) { open_req1.result, &iov, 1, - read_req.result + offset, + offset + write_req.result, NULL); ASSERT(r == 0); ASSERT(read_req.result == 0); @@ -2969,6 +3038,175 @@ TEST_IMPL(fs_write_alotof_bufs_with_offset) { } +#ifdef _WIN32 + +TEST_IMPL(fs_partial_read) { + RETURN_SKIP("Test not implemented on Windows."); +} + +TEST_IMPL(fs_partial_write) { + RETURN_SKIP("Test not implemented on Windows."); +} + +#else /* !_WIN32 */ + +struct thread_ctx { + pthread_t pid; + int fd; + char* data; + int size; + int interval; + int doread; +}; + +static void thread_main(void* arg) { + const struct thread_ctx* ctx; + int size; + char* data; + + ctx = (struct thread_ctx*)arg; + size = ctx->size; + data = ctx->data; + + while (size > 0) { + ssize_t result; + int nbytes; + nbytes = size < ctx->interval ? size : ctx->interval; + if (ctx->doread) { + result = write(ctx->fd, data, nbytes); + /* Should not see EINTR (or other errors) */ + ASSERT(result == nbytes); + } else { + result = read(ctx->fd, data, nbytes); + /* Should not see EINTR (or other errors), + * but might get a partial read if we are faster than the writer + */ + ASSERT(result > 0 && result <= nbytes); + } + + pthread_kill(ctx->pid, SIGUSR1); + size -= result; + data += result; + } +} + +static void sig_func(uv_signal_t* handle, int signum) { + uv_signal_stop(handle); +} + +static size_t uv_test_fs_buf_offset(uv_buf_t* bufs, size_t size) { + size_t offset; + /* Figure out which bufs are done */ + for (offset = 0; size > 0 && bufs[offset].len <= size; ++offset) + size -= bufs[offset].len; + + /* Fix a partial read/write */ + if (size > 0) { + bufs[offset].base += size; + bufs[offset].len -= size; + } + return offset; +} + +static void test_fs_partial(int doread) { + struct thread_ctx ctx; + uv_thread_t thread; + uv_signal_t signal; + int pipe_fds[2]; + size_t iovcount; + uv_buf_t* iovs; + char* buffer; + size_t index; + + iovcount = 54321; + + iovs = malloc(sizeof(*iovs) * iovcount); + ASSERT(iovs != NULL); + + ctx.pid = pthread_self(); + ctx.doread = doread; + ctx.interval = 1000; + ctx.size = sizeof(test_buf) * iovcount; + ctx.data = malloc(ctx.size); + ASSERT(ctx.data != NULL); + buffer = malloc(ctx.size); + ASSERT(buffer != NULL); + + for (index = 0; index < iovcount; ++index) + iovs[index] = uv_buf_init(buffer + index * sizeof(test_buf), sizeof(test_buf)); + + loop = uv_default_loop(); + + ASSERT(0 == uv_signal_init(loop, &signal)); + ASSERT(0 == uv_signal_start(&signal, sig_func, SIGUSR1)); + + ASSERT(0 == pipe(pipe_fds)); + + ctx.fd = pipe_fds[doread]; + ASSERT(0 == uv_thread_create(&thread, thread_main, &ctx)); + + if (doread) { + uv_buf_t* read_iovs; + int nread; + read_iovs = iovs; + nread = 0; + while (nread < ctx.size) { + int result; + result = uv_fs_read(loop, &read_req, pipe_fds[0], read_iovs, iovcount, -1, NULL); + if (result > 0) { + size_t read_iovcount; + read_iovcount = uv_test_fs_buf_offset(read_iovs, result); + read_iovs += read_iovcount; + iovcount -= read_iovcount; + nread += result; + } else { + ASSERT(result == UV_EINTR); + } + uv_fs_req_cleanup(&read_req); + } + } else { + int result; + result = uv_fs_write(loop, &write_req, pipe_fds[1], iovs, iovcount, -1, NULL); + ASSERT(write_req.result == result); + ASSERT(result == ctx.size); + uv_fs_req_cleanup(&write_req); + } + + ASSERT(0 == memcmp(buffer, ctx.data, ctx.size)); + + ASSERT(0 == uv_thread_join(&thread)); + ASSERT(0 == uv_run(loop, UV_RUN_DEFAULT)); + + ASSERT(0 == close(pipe_fds[1])); + uv_close((uv_handle_t*) &signal, NULL); + + { /* Make sure we read everything that we wrote. */ + int result; + result = uv_fs_read(loop, &read_req, pipe_fds[0], iovs, 1, -1, NULL); + ASSERT(result == 0); + uv_fs_req_cleanup(&read_req); + } + ASSERT(0 == close(pipe_fds[0])); + + free(iovs); + free(buffer); + free(ctx.data); + + MAKE_VALGRIND_HAPPY(); +} + +TEST_IMPL(fs_partial_read) { + test_fs_partial(1); + return 0; +} + +TEST_IMPL(fs_partial_write) { + test_fs_partial(0); + return 0; +} + +#endif/* _WIN32 */ + TEST_IMPL(fs_read_write_null_arguments) { int r; @@ -3313,7 +3551,7 @@ TEST_IMPL(fs_exclusive_sharing_mode) { int call_icacls(const char* command, ...) { char icacls_command[1024]; va_list args; - + va_start(args, command); vsnprintf(icacls_command, ARRAYSIZE(icacls_command), command, args); va_end(args); @@ -3335,7 +3573,7 @@ TEST_IMPL(fs_open_readonly_acl) { attrib -r test_file_icacls del test_file_icacls */ - + /* Setup - clear the ACL and remove the file */ loop = uv_default_loop(); r = uv_os_get_passwd(&pwd); @@ -3345,7 +3583,7 @@ TEST_IMPL(fs_open_readonly_acl) { uv_fs_chmod(loop, &req, "test_file_icacls", S_IWUSR, NULL); unlink("test_file_icacls"); - /* Create the file */ + /* Create the file */ r = uv_fs_open(loop, &open_req1, "test_file_icacls", @@ -3370,7 +3608,7 @@ TEST_IMPL(fs_open_readonly_acl) { if (r != 0) { goto acl_cleanup; } - + /* Try opening the file */ r = uv_fs_open(NULL, &open_req1, "test_file_icacls", O_RDONLY, 0, NULL); if (r < 0) { diff --git a/deps/uv/test/test-list.h b/deps/uv/test/test-list.h index b501722d4d..1bd062da3d 100644 --- a/deps/uv/test/test-list.h +++ b/deps/uv/test/test-list.h @@ -37,6 +37,8 @@ TEST_DECLARE (default_loop_close) TEST_DECLARE (barrier_1) TEST_DECLARE (barrier_2) TEST_DECLARE (barrier_3) +TEST_DECLARE (barrier_serial_thread) +TEST_DECLARE (barrier_serial_thread_single) TEST_DECLARE (condvar_1) TEST_DECLARE (condvar_2) TEST_DECLARE (condvar_3) @@ -50,6 +52,7 @@ TEST_DECLARE (tty) TEST_DECLARE (tty_raw) TEST_DECLARE (tty_empty_write) TEST_DECLARE (tty_large_write) +TEST_DECLARE (tty_raw_cancel) #endif TEST_DECLARE (tty_file) TEST_DECLARE (tty_pty) @@ -339,6 +342,8 @@ TEST_DECLARE (get_osfhandle_valid_handle) TEST_DECLARE (open_osfhandle_valid_handle) TEST_DECLARE (fs_write_alotof_bufs) TEST_DECLARE (fs_write_alotof_bufs_with_offset) +TEST_DECLARE (fs_partial_read) +TEST_DECLARE (fs_partial_write) TEST_DECLARE (fs_file_pos_after_op_with_offset) TEST_DECLARE (fs_null_req) #ifdef _WIN32 @@ -456,6 +461,8 @@ TASK_LIST_START TEST_ENTRY (barrier_1) TEST_ENTRY (barrier_2) TEST_ENTRY (barrier_3) + TEST_ENTRY (barrier_serial_thread) + TEST_ENTRY (barrier_serial_thread_single) TEST_ENTRY (condvar_1) TEST_ENTRY (condvar_2) TEST_ENTRY (condvar_3) @@ -480,6 +487,7 @@ TASK_LIST_START TEST_ENTRY (tty_raw) TEST_ENTRY (tty_empty_write) TEST_ENTRY (tty_large_write) + TEST_ENTRY (tty_raw_cancel) #endif TEST_ENTRY (tty_file) TEST_ENTRY (tty_pty) @@ -884,6 +892,8 @@ TASK_LIST_START TEST_ENTRY (fs_write_multiple_bufs) TEST_ENTRY (fs_write_alotof_bufs) TEST_ENTRY (fs_write_alotof_bufs_with_offset) + TEST_ENTRY (fs_partial_read) + TEST_ENTRY (fs_partial_write) TEST_ENTRY (fs_read_write_null_arguments) TEST_ENTRY (fs_file_pos_after_op_with_offset) TEST_ENTRY (fs_null_req) diff --git a/deps/uv/test/test-process-priority.c b/deps/uv/test/test-process-priority.c index ebee6b90af..b3d0a85bdd 100644 --- a/deps/uv/test/test-process-priority.c +++ b/deps/uv/test/test-process-priority.c @@ -54,8 +54,10 @@ TEST_IMPL(process_priority) { #ifndef _WIN32 ASSERT(priority == i); #else + /* On Windows, only elevated users can set UV_PRIORITY_HIGHEST. Other + users will silently be set to UV_PRIORITY_HIGH. */ if (i < UV_PRIORITY_HIGH) - ASSERT(priority == UV_PRIORITY_HIGHEST); + ASSERT(priority == UV_PRIORITY_HIGHEST || priority == UV_PRIORITY_HIGH); else if (i < UV_PRIORITY_ABOVE_NORMAL) ASSERT(priority == UV_PRIORITY_HIGH); else if (i < UV_PRIORITY_NORMAL) diff --git a/deps/uv/test/test-tty.c b/deps/uv/test/test-tty.c index 3bbdfad780..979a6ec38d 100644 --- a/deps/uv/test/test-tty.c +++ b/deps/uv/test/test-tty.c @@ -310,6 +310,41 @@ TEST_IMPL(tty_large_write) { MAKE_VALGRIND_HAPPY(); return 0; } + +TEST_IMPL(tty_raw_cancel) { + int r; + int ttyin_fd; + uv_tty_t tty_in; + uv_loop_t* loop; + HANDLE handle; + + loop = uv_default_loop(); + /* Make sure we have an FD that refers to a tty */ + handle = CreateFileA("conin$", + GENERIC_READ | GENERIC_WRITE, + FILE_SHARE_READ | FILE_SHARE_WRITE, + NULL, + OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL, + NULL); + ASSERT(handle != INVALID_HANDLE_VALUE); + ttyin_fd = _open_osfhandle((intptr_t) handle, 0); + ASSERT(ttyin_fd >= 0); + ASSERT(UV_TTY == uv_guess_handle(ttyin_fd)); + + r = uv_tty_init(uv_default_loop(), &tty_in, ttyin_fd, 1); /* Readable. */ + ASSERT(r == 0); + r = uv_tty_set_mode(&tty_in, UV_TTY_MODE_RAW); + ASSERT(r == 0); + r = uv_read_start((uv_stream_t*)&tty_in, tty_raw_alloc, tty_raw_read); + ASSERT(r == 0); + + r = uv_read_stop((uv_stream_t*) &tty_in); + ASSERT(r == 0); + + MAKE_VALGRIND_HAPPY(); + return 0; +} #endif diff --git a/deps/uv/uv.gyp b/deps/uv/uv.gyp index 37dcb3604f..5148a850ab 100644 --- a/deps/uv/uv.gyp +++ b/deps/uv/uv.gyp @@ -116,7 +116,6 @@ 'src/win/poll.c', 'src/win/process.c', 'src/win/process-stdio.c', - 'src/win/req.c', 'src/win/req-inl.h', 'src/win/signal.c', 'src/win/snprintf.c', diff --git a/deps/v8/include/v8-version.h b/deps/v8/include/v8-version.h index 06038eca3b..415d17dbbb 100644 --- a/deps/v8/include/v8-version.h +++ b/deps/v8/include/v8-version.h @@ -11,7 +11,7 @@ #define V8_MAJOR_VERSION 7 #define V8_MINOR_VERSION 0 #define V8_BUILD_NUMBER 276 -#define V8_PATCH_LEVEL 24 +#define V8_PATCH_LEVEL 25 // Use 1 for candidates and 0 otherwise. // (Boolean macro values are not supported by all preprocessors.) diff --git a/deps/v8/src/compiler/js-operator.cc b/deps/v8/src/compiler/js-operator.cc index 57f9950d55..797814314f 100644 --- a/deps/v8/src/compiler/js-operator.cc +++ b/deps/v8/src/compiler/js-operator.cc @@ -623,7 +623,7 @@ CompareOperationHint CompareOperationHintOf(const Operator* op) { V(CreateKeyValueArray, Operator::kEliminatable, 2, 1) \ V(CreatePromise, Operator::kEliminatable, 0, 1) \ V(CreateTypedArray, Operator::kNoProperties, 5, 1) \ - V(CreateObject, Operator::kNoWrite, 1, 1) \ + V(CreateObject, Operator::kNoProperties, 1, 1) \ V(ObjectIsArray, Operator::kNoProperties, 1, 1) \ V(HasProperty, Operator::kNoProperties, 2, 1) \ V(HasInPrototypeChain, Operator::kNoProperties, 2, 1) \ diff --git a/deps/v8/test/mjsunit/compiler/regress-888923.js b/deps/v8/test/mjsunit/compiler/regress-888923.js new file mode 100644 index 0000000000..e352673b7d --- /dev/null +++ b/deps/v8/test/mjsunit/compiler/regress-888923.js @@ -0,0 +1,31 @@ +// Copyright 2018 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax + +(function() { + function f(o) { + o.x; + Object.create(o); + return o.y.a; + } + + f({ x : 0, y : { a : 1 } }); + f({ x : 0, y : { a : 2 } }); + %OptimizeFunctionOnNextCall(f); + assertEquals(3, f({ x : 0, y : { a : 3 } })); +})(); + +(function() { + function f(o) { + let a = o.y; + Object.create(o); + return o.x + a; + } + + f({ x : 42, y : 21 }); + f({ x : 42, y : 21 }); + %OptimizeFunctionOnNextCall(f); + assertEquals(63, f({ x : 42, y : 21 })); +})(); diff --git a/doc/api/cli.md b/doc/api/cli.md index 8337a9aef5..a8e935be2a 100644 --- a/doc/api/cli.md +++ b/doc/api/cli.md @@ -23,7 +23,7 @@ _For more info about `node inspect`, please see the [debugger][] documentation._ ## Options Print source-able bash completion script for Node.js. diff --git a/doc/api/crypto.md b/doc/api/crypto.md index ecb0c8186c..88545f8636 100644 --- a/doc/api/crypto.md +++ b/doc/api/crypto.md @@ -1675,7 +1675,7 @@ signing algorithms. Optional `options` argument controls the ### crypto.generateKeyPair(type, options, callback) * `type`: {string} Must be `'rsa'`, `'dsa'` or `'ec'`. * `options`: {Object} @@ -1736,7 +1736,7 @@ a `Promise` for an `Object` with `publicKey` and `privateKey` properties. ### crypto.generateKeyPairSync(type, options) * `type`: {string} Must be `'rsa'`, `'dsa'` or `'ec'`. * `options`: {Object} diff --git a/doc/api/errors.md b/doc/api/errors.md index 7cdee52e79..3ba2742b94 100644 --- a/doc/api/errors.md +++ b/doc/api/errors.md @@ -1952,9 +1952,9 @@ The `repl` module was unable to parse data from the REPL history file. ### ERR_STDERR_CLOSE + + + +* {Object} + +The object that acts as the namespace for all W3C +[WebAssembly][webassembly-org] related functionality. See the +[Mozilla Developer Network][webassembly-mdn] for usage and compatibility. + [`__dirname`]: modules.html#modules_dirname [`__filename`]: modules.html#modules_filename [`clearImmediate`]: timers.html#timers_clearimmediate_immediate @@ -236,3 +249,5 @@ The WHATWG `URLSearchParams` class. See the [`URLSearchParams`][] section. [built-in objects]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects [module system documentation]: modules.html [timers]: timers.html +[webassembly-mdn]: https://developer.mozilla.org/en-US/docs/WebAssembly +[webassembly-org]: https://webassembly.org diff --git a/doc/api/http2.md b/doc/api/http2.md index e1e82c9dce..f3314695cf 100644 --- a/doc/api/http2.md +++ b/doc/api/http2.md @@ -224,7 +224,7 @@ session.on('localSettings', (settings) => { #### Event: 'ping' * `payload` {Buffer} The `PING` frame 8-byte payload @@ -684,7 +684,7 @@ are passed through as provided by the user or received from the peer. #### serverhttp2session.origin(...origins) * `origins` { string | URL | Object } One or more URL Strings passed as @@ -764,7 +764,7 @@ client.on('altsvc', (alt, origin, streamId) => { #### Event: 'origin' * `origins` {string[]} @@ -2000,7 +2000,7 @@ server.listen(80); * `filename` {string} Filename to be used to construct the relative require diff --git a/doc/api/n-api.md b/doc/api/n-api.md index 5276ee2e54..c976c5e8f0 100644 --- a/doc/api/n-api.md +++ b/doc/api/n-api.md @@ -11,8 +11,8 @@ the underlying JavaScript runtime (ex V8) and is maintained as part of Node.js itself. This API will be Application Binary Interface (ABI) stable across versions of Node.js. It is intended to insulate Addons from changes in the underlying JavaScript engine and allow modules -compiled for one version to run on later versions of Node.js without -recompilation. +compiled for one major version to run on later major versions of Node.js without +recompilation. The [ABI Stability][] guide provides a more in-depth explanation. Addons are built/packaged with the same approach/tools outlined in the section titled [C++ Addons](addons.html). @@ -1757,7 +1757,7 @@ added: v10.7.0 ```C napi_status napi_create_bigint_uint64(napi_env env, - uint64_t vaue, + uint64_t value, napi_value* result); ``` @@ -4596,6 +4596,7 @@ idempotent. This API may only be called from the main thread. +[ABI Stability]: https://nodejs.org/en/docs/guides/abi-stability/ [ECMAScript Language Specification]: https://tc39.github.io/ecma262/ [Error Handling]: #n_api_error_handling [Native Abstractions for Node.js]: https://github.com/nodejs/nan diff --git a/doc/api/process.md b/doc/api/process.md index 0eaeef8ba3..5139ad95d8 100644 --- a/doc/api/process.md +++ b/doc/api/process.md @@ -99,7 +99,7 @@ not be the same as what is originally sent. ### Event: 'multipleResolves' * `type` {string} The error type. One of `'resolve'` or `'reject'`. diff --git a/doc/api/stream.md b/doc/api/stream.md index 4ec151a37c..fb2f2da28d 100644 --- a/doc/api/stream.md +++ b/doc/api/stream.md @@ -1205,9 +1205,8 @@ added: v0.9.4 * `stream` {Stream} An "old style" readable stream * Returns: {this} -Versions of Node.js prior to v0.10 had streams that did not implement the -entire `stream` module API as it is currently defined. (See [Compatibility][] -for more information.) +Prior to Node.js 0.10, streams did not implement the entire `stream` module API +as it is currently defined. (See [Compatibility][] for more information.) When using an older Node.js library that emits [`'data'`][] events and has a [`stream.pause()`][stream-pause] method that is advisory only, the @@ -2325,10 +2324,10 @@ primarily for examples and testing, but there are some use cases where -In versions of Node.js prior to v0.10, the `Readable` stream interface was -simpler, but also less powerful and less useful. +Prior to Node.js 0.10, the `Readable` stream interface was simpler, but also +less powerful and less useful. -* Rather than waiting for calls the [`stream.read()`][stream-read] method, +* Rather than waiting for calls to the [`stream.read()`][stream-read] method, [`'data'`][] events would begin emitting immediately. Applications that would need to perform some amount of work to decide how to handle data were required to store read data into buffers so the data would not be lost. @@ -2336,7 +2335,7 @@ simpler, but also less powerful and less useful. guaranteed. This meant that it was still necessary to be prepared to receive [`'data'`][] events *even when the stream was in a paused state*. -In Node.js v0.10, the [`Readable`][] class was added. For backwards +In Node.js 0.10, the [`Readable`][] class was added. For backwards compatibility with older Node.js programs, `Readable` streams switch into "flowing mode" when a [`'data'`][] event handler is added, or when the [`stream.resume()`][stream-resume] method is called. The effect is that, even @@ -2366,9 +2365,8 @@ net.createServer((socket) => { }).listen(1337); ``` -In versions of Node.js prior to v0.10, the incoming message data would be -simply discarded. However, in Node.js v0.10 and beyond, the socket remains -paused forever. +Prior to Node.js 0.10, the incoming message data would be simply discarded. +However, in Node.js 0.10 and beyond, the socket remains paused forever. The workaround in this situation is to call the [`stream.resume()`][stream-resume] method to begin the flow of data: @@ -2386,7 +2384,7 @@ net.createServer((socket) => { ``` In addition to new `Readable` streams switching into flowing mode, -pre-v0.10 style streams can be wrapped in a `Readable` class using the +pre-0.10 style streams can be wrapped in a `Readable` class using the [`readable.wrap()`][`stream.wrap()`] method. ### `readable.read(0)` diff --git a/doc/api/util.md b/doc/api/util.md index 6dfbec8ac3..c1fc606a51 100644 --- a/doc/api/util.md +++ b/doc/api/util.md @@ -202,8 +202,8 @@ Each placeholder token is replaced with the converted value from the corresponding argument. Supported placeholders are: * `%s` - `String`. -* `%d` - `Number` (integer or floating point value). -* `%i` - Integer. +* `%d` - `Number` (integer or floating point value) or `BigInt`. +* `%i` - Integer or `BigInt`. * `%f` - Floating point value. * `%j` - JSON. Replaced with the string `'[Circular]'` if the argument contains circular references. @@ -361,13 +361,14 @@ stream.write('With ES6'); ``` ## util.inspect(object[, options]) +## util.inspect(object[, showHidden[, depth[, colors]]]) diff --git a/doc/changelogs/CHANGELOG_V10.md b/doc/changelogs/CHANGELOG_V10.md index 04b836a947..5b69c7c4e5 100644 --- a/doc/changelogs/CHANGELOG_V10.md +++ b/doc/changelogs/CHANGELOG_V10.md @@ -9,6 +9,7 @@ +10.12.0
10.11.0
10.10.0
10.9.0
@@ -39,6 +40,323 @@ * [io.js](CHANGELOG_IOJS.md) * [Archive](CHANGELOG_ARCHIVE.md) + +## 2018-10-10, Version 10.12.0 (Current), @targos + +### Notable changes + +* **assert** + * The diff output is now a tiny bit improved by sorting object properties when + inspecting the values that are compared with each other. [#22788](https://github.com/nodejs/node/pull/22788) +* **cli** + * The options parser now normalizes `_` to `-` in all multi-word command-line + flags, e.g. `--no_warnings` has the same effect as `--no-warnings`. [#23020](https://github.com/nodejs/node/pull/23020) + * Added bash completion for the `node` binary. To generate a bash completion + script, run `node --completion-bash`. The output can be saved to a file + which can be sourced to enable completion. [#20713](https://github.com/nodejs/node/pull/20713) +* **crypto** + * Added support for PEM-level encryption. [#23151](https://github.com/nodejs/node/pull/23151) + * Added an API asymmetric key pair generation. The new methods + `crypto.generateKeyPair` and `crypto.generateKeyPairSync` can be used to + generate public and private key pairs. The API supports RSA, DSA and EC and + a variety of key encodings (both PEM and DER). [#22660](https://github.com/nodejs/node/pull/22660) +* **fs** + * Added a `recursive` option to `fs.mkdir` and `fs.mkdirSync`. If this option + is set to true, non-existing parent folders will be automatically created. [#21875](https://github.com/nodejs/node/pull/21875) +* **http2** + * Added a `'ping'` event to `Http2Session` that is emitted whenever a non-ack + `PING` is received. [#23009](https://github.com/nodejs/node/pull/23009) + * Added support for the `ORIGIN` frame. [#22956](https://github.com/nodejs/node/pull/22956) + * Updated nghttp2 to 1.34.0. This adds RFC 8441 extended connect protocol + support to allow use of WebSockets over HTTP/2. [#23284](https://github.com/nodejs/node/pull/23284) +* **module** + * Added `module.createRequireFromPath(filename)`. This new method can be used + to create a custom require function that will resolve modules relative to + the filename path. [#19360](https://github.com/nodejs/node/pull/19360) +* **process** + * Added a `'multipleResolves'` process event that is emitted whenever a + `Promise` is attempted to be resolved multiple times, e.g. if the `resolve` + and `reject` functions are both called in a `Promise` executor. [#22218](https://github.com/nodejs/node/pull/22218) +* **url** + * Added `url.fileURLToPath(url)` and `url.pathToFileURL(path)`. These methods + can be used to correctly convert between file: URLs and absolute paths. [#22506](https://github.com/nodejs/node/pull/22506) +* **util** + * Added the `sorted` option to `util.inspect()`. If set to `true`, all + properties of an object and Set and Map entries will be sorted in the + returned string. If set to a function, it is used as a compare function. [#22788](https://github.com/nodejs/node/pull/22788) + * The `util.instpect.custom` symbol is now defined in the global symbol + registry as `Symbol.for('nodejs.util.inspect.custom')`. [#20857](https://github.com/nodejs/node/pull/20857) + * Added support for `BigInt` numbers in `util.format()`. [#22097](https://github.com/nodejs/node/pull/22097) +* **V8 API** + * A number of V8 C++ APIs have been marked as deprecated since they have been + removed in the upstream repository. Replacement APIs are added where + necessary. [#23159](https://github.com/nodejs/node/pull/23159) +* **Windows** + * The Windows msi installer now provides an option to automatically install + the tools required to build native modules. [#22645](https://github.com/nodejs/node/pull/22645) +* **Workers** + * Debugging support for Workers using the DevTools protocol has been + implemented. [#21364](https://github.com/nodejs/node/pull/21364) + * The public `inspector` module is now enabled in Workers. [#22769](https://github.com/nodejs/node/pull/22769) +* **Added new collaborators**: + * [digitalinfinity](https://github.com/digitalinfinity) - Hitesh Kanwathirtha + +### Commits + +* [[`12ff395e35`](https://github.com/nodejs/node/commit/12ff395e35)] - **assert**: remove internal errorCache property (Rich Trott) [#23304](https://github.com/nodejs/node/pull/23304) +* [[`efdb32603c`](https://github.com/nodejs/node/commit/efdb32603c)] - **(SEMVER-MINOR)** **assert**: improve diff output (Ruben Bridgewater) [#22788](https://github.com/nodejs/node/pull/22788) +* [[`9749d48729`](https://github.com/nodejs/node/commit/9749d48729)] - **benchmark**: increase lint compliance (Rich Trott) [#23305](https://github.com/nodejs/node/pull/23305) +* [[`90bbab6f71`](https://github.com/nodejs/node/commit/90bbab6f71)] - **benchmark**: refactor util benchmarks (Ruben Bridgewater) [#22503](https://github.com/nodejs/node/pull/22503) +* [[`2d7e4e0116`](https://github.com/nodejs/node/commit/2d7e4e0116)] - **benchmark,doc,lib,src,test,tools**: fix typos (Brandon Smith) [#23302](https://github.com/nodejs/node/pull/23302) +* [[`e6484c2c11`](https://github.com/nodejs/node/commit/e6484c2c11)] - **build**: restore js2c direct dependency on config.gypi (Refael Ackermann) [#23355](https://github.com/nodejs/node/pull/23355) +* [[`c4aa0331c1`](https://github.com/nodejs/node/commit/c4aa0331c1)] - **build**: make configure script verbose by default (Michaël Zasso) [#23408](https://github.com/nodejs/node/pull/23408) +* [[`cf17759113`](https://github.com/nodejs/node/commit/cf17759113)] - **build**: toggle lint-cpp using verbose (V) variable (Daniel Bevenius) [#23217](https://github.com/nodejs/node/pull/23217) +* [[`b0dc0ca9a9`](https://github.com/nodejs/node/commit/b0dc0ca9a9)] - **build**: make lint-addon-docs quiet (Daniel Bevenius) [#23217](https://github.com/nodejs/node/pull/23217) +* [[`0f236c8d42`](https://github.com/nodejs/node/commit/0f236c8d42)] - **build**: add pgo specific variables to common.gypi (Denys Otrishko) [#23102](https://github.com/nodejs/node/pull/23102) +* [[`de4d688d1f`](https://github.com/nodejs/node/commit/de4d688d1f)] - **build**: cleanup in .gitignore (Refael Ackermann) [#23180](https://github.com/nodejs/node/pull/23180) +* [[`49b0ec4fe7`](https://github.com/nodejs/node/commit/49b0ec4fe7)] - **build**: add loader path to rpath for cctest (Sam Ruby) [#23168](https://github.com/nodejs/node/pull/23168) +* [[`7d21cc2177`](https://github.com/nodejs/node/commit/7d21cc2177)] - **build**: reduce chance of unneeded rebuild (Refael Ackermann) [#23156](https://github.com/nodejs/node/pull/23156) +* [[`aae0eceea0`](https://github.com/nodejs/node/commit/aae0eceea0)] - **build**: encapsulate node/inspector gyp scafolding (Refael Ackermann) [#23156](https://github.com/nodejs/node/pull/23156) +* [[`180099a5ac`](https://github.com/nodejs/node/commit/180099a5ac)] - **build**: enabling pgo at configure (Octavian Soldea) [#21596](https://github.com/nodejs/node/pull/21596) +* [[`f4cffffc96`](https://github.com/nodejs/node/commit/f4cffffc96)] - **build**: add --quiet to lint-cpp (Daniel Bevenius) [#23075](https://github.com/nodejs/node/pull/23075) +* [[`d572f6001a`](https://github.com/nodejs/node/commit/d572f6001a)] - **build**: remove unnecessary Makefile output (Rich Trott) [#23129](https://github.com/nodejs/node/pull/23129) +* [[`fb03faa835`](https://github.com/nodejs/node/commit/fb03faa835)] - **build**: move addons message in Makefile (Rich Trott) [#23114](https://github.com/nodejs/node/pull/23114) +* [[`948dc71664`](https://github.com/nodejs/node/commit/948dc71664)] - **build**: make config verbose on CI (Refael Ackermann) [#22935](https://github.com/nodejs/node/pull/22935) +* [[`b69ed9c80c`](https://github.com/nodejs/node/commit/b69ed9c80c)] - **build**: stop printing execution of lint-md command (Ruben Bridgewater) [#22904](https://github.com/nodejs/node/pull/22904) +* [[`2b8f569388`](https://github.com/nodejs/node/commit/2b8f569388)] - **build,deps**: refactor and fix v8.gyp (Refael Ackermann) [#23182](https://github.com/nodejs/node/pull/23182) +* [[`4db9e36b57`](https://github.com/nodejs/node/commit/4db9e36b57)] - **build,doc**: remove outdated `lint-md-build` (Michaël Zasso) [#22991](https://github.com/nodejs/node/pull/22991) +* [[`c29e5ac5be`](https://github.com/nodejs/node/commit/c29e5ac5be)] - **(SEMVER-MINOR)** **cli**: normalize `\_` → `-` when parsing options (Anna Henningsen) [#23020](https://github.com/nodejs/node/pull/23020) +* [[`54ca0e159f`](https://github.com/nodejs/node/commit/54ca0e159f)] - **cluster**: move handle tracking out of utils (cjihrig) [#23131](https://github.com/nodejs/node/pull/23131) +* [[`cb0d8239b7`](https://github.com/nodejs/node/commit/cb0d8239b7)] - **cluster**: use Map to track handles in master (cjihrig) [#23125](https://github.com/nodejs/node/pull/23125) +* [[`0f133eb5a3`](https://github.com/nodejs/node/commit/0f133eb5a3)] - **cluster**: use Map to track handles in cluster child (cjihrig) [#23125](https://github.com/nodejs/node/pull/23125) +* [[`2dd157fbf3`](https://github.com/nodejs/node/commit/2dd157fbf3)] - **cluster**: use Map to track indexes (cjihrig) [#23125](https://github.com/nodejs/node/pull/23125) +* [[`64f840a767`](https://github.com/nodejs/node/commit/64f840a767)] - **cluster**: use Map to track round robin workers (cjihrig) [#23125](https://github.com/nodejs/node/pull/23125) +* [[`22f51a6a83`](https://github.com/nodejs/node/commit/22f51a6a83)] - **cluster**: use Map to track callbacks (cjihrig) [#23125](https://github.com/nodejs/node/pull/23125) +* [[`26c36efa2f`](https://github.com/nodejs/node/commit/26c36efa2f)] - **crypto**: remove node::crypto::CheckResult (Tobias Nießen) [#23225](https://github.com/nodejs/node/pull/23225) +* [[`5f450f3f92`](https://github.com/nodejs/node/commit/5f450f3f92)] - **crypto**: replace goto SSL\_CTX\_use\_certificate\_chain (Daniel Bevenius) [#23113](https://github.com/nodejs/node/pull/23113) +* [[`db8d99dbc2`](https://github.com/nodejs/node/commit/db8d99dbc2)] - **crypto**: add virtual dtor to KeyPairGenerationConfig (Daniel Bevenius) [#23215](https://github.com/nodejs/node/pull/23215) +* [[`f98d441461`](https://github.com/nodejs/node/commit/f98d441461)] - **crypto**: extract throwInvalidArgType function (Daniel Bevenius) [#22947](https://github.com/nodejs/node/pull/22947) +* [[`1a21cf13cb`](https://github.com/nodejs/node/commit/1a21cf13cb)] - **crypto**: make PEM parsing RFC7468-compliant (Tobias Nießen) [#23164](https://github.com/nodejs/node/pull/23164) +* [[`9c96573124`](https://github.com/nodejs/node/commit/9c96573124)] - **(SEMVER-MINOR)** **crypto**: add support for PEM-level encryption (Tobias Nießen) [#23151](https://github.com/nodejs/node/pull/23151) +* [[`398c0e03e4`](https://github.com/nodejs/node/commit/398c0e03e4)] - **crypto**: replace gotos (Tobias Nießen) [#23132](https://github.com/nodejs/node/pull/23132) +* [[`a51d839a31`](https://github.com/nodejs/node/commit/a51d839a31)] - **crypto**: remove unnecessary calls to TLS\_method() (Daniel Bevenius) [#23077](https://github.com/nodejs/node/pull/23077) +* [[`074b7af7ef`](https://github.com/nodejs/node/commit/074b7af7ef)] - **crypto**: enable auto cert chaining for BoringSSL (Jeremy Apthorp) [#22110](https://github.com/nodejs/node/pull/22110) +* [[`2888f809e3`](https://github.com/nodejs/node/commit/2888f809e3)] - **crypto**: deduplicate cipher initialization code (Tobias Nießen) [#23011](https://github.com/nodejs/node/pull/23011) +* [[`0bc4529a07`](https://github.com/nodejs/node/commit/0bc4529a07)] - **crypto**: remove unnecessary usage of goto (Tobias Nießen) [#23018](https://github.com/nodejs/node/pull/23018) +* [[`cc8219433c`](https://github.com/nodejs/node/commit/cc8219433c)] - **(SEMVER-MINOR)** **crypto**: allow promisifying generateKeyPair (Tobias Nießen) [#22660](https://github.com/nodejs/node/pull/22660) +* [[`421909394c`](https://github.com/nodejs/node/commit/421909394c)] - **(SEMVER-MINOR)** **crypto**: add API for key pair generation (Tobias Nießen) [#22660](https://github.com/nodejs/node/pull/22660) +* [[`76cb52ca11`](https://github.com/nodejs/node/commit/76cb52ca11)] - **deps**: upgrade to libuv 1.23.2 (cjihrig) [#23336](https://github.com/nodejs/node/pull/23336) +* [[`95bdf37265`](https://github.com/nodejs/node/commit/95bdf37265)] - **(SEMVER-MINOR)** **deps**: update nghttp2 to 1.34.0 (James M Snell) [#23284](https://github.com/nodejs/node/pull/23284) +* [[`46c7d0d21f`](https://github.com/nodejs/node/commit/46c7d0d21f)] - **(SEMVER-MINOR)** **deps**: increase V8 deprecation levels (Anna Henningsen) [#23159](https://github.com/nodejs/node/pull/23159) +* [[`e3550f2366`](https://github.com/nodejs/node/commit/e3550f2366)] - **deps**: backport 958b761 from upstream V8 (Matheus Marchini) [#22914](https://github.com/nodejs/node/pull/22914) +* [[`f08373f18d`](https://github.com/nodejs/node/commit/f08373f18d)] - **deps**: cherry-pick 64-bit hash seed commits from V8 (Yang Guo) [#23260](https://github.com/nodejs/node/pull/23260) +* [[`e93c94c327`](https://github.com/nodejs/node/commit/e93c94c327)] - **deps**: add no-strict-aliasing to ICU cflags (Daniel Bevenius) [#23112](https://github.com/nodejs/node/pull/23112) +* [[`5d70652d86`](https://github.com/nodejs/node/commit/5d70652d86)] - **deps**: fix Array.prototype.forEach on v8 6.8 (Mike Stanton) [#22899](https://github.com/nodejs/node/pull/22899) +* [[`e668815a24`](https://github.com/nodejs/node/commit/e668815a24)] - **deps**: cherry-pick dbfcc48 from upstream V8 (Alexey Kozyatinskiy) [#22251](https://github.com/nodejs/node/pull/22251) +* [[`e5efdba75c`](https://github.com/nodejs/node/commit/e5efdba75c)] - **deps**: upgrade to libuv 1.23.1 (cjihrig) [#22997](https://github.com/nodejs/node/pull/22997) +* [[`39d7699a87`](https://github.com/nodejs/node/commit/39d7699a87)] - **deps**: cherry-pick d48bd16 from upstream V8 (Junliang Yan) [#22909](https://github.com/nodejs/node/pull/22909) +* [[`62a2c81214`](https://github.com/nodejs/node/commit/62a2c81214)] - **doc**: simplify and clarify README language (Rich Trott) [#23322](https://github.com/nodejs/node/pull/23322) +* [[`7c0d6ac0bd`](https://github.com/nodejs/node/commit/7c0d6ac0bd)] - **doc**: simplify governance info in README intro (Rich Trott) [#23320](https://github.com/nodejs/node/pull/23320) +* [[`5ff43006d1`](https://github.com/nodejs/node/commit/5ff43006d1)] - **doc**: add link to ABI guide (Gabriel Schulhof) +* [[`9dd47bcf99`](https://github.com/nodejs/node/commit/9dd47bcf99)] - **doc**: fix minor typo in streams.md (Rich Trott) [#23306](https://github.com/nodejs/node/pull/23306) +* [[`a0e8e7fea6`](https://github.com/nodejs/node/commit/a0e8e7fea6)] - **doc**: standardize versions in stream module doc (Rich Trott) [#23306](https://github.com/nodejs/node/pull/23306) +* [[`eee71d6d16`](https://github.com/nodejs/node/commit/eee71d6d16)] - **doc**: add util.inspect() legacy signature (siddhant) [#23216](https://github.com/nodejs/node/pull/23216) +* [[`fbbb25b901`](https://github.com/nodejs/node/commit/fbbb25b901)] - **doc**: edit building-node text (Rich Trott) [#23335](https://github.com/nodejs/node/pull/23335) +* [[`037063c6ee`](https://github.com/nodejs/node/commit/037063c6ee)] - **doc**: remove 72-hour mentions in pull-requests.md (Rich Trott) [#23309](https://github.com/nodejs/node/pull/23309) +* [[`4c54f897f8`](https://github.com/nodejs/node/commit/4c54f897f8)] - **doc**: fix minor typo in n-api.md (Aleksey Chemakin) [#23310](https://github.com/nodejs/node/pull/23310) +* [[`f1cb8ab4bf`](https://github.com/nodejs/node/commit/f1cb8ab4bf)] - **doc**: remove ABI guide (Gabriel Schulhof) [#23303](https://github.com/nodejs/node/pull/23303) +* [[`39e3ef7739`](https://github.com/nodejs/node/commit/39e3ef7739)] - **doc**: Replace vague 'may not' with definitive 'will not' (Mike MacCana) [#23143](https://github.com/nodejs/node/pull/23143) +* [[`11c674549b`](https://github.com/nodejs/node/commit/11c674549b)] - **doc**: update author-ready label terms (Vse Mozhet Byt) [#23249](https://github.com/nodejs/node/pull/23249) +* [[`33e3eb44f7`](https://github.com/nodejs/node/commit/33e3eb44f7)] - **doc**: update onboarding task (Rich Trott) [#23300](https://github.com/nodejs/node/pull/23300) +* [[`df4ade7dc7`](https://github.com/nodejs/node/commit/df4ade7dc7)] - **doc**: use backticks around file names in README.md (Rich Trott) [#23299](https://github.com/nodejs/node/pull/23299) +* [[`80964d36b7`](https://github.com/nodejs/node/commit/80964d36b7)] - **doc**: improve API Documentation text in README (Rich Trott) [#23268](https://github.com/nodejs/node/pull/23268) +* [[`ef0f7e613a`](https://github.com/nodejs/node/commit/ef0f7e613a)] - **doc**: shorten pull request wait time to 48 hours (Rich Trott) [#23082](https://github.com/nodejs/node/pull/23082) +* [[`5b76313059`](https://github.com/nodejs/node/commit/5b76313059)] - **doc**: improve instructions for verifying binaries (Rich Trott) [#23248](https://github.com/nodejs/node/pull/23248) +* [[`6943fa9fc7`](https://github.com/nodejs/node/commit/6943fa9fc7)] - **doc**: shorten intro of README.md (Rich Trott) [#23073](https://github.com/nodejs/node/pull/23073) +* [[`e5bfab0fb6`](https://github.com/nodejs/node/commit/e5bfab0fb6)] - **doc**: add guide about abi stability (Gabriel Schulhof) [#23229](https://github.com/nodejs/node/pull/23229) +* [[`e283206047`](https://github.com/nodejs/node/commit/e283206047)] - **doc**: improve `stream.Writable` ctor encoding option docs (Anna Henningsen) [#23246](https://github.com/nodejs/node/pull/23246) +* [[`bd59d4efbf`](https://github.com/nodejs/node/commit/bd59d4efbf)] - **doc**: fix code snippets in tls.md (Ouyang Yadong) [#23239](https://github.com/nodejs/node/pull/23239) +* [[`27c5e96ffe`](https://github.com/nodejs/node/commit/27c5e96ffe)] - **doc**: leave pull requests open for 72 hours (Rich Trott) [#22275](https://github.com/nodejs/node/pull/22275) +* [[`5836b9fcc8`](https://github.com/nodejs/node/commit/5836b9fcc8)] - **doc**: specify cluster worker.kill() caveat (cjihrig) [#23165](https://github.com/nodejs/node/pull/23165) +* [[`ed01b38295`](https://github.com/nodejs/node/commit/ed01b38295)] - **doc**: use stronger language about security of vm (Gus Caplan) [#23198](https://github.com/nodejs/node/pull/23198) +* [[`eb8721977f`](https://github.com/nodejs/node/commit/eb8721977f)] - **doc**: improve Download section of README (Rich Trott) [#23212](https://github.com/nodejs/node/pull/23212) +* [[`003d85d2d9`](https://github.com/nodejs/node/commit/003d85d2d9)] - **doc**: remove GA tracking (Ben Noordhuis) [#23083](https://github.com/nodejs/node/pull/23083) +* [[`6912376562`](https://github.com/nodejs/node/commit/6912376562)] - **doc**: move gibfahn to TSC Emeritus (Gibson Fahnestock) [#23238](https://github.com/nodejs/node/pull/23238) +* [[`1553e21007`](https://github.com/nodejs/node/commit/1553e21007)] - **doc**: clarify assigning issues to the TSC (Franziska Hinkelmann) [#22759](https://github.com/nodejs/node/pull/22759) +* [[`71901d6b30`](https://github.com/nodejs/node/commit/71901d6b30)] - **doc**: improve Release Types text in README (Rich Trott) [#23190](https://github.com/nodejs/node/pull/23190) +* [[`8191bee313`](https://github.com/nodejs/node/commit/8191bee313)] - **doc**: simplify support section of README (Rich Trott) [#23170](https://github.com/nodejs/node/pull/23170) +* [[`548934d412`](https://github.com/nodejs/node/commit/548934d412)] - **doc**: fix incorrect anchoring (#vcbuild.bat -\> #vcbuildbat) (Justin Lee) [#23211](https://github.com/nodejs/node/pull/23211) +* [[`ce006eb68d`](https://github.com/nodejs/node/commit/ce006eb68d)] - **doc**: fix minor typo (to early -\> too early) (Justin Lee) [#23211](https://github.com/nodejs/node/pull/23211) +* [[`21490c2a87`](https://github.com/nodejs/node/commit/21490c2a87)] - **doc**: remove recommendation to use node-eps (Richard Lau) [#23148](https://github.com/nodejs/node/pull/23148) +* [[`e71a72fbf2`](https://github.com/nodejs/node/commit/e71a72fbf2)] - **doc**: add contents table to CONTRIBUTING.md (ZYSzys) [#23140](https://github.com/nodejs/node/pull/23140) +* [[`818db4036b`](https://github.com/nodejs/node/commit/818db4036b)] - **doc**: move perf tools and APIs to Tier 3 (Matheus Marchini) [#22915](https://github.com/nodejs/node/pull/22915) +* [[`e791abe5ef`](https://github.com/nodejs/node/commit/e791abe5ef)] - **doc**: formalize `auto` usage in C++ style guide (Anna Henningsen) [#23028](https://github.com/nodejs/node/pull/23028) +* [[`310109691b`](https://github.com/nodejs/node/commit/310109691b)] - **doc**: fix casing in stream.md (Sintendo) [#23166](https://github.com/nodejs/node/pull/23166) +* [[`bb5c6892ee`](https://github.com/nodejs/node/commit/bb5c6892ee)] - **doc**: add table of contents in BUILDING.md (ZYSzys) [#23147](https://github.com/nodejs/node/pull/23147) +* [[`cbcf5f88cd`](https://github.com/nodejs/node/commit/cbcf5f88cd)] - **doc**: deeper link to downloads site (Refael Ackermann) [#23084](https://github.com/nodejs/node/pull/23084) +* [[`9109187948`](https://github.com/nodejs/node/commit/9109187948)] - **doc**: update guide for assert team (Rich Trott) [#23085](https://github.com/nodejs/node/pull/23085) +* [[`2731d08c33`](https://github.com/nodejs/node/commit/2731d08c33)] - **doc**: add links for fs.createWriteStream() (Rich Trott) [#23104](https://github.com/nodejs/node/pull/23104) +* [[`9fa3813845`](https://github.com/nodejs/node/commit/9fa3813845)] - **doc**: edit fast-tracking section (cjihrig) [#23059](https://github.com/nodejs/node/pull/23059) +* [[`14327aea7b`](https://github.com/nodejs/node/commit/14327aea7b)] - **doc**: improve instruction to purple merge (Refael Ackermann) [#23007](https://github.com/nodejs/node/pull/23007) +* [[`87565c763a`](https://github.com/nodejs/node/commit/87565c763a)] - **doc**: require two approvals to land changes (Rich Trott) [#22255](https://github.com/nodejs/node/pull/22255) +* [[`e7be1edc49`](https://github.com/nodejs/node/commit/e7be1edc49)] - **doc**: fix optional parameters in n-api.md (Lars-Magnus Skog) [#22998](https://github.com/nodejs/node/pull/22998) +* [[`24073cef6b`](https://github.com/nodejs/node/commit/24073cef6b)] - **doc**: add callback parameters of worker.terminate() (Denis Fäcke) [#23002](https://github.com/nodejs/node/pull/23002) +* [[`6b2e2ff036`](https://github.com/nodejs/node/commit/6b2e2ff036)] - **doc**: improve metadata for http.request (Tobias Nießen) [#22949](https://github.com/nodejs/node/pull/22949) +* [[`91b410259e`](https://github.com/nodejs/node/commit/91b410259e)] - **doc**: add missing metadata for recursive mkdir (Tobias Nießen) [#22949](https://github.com/nodejs/node/pull/22949) +* [[`15c7c57a78`](https://github.com/nodejs/node/commit/15c7c57a78)] - **doc**: add missing metadata for dns.lookup (Tobias Nießen) [#22949](https://github.com/nodejs/node/pull/22949) +* [[`05196893b9`](https://github.com/nodejs/node/commit/05196893b9)] - **doc**: fix heading levels in C++ style guide (Anna Henningsen) [#23061](https://github.com/nodejs/node/pull/23061) +* [[`29a9e8498a`](https://github.com/nodejs/node/commit/29a9e8498a)] - **doc**: remove outdated notes on stdio in workers (Anna Henningsen) [#23054](https://github.com/nodejs/node/pull/23054) +* [[`d3bc862d88`](https://github.com/nodejs/node/commit/d3bc862d88)] - **doc**: match program and console output in synopsis.md (Mohammed Essehemy) [#23006](https://github.com/nodejs/node/pull/23006) +* [[`15b91b9eb8`](https://github.com/nodejs/node/commit/15b91b9eb8)] - **doc**: add links for repl.ReplServer (Rich Trott) [#23005](https://github.com/nodejs/node/pull/23005) +* [[`b0e86ea8d0`](https://github.com/nodejs/node/commit/b0e86ea8d0)] - **doc**: update maintaining V8 guide (Michaël Zasso) [#22913](https://github.com/nodejs/node/pull/22913) +* [[`00dd9738ee`](https://github.com/nodejs/node/commit/00dd9738ee)] - **doc**: specify fast-tracking (Ruben Bridgewater) [#22929](https://github.com/nodejs/node/pull/22929) +* [[`ef5d90dfdc`](https://github.com/nodejs/node/commit/ef5d90dfdc)] - **doc**: add digitalinfinity to collaborators (Hitesh Kanwathirtha) [#22984](https://github.com/nodejs/node/pull/22984) +* [[`b48dc0b667`](https://github.com/nodejs/node/commit/b48dc0b667)] - **doc,test**: fix inspect's sorted compare function (Michaël Zasso) [#22992](https://github.com/nodejs/node/pull/22992) +* [[`d9d9d23191`](https://github.com/nodejs/node/commit/d9d9d23191)] - **errors**: fix ERR\_SOCKET\_BAD\_PORT message (Giovanny Andres Gongora Granada (Gioyik)) [#23015](https://github.com/nodejs/node/pull/23015) +* [[`bb6530b31b`](https://github.com/nodejs/node/commit/bb6530b31b)] - **fs**: consistently return symlink type from readdir (Klaus Meinhardt) [#22808](https://github.com/nodejs/node/pull/22808) +* [[`7e45daf494`](https://github.com/nodejs/node/commit/7e45daf494)] - **(SEMVER-MINOR)** **fs**: implement mkdir recursive (mkdirp) (Benjamin Coe) [#21875](https://github.com/nodejs/node/pull/21875) +* [[`c29734c9d6`](https://github.com/nodejs/node/commit/c29734c9d6)] - **fs**: improve fs.watch ENOSPC error message (Anna Henningsen) [#21846](https://github.com/nodejs/node/pull/21846) +* [[`7b327ea909`](https://github.com/nodejs/node/commit/7b327ea909)] - **(SEMVER-MINOR)** **http2**: add RFC 8441 extended connect protocol support (James M Snell) [#23284](https://github.com/nodejs/node/pull/23284) +* [[`001881f33e`](https://github.com/nodejs/node/commit/001881f33e)] - **http2**: set nghttp2\_option\_set\_no\_closed\_streams (David Halls) [#23134](https://github.com/nodejs/node/pull/23134) +* [[`8fe62f8d38`](https://github.com/nodejs/node/commit/8fe62f8d38)] - **http2**: don't send trailers on a closed connection (André Cruz) [#23146](https://github.com/nodejs/node/pull/23146) +* [[`d1826fed41`](https://github.com/nodejs/node/commit/d1826fed41)] - **http2**: close fd in doSendFileFD() (cjihrig) [#23047](https://github.com/nodejs/node/pull/23047) +* [[`8bf004b96d`](https://github.com/nodejs/node/commit/8bf004b96d)] - **(SEMVER-MINOR)** **http2**: add ping event (James M Snell) [#23009](https://github.com/nodejs/node/pull/23009) +* [[`badc38f305`](https://github.com/nodejs/node/commit/badc38f305)] - **http2**: do not falsely emit 'aborted' on push (Anatoli Papirovski) [#22878](https://github.com/nodejs/node/pull/22878) +* [[`24675a4306`](https://github.com/nodejs/node/commit/24675a4306)] - **(SEMVER-MINOR)** **http2**: add origin frame support (James M Snell) [#22956](https://github.com/nodejs/node/pull/22956) +* [[`89fe9edd08`](https://github.com/nodejs/node/commit/89fe9edd08)] - **http2**: check if stream is not destroyed before sending trailers (Matteo Collina) [#22896](https://github.com/nodejs/node/pull/22896) +* [[`aa48192f9d`](https://github.com/nodejs/node/commit/aa48192f9d)] - **inspector**: add virtual destructor to WorkerDelegate (Daniel Bevenius) [#23215](https://github.com/nodejs/node/pull/23215) +* [[`16f7f52b24`](https://github.com/nodejs/node/commit/16f7f52b24)] - **inspector**: workers debugging (Eugene Ostroukhov) [#21364](https://github.com/nodejs/node/pull/21364) +* [[`f66e9abcb3`](https://github.com/nodejs/node/commit/f66e9abcb3)] - **inspector**: implemented V8InspectorClient::resourceNameToUrl (Alexey Kozyatinskiy) [#22251](https://github.com/nodejs/node/pull/22251) +* [[`1c3a2ebfcf`](https://github.com/nodejs/node/commit/1c3a2ebfcf)] - **inspector**: enable Inspector JS API in workers (Eugene Ostroukhov) [#22769](https://github.com/nodejs/node/pull/22769) +* [[`c40e2dd6c9`](https://github.com/nodejs/node/commit/c40e2dd6c9)] - **lib**: reword help text for clarity (Gireesh Punathil) [#23016](https://github.com/nodejs/node/pull/23016) +* [[`f38eff29e7`](https://github.com/nodejs/node/commit/f38eff29e7)] - **lib**: change abstract equal to strict equal (ZYSzys) [#22974](https://github.com/nodejs/node/pull/22974) +* [[`0140a98e05`](https://github.com/nodejs/node/commit/0140a98e05)] - **lib**: make DOMException attributes configurable and enumerable (Joyee Cheung) [#22550](https://github.com/nodejs/node/pull/22550) +* [[`5e7b1082d9`](https://github.com/nodejs/node/commit/5e7b1082d9)] - **lib**: set Symbol.toStringTag of DOMException (Joyee Cheung) [#22933](https://github.com/nodejs/node/pull/22933) +* [[`a7f4d5e134`](https://github.com/nodejs/node/commit/a7f4d5e134)] - **lib**: refactor variable declarations (ZYSzys) [#22643](https://github.com/nodejs/node/pull/22643) +* [[`fb68ef2e74`](https://github.com/nodejs/node/commit/fb68ef2e74)] - **lib**: added common.restoreStderr(); to end of file (Mark Abel) [#22487](https://github.com/nodejs/node/pull/22487) +* [[`600c225439`](https://github.com/nodejs/node/commit/600c225439)] - **(SEMVER-MINOR)** **module**: add createRequireFunction method (Gus Caplan) [#19360](https://github.com/nodejs/node/pull/19360) +* [[`a65bb42551`](https://github.com/nodejs/node/commit/a65bb42551)] - **net**: use connect() instead of connect.call() (Jackson Tian) [#23289](https://github.com/nodejs/node/pull/23289) +* [[`5a306748e9`](https://github.com/nodejs/node/commit/5a306748e9)] - **process**: allow reading from stdout/stderr sockets (Anna Henningsen) [#23053](https://github.com/nodejs/node/pull/23053) +* [[`66484b82c4`](https://github.com/nodejs/node/commit/66484b82c4)] - **(SEMVER-MINOR)** **process**: add `multipleResolves` event (Ruben Bridgewater) [#22218](https://github.com/nodejs/node/pull/22218) +* [[`e16dd6d165`](https://github.com/nodejs/node/commit/e16dd6d165)] - **repl**: refactor ERR\_SCRIPT\_EXECUTION\_INTERRUPTED stack handling (Ruben Bridgewater) [#22436](https://github.com/nodejs/node/pull/22436) +* [[`b1ffda6c17`](https://github.com/nodejs/node/commit/b1ffda6c17)] - **repl**: improve error output (Ruben Bridgewater) [#22436](https://github.com/nodejs/node/pull/22436) +* [[`cd69e1b6c3`](https://github.com/nodejs/node/commit/cd69e1b6c3)] - **src**: fix ToObject() usage in node\_http\_parser.cc (cjihrig) [#23314](https://github.com/nodejs/node/pull/23314) +* [[`5228ec4410`](https://github.com/nodejs/node/commit/5228ec4410)] - **src**: fix ToObject() usage in exceptions.cc (cjihrig) [#23314](https://github.com/nodejs/node/pull/23314) +* [[`4d761d4224`](https://github.com/nodejs/node/commit/4d761d4224)] - **src**: reduce variable scope in stream\_base.cc (cjihrig) [#23297](https://github.com/nodejs/node/pull/23297) +* [[`740741b279`](https://github.com/nodejs/node/commit/740741b279)] - **src**: reduce variable scope in node\_worker.cc (cjihrig) [#23297](https://github.com/nodejs/node/pull/23297) +* [[`56c2f5702f`](https://github.com/nodejs/node/commit/56c2f5702f)] - **src**: reduce variable scope in node\_trace\_writer.cc (cjihrig) [#23297](https://github.com/nodejs/node/pull/23297) +* [[`046fd987e4`](https://github.com/nodejs/node/commit/046fd987e4)] - **src**: reduce variable scope in node\_url.cc (cjihrig) [#23297](https://github.com/nodejs/node/pull/23297) +* [[`36c430796b`](https://github.com/nodejs/node/commit/36c430796b)] - **src**: remove unneeded variables in node\_crypto.cc (cjihrig) [#23297](https://github.com/nodejs/node/pull/23297) +* [[`902ba0ecb4`](https://github.com/nodejs/node/commit/902ba0ecb4)] - **src**: reduce variable scope in module\_wrap.cc (cjihrig) [#23297](https://github.com/nodejs/node/pull/23297) +* [[`402867c0a9`](https://github.com/nodejs/node/commit/402867c0a9)] - **src**: reduce variable scope in cares\_wrap.cc (cjihrig) [#23297](https://github.com/nodejs/node/pull/23297) +* [[`315bf257e5`](https://github.com/nodejs/node/commit/315bf257e5)] - **src**: fix ToObject() usage in node\_crypto.cc (cjihrig) [#23298](https://github.com/nodejs/node/pull/23298) +* [[`950ccee386`](https://github.com/nodejs/node/commit/950ccee386)] - **src**: name EmbededderGraph edges and use class names for nodes (Joyee Cheung) [#23072](https://github.com/nodejs/node/pull/23072) +* [[`390fc85ff0`](https://github.com/nodejs/node/commit/390fc85ff0)] - **src**: implement the new EmbedderGraph::AddEdge() (Joyee Cheung) [#22106](https://github.com/nodejs/node/pull/22106) +* [[`5a8396796d`](https://github.com/nodejs/node/commit/5a8396796d)] - **src**: use JS inheritance for `AsyncWrap` (Anna Henningsen) [#23094](https://github.com/nodejs/node/pull/23094) +* [[`894210ec12`](https://github.com/nodejs/node/commit/894210ec12)] - **src**: add virtual desctructor to Options class (Daniel Bevenius) [#23215](https://github.com/nodejs/node/pull/23215) +* [[`8f5fb6f90c`](https://github.com/nodejs/node/commit/8f5fb6f90c)] - **src**: clean up zlib write code (Anna Henningsen) [#23183](https://github.com/nodejs/node/pull/23183) +* [[`2da6f622dc`](https://github.com/nodejs/node/commit/2da6f622dc)] - **(SEMVER-MINOR)** **src**: deprecate `UVException()` without `Isolate\*` (Anna Henningsen) [#23175](https://github.com/nodejs/node/pull/23175) +* [[`e9a0cffbd6`](https://github.com/nodejs/node/commit/e9a0cffbd6)] - **(SEMVER-MINOR)** **src**: deprecate V8 date conversion helpers (Anna Henningsen) [#23179](https://github.com/nodejs/node/pull/23179) +* [[`a2c1ce24b5`](https://github.com/nodejs/node/commit/a2c1ce24b5)] - **src**: fix indentation for `AsyncResource` (Anna Henningsen) [#23177](https://github.com/nodejs/node/pull/23177) +* [[`64689edf76`](https://github.com/nodejs/node/commit/64689edf76)] - **src**: remove unused using declarations (Daniel Bevenius) [#23120](https://github.com/nodejs/node/pull/23120) +* [[`0202c6c808`](https://github.com/nodejs/node/commit/0202c6c808)] - **src**: remove unused locale.h (Daniel Bevenius) [#23120](https://github.com/nodejs/node/pull/23120) +* [[`20a4f14c57`](https://github.com/nodejs/node/commit/20a4f14c57)] - **src**: make req\_wrap a unique\_ptr in AfterConnect (Daniel Bevenius) [#23115](https://github.com/nodejs/node/pull/23115) +* [[`ce7fad5b79`](https://github.com/nodejs/node/commit/ce7fad5b79)] - **src**: use unique\_ptr for obj in SetWeak lambda (Daniel Bevenius) [#23117](https://github.com/nodejs/node/pull/23117) +* [[`7d7dc16240`](https://github.com/nodejs/node/commit/7d7dc16240)] - **src**: unique\_ptrs in few lambdas (Gireesh Punathil) [#23124](https://github.com/nodejs/node/pull/23124) +* [[`4bd3b6e332`](https://github.com/nodejs/node/commit/4bd3b6e332)] - **src**: refactor crypto code with RAII cleanup (Gireesh Punathil) [#23014](https://github.com/nodejs/node/pull/23014) +* [[`f3d09b6e4f`](https://github.com/nodejs/node/commit/f3d09b6e4f)] - **src**: simplify `MessagePort` construction code a bit (Anna Henningsen) [#23036](https://github.com/nodejs/node/pull/23036) +* [[`4d61c34b9e`](https://github.com/nodejs/node/commit/4d61c34b9e)] - **src**: fix a typo in the comment (Gireesh Punathil) [#23078](https://github.com/nodejs/node/pull/23078) +* [[`fa833828b2`](https://github.com/nodejs/node/commit/fa833828b2)] - **src**: added URL::FromFilePath method (Alexey Kozyatinskiy) [#22251](https://github.com/nodejs/node/pull/22251) +* [[`109aa63910`](https://github.com/nodejs/node/commit/109aa63910)] - **src**: cache and resue isolate and contex pointers (Gireesh Punathil) [#23024](https://github.com/nodejs/node/pull/23024) +* [[`2f659a3d74`](https://github.com/nodejs/node/commit/2f659a3d74)] - **src**: use RAII cleanup in node\_i18n.cc (Anna Henningsen) [#23021](https://github.com/nodejs/node/pull/23021) +* [[`90f1200be9`](https://github.com/nodejs/node/commit/90f1200be9)] - **src**: define zlib constants in node\_zlib.cc (Anna Henningsen) [#23019](https://github.com/nodejs/node/pull/23019) +* [[`d72867ec0c`](https://github.com/nodejs/node/commit/d72867ec0c)] - **src**: make `ZCtx::Init()` non-static (Anna Henningsen) [#23019](https://github.com/nodejs/node/pull/23019) +* [[`56b1a3cf6e`](https://github.com/nodejs/node/commit/56b1a3cf6e)] - **src**: refactor zlib dictionary to STL vector (Anna Henningsen) [#23019](https://github.com/nodejs/node/pull/23019) +* [[`76453f1878`](https://github.com/nodejs/node/commit/76453f1878)] - **src**: replace deprecated uses of FunctionTemplate::GetFunction (Andreas Haas) [#22993](https://github.com/nodejs/node/pull/22993) +* [[`cb3062aa42`](https://github.com/nodejs/node/commit/cb3062aa42)] - **src**: remove calls to SetWrapperClassId() (Joyee Cheung) [#22975](https://github.com/nodejs/node/pull/22975) +* [[`ab032e4ff4`](https://github.com/nodejs/node/commit/ab032e4ff4)] - **src**: refactor win32 `DebugProcess()` to use RAII cleanup (Anna Henningsen) [#22981](https://github.com/nodejs/node/pull/22981) +* [[`b6cd18517c`](https://github.com/nodejs/node/commit/b6cd18517c)] - **src**: add CheckOptions to Options classes (Daniel Bevenius) [#22943](https://github.com/nodejs/node/pull/22943) +* [[`ace6e07f0e`](https://github.com/nodejs/node/commit/ace6e07f0e)] - **src**: initialize pid variable before goto (Jeremy Apthorp) [#22961](https://github.com/nodejs/node/pull/22961) +* [[`25bf1f5e28`](https://github.com/nodejs/node/commit/25bf1f5e28)] - **stream**: improve buffer list inspection (Ruben Bridgewater) [#23109](https://github.com/nodejs/node/pull/23109) +* [[`2b77b94c05`](https://github.com/nodejs/node/commit/2b77b94c05)] - **streams**: refactor ReadableStream asyncIterator creation and a few fixes (Gus Caplan) [#23042](https://github.com/nodejs/node/pull/23042) +* [[`df54db667c`](https://github.com/nodejs/node/commit/df54db667c)] - **test**: remove internal errorCache property (Rich Trott) [#23304](https://github.com/nodejs/node/pull/23304) +* [[`70abcf2d10`](https://github.com/nodejs/node/commit/70abcf2d10)] - **test**: remove eslint-disable from fixtures (Rich Trott) [#23345](https://github.com/nodejs/node/pull/23345) +* [[`b2d3445644`](https://github.com/nodejs/node/commit/b2d3445644)] - **test**: read() on dir on AIX does not return EISDIR (Ben Noordhuis) [#23330](https://github.com/nodejs/node/pull/23330) +* [[`b523f13fa2`](https://github.com/nodejs/node/commit/b523f13fa2)] - **test**: add module require tests for certain package.json errors (Tom White) [#23285](https://github.com/nodejs/node/pull/23285) +* [[`45e0080cf1`](https://github.com/nodejs/node/commit/45e0080cf1)] - **test**: remove flaky designation for test (Rich Trott) [#22856](https://github.com/nodejs/node/pull/22856) +* [[`085de6fe18`](https://github.com/nodejs/node/commit/085de6fe18)] - **test**: swap arguments in strictEqual() (Duarte David) [#23204](https://github.com/nodejs/node/pull/23204) +* [[`a070842e97`](https://github.com/nodejs/node/commit/a070842e97)] - **test**: remove obsolete domain test (Julien Gilli) +* [[`cb68188805`](https://github.com/nodejs/node/commit/cb68188805)] - **test**: add stdin writable regression test (Anna Henningsen) [#23053](https://github.com/nodejs/node/pull/23053) +* [[`06b5ef3868`](https://github.com/nodejs/node/commit/06b5ef3868)] - **test**: terminate cluster worker in infinite loop (cjihrig) [#23165](https://github.com/nodejs/node/pull/23165) +* [[`9352d9d596`](https://github.com/nodejs/node/commit/9352d9d596)] - **test**: harden test-gc-http-client-timeout (Denys Otrishko) [#23184](https://github.com/nodejs/node/pull/23184) +* [[`748d9d22fa`](https://github.com/nodejs/node/commit/748d9d22fa)] - **test**: add process.stdin.end() TTY regression test (Matteo Collina) [#23051](https://github.com/nodejs/node/pull/23051) +* [[`44db98a7b6`](https://github.com/nodejs/node/commit/44db98a7b6)] - **test**: add more descriptive err message to assert (Josh Broomfield) [#23118](https://github.com/nodejs/node/pull/23118) +* [[`b2a1cf3793`](https://github.com/nodejs/node/commit/b2a1cf3793)] - **test**: mark some flakes (Refael Ackermann) [#23208](https://github.com/nodejs/node/pull/23208) +* [[`9b30a635e0`](https://github.com/nodejs/node/commit/9b30a635e0)] - **test**: improve test-gc-http-client (Rich Trott) [#23145](https://github.com/nodejs/node/pull/23145) +* [[`23525b0547`](https://github.com/nodejs/node/commit/23525b0547)] - **test**: replace localhost with os.hostname in fs-readfilesync (Denys Otrishko) [#23101](https://github.com/nodejs/node/pull/23101) +* [[`bebd7b2cdc`](https://github.com/nodejs/node/commit/bebd7b2cdc)] - **test**: fix flaky test-gc-net-timeout (Rich Trott) [#23139](https://github.com/nodejs/node/pull/23139) +* [[`efeb49d224`](https://github.com/nodejs/node/commit/efeb49d224)] - **test**: increase test coverage for fs.promises read (Jennifer Bland) [#22800](https://github.com/nodejs/node/pull/22800) +* [[`39c2a3f1c1`](https://github.com/nodejs/node/commit/39c2a3f1c1)] - **test**: improve test-gc-http-client-connaborted (Rich Trott) [#23091](https://github.com/nodejs/node/pull/23091) +* [[`48c1c428f9`](https://github.com/nodejs/node/commit/48c1c428f9)] - **test**: improve debugging information for http2 test (Rich Trott) [#23058](https://github.com/nodejs/node/pull/23058) +* [[`f486186e25`](https://github.com/nodejs/node/commit/f486186e25)] - **test**: remove setImmediate from timeout test (Rich Trott) [#23058](https://github.com/nodejs/node/pull/23058) +* [[`85c4ecb8a5`](https://github.com/nodejs/node/commit/85c4ecb8a5)] - **test**: test undefined in util (ZYSzys) [#22741](https://github.com/nodejs/node/pull/22741) +* [[`3e4af49157`](https://github.com/nodejs/node/commit/3e4af49157)] - **test**: add dns.onlookupall() to increase coverage (Masashi Hirano) [#22985](https://github.com/nodejs/node/pull/22985) +* [[`d68dfa9243`](https://github.com/nodejs/node/commit/d68dfa9243)] - **test**: console.table when `null` in data (ZYSzys) [#22974](https://github.com/nodejs/node/pull/22974) +* [[`4cda83dae2`](https://github.com/nodejs/node/commit/4cda83dae2)] - **test**: improve test-gc-http-client-onerror (Rich Trott) [#23090](https://github.com/nodejs/node/pull/23090) +* [[`52c6ee789b`](https://github.com/nodejs/node/commit/52c6ee789b)] - **test**: improve test-gc-http-client-timeout (Rich Trott) [#23088](https://github.com/nodejs/node/pull/23088) +* [[`69d3c08be1`](https://github.com/nodejs/node/commit/69d3c08be1)] - **test**: improve reliability of test-gc-http-client (Rich Trott) [#23087](https://github.com/nodejs/node/pull/23087) +* [[`a566f0f43e`](https://github.com/nodejs/node/commit/a566f0f43e)] - **test**: improve reliability of test-gc-net-timeout (Rich Trott) [#23086](https://github.com/nodejs/node/pull/23086) +* [[`c54e42362c`](https://github.com/nodejs/node/commit/c54e42362c)] - **test**: remove unnecessary assertions (Anna Henningsen) [#23040](https://github.com/nodejs/node/pull/23040) +* [[`adaf530cdb`](https://github.com/nodejs/node/commit/adaf530cdb)] - **test**: check parameter type of fs.mkdir() (Masashi Hirano) [#22616](https://github.com/nodejs/node/pull/22616) +* [[`a3b3485b34`](https://github.com/nodejs/node/commit/a3b3485b34)] - **test**: add comment describing test-fs-mkdir (Jennifer Bland) [#22424](https://github.com/nodejs/node/pull/22424) +* [[`5d4bec3e0f`](https://github.com/nodejs/node/commit/5d4bec3e0f)] - **test**: fix flaky sequential/test-fs-watch-system-limit (Anna Henningsen) [#23038](https://github.com/nodejs/node/pull/23038) +* [[`9de6b26a0c`](https://github.com/nodejs/node/commit/9de6b26a0c)] - **test**: remove string literals for strictEquals/notStrictEquals (MaleDong) [#22891](https://github.com/nodejs/node/pull/22891) +* [[`43e3cf93e8`](https://github.com/nodejs/node/commit/43e3cf93e8)] - **test**: do not export common.leakedGlobals() (Rich Trott) [#22965](https://github.com/nodejs/node/pull/22965) +* [[`70ccec2d91`](https://github.com/nodejs/node/commit/70ccec2d91)] - **test**: increase coverage for worker\_threads (Rich Trott) [#22942](https://github.com/nodejs/node/pull/22942) +* [[`83278b23a7`](https://github.com/nodejs/node/commit/83278b23a7)] - **test**: fix flaky key pair generation test (Tobias Nießen) [#22980](https://github.com/nodejs/node/pull/22980) +* [[`d38ce82756`](https://github.com/nodejs/node/commit/d38ce82756)] - **test**: remove common.hasSmallICU (Rich Trott) [#22937](https://github.com/nodejs/node/pull/22937) +* [[`dcce2d67ae`](https://github.com/nodejs/node/commit/dcce2d67ae)] - **test**: add tests to check error in dns.lookupService. (Masashi Hirano) [#22908](https://github.com/nodejs/node/pull/22908) +* [[`079760f28b`](https://github.com/nodejs/node/commit/079760f28b)] - **test**: mark some tests as flaky (João Reis) [#22941](https://github.com/nodejs/node/pull/22941) +* [[`4436a3d660`](https://github.com/nodejs/node/commit/4436a3d660)] - **timers**: use custom inspection for linked lists (Ruben Bridgewater) [#23108](https://github.com/nodejs/node/pull/23108) +* [[`4b976df9e2`](https://github.com/nodejs/node/commit/4b976df9e2)] - **tls**: fix DEP0083 after upgrading to OpenSSL 1.1.0 (Tobias Nießen) [#22953](https://github.com/nodejs/node/pull/22953) +* [[`acc4a761b7`](https://github.com/nodejs/node/commit/acc4a761b7)] - **tools**: make Travis commit linting more robust (Rich Trott) [#23397](https://github.com/nodejs/node/pull/23397) +* [[`e2a6e051b3`](https://github.com/nodejs/node/commit/e2a6e051b3)] - **tools**: apply linting to first commit in PRs (Rich Trott) [#22452](https://github.com/nodejs/node/pull/22452) +* [[`42e67a4e68`](https://github.com/nodejs/node/commit/42e67a4e68)] - **tools**: remove useless assignment from configure.py (Gus Caplan) [#23200](https://github.com/nodejs/node/pull/23200) +* [[`1010ef5df7`](https://github.com/nodejs/node/commit/1010ef5df7)] - **tools**: fix ICU shrinker and docs (Steven R. Loomis) [#23266](https://github.com/nodejs/node/pull/23266) +* [[`d7031df415`](https://github.com/nodejs/node/commit/d7031df415)] - **tools**: allow input for TTY tests (Anna Henningsen) [#23053](https://github.com/nodejs/node/pull/23053) +* [[`1a92335543`](https://github.com/nodejs/node/commit/1a92335543)] - **tools**: unify .editorconfig rules for 2-space (Roman Reiss) [#23163](https://github.com/nodejs/node/pull/23163) +* [[`ef00e5c967`](https://github.com/nodejs/node/commit/ef00e5c967)] - **tools**: fix cpplint --quiet option (Daniel Bevenius) [#23075](https://github.com/nodejs/node/pull/23075) +* [[`1cbc2ee034`](https://github.com/nodejs/node/commit/1cbc2ee034)] - **tools**: update ESLint to 5.6.1 (cjihrig) [#23149](https://github.com/nodejs/node/pull/23149) +* [[`f6fc7e7aa5`](https://github.com/nodejs/node/commit/f6fc7e7aa5)] - **tools**: .eslintrc.js messages "default" typo style (Lovingly) [#22868](https://github.com/nodejs/node/pull/22868) +* [[`a22485d8f1`](https://github.com/nodejs/node/commit/a22485d8f1)] - **(SEMVER-MINOR)** **tools**: add bash completion for node (Daniel Bevenius) [#20713](https://github.com/nodejs/node/pull/20713) +* [[`a6562685c3`](https://github.com/nodejs/node/commit/a6562685c3)] - ***Revert*** "**tools,gyp**: don't force build actions with multiple outputs" (Sakthipriyan Vairamani (thefourtheye)) [#23257](https://github.com/nodejs/node/pull/23257) +* [[`73917387f4`](https://github.com/nodejs/node/commit/73917387f4)] - **tools,gyp**: cosmetic change to GYP `make` generator outputs (Refael Ackermann) [#23156](https://github.com/nodejs/node/pull/23156) +* [[`d8cedf545e`](https://github.com/nodejs/node/commit/d8cedf545e)] - **tools,gyp**: don't force build actions with multiple outputs (Refael Ackermann) [#23156](https://github.com/nodejs/node/pull/23156) +* [[`bf17708aa2`](https://github.com/nodejs/node/commit/bf17708aa2)] - **tty**: document `WriteStream.cursorTo()` and others (Umang Raghuvanshi) [#22893](https://github.com/nodejs/node/pull/22893) +* [[`9c36827e94`](https://github.com/nodejs/node/commit/9c36827e94)] - **(SEMVER-MINOR)** **tty**: make `readStream.setRawMode()` return `this` (Alexander Mills) [#22950](https://github.com/nodejs/node/pull/22950) +* [[`36028caf8c`](https://github.com/nodejs/node/commit/36028caf8c)] - **tty**: handle setRawMode errors (Nikolai Vavilov) [#22886](https://github.com/nodejs/node/pull/22886) +* [[`d22ee2c698`](https://github.com/nodejs/node/commit/d22ee2c698)] - **url**: use foreach-style C++ loop (Tobias Nießen) [#23138](https://github.com/nodejs/node/pull/23138) +* [[`f1b1b73c2b`](https://github.com/nodejs/node/commit/f1b1b73c2b)] - **(SEMVER-MINOR)** **url**: provide pathToFileURL and fileURLToPath (guybedford) [#22506](https://github.com/nodejs/node/pull/22506) +* [[`384221e75c`](https://github.com/nodejs/node/commit/384221e75c)] - **(SEMVER-MINOR)** **util**: support BigInt in util.format (Masashi Hirano) [#22097](https://github.com/nodejs/node/pull/22097) +* [[`77de1beaf0`](https://github.com/nodejs/node/commit/77de1beaf0)] - **util**: move inspect in separate file (Ruben Bridgewater) [#22845](https://github.com/nodejs/node/pull/22845) +* [[`f2dfebb7b4`](https://github.com/nodejs/node/commit/f2dfebb7b4)] - **util**: update definition of DISALLOW\_COPY\_AND\_ASSIGN macro (Nitish Sakhawalkar) [#23092](https://github.com/nodejs/node/pull/23092) +* [[`68eaa8789a`](https://github.com/nodejs/node/commit/68eaa8789a)] - **(SEMVER-MINOR)** **util**: add order option to `.inspect()` (Ruben Bridgewater) [#22788](https://github.com/nodejs/node/pull/22788) +* [[`a2a1ebfecf`](https://github.com/nodejs/node/commit/a2a1ebfecf)] - **(SEMVER-MINOR)** **util**: use a shared symbol for util.inspect.custom (chocolateboy) [#20857](https://github.com/nodejs/node/pull/20857) +* [[`077e7e0ce7`](https://github.com/nodejs/node/commit/077e7e0ce7)] - **util**: fix indentationLvl when exceeding max call stack size (Ruben Bridgewater) [#22787](https://github.com/nodejs/node/pull/22787) +* [[`5a13e66088`](https://github.com/nodejs/node/commit/5a13e66088)] - **util**: improve inspect performance (Ruben Bridgewater) [#22503](https://github.com/nodejs/node/pull/22503) +* [[`92e0f38a65`](https://github.com/nodejs/node/commit/92e0f38a65)] - **util**: remove outdated TODO (Ruben Bridgewater) [#22503](https://github.com/nodejs/node/pull/22503) +* [[`3b895d1258`](https://github.com/nodejs/node/commit/3b895d1258)] - **win,msi**: display license notes before installing tools (João Reis) [#23044](https://github.com/nodejs/node/pull/23044) +* [[`cf284c80a9`](https://github.com/nodejs/node/commit/cf284c80a9)] - **win,msi**: install Boxstarter from elevated shell (João Reis) [#22988](https://github.com/nodejs/node/pull/22988) +* [[`2b7e18dec5`](https://github.com/nodejs/node/commit/2b7e18dec5)] - **win,msi**: highlight installation of 3rd-party tools (Tobias Nießen) [#23003](https://github.com/nodejs/node/pull/23003) +* [[`ebf36cd180`](https://github.com/nodejs/node/commit/ebf36cd180)] - **(SEMVER-MINOR)** **win,msi**: install tools for native modules (João Reis) [#22645](https://github.com/nodejs/node/pull/22645) +* [[`c34db7a9c2`](https://github.com/nodejs/node/commit/c34db7a9c2)] - **worker**: reduce `MessagePort` prototype to documented API (Anna Henningsen) [#23037](https://github.com/nodejs/node/pull/23037) +* [[`2e30a6897d`](https://github.com/nodejs/node/commit/2e30a6897d)] - **worker**: hide MessagePort init function behind symbol (Anna Henningsen) [#23037](https://github.com/nodejs/node/pull/23037) +* [[`b5889d0b84`](https://github.com/nodejs/node/commit/b5889d0b84)] - **worker**: only stop inspector if started (Anna Henningsen) [#22927](https://github.com/nodejs/node/pull/22927) +* [[`7639390032`](https://github.com/nodejs/node/commit/7639390032)] - **worker,coverage**: support V8 coverage generation (Anna Henningsen) [#22928](https://github.com/nodejs/node/pull/22928) +* [[`18cbde5ade`](https://github.com/nodejs/node/commit/18cbde5ade)] - **zlib**: simplify flushing mechanism (Anna Henningsen) [#23186](https://github.com/nodejs/node/pull/23186) +* [[`e749a28c55`](https://github.com/nodejs/node/commit/e749a28c55)] - **zlib**: use common owner symbol to access JS wrapper (Anna Henningsen) [#23189](https://github.com/nodejs/node/pull/23189) +* [[`a6b55c73b0`](https://github.com/nodejs/node/commit/a6b55c73b0)] - **zlib**: move, rename, document internal params() cb (Anna Henningsen) [#23187](https://github.com/nodejs/node/pull/23187) + ## 2018-09-20, Version 10.11.0 (Current), @targos diff --git a/lib/_http_agent.js b/lib/_http_agent.js index 1a2920cf09..97c5ab604f 100644 --- a/lib/_http_agent.js +++ b/lib/_http_agent.js @@ -167,7 +167,7 @@ Agent.prototype.addRequest = function addRequest(req, options, port/* legacy */, var socket = this.freeSockets[name].shift(); // Guard against an uninitialized or user supplied Socket. if (socket._handle && typeof socket._handle.asyncReset === 'function') { - // Assign the handle a new asyncId and run any init() hooks. + // Assign the handle a new asyncId and run any destroy()/init() hooks. socket._handle.asyncReset(); socket[async_id_symbol] = socket._handle.getAsyncId(); } diff --git a/lib/_http_client.js b/lib/_http_client.js index c83800a93b..d91b43516f 100644 --- a/lib/_http_client.js +++ b/lib/_http_client.js @@ -47,6 +47,7 @@ const { ERR_UNESCAPED_CHARACTERS } = require('internal/errors').codes; const { validateTimerDuration } = require('internal/timers'); +const is_reused_symbol = require('internal/freelist').symbols.is_reused_symbol; const INVALID_PATH_REGEX = /[^\u0021-\u00ff]/; @@ -631,7 +632,7 @@ function tickOnSocket(req, socket) { var parser = parsers.alloc(); req.socket = socket; req.connection = socket; - parser.reinitialize(HTTPParser.RESPONSE); + parser.reinitialize(HTTPParser.RESPONSE, parser[is_reused_symbol]); parser.socket = socket; parser.outgoing = req; req.parser = parser; diff --git a/lib/_http_common.js b/lib/_http_common.js index 1de0ee6025..b37814f783 100644 --- a/lib/_http_common.js +++ b/lib/_http_common.js @@ -23,7 +23,7 @@ const { methods, HTTPParser } = internalBinding('http_parser'); -const FreeList = require('internal/freelist'); +const { FreeList } = require('internal/freelist'); const { ondrain } = require('internal/http'); const incoming = require('_http_incoming'); const { diff --git a/lib/_http_server.js b/lib/_http_server.js index cc1a428cd6..3b2d7f5041 100644 --- a/lib/_http_server.js +++ b/lib/_http_server.js @@ -42,6 +42,7 @@ const { defaultTriggerAsyncIdScope, getOrSetAsyncId } = require('internal/async_hooks'); +const is_reused_symbol = require('internal/freelist').symbols.is_reused_symbol; const { IncomingMessage } = require('_http_incoming'); const { ERR_HTTP_HEADERS_SENT, @@ -338,7 +339,7 @@ function connectionListenerInternal(server, socket) { socket.on('timeout', socketOnTimeout); var parser = parsers.alloc(); - parser.reinitialize(HTTPParser.REQUEST); + parser.reinitialize(HTTPParser.REQUEST, parser[is_reused_symbol]); parser.socket = socket; socket.parser = parser; diff --git a/lib/_stream_readable.js b/lib/_stream_readable.js index 2b9600f0fd..488d10a10b 100644 --- a/lib/_stream_readable.js +++ b/lib/_stream_readable.js @@ -42,7 +42,7 @@ const { emitExperimentalWarning } = require('internal/util'); // Lazy loaded to improve the startup performance. let StringDecoder; -let ReadableAsyncIterator; +let createReadableStreamAsyncIterator; util.inherits(Readable, Stream); @@ -990,9 +990,11 @@ Readable.prototype.wrap = function(stream) { Readable.prototype[Symbol.asyncIterator] = function() { emitExperimentalWarning('Readable[Symbol.asyncIterator]'); - if (ReadableAsyncIterator === undefined) - ReadableAsyncIterator = require('internal/streams/async_iterator'); - return new ReadableAsyncIterator(this); + if (createReadableStreamAsyncIterator === undefined) { + createReadableStreamAsyncIterator = + require('internal/streams/async_iterator'); + } + return createReadableStreamAsyncIterator(this); }; Object.defineProperty(Readable.prototype, 'readableHighWaterMark', { diff --git a/lib/assert.js b/lib/assert.js index 0f3d770358..9990d0e888 100644 --- a/lib/assert.js +++ b/lib/assert.js @@ -27,12 +27,14 @@ const { codes: { ERR_INVALID_ARG_VALUE, ERR_INVALID_RETURN_VALUE } } = require('internal/errors'); -const { AssertionError, errorCache } = require('internal/assert'); +const { AssertionError } = require('internal/assert'); const { openSync, closeSync, readSync } = require('fs'); const { inspect, types: { isPromise, isRegExp } } = require('util'); const { EOL } = require('internal/constants'); const { NativeModule } = require('internal/bootstrap/loaders'); +const errorCache = new Map(); + let isDeepEqual; let isDeepStrictEqual; let parseExpressionAt; diff --git a/lib/buffer.js b/lib/buffer.js index f274c51739..c7ffa42a54 100644 --- a/lib/buffer.js +++ b/lib/buffer.js @@ -37,14 +37,7 @@ const { kMaxLength, kStringMaxLength } = process.binding('buffer'); -// We cannot use internalBinding unconditionally here because of the way -// that test/parallel/test-buffer-bindingobj-no-zerofill.js is written. -let isAnyArrayBuffer; -try { - isAnyArrayBuffer = internalBinding('types').isAnyArrayBuffer; -} catch (e) { - isAnyArrayBuffer = require('util').types.isAnyArrayBuffer; -} +const { isAnyArrayBuffer } = internalBinding('types'); const { customInspectSymbol, isInsideNodeModules, @@ -1078,7 +1071,7 @@ if (process.binding('config').hasIntl) { const { icuErrName, transcode: _transcode - } = process.binding('icu'); + } = internalBinding('icu'); // Transcodes the Buffer from one encoding to another, returning a new // Buffer instance. diff --git a/lib/internal/assert.js b/lib/internal/assert.js index e174cddb60..829f666319 100644 --- a/lib/internal/assert.js +++ b/lib/internal/assert.js @@ -396,6 +396,5 @@ class AssertionError extends Error { } module.exports = { - AssertionError, - errorCache: new Map() + AssertionError }; diff --git a/lib/internal/bootstrap/node.js b/lib/internal/bootstrap/node.js index 70de4bfa41..770bb78f73 100644 --- a/lib/internal/bootstrap/node.js +++ b/lib/internal/bootstrap/node.js @@ -128,7 +128,7 @@ const browserGlobals = !process._noBrowserGlobals; if (browserGlobals) { - // we are setting this here to foward it to the inspector later + // we are setting this here to forward it to the inspector later perThreadSetup.originalConsole = global.console; setupGlobalTimeouts(); setupGlobalConsole(); @@ -393,6 +393,7 @@ new SafeSet([ 'cares_wrap', 'fs_event_wrap', + 'icu', 'udp_wrap', 'uv', 'pipe_wrap', @@ -653,7 +654,7 @@ function setupProcessICUVersions() { const icu = process.binding('config').hasIntl ? - process.binding('icu') : undefined; + internalBinding('icu') : undefined; if (!icu) return; // no Intl/ICU: nothing to add here. // With no argument, getVersion() returns a comma separated list // of possible types. diff --git a/lib/internal/encoding.js b/lib/internal/encoding.js index 161ae72a19..b2448144b0 100644 --- a/lib/internal/encoding.js +++ b/lib/internal/encoding.js @@ -356,7 +356,7 @@ function makeTextDecoderICU() { decode: _decode, getConverter, hasConverter - } = process.binding('icu'); + } = internalBinding('icu'); class TextDecoder { constructor(encoding = 'utf-8', options = {}) { diff --git a/lib/internal/freelist.js b/lib/internal/freelist.js index 7e9cef9528..04d684e833 100644 --- a/lib/internal/freelist.js +++ b/lib/internal/freelist.js @@ -1,5 +1,7 @@ 'use strict'; +const is_reused_symbol = Symbol('isReused'); + class FreeList { constructor(name, max, ctor) { this.name = name; @@ -9,9 +11,15 @@ class FreeList { } alloc() { - return this.list.length ? - this.list.pop() : - this.ctor.apply(this, arguments); + let item; + if (this.list.length > 0) { + item = this.list.pop(); + item[is_reused_symbol] = true; + } else { + item = this.ctor.apply(this, arguments); + item[is_reused_symbol] = false; + } + return item; } free(obj) { @@ -23,4 +31,9 @@ class FreeList { } } -module.exports = FreeList; +module.exports = { + FreeList, + symbols: { + is_reused_symbol + } +}; diff --git a/lib/internal/http2/core.js b/lib/internal/http2/core.js index b08008857e..4e9ab05af5 100644 --- a/lib/internal/http2/core.js +++ b/lib/internal/http2/core.js @@ -761,7 +761,7 @@ const proxySocketHandler = { // indicate if the ping was successful or not. The duration indicates the // number of milliseconds elapsed since the ping was sent and the ack // received. The payload is a Buffer containing the 8 bytes of payload -// data received on the PING acknowlegement. +// data received on the PING acknowledgement. function pingCallback(cb) { return function pingCallback(ack, duration, payload) { if (ack) { diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js index ec5e9d491f..70ae4c4ef1 100644 --- a/lib/internal/modules/cjs/loader.js +++ b/lib/internal/modules/cjs/loader.js @@ -218,16 +218,6 @@ function tryExtensions(p, exts, isMain) { return false; } -function readExtensions() { - const exts = Object.keys(Module._extensions); - for (var i = 0, j = 0; i < exts.length; ++i) { - if (path.extname(exts[i]) === '') - exts[j++] = exts[i]; - } - exts.length = j; - return exts; -} - var warned = false; Module._findPath = function(request, paths, isMain) { if (path.isAbsolute(request)) { @@ -284,7 +274,7 @@ Module._findPath = function(request, paths, isMain) { if (!filename) { // try it with each of the extensions if (exts === undefined) - exts = readExtensions(); + exts = Object.keys(Module._extensions); filename = tryExtensions(basePath, exts, isMain); } } @@ -292,7 +282,7 @@ Module._findPath = function(request, paths, isMain) { if (!filename && rc === 1) { // Directory. // try it with each of the extensions at "index" if (exts === undefined) - exts = readExtensions(); + exts = Object.keys(Module._extensions); filename = tryPackage(basePath, exts, isMain); if (!filename) { filename = tryExtensions(path.resolve(basePath, 'index'), exts, isMain); diff --git a/lib/internal/readline.js b/lib/internal/readline.js index 45125db0c2..0f7d969d20 100644 --- a/lib/internal/readline.js +++ b/lib/internal/readline.js @@ -31,7 +31,7 @@ CSI.kClearLine = CSI`2K`; CSI.kClearScreenDown = CSI`0J`; if (process.binding('config').hasIntl) { - const icu = process.binding('icu'); + const icu = internalBinding('icu'); getStringWidth = function getStringWidth(str, options) { options = options || {}; if (!Number.isInteger(str)) diff --git a/lib/internal/repl/recoverable.js b/lib/internal/repl/recoverable.js index 5d270f5146..023de2f7ab 100644 --- a/lib/internal/repl/recoverable.js +++ b/lib/internal/repl/recoverable.js @@ -5,7 +5,7 @@ const { tokTypes: tt } = acorn; // If the error is that we've unexpectedly ended the input, // then let the user try to recover by adding more input. -// Note: `e` (the original exception) is not used by the current implemention, +// Note: `e` (the original exception) is not used by the current implementation, // but may be needed in the future. function isRecoverableError(e, code) { let recoverable = false; diff --git a/lib/internal/streams/async_iterator.js b/lib/internal/streams/async_iterator.js index 0e34573d87..91c473ee9d 100644 --- a/lib/internal/streams/async_iterator.js +++ b/lib/internal/streams/async_iterator.js @@ -8,12 +8,9 @@ const kLastPromise = Symbol('lastPromise'); const kHandlePromise = Symbol('handlePromise'); const kStream = Symbol('stream'); -const AsyncIteratorRecord = class AsyncIteratorRecord { - constructor(value, done) { - this.done = done; - this.value = value; - } -}; +function createIterResult(value, done) { + return { value, done }; +} function readAndResolve(iter) { const resolve = iter[kLastResolve]; @@ -26,7 +23,7 @@ function readAndResolve(iter) { iter[kLastPromise] = null; iter[kLastResolve] = null; iter[kLastReject] = null; - resolve(new AsyncIteratorRecord(data, false)); + resolve(createIterResult(data, false)); } } } @@ -43,7 +40,7 @@ function onEnd(iter) { iter[kLastPromise] = null; iter[kLastResolve] = null; iter[kLastReject] = null; - resolve(new AsyncIteratorRecord(null, true)); + resolve(createIterResult(null, true)); } iter[kEnded] = true; } @@ -69,39 +66,13 @@ function wrapForNext(lastPromise, iter) { }; } -const ReadableAsyncIterator = class ReadableAsyncIterator { - constructor(stream) { - this[kStream] = stream; - this[kLastResolve] = null; - this[kLastReject] = null; - this[kError] = null; - this[kEnded] = false; - this[kLastPromise] = null; - - stream.on('readable', onReadable.bind(null, this)); - stream.on('end', onEnd.bind(null, this)); - stream.on('error', onError.bind(null, this)); - - // the function passed to new Promise - // is cached so we avoid allocating a new - // closure at every run - this[kHandlePromise] = (resolve, reject) => { - const data = this[kStream].read(); - if (data) { - this[kLastPromise] = null; - this[kLastResolve] = null; - this[kLastReject] = null; - resolve(new AsyncIteratorRecord(data, false)); - } else { - this[kLastResolve] = resolve; - this[kLastReject] = reject; - } - }; - } +const AsyncIteratorPrototype = Object.getPrototypeOf( + Object.getPrototypeOf(async function* () {}).prototype); +const ReadableStreamAsyncIteratorPrototype = Object.setPrototypeOf({ get stream() { return this[kStream]; - } + }, next() { // if we have detected an error in the meanwhile @@ -112,7 +83,7 @@ const ReadableAsyncIterator = class ReadableAsyncIterator { } if (this[kEnded]) { - return Promise.resolve(new AsyncIteratorRecord(null, true)); + return Promise.resolve(createIterResult(null, true)); } // if we have multiple next() calls @@ -129,7 +100,7 @@ const ReadableAsyncIterator = class ReadableAsyncIterator { // without triggering the next() queue const data = this[kStream].read(); if (data !== null) { - return Promise.resolve(new AsyncIteratorRecord(data, false)); + return Promise.resolve(createIterResult(data, false)); } promise = new Promise(this[kHandlePromise]); @@ -138,7 +109,7 @@ const ReadableAsyncIterator = class ReadableAsyncIterator { this[kLastPromise] = promise; return promise; - } + }, return() { // destroy(err, cb) is a private API @@ -150,10 +121,45 @@ const ReadableAsyncIterator = class ReadableAsyncIterator { reject(err); return; } - resolve(new AsyncIteratorRecord(null, true)); + resolve(createIterResult(null, true)); }); }); - } + }, +}, AsyncIteratorPrototype); + +const createReadableStreamAsyncIterator = (stream) => { + const iterator = Object.create(ReadableStreamAsyncIteratorPrototype, { + [kStream]: { value: stream, writable: true }, + [kLastResolve]: { value: null, writable: true }, + [kLastReject]: { value: null, writable: true }, + [kError]: { value: null, writable: true }, + [kEnded]: { value: false, writable: true }, + [kLastPromise]: { value: null, writable: true }, + // the function passed to new Promise + // is cached so we avoid allocating a new + // closure at every run + [kHandlePromise]: { + value: (resolve, reject) => { + const data = iterator[kStream].read(); + if (data) { + iterator[kLastPromise] = null; + iterator[kLastResolve] = null; + iterator[kLastReject] = null; + resolve(createIterResult(data, false)); + } else { + iterator[kLastResolve] = resolve; + iterator[kLastReject] = reject; + } + }, + writable: true, + }, + }); + + stream.on('readable', onReadable.bind(null, iterator)); + stream.on('end', onEnd.bind(null, iterator)); + stream.on('error', onError.bind(null, iterator)); + + return iterator; }; -module.exports = ReadableAsyncIterator; +module.exports = createReadableStreamAsyncIterator; diff --git a/lib/net.js b/lib/net.js index 8fdd7bd86a..f7d55ca646 100644 --- a/lib/net.js +++ b/lib/net.js @@ -152,7 +152,7 @@ function connect(...args) { socket.setTimeout(options.timeout); } - return Socket.prototype.connect.call(socket, normalized); + return socket.connect(normalized); } diff --git a/lib/url.js b/lib/url.js index ba2033b4e5..db7369fed0 100644 --- a/lib/url.js +++ b/lib/url.js @@ -22,7 +22,7 @@ 'use strict'; const { toASCII } = process.binding('config').hasIntl ? - process.binding('icu') : require('punycode'); + internalBinding('icu') : require('punycode'); const { hexTable } = require('internal/querystring'); diff --git a/lib/util.js b/lib/util.js index 27affda109..2e42beb58b 100644 --- a/lib/util.js +++ b/lib/util.js @@ -102,7 +102,13 @@ function formatWithOptions(inspectOptions, f) { tempStr = tryStringify(arguments[a++]); break; case 100: // 'd' - tempStr = `${Number(arguments[a++])}`; + const tempNum = arguments[a++]; + // eslint-disable-next-line valid-typeof + if (typeof tempNum === 'bigint') { + tempStr = `${tempNum}n`; + } else { + tempStr = `${Number(tempNum)}`; + } break; case 79: // 'O' tempStr = inspect(arguments[a++], inspectOptions); @@ -117,7 +123,13 @@ function formatWithOptions(inspectOptions, f) { break; } case 105: // 'i' - tempStr = `${parseInt(arguments[a++])}`; + const tempInteger = arguments[a++]; + // eslint-disable-next-line valid-typeof + if (typeof tempInteger === 'bigint') { + tempStr = `${tempInteger}n`; + } else { + tempStr = `${parseInt(tempInteger)}`; + } break; case 102: // 'f' tempStr = `${parseFloat(arguments[a++])}`; diff --git a/lib/zlib.js b/lib/zlib.js index 68d06fa93f..5d5ef3e083 100644 --- a/lib/zlib.js +++ b/lib/zlib.js @@ -311,10 +311,9 @@ function Zlib(opts, mode) { this._level = level; this._strategy = strategy; this._chunkSize = chunkSize; - this._flushFlag = flush; - this._scheduledFlushFlag = Z_NO_FLUSH; - this._origFlushFlag = flush; + this._defaultFlushFlag = flush; this._finishFlushFlag = finishFlush; + this._nextFlush = -1; this._info = opts && opts.info; this.once('end', this.close); } @@ -398,6 +397,7 @@ function maxFlush(a, b) { return flushiness[a] > flushiness[b] ? a : b; } +const flushBuffer = Buffer.alloc(0); Zlib.prototype.flush = function flush(kind, callback) { var ws = this._writableState; @@ -412,21 +412,13 @@ Zlib.prototype.flush = function flush(kind, callback) { } else if (ws.ending) { if (callback) this.once('end', callback); - } else if (ws.needDrain) { - const alreadyHadFlushScheduled = this._scheduledFlushFlag !== Z_NO_FLUSH; - this._scheduledFlushFlag = maxFlush(kind, this._scheduledFlushFlag); - - // If a callback was passed, always register a new `drain` + flush handler, - // mostly because that's simpler and flush callbacks piling up is a rare - // thing anyway. - if (!alreadyHadFlushScheduled || callback) { - const drainHandler = () => this.flush(this._scheduledFlushFlag, callback); - this.once('drain', drainHandler); - } + } else if (this._nextFlush !== -1) { + // This means that there is a flush currently in the write queue. + // We currently coalesce this flush into the pending one. + this._nextFlush = maxFlush(this._nextFlush, kind); } else { - this._flushFlag = kind; - this.write(Buffer.alloc(0), '', callback); - this._scheduledFlushFlag = Z_NO_FLUSH; + this._nextFlush = kind; + this.write(flushBuffer, '', callback); } }; @@ -436,20 +428,18 @@ Zlib.prototype.close = function close(callback) { }; Zlib.prototype._transform = function _transform(chunk, encoding, cb) { - // If it's the last chunk, or a final flush, we use the Z_FINISH flush flag - // (or whatever flag was provided using opts.finishFlush). - // If it's explicitly flushing at some other time, then we use - // Z_FULL_FLUSH. Otherwise, use the original opts.flush flag. - var flushFlag; + var flushFlag = this._defaultFlushFlag; + // We use a 'fake' zero-length chunk to carry information about flushes from + // the public API to the actual stream implementation. + if (chunk === flushBuffer) { + flushFlag = this._nextFlush; + this._nextFlush = -1; + } + + // For the last chunk, also apply `_finishFlushFlag`. var ws = this._writableState; if ((ws.ending || ws.ended) && ws.length === chunk.byteLength) { - flushFlag = this._finishFlushFlag; - } else { - flushFlag = this._flushFlag; - // once we've flushed the last of the queue, stop flushing and - // go back to the normal behavior. - if (chunk.byteLength >= ws.length) - this._flushFlag = this._origFlushFlag; + flushFlag = maxFlush(flushFlag, this._finishFlushFlag); } processChunk(this, chunk, flushFlag, cb); }; diff --git a/node.gyp b/node.gyp index e33628816c..a3b0cd1838 100644 --- a/node.gyp +++ b/node.gyp @@ -629,6 +629,7 @@ 'process_outputs_as_sources': 1, 'inputs': [ '<@(library_files)', + 'config.gypi', 'tools/check_macros.py' ], 'outputs': [ @@ -648,7 +649,7 @@ 'action': [ 'python', 'tools/js2c.py', '<@(_outputs)', - '<@(_inputs)', 'config.gypi', + '<@(_inputs)', ], }, ], diff --git a/src/aliased_buffer.h b/src/aliased_buffer.h index 931b275364..2642b2b2a7 100644 --- a/src/aliased_buffer.h +++ b/src/aliased_buffer.h @@ -14,7 +14,7 @@ namespace node { * going through JS, and the data is then available to user's via the exposed * JS object. * - * While this technique is computationaly efficient, it is effectively a + * While this technique is computationally efficient, it is effectively a * write to JS program state w/out going through the standard * (monitored) API. Thus any VM capabilities to detect the modification are * circumvented. diff --git a/src/async_wrap.cc b/src/async_wrap.cc index 2b163a5fa2..596fcc8356 100644 --- a/src/async_wrap.cc +++ b/src/async_wrap.cc @@ -563,6 +563,7 @@ AsyncWrap::AsyncWrap(Environment* env, CHECK_NE(provider, PROVIDER_NONE); CHECK_GE(object->InternalFieldCount(), 1); + async_id_ = -1; // Use AsyncReset() call to execute the init() callbacks. AsyncReset(execution_async_id, silent); } @@ -606,6 +607,14 @@ void AsyncWrap::EmitDestroy(Environment* env, double async_id) { // and reused over their lifetime. This way a new uid can be assigned when // the resource is pulled out of the pool and put back into use. void AsyncWrap::AsyncReset(double execution_async_id, bool silent) { + if (async_id_ != -1) { + // This instance was in use before, we have already emitted an init with + // its previous async_id and need to emit a matching destroy for that + // before generating a new async_id. + EmitDestroy(env(), async_id_); + } + + // Now we can assign a new async_id_ to this instance. async_id_ = execution_async_id == -1 ? env()->new_async_id() : execution_async_id; trigger_async_id_ = env()->get_default_trigger_async_id(); diff --git a/src/cares_wrap.cc b/src/cares_wrap.cc index 3fb00859d3..1a83a1cf7a 100644 --- a/src/cares_wrap.cc +++ b/src/cares_wrap.cc @@ -429,7 +429,6 @@ void cares_wrap_hostent_cpy(struct hostent* dest, struct hostent* src) { /* copy `h_aliases` */ size_t alias_count; - size_t cur_alias_length; for (alias_count = 0; src->h_aliases[alias_count] != nullptr; alias_count++) { @@ -437,9 +436,9 @@ void cares_wrap_hostent_cpy(struct hostent* dest, struct hostent* src) { dest->h_aliases = node::Malloc(alias_count + 1); for (size_t i = 0; i < alias_count; i++) { - cur_alias_length = strlen(src->h_aliases[i]); - dest->h_aliases[i] = node::Malloc(cur_alias_length + 1); - memcpy(dest->h_aliases[i], src->h_aliases[i], cur_alias_length + 1); + const size_t cur_alias_size = strlen(src->h_aliases[i]) + 1; + dest->h_aliases[i] = node::Malloc(cur_alias_size); + memcpy(dest->h_aliases[i], src->h_aliases[i], cur_alias_size); } dest->h_aliases[alias_count] = nullptr; @@ -1065,7 +1064,6 @@ int ParseSoaReply(Environment* env, /* Can't use ares_parse_soa_reply() here which can only parse single record */ unsigned int ancount = cares_get_16bit(buf + 6); unsigned char* ptr = buf + NS_HFIXEDSZ; - int rr_type, rr_len; char* name; char* rr_name; long temp_len; // NOLINT(runtime/int) @@ -1094,8 +1092,8 @@ int ParseSoaReply(Environment* env, break; } - rr_type = cares_get_16bit(ptr); - rr_len = cares_get_16bit(ptr + 8); + const int rr_type = cares_get_16bit(ptr); + const int rr_len = cares_get_16bit(ptr + 8); ptr += NS_RRFIXEDSZ; /* only need SOA */ diff --git a/src/env.cc b/src/env.cc index 9efeaadff1..14a8b23a84 100644 --- a/src/env.cc +++ b/src/env.cc @@ -576,10 +576,10 @@ void Environment::RunTimers(uv_timer_t* handle) { ret = cb->Call(env->context(), process, 1, &arg); } while (ret.IsEmpty() && env->can_call_into_js()); - // NOTE(apapirovski): If it ever becomes possibble that `call_into_js` above + // NOTE(apapirovski): If it ever becomes possible that `call_into_js` above // is reset back to `true` after being previously set to `false` then this // code becomes invalid and needs to be rewritten. Otherwise catastrophic - // timers corruption will occurr and all timers behaviour will become + // timers corruption will occur and all timers behaviour will become // entirely unpredictable. if (ret.IsEmpty()) return; diff --git a/src/exceptions.cc b/src/exceptions.cc index c9e308240f..98c87603dd 100644 --- a/src/exceptions.cc +++ b/src/exceptions.cc @@ -128,7 +128,9 @@ Local UVException(Isolate* isolate, String::Concat(isolate, js_msg, FIXED_ONE_BYTE_STRING(isolate, "'")); } - Local e = Exception::Error(js_msg)->ToObject(isolate); + Local e = + Exception::Error(js_msg)->ToObject(isolate->GetCurrentContext()) + .ToLocalChecked(); e->Set(env->errno_string(), Integer::New(isolate, errorno)); e->Set(env->code_string(), js_code); diff --git a/src/inspector_agent.h b/src/inspector_agent.h index e926ccaa92..9537ae05b6 100644 --- a/src/inspector_agent.h +++ b/src/inspector_agent.h @@ -57,7 +57,7 @@ class Agent { bool IsListening() { return io_ != nullptr; } // Returns true if the Node inspector is actually in use. It will be true - // if either the user explicitely opted into inspector (e.g. with the + // if either the user explicitly opted into inspector (e.g. with the // --inspect command line flag) or if inspector JS API had been used. bool IsActive(); diff --git a/src/module_wrap.cc b/src/module_wrap.cc index 551a650be6..f7cea5d0d7 100644 --- a/src/module_wrap.cc +++ b/src/module_wrap.cc @@ -448,16 +448,15 @@ std::string ReadFile(uv_file file) { uv_fs_t req; char buffer_memory[4096]; uv_buf_t buf = uv_buf_init(buffer_memory, sizeof(buffer_memory)); - int r; do { - r = uv_fs_read(uv_default_loop(), - &req, - file, - &buf, - 1, - contents.length(), // offset - nullptr); + const int r = uv_fs_read(uv_default_loop(), + &req, + file, + &buf, + 1, + contents.length(), // offset + nullptr); uv_fs_req_cleanup(&req); if (r <= 0) diff --git a/src/node_api.h b/src/node_api.h index 10a2c8ff30..e8c1f79de7 100644 --- a/src/node_api.h +++ b/src/node_api.h @@ -598,7 +598,7 @@ NAPI_EXTERN napi_status napi_adjust_external_memory(napi_env env, int64_t change_in_bytes, int64_t* adjusted_value); -// Runnig a script +// Running a script NAPI_EXTERN napi_status napi_run_script(napi_env env, napi_value script, napi_value* result); diff --git a/src/node_crypto.cc b/src/node_crypto.cc index 4cccc6eb7a..9b22edfb96 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -573,17 +573,13 @@ int SSL_CTX_use_certificate_chain(SSL_CTX* ctx, if (ret) { // If we could set up our certificate, now proceed to // the CA certificates. - int r; - SSL_CTX_clear_extra_chain_certs(ctx); for (int i = 0; i < sk_X509_num(extra_certs); i++) { X509* ca = sk_X509_value(extra_certs, i); // NOTE: Increments reference count on `ca` - r = SSL_CTX_add1_chain_cert(ctx, ca); - - if (!r) { + if (!SSL_CTX_add1_chain_cert(ctx, ca)) { ret = 0; issuer = nullptr; break; @@ -1580,15 +1576,11 @@ static Local X509ToObject(Environment* env, X509* cert) { if (index < 0) continue; - X509_EXTENSION* ext; - int rv; - - ext = X509_get_ext(cert, index); + X509_EXTENSION* ext = X509_get_ext(cert, index); CHECK_NOT_NULL(ext); if (!SafeX509ExtPrint(bio.get(), ext)) { - rv = X509V3_EXT_print(bio.get(), ext, 0, 0); - CHECK_EQ(rv, 1); + CHECK_EQ(1, X509V3_EXT_print(bio.get(), ext, 0, 0)); } BIO_get_mem_ptr(bio.get(), &mem); @@ -2168,7 +2160,8 @@ void SSLWrap::VerifyError(const FunctionCallbackInfo& args) { Isolate* isolate = args.GetIsolate(); Local reason_string = OneByteString(isolate, reason); Local exception_value = Exception::Error(reason_string); - Local exception_object = exception_value->ToObject(isolate); + Local exception_object = + exception_value->ToObject(isolate->GetCurrentContext()).ToLocalChecked(); exception_object->Set(w->env()->context(), w->env()->code_string(), OneByteString(isolate, code)).FromJust(); args.GetReturnValue().Set(exception_object); @@ -2522,7 +2515,7 @@ int VerifyCallback(int preverify_ok, X509_STORE_CTX* ctx) { // // Since we cannot perform I/O quickly enough in this callback, we ignore // all preverify_ok errors and let the handshake continue. It is - // imparative that the user use Connection::VerifyError after the + // imperative that the user use Connection::VerifyError after the // 'secure' callback has been made. return 1; } @@ -3745,7 +3738,6 @@ SignBase::Error Verify::VerifyFinal(const char* key_pem, EVPKeyPointer pkey; unsigned char m[EVP_MAX_MD_SIZE]; unsigned int m_len; - int r = 0; *verify_result = false; EVPMDPointer mdctx = std::move(mdctx_); @@ -3761,11 +3753,11 @@ SignBase::Error Verify::VerifyFinal(const char* key_pem, ApplyRSAOptions(pkey, pkctx.get(), padding, saltlen) && EVP_PKEY_CTX_set_signature_md(pkctx.get(), EVP_MD_CTX_md(mdctx.get())) > 0) { - r = EVP_PKEY_verify(pkctx.get(), - reinterpret_cast(sig), - siglen, - m, - m_len); + const int r = EVP_PKEY_verify(pkctx.get(), + reinterpret_cast(sig), + siglen, + m, + m_len); *verify_result = r == 1; } diff --git a/src/node_http_parser.cc b/src/node_http_parser.cc index 5d093b27c3..b82710480d 100644 --- a/src/node_http_parser.cc +++ b/src/node_http_parser.cc @@ -465,6 +465,8 @@ class Parser : public AsyncWrap, public StreamListener { Environment* env = Environment::GetCurrent(args); CHECK(args[0]->IsInt32()); + CHECK(args[1]->IsBoolean()); + bool isReused = args[1]->IsTrue(); http_parser_type type = static_cast(args[0].As()->Value()); @@ -473,8 +475,12 @@ class Parser : public AsyncWrap, public StreamListener { ASSIGN_OR_RETURN_UNWRAP(&parser, args.Holder()); // Should always be called from the same context. CHECK_EQ(env, parser->env()); - // The parser is being reused. Reset the async id and call init() callbacks. - parser->AsyncReset(); + // This parser has either just been created or it is being reused. + // We must only call AsyncReset for the latter case, because AsyncReset has + // already been called via the constructor for the former case. + if (isReused) { + parser->AsyncReset(); + } parser->Init(type); } @@ -617,7 +623,8 @@ class Parser : public AsyncWrap, public StreamListener { enum http_errno err = HTTP_PARSER_ERRNO(&parser_); Local e = Exception::Error(env()->parse_error_string()); - Local obj = e->ToObject(env()->isolate()); + Local obj = e->ToObject(env()->isolate()->GetCurrentContext()) + .ToLocalChecked(); obj->Set(env()->bytes_parsed_string(), nparsed_obj); obj->Set(env()->code_string(), OneByteString(env()->isolate(), http_errno_name(err))); diff --git a/src/node_i18n.cc b/src/node_i18n.cc index 5966e3ff67..fda53cc6d4 100644 --- a/src/node_i18n.cc +++ b/src/node_i18n.cc @@ -882,6 +882,6 @@ void Initialize(Local target, } // namespace i18n } // namespace node -NODE_BUILTIN_MODULE_CONTEXT_AWARE(icu, node::i18n::Initialize) +NODE_MODULE_CONTEXT_AWARE_INTERNAL(icu, node::i18n::Initialize) #endif // NODE_HAVE_I18N_SUPPORT diff --git a/src/node_messaging.cc b/src/node_messaging.cc index a8b95401fd..c9b5e32447 100644 --- a/src/node_messaging.cc +++ b/src/node_messaging.cc @@ -98,7 +98,7 @@ MaybeLocal Message::Deserialize(Environment* env, message_ports_.clear(); std::vector> shared_array_buffers; - // Attach all transfered SharedArrayBuffers to their new Isolate. + // Attach all transferred SharedArrayBuffers to their new Isolate. for (uint32_t i = 0; i < shared_array_buffers_.size(); ++i) { Local sab; if (!shared_array_buffers_[i]->GetSharedArrayBuffer(env, context) @@ -116,7 +116,7 @@ MaybeLocal Message::Deserialize(Environment* env, &delegate); delegate.deserializer = &deserializer; - // Attach all transfered ArrayBuffers to their new Isolate. + // Attach all transferred ArrayBuffers to their new Isolate. for (uint32_t i = 0; i < array_buffer_contents_.size(); ++i) { Local ab = ArrayBuffer::New(env->isolate(), @@ -234,7 +234,7 @@ class SerializerDelegate : public ValueSerializer::Delegate { friend class worker::Message; }; -} // anynomous namespace +} // anonymous namespace Maybe Message::Serialize(Environment* env, Local context, diff --git a/src/node_options.h b/src/node_options.h index 8a10cc211d..163cabf442 100644 --- a/src/node_options.h +++ b/src/node_options.h @@ -230,7 +230,7 @@ class OptionsParser { void AddAlias(const std::string& from, const std::initializer_list& to); - // Add implications from some arbitary option to a boolean one, either + // Add implications from some arbitrary option to a boolean one, either // in a way that makes `from` set `to` to true or to false. void Implies(const std::string& from, const std::string& to); void ImpliesNot(const std::string& from, const std::string& to); diff --git a/src/node_url.cc b/src/node_url.cc index e9b7eaf7bf..0be777e03d 100644 --- a/src/node_url.cc +++ b/src/node_url.cc @@ -792,7 +792,7 @@ void URLHost::ParseIPv6Host(const char* input, size_t length) { uint16_t* compress_pointer = nullptr; const char* pointer = input; const char* end = pointer + length; - unsigned value, len, swaps, numbers_seen; + unsigned value, len, numbers_seen; char ch = pointer < end ? pointer[0] : kEOL; if (ch == ':') { if (length < 2 || pointer[1] != ':') @@ -881,7 +881,7 @@ void URLHost::ParseIPv6Host(const char* input, size_t length) { } if (compress_pointer != nullptr) { - swaps = piece_pointer - compress_pointer; + unsigned swaps = piece_pointer - compress_pointer; piece_pointer = buffer_end - 1; while (piece_pointer != &value_.ipv6[0] && swaps > 0) { uint16_t temp = *piece_pointer; diff --git a/src/node_worker.cc b/src/node_worker.cc index 63d89a966d..debec3078c 100644 --- a/src/node_worker.cc +++ b/src/node_worker.cc @@ -150,13 +150,13 @@ void Worker::Run() { TRACE_STR_COPY(name.c_str())); MultiIsolatePlatform* platform = isolate_data_->platform(); CHECK_NE(platform, nullptr); - bool inspector_started = false; Debug(this, "Starting worker with id %llu", thread_id_); { Locker locker(isolate_); Isolate::Scope isolate_scope(isolate_); SealHandleScope outer_seal(isolate_); + bool inspector_started = false; { Context::Scope context_scope(env_->context()); diff --git a/src/sharedarraybuffer_metadata.cc b/src/sharedarraybuffer_metadata.cc index b20d9f46a4..3e760bc50b 100644 --- a/src/sharedarraybuffer_metadata.cc +++ b/src/sharedarraybuffer_metadata.cc @@ -21,7 +21,7 @@ namespace { // Yield a JS constructor for SABLifetimePartner objects in the form of a // standard API object, that has a single field for containing the raw -// SABLiftimePartner* pointer. +// SABLifetimePartner* pointer. Local GetSABLifetimePartnerConstructor( Environment* env, Local context) { Local templ; diff --git a/src/stream_base.cc b/src/stream_base.cc index f429f3593f..f44e188b5b 100644 --- a/src/stream_base.cc +++ b/src/stream_base.cc @@ -209,8 +209,6 @@ int StreamBase::WriteString(const FunctionCallbackInfo& args) { if (args[2]->IsObject()) send_handle_obj = args[2].As(); - int err; - // Compute the size of the storage that the string will be flattened into. // For UTF8 strings that are very long, go ahead and take the hit for // computing their actual size, rather than tripling the storage. @@ -243,7 +241,7 @@ int StreamBase::WriteString(const FunctionCallbackInfo& args) { uv_buf_t* bufs = &buf; size_t count = 1; - err = DoTryWrite(&bufs, &count); + const int err = DoTryWrite(&bufs, &count); // Keep track of the bytes written here, because we're taking a shortcut // by using `DoTryWrite()` directly instead of using the utilities // provided by `Write()`. diff --git a/src/tracing/node_trace_writer.cc b/src/tracing/node_trace_writer.cc index a0382e587b..1d06c94233 100644 --- a/src/tracing/node_trace_writer.cc +++ b/src/tracing/node_trace_writer.cc @@ -49,10 +49,8 @@ void NodeTraceWriter::WriteSuffix() { NodeTraceWriter::~NodeTraceWriter() { WriteSuffix(); uv_fs_t req; - int err; if (fd_ != -1) { - err = uv_fs_close(nullptr, &req, fd_, nullptr); - CHECK_EQ(err, 0); + CHECK_EQ(0, uv_fs_close(nullptr, &req, fd_, nullptr)); uv_fs_req_cleanup(&req); } uv_async_send(&exit_signal_); diff --git a/test/async-hooks/test-embedder.api.async-resource.improper-unwind.js b/test/async-hooks/test-embedder.api.async-resource.improper-unwind.js index a552b46e1f..cb9e338905 100644 --- a/test/async-hooks/test-embedder.api.async-resource.improper-unwind.js +++ b/test/async-hooks/test-embedder.api.async-resource.improper-unwind.js @@ -19,7 +19,7 @@ if (process.argv[2] === 'child') { // Therefore the 'after' of event2 needs to occur before the // 'after' of event 1. // The first test of the two below follows that rule, - // the second one doesnt. + // the second one doesn't. const event1 = new AsyncResource('event1', async_hooks.executionAsyncId()); const event2 = new AsyncResource('event2', async_hooks.executionAsyncId()); diff --git a/test/async-hooks/test-graph.http.js b/test/async-hooks/test-graph.http.js index b18bc7453c..414ebabeee 100644 --- a/test/async-hooks/test-graph.http.js +++ b/test/async-hooks/test-graph.http.js @@ -38,20 +38,14 @@ process.on('exit', function() { { type: 'HTTPPARSER', id: 'httpparser:1', triggerAsyncId: 'tcpserver:1' }, - { type: 'HTTPPARSER', - id: 'httpparser:2', - triggerAsyncId: 'tcpserver:1' }, { type: 'TCPWRAP', id: 'tcp:2', triggerAsyncId: 'tcpserver:1' }, { type: 'Timeout', id: 'timeout:1', triggerAsyncId: 'tcp:2' }, { type: 'HTTPPARSER', - id: 'httpparser:3', - triggerAsyncId: 'tcp:2' }, - { type: 'HTTPPARSER', - id: 'httpparser:4', + id: 'httpparser:2', triggerAsyncId: 'tcp:2' }, { type: 'Timeout', id: 'timeout:2', - triggerAsyncId: 'httpparser:4' }, + triggerAsyncId: 'httpparser:2' }, { type: 'SHUTDOWNWRAP', id: 'shutdown:1', triggerAsyncId: 'tcp:2' } ] diff --git a/test/fixtures/guess-hash-seed.js b/test/fixtures/guess-hash-seed.js index 18a6f5124d..ffcfd75aac 100644 --- a/test/fixtures/guess-hash-seed.js +++ b/test/fixtures/guess-hash-seed.js @@ -1,4 +1,3 @@ -/* eslint-disable required-modules */ 'use strict'; function min(arr) { let res = arr[0]; diff --git a/test/fixtures/inspector-global-function.js b/test/fixtures/inspector-global-function.js index d72bacd7ca..6155ae5298 100644 --- a/test/fixtures/inspector-global-function.js +++ b/test/fixtures/inspector-global-function.js @@ -1,4 +1,4 @@ -'use strict'; // eslint-disable-line required-modules +'use strict'; let invocations = 0; const interval = setInterval(() => {}, 1000); diff --git a/test/internet/test-dgram-broadcast-multi-process.js b/test/internet/test-dgram-broadcast-multi-process.js index 606ab818c9..c30059e739 100644 --- a/test/internet/test-dgram-broadcast-multi-process.js +++ b/test/internet/test-dgram-broadcast-multi-process.js @@ -146,7 +146,7 @@ if (process.argv[2] !== 'child') { } }); - console.error('[PARENT] %d received %d matching messges.', + console.error('[PARENT] %d received %d matching messages.', worker.pid, count); diff --git a/test/known_issues/test-module-deleted-extensions.js b/test/known_issues/test-module-deleted-extensions.js new file mode 100644 index 0000000000..3a51e8725e --- /dev/null +++ b/test/known_issues/test-module-deleted-extensions.js @@ -0,0 +1,18 @@ +'use strict'; +// Refs: https://github.com/nodejs/node/issues/4778 +const common = require('../common'); +const assert = require('assert'); +const fs = require('fs'); +const path = require('path'); +const tmpdir = require('../common/tmpdir'); +const file = path.join(tmpdir.path, 'test-extensions.foo.bar'); + +tmpdir.refresh(); +fs.writeFileSync(file, '', 'utf8'); +require.extensions['.foo.bar'] = (module, path) => {}; +delete require.extensions['.foo.bar']; +require.extensions['.bar'] = common.mustCall((module, path) => { + assert.strictEqual(module.id, file); + assert.strictEqual(path, file); +}); +require(path.join(tmpdir.path, 'test-extensions')); diff --git a/test/parallel/test-assert-builtins-not-read-from-filesystem.js b/test/parallel/test-assert-builtins-not-read-from-filesystem.js index 000798aca2..7a713a2ea4 100644 --- a/test/parallel/test-assert-builtins-not-read-from-filesystem.js +++ b/test/parallel/test-assert-builtins-not-read-from-filesystem.js @@ -5,24 +5,14 @@ require('../common'); const assert = require('assert'); +const EventEmitter = require('events'); +const e = new EventEmitter(); +e.on('hello', assert); if (process.argv[2] !== 'child') { const tmpdir = require('../common/tmpdir'); tmpdir.refresh(); const { spawnSync } = require('child_process'); - const { output, status, error } = - spawnSync(process.execPath, - ['--expose-internals', process.argv[1], 'child'], - { cwd: tmpdir.path, env: process.env }); - assert.ifError(error); - assert.strictEqual(status, 0, `Exit code: ${status}\n${output}`); -} else { - const EventEmitter = require('events'); - const { errorCache } = require('internal/assert'); - const { writeFileSync } = require('fs'); - const e = new EventEmitter(); - - e.on('hello', assert); let threw = false; try { @@ -30,22 +20,29 @@ if (process.argv[2] !== 'child') { } catch (err) { const frames = err.stack.split('\n'); const [, filename, line, column] = frames[1].match(/\((.+):(\d+):(\d+)\)/); - // Reset the cache to check again - const size = errorCache.size; - errorCache.delete(`${filename}${line - 1}${column - 1}`); - assert.strictEqual(errorCache.size, size - 1); - const data = `${'\n'.repeat(line - 1)}${' '.repeat(column - 1)}` + - 'ok(failed(badly));'; + // Spawn a child process to avoid the error having been cached in the assert + // module's `errorCache` Map. - writeFileSync(filename, data); - assert.throws( - () => e.emit('hello', false), - { - message: 'false == true' - } - ); + const { output, status, error } = + spawnSync(process.execPath, + [process.argv[1], 'child', filename, line, column], + { cwd: tmpdir.path, env: process.env }); + assert.ifError(error); + assert.strictEqual(status, 0, `Exit code: ${status}\n${output}`); threw = true; - } - assert(threw); + assert.ok(threw); +} else { + const { writeFileSync } = require('fs'); + const [, , , filename, line, column] = process.argv; + const data = `${'\n'.repeat(line - 1)}${' '.repeat(column - 1)}` + + 'ok(failed(badly));'; + + writeFileSync(filename, data); + assert.throws( + () => e.emit('hello', false), + { + message: 'false == true' + } + ); } diff --git a/test/parallel/test-async-hooks-http-agent-destroy.js b/test/parallel/test-async-hooks-http-agent-destroy.js new file mode 100644 index 0000000000..637f2c5114 --- /dev/null +++ b/test/parallel/test-async-hooks-http-agent-destroy.js @@ -0,0 +1,84 @@ +'use strict'; +// Flags: --expose-internals +const common = require('../common'); +const assert = require('assert'); +const { async_id_symbol } = require('internal/async_hooks').symbols; +const async_hooks = require('async_hooks'); +const http = require('http'); + +// Regression test for https://github.com/nodejs/node/issues/19859 +// Checks that an http.Agent emits a destroy for the old asyncId before calling +// asyncReset()s when reusing a socket handle. The setup is nearly identical to +// parallel/test-async-hooks-http-agent (which focuses on the assertion that +// a fresh asyncId is assigned to the net.Socket instance). + +const destroyedIds = new Set(); +async_hooks.createHook({ + destroy: common.mustCallAtLeast((asyncId) => { + destroyedIds.add(asyncId); + }, 1) +}).enable(); + +// Make sure a single socket is transparently reused for 2 requests. +const agent = new http.Agent({ + keepAlive: true, + keepAliveMsecs: Infinity, + maxSockets: 1 +}); + +const server = http.createServer(common.mustCall((req, res) => { + req.once('data', common.mustCallAtLeast(() => { + res.writeHead(200, { 'Content-Type': 'text/plain' }); + res.write('foo'); + })); + req.on('end', common.mustCall(() => { + res.end('bar'); + })); +}, 2)).listen(0, common.mustCall(() => { + const port = server.address().port; + const payload = 'hello world'; + + // First request. This is useless except for adding a socket to the + // agent’s pool for reuse. + const r1 = http.request({ + agent, port, method: 'POST' + }, common.mustCall((res) => { + // Remember which socket we used. + const socket = res.socket; + const asyncIdAtFirstRequest = socket[async_id_symbol]; + assert.ok(asyncIdAtFirstRequest > 0, `${asyncIdAtFirstRequest} > 0`); + // Check that request and response share their socket. + assert.strictEqual(r1.socket, socket); + + res.on('data', common.mustCallAtLeast(() => {})); + res.on('end', common.mustCall(() => { + // setImmediate() to give the agent time to register the freed socket. + setImmediate(common.mustCall(() => { + // The socket is free for reuse now. + assert.strictEqual(socket[async_id_symbol], -1); + + // second request: + const r2 = http.request({ + agent, port, method: 'POST' + }, common.mustCall((res) => { + assert.ok(destroyedIds.has(asyncIdAtFirstRequest)); + + // Empty payload, to hit the “right” code path. + r2.end(''); + + res.on('data', common.mustCallAtLeast(() => {})); + res.on('end', common.mustCall(() => { + // Clean up to let the event loop stop. + server.close(); + agent.destroy(); + })); + })); + + // Schedule a payload to be written immediately, but do not end the + // request just yet. + r2.write(payload); + })); + })); + })); + r1.end(payload); +})); diff --git a/test/parallel/test-async-hooks-http-parser-destroy.js b/test/parallel/test-async-hooks-http-parser-destroy.js new file mode 100644 index 0000000000..aeb805702d --- /dev/null +++ b/test/parallel/test-async-hooks-http-parser-destroy.js @@ -0,0 +1,61 @@ +'use strict'; +const common = require('../common'); +const Countdown = require('../common/countdown'); +const assert = require('assert'); +const async_hooks = require('async_hooks'); +const http = require('http'); + +// Regression test for https://github.com/nodejs/node/issues/19859. +// Checks that matching destroys are emitted when creating new/reusing old http +// parser instances. + +const N = 50; +const KEEP_ALIVE = 100; + +const createdIds = []; +const destroyedIds = []; +async_hooks.createHook({ + init: common.mustCallAtLeast((asyncId, type) => { + if (type === 'HTTPPARSER') { + createdIds.push(asyncId); + } + }, N), + destroy: (asyncId) => { + destroyedIds.push(asyncId); + } +}).enable(); + +const server = http.createServer(function(req, res) { + res.end('Hello'); +}); + +const keepAliveAgent = new http.Agent({ + keepAlive: true, + keepAliveMsecs: KEEP_ALIVE, +}); + +const countdown = new Countdown(N, () => { + server.close(() => { + // give the server sockets time to close (which will also free their + // associated parser objects) after the server has been closed. + setTimeout(() => { + createdIds.forEach((createdAsyncId) => { + assert.ok(destroyedIds.indexOf(createdAsyncId) >= 0); + }); + }, KEEP_ALIVE * 2); + }); +}); + +server.listen(0, function() { + for (let i = 0; i < N; ++i) { + (function makeRequest() { + http.get({ + port: server.address().port, + agent: keepAliveAgent + }, function(res) { + countdown.dec(); + res.resume(); + }); + })(); + } +}); diff --git a/test/parallel/test-buffer-bindingobj-no-zerofill.js b/test/parallel/test-buffer-bindingobj-no-zerofill.js deleted file mode 100644 index ab584c2597..0000000000 --- a/test/parallel/test-buffer-bindingobj-no-zerofill.js +++ /dev/null @@ -1,49 +0,0 @@ -'use strict'; - -// Flags: --expose-internals - -// Confirm that if a custom ArrayBufferAllocator does not define a zeroFill -// property, that the buffer module will zero-fill when allocUnsafe() is called. - -require('../common'); - -const assert = require('assert'); -const buffer = require('buffer'); - -// Monkey-patch setupBufferJS() to have an undefined zeroFill. -const internalBuffer = require('internal/buffer'); - -const originalSetup = internalBuffer.setupBufferJS; - -internalBuffer.setupBufferJS = (proto, obj) => { - originalSetup(proto, obj); - assert.strictEqual(obj.zeroFill[0], 1); - delete obj.zeroFill; -}; - -const bindingObj = {}; - -internalBuffer.setupBufferJS(Buffer.prototype, bindingObj); -assert.strictEqual(bindingObj.zeroFill, undefined); - -// Load from file system because internal buffer is already loaded and we're -// testing code that runs on first load only. -// Do not move this require() to top of file. It is important that -// `require('internal/buffer').setupBufferJS` be monkey-patched before this -// runs. -const monkeyPatchedBuffer = require('../../lib/buffer'); - -// On unpatched buffer, allocUnsafe() should not zero fill memory. It's always -// possible that a segment of memory is already zeroed out, so try again and -// again until we succeed or we time out. -let uninitialized = buffer.Buffer.allocUnsafe(1024); -while (uninitialized.every((val) => val === 0)) - uninitialized = buffer.Buffer.allocUnsafe(1024); - -// On monkeypatched buffer, zeroFill property is undefined. allocUnsafe() should -// zero-fill in that case. -const zeroFilled = monkeyPatchedBuffer.Buffer.allocUnsafe(1024); -assert(zeroFilled.every((val) => val === 0)); - -// setupBufferJS shouldn't still be exposed on the binding -assert(!('setupBufferJs' in process.binding('buffer'))); diff --git a/test/parallel/test-cluster-fork-windowsHide.js b/test/parallel/test-cluster-fork-windowsHide.js index a7476983f9..b9ee701beb 100644 --- a/test/parallel/test-cluster-fork-windowsHide.js +++ b/test/parallel/test-cluster-fork-windowsHide.js @@ -45,7 +45,7 @@ if (!process.argv[2]) { } else if (cluster.isMaster) { cluster.setupMaster({ - silient: true, + silent: true, windowsHide: true }); diff --git a/test/parallel/test-cluster-setup-master-cumulative.js b/test/parallel/test-cluster-setup-master-cumulative.js index 838890cb4b..2621685e31 100644 --- a/test/parallel/test-cluster-setup-master-cumulative.js +++ b/test/parallel/test-cluster-setup-master-cumulative.js @@ -40,7 +40,7 @@ console.log('ok sets defaults'); cluster.setupMaster({ exec: 'overridden' }); assert.strictEqual(cluster.settings.exec, 'overridden'); -console.log('ok overrids defaults'); +console.log('ok overrides defaults'); cluster.setupMaster({ args: ['foo', 'bar'] }); assert.strictEqual(cluster.settings.exec, 'overridden'); diff --git a/test/parallel/test-crypto-stream.js b/test/parallel/test-crypto-stream.js index 0464829f74..9430084bbe 100644 --- a/test/parallel/test-crypto-stream.js +++ b/test/parallel/test-crypto-stream.js @@ -40,7 +40,7 @@ if (!common.hasFipsCrypto) { }); } - _write(data, encodeing, done) { + _write(data, encoding, done) { this._buffers.push(data); return done(null); } diff --git a/test/parallel/test-freelist.js b/test/parallel/test-freelist.js index d1f7d888c0..03946dfda2 100644 --- a/test/parallel/test-freelist.js +++ b/test/parallel/test-freelist.js @@ -4,28 +4,27 @@ require('../common'); const assert = require('assert'); -const FreeList = require('internal/freelist'); +const { FreeList } = require('internal/freelist'); assert.strictEqual(typeof FreeList, 'function'); -const flist1 = new FreeList('flist1', 3, String); +const flist1 = new FreeList('flist1', 3, Object); // Allocating when empty, should not change the list size -const result = flist1.alloc('test'); -assert.strictEqual(typeof result, 'string'); -assert.strictEqual(result, 'test'); +const result = flist1.alloc(); +assert.strictEqual(typeof result, 'object'); assert.strictEqual(flist1.list.length, 0); // Exhaust the free list -assert(flist1.free('test1')); -assert(flist1.free('test2')); -assert(flist1.free('test3')); +assert(flist1.free({ id: 'test1' })); +assert(flist1.free({ id: 'test2' })); +assert(flist1.free({ id: 'test3' })); // Now it should not return 'true', as max length is exceeded -assert.strictEqual(flist1.free('test4'), false); -assert.strictEqual(flist1.free('test5'), false); +assert.strictEqual(flist1.free({ id: 'test4' }), false); +assert.strictEqual(flist1.free({ id: 'test5' }), false); // At this point 'alloc' should just return the stored values -assert.strictEqual(flist1.alloc(), 'test3'); -assert.strictEqual(flist1.alloc(), 'test2'); -assert.strictEqual(flist1.alloc(), 'test1'); +assert.strictEqual(flist1.alloc().id, 'test3'); +assert.strictEqual(flist1.alloc().id, 'test2'); +assert.strictEqual(flist1.alloc().id, 'test1'); diff --git a/test/parallel/test-fs-read-empty-buffer.js b/test/parallel/test-fs-read-empty-buffer.js index 34e418eac6..2f44b9a184 100644 --- a/test/parallel/test-fs-read-empty-buffer.js +++ b/test/parallel/test-fs-read-empty-buffer.js @@ -6,6 +6,7 @@ const assert = require('assert'); const fs = require('fs'); const filepath = fixtures.path('x.txt'); const fd = fs.openSync(filepath, 'r'); +const fsPromises = fs.promises; const buffer = new Uint8Array(); @@ -26,3 +27,15 @@ assert.throws( 'Received Uint8Array []' } ); + +(async () => { + const filehandle = await fsPromises.open(filepath, 'r'); + assert.rejects( + () => filehandle.read(buffer, 0, 1, 0), + { + code: 'ERR_INVALID_ARG_VALUE', + message: 'The argument \'buffer\' is empty and cannot be written. ' + + 'Received Uint8Array []' + } + ); +})(); diff --git a/test/parallel/test-fs-readfile-error.js b/test/parallel/test-fs-readfile-error.js index fe6174c577..719c0061c4 100644 --- a/test/parallel/test-fs-readfile-error.js +++ b/test/parallel/test-fs-readfile-error.js @@ -25,9 +25,9 @@ const fs = require('fs'); // Test that fs.readFile fails correctly on a non-existent file. -// `fs.readFile('/')` does not fail on FreeBSD, because you can open and read -// the directory there. -if (common.isFreeBSD) +// `fs.readFile('/')` does not fail on AIX and FreeBSD because you can open +// and read the directory there. +if (common.isAIX || common.isFreeBSD) common.skip('platform not supported.'); const assert = require('assert'); diff --git a/test/parallel/test-gc-tls-external-memory.js b/test/parallel/test-gc-tls-external-memory.js index d77553b157..2b584dd93d 100644 --- a/test/parallel/test-gc-tls-external-memory.js +++ b/test/parallel/test-gc-tls-external-memory.js @@ -31,7 +31,7 @@ function connect() { const externalMemoryUsage = process.memoryUsage().external; assert(externalMemoryUsage >= 0, `${externalMemoryUsage} < 0`); if (runs++ === 512) { - // Make sure at least half the TLS sockets have been gargbage collected + // Make sure at least half the TLS sockets have been garbage collected // (so that this test can actually check what it's testing): assert(gced >= 256, `${gced} < 256`); return; diff --git a/test/parallel/test-http-eof-on-connect.js b/test/parallel/test-http-eof-on-connect.js index 7e244354c1..5e885bb91a 100644 --- a/test/parallel/test-http-eof-on-connect.js +++ b/test/parallel/test-http-eof-on-connect.js @@ -27,7 +27,7 @@ const http = require('http'); // This is a regression test for https://github.com/joyent/node/issues/44 // It is separate from test-http-malformed-request.js because it is only -// reproduceable on the first packet on the first connection to a server. +// reproducible on the first packet on the first connection to a server. const server = http.createServer(common.mustNotCall()); server.listen(0); diff --git a/test/parallel/test-http-full-response.js b/test/parallel/test-http-full-response.js index 2f6fc8fc2a..d08e091ebd 100644 --- a/test/parallel/test-http-full-response.js +++ b/test/parallel/test-http-full-response.js @@ -56,10 +56,10 @@ function runAb(opts, callback) { const completeRequests = parseInt(m[1]); m = /HTML transferred:\s*(\d+) bytes/i.exec(stdout); - const htmlTransfered = parseInt(m[1]); + const htmlTransferred = parseInt(m[1]); assert.strictEqual(bodyLength, documentLength); - assert.strictEqual(completeRequests * documentLength, htmlTransfered); + assert.strictEqual(completeRequests * documentLength, htmlTransferred); if (callback) callback(); }); diff --git a/test/parallel/test-http-parser.js b/test/parallel/test-http-parser.js index 0bdaa22b8a..36f41f79e5 100644 --- a/test/parallel/test-http-parser.js +++ b/test/parallel/test-http-parser.js @@ -98,7 +98,7 @@ function expectBody(expected) { throw new Error('hello world'); }; - parser.reinitialize(HTTPParser.REQUEST); + parser.reinitialize(HTTPParser.REQUEST, false); assert.throws( () => { parser.execute(request, 0, request.length); }, @@ -558,7 +558,7 @@ function expectBody(expected) { parser[kOnBody] = expectBody('ping'); parser.execute(req1, 0, req1.length); - parser.reinitialize(REQUEST); + parser.reinitialize(REQUEST, false); parser[kOnBody] = expectBody('pong'); parser[kOnHeadersComplete] = onHeadersComplete2; parser.execute(req2, 0, req2.length); diff --git a/test/parallel/test-http-pipeline-flood.js b/test/parallel/test-http-pipeline-flood.js index 3d6167d387..29df81e857 100644 --- a/test/parallel/test-http-pipeline-flood.js +++ b/test/parallel/test-http-pipeline-flood.js @@ -9,7 +9,7 @@ const common = require('../common'); // processed). // Normally when the writable stream emits a 'drain' event, the server then -// uncorks the readable stream, although we arent testing that part here. +// uncorks the readable stream, although we aren't testing that part here. // The issue being tested exists in Node.js 0.10.20 and is resolved in 0.10.21 // and newer. diff --git a/test/parallel/test-http2-compat-serverresponse-end-after-statuses-without-body.js b/test/parallel/test-http2-compat-serverresponse-end-after-statuses-without-body.js index 83d5521bf2..ce8cbe600c 100644 --- a/test/parallel/test-http2-compat-serverresponse-end-after-statuses-without-body.js +++ b/test/parallel/test-http2-compat-serverresponse-end-after-statuses-without-body.js @@ -15,15 +15,15 @@ const { HTTP_STATUS_NOT_MODIFIED } = h2.constants; -const statusWithouBody = [ +const statusWithoutBody = [ HTTP_STATUS_NO_CONTENT, HTTP_STATUS_RESET_CONTENT, HTTP_STATUS_NOT_MODIFIED, ]; -const STATUS_CODES_COUNT = statusWithouBody.length; +const STATUS_CODES_COUNT = statusWithoutBody.length; const server = h2.createServer(common.mustCall(function(req, res) { - res.writeHead(statusWithouBody.pop()); + res.writeHead(statusWithoutBody.pop()); res.end(); }, STATUS_CODES_COUNT)); diff --git a/test/parallel/test-https-agent-additional-options.js b/test/parallel/test-https-agent-additional-options.js index 8d10524d90..eaa6ea710e 100644 --- a/test/parallel/test-https-agent-additional-options.js +++ b/test/parallel/test-https-agent-additional-options.js @@ -24,7 +24,7 @@ function getBaseOptions(port) { path: '/', port: port, ca: options.ca, - rejectUnautorized: true, + rejectUnauthorized: true, servername: 'agent1', }; } diff --git a/test/parallel/test-icu-punycode.js b/test/parallel/test-icu-punycode.js index 82c1528798..3744891ee0 100644 --- a/test/parallel/test-icu-punycode.js +++ b/test/parallel/test-icu-punycode.js @@ -1,10 +1,12 @@ 'use strict'; +// Flags: --expose-internals const common = require('../common'); if (!common.hasIntl) common.skip('missing Intl'); -const icu = process.binding('icu'); +const { internalBinding } = require('internal/test/binding'); +const icu = internalBinding('icu'); const assert = require('assert'); const tests = require('../fixtures/url-idna.js'); diff --git a/test/parallel/test-internal-modules-expose.js b/test/parallel/test-internal-modules-expose.js index a3fd6f63ff..ab48e36881 100644 --- a/test/parallel/test-internal-modules-expose.js +++ b/test/parallel/test-internal-modules-expose.js @@ -7,5 +7,5 @@ const config = process.binding('config'); console.log(config, process.argv); -assert.strictEqual(typeof require('internal/freelist'), 'function'); +assert.strictEqual(typeof require('internal/freelist').FreeList, 'function'); assert.strictEqual(config.exposeInternals, true); diff --git a/test/parallel/test-microtask-queue-integration-domain.js b/test/parallel/test-microtask-queue-integration-domain.js deleted file mode 100644 index 98da703ee5..0000000000 --- a/test/parallel/test-microtask-queue-integration-domain.js +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -'use strict'; -require('../common'); -const assert = require('assert'); - -// Requiring the domain module here changes the function that is used by node to -// call process.nextTick's callbacks to a variant that specifically handles -// domains. We want to test this specific variant in this test, and so even if -// the domain module is not used, this require call is needed and must not be -// removed. -require('domain'); - -const implementations = [ - function(fn) { - Promise.resolve().then(fn); - } -]; - -let expected = 0; -let done = 0; - -process.on('exit', function() { - assert.strictEqual(done, expected); -}); - -function test(scheduleMicrotask) { - let nextTickCalled = false; - expected++; - - scheduleMicrotask(function() { - process.nextTick(function() { - nextTickCalled = true; - }); - - setTimeout(function() { - assert(nextTickCalled); - done++; - }, 0); - }); -} - -// first tick case -implementations.forEach(test); - -// tick callback case -setTimeout(function() { - implementations.forEach(function(impl) { - process.nextTick(test.bind(null, impl)); - }); -}, 0); diff --git a/test/parallel/test-microtask-queue-run-domain.js b/test/parallel/test-microtask-queue-run-domain.js deleted file mode 100644 index 39baf93023..0000000000 --- a/test/parallel/test-microtask-queue-run-domain.js +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -'use strict'; -require('../common'); -const assert = require('assert'); - -// Requiring the domain module here changes the function that is used by node to -// call process.nextTick's callbacks to a variant that specifically handles -// domains. We want to test this specific variant in this test, and so even if -// the domain module is not used, this require call is needed and must not be -// removed. -require('domain'); - -function enqueueMicrotask(fn) { - Promise.resolve().then(fn); -} - -let done = 0; - -process.on('exit', function() { - assert.strictEqual(done, 2); -}); - -// no nextTick, microtask -setTimeout(function() { - enqueueMicrotask(function() { - done++; - }); -}, 0); - - -// no nextTick, microtask with nextTick -setTimeout(function() { - let called = false; - - enqueueMicrotask(function() { - process.nextTick(function() { - called = true; - }); - }); - - setTimeout(function() { - if (called) - done++; - }, 0); - -}, 0); diff --git a/test/parallel/test-module-deleted-extensions.js b/test/parallel/test-module-deleted-extensions.js deleted file mode 100644 index f14da0a70f..0000000000 --- a/test/parallel/test-module-deleted-extensions.js +++ /dev/null @@ -1,58 +0,0 @@ -'use strict'; - -// Refs: https://github.com/nodejs/node/issues/4778 - -const common = require('../common'); -const assert = require('assert'); -const fs = require('fs'); -const path = require('path'); -const tmpdir = require('../common/tmpdir'); -const file = path.join(tmpdir.path, 'test-extensions.foo.bar'); - -tmpdir.refresh(); -fs.writeFileSync(file, '', 'utf8'); - -{ - require.extensions['.bar'] = common.mustNotCall(); - require.extensions['.foo.bar'] = common.mustNotCall(); - const modulePath = path.join(tmpdir.path, 'test-extensions'); - assert.throws( - () => require(modulePath), - new Error(`Cannot find module '${modulePath}'`) - ); -} - -{ - delete require.extensions['.bar']; - require.extensions['.foo.bar'] = common.mustNotCall(); - const modulePath = path.join(tmpdir.path, 'test-extensions'); - assert.throws( - () => require(modulePath), - new Error(`Cannot find module '${modulePath}'`) - ); - assert.throws( - () => require(modulePath + '.foo'), - new Error(`Cannot find module '${modulePath}.foo'`) - ); -} - -{ - delete require.extensions['.bar']; - delete require.extensions['.foo.bar']; - const modulePath = path.join(tmpdir.path, 'test-extensions'); - assert.throws( - () => require(modulePath), - new Error(`Cannot find module '${modulePath}'`) - ); -} - -{ - delete require.extensions['.foo.bar']; - require.extensions['.bar'] = common.mustCall((module, path) => { - assert.strictEqual(module.id, file); - assert.strictEqual(path, file); - }); - - const modulePath = path.join(tmpdir.path, 'test-extensions.foo'); - require(modulePath); -} diff --git a/test/parallel/test-module-readonly.js b/test/parallel/test-module-readonly.js index fa12471a37..8f14d9ee18 100644 --- a/test/parallel/test-module-readonly.js +++ b/test/parallel/test-module-readonly.js @@ -38,7 +38,7 @@ try { except = err; } -// Remove the expliclty granted rights, and reenable inheritance +// Remove the explicitly granted rights, and re-enable inheritance cp.execSync( `icacls.exe "${readOnlyModFullPath}" /remove "%USERNAME%" /inheritance:e`); diff --git a/test/parallel/test-querystring-maxKeys-non-finite.js b/test/parallel/test-querystring-maxKeys-non-finite.js index 2db3acff0f..4c752fd269 100644 --- a/test/parallel/test-querystring-maxKeys-non-finite.js +++ b/test/parallel/test-querystring-maxKeys-non-finite.js @@ -34,7 +34,7 @@ const originalMaxLength = 1000; const params = createManyParams(count); // thealphanerd -// 27def4f introduced a change to parse that would cause Inifity +// 27def4f introduced a change to parse that would cause Infinity // to be passed to String.prototype.split as an argument for limit // In this instance split will always return an empty array // this test confirms that the output of parse is the expected length diff --git a/test/parallel/test-repl-editor.js b/test/parallel/test-repl-editor.js index 8db7789f02..5afbf2540d 100644 --- a/test/parallel/test-repl-editor.js +++ b/test/parallel/test-repl-editor.js @@ -74,7 +74,7 @@ const tests = [ tests.forEach(run); // Auto code alignment for .editor mode -function testCodeAligment({ input, cursor = 0, line = '' }) { +function testCodeAlignment({ input, cursor = 0, line = '' }) { const stream = new ArrayStream(); const outputStream = new ArrayStream(); @@ -121,4 +121,4 @@ const codeAlignmentTests = [ } ]; -codeAlignmentTests.forEach(testCodeAligment); +codeAlignmentTests.forEach(testCodeAlignment); diff --git a/test/parallel/test-stdio-pipe-access.js b/test/parallel/test-stdio-pipe-access.js index 084fa4c038..e8f8131d1f 100644 --- a/test/parallel/test-stdio-pipe-access.js +++ b/test/parallel/test-stdio-pipe-access.js @@ -3,7 +3,7 @@ const common = require('../common'); if (!common.isMainThread) common.skip("Workers don't have process-like stdio"); -// Test if Node handles acessing process.stdin if it is a redirected +// Test if Node handles accessing process.stdin if it is a redirected // pipe without deadlocking const { spawn, spawnSync } = require('child_process'); diff --git a/test/parallel/test-stream-readable-async-iterators.js b/test/parallel/test-stream-readable-async-iterators.js index d8eb83a585..fb3c55846c 100644 --- a/test/parallel/test-stream-readable-async-iterators.js +++ b/test/parallel/test-stream-readable-async-iterators.js @@ -5,6 +5,28 @@ const { Readable } = require('stream'); const assert = require('assert'); async function tests() { + { + const AsyncIteratorPrototype = Object.getPrototypeOf( + Object.getPrototypeOf(async function* () {}).prototype); + const rs = new Readable({}); + assert.strictEqual( + Object.getPrototypeOf(Object.getPrototypeOf(rs[Symbol.asyncIterator]())), + AsyncIteratorPrototype); + } + + await (async function() { + const readable = new Readable({ objectMode: true, read() {} }); + readable.push(0); + readable.push(1); + readable.push(null); + + const iter = readable[Symbol.asyncIterator](); + assert.strictEqual((await iter.next()).value, 0); + for await (const d of iter) { + assert.strictEqual(d, 1); + } + })(); + await (async function() { console.log('read without for..await'); const max = 5; diff --git a/test/parallel/test-stream-writable-write-writev-finish.js b/test/parallel/test-stream-writable-write-writev-finish.js index c0bb60f925..98660b76ac 100644 --- a/test/parallel/test-stream-writable-write-writev-finish.js +++ b/test/parallel/test-stream-writable-write-writev-finish.js @@ -174,7 +174,7 @@ const stream = require('stream'); }; w.on('error', common.mustCall()); w.on('finish', () => { - w.write("should't write in finish listener"); + w.write("shouldn't write in finish listener"); }); w.end(); } diff --git a/test/parallel/test-timers-unrefd-interval-still-fires.js b/test/parallel/test-timers-unrefd-interval-still-fires.js index a9e9af8430..45c59c0108 100644 --- a/test/parallel/test-timers-unrefd-interval-still-fires.js +++ b/test/parallel/test-timers-unrefd-interval-still-fires.js @@ -16,7 +16,7 @@ const timer = setInterval(common.mustCall(() => { if (--N === 0) { clearInterval(timer); timer._onTimeout = - common.mustNotCall('Unrefd interal fired after being cleared'); + common.mustNotCall('Unrefd interval fired after being cleared'); clearTimeout(keepOpen); } }, N), 1); diff --git a/test/parallel/test-util-format.js b/test/parallel/test-util-format.js index a8adf93671..0c4ba82fec 100644 --- a/test/parallel/test-util-format.js +++ b/test/parallel/test-util-format.js @@ -68,6 +68,18 @@ assert.strictEqual(util.format('%d', -0.5), '-0.5'); assert.strictEqual(util.format('%d', ''), '0'); assert.strictEqual(util.format('%d %d', 42, 43), '42 43'); assert.strictEqual(util.format('%d %d', 42), '42 %d'); +assert.strictEqual( + util.format('%d', 1180591620717411303424), + '1.1805916207174113e+21' +); +assert.strictEqual( + util.format('%d', 1180591620717411303424n), + '1180591620717411303424n' +); +assert.strictEqual( + util.format('%d %d', 1180591620717411303424n, 12345678901234567890123n), + '1180591620717411303424n 12345678901234567890123n' +); // Integer format specifier assert.strictEqual(util.format('%i'), '%i'); @@ -80,6 +92,28 @@ assert.strictEqual(util.format('%i', -0.5), '0'); assert.strictEqual(util.format('%i', ''), 'NaN'); assert.strictEqual(util.format('%i %i', 42, 43), '42 43'); assert.strictEqual(util.format('%i %i', 42), '42 %i'); +assert.strictEqual( + util.format('%i', 1180591620717411303424), + '1' +); +assert.strictEqual( + util.format('%i', 1180591620717411303424n), + '1180591620717411303424n' +); +assert.strictEqual( + util.format('%i %i', 1180591620717411303424n, 12345678901234567890123n), + '1180591620717411303424n 12345678901234567890123n' +); + +assert.strictEqual( + util.format('%d %i', 1180591620717411303424n, 12345678901234567890123n), + '1180591620717411303424n 12345678901234567890123n' +); + +assert.strictEqual( + util.format('%i %d', 1180591620717411303424n, 12345678901234567890123n), + '1180591620717411303424n 12345678901234567890123n' +); // Float format specifier assert.strictEqual(util.format('%f'), '%f'); diff --git a/test/parallel/test-worker-debug.js b/test/parallel/test-worker-debug.js index 8691879f14..2340c233a1 100644 --- a/test/parallel/test-worker-debug.js +++ b/test/parallel/test-worker-debug.js @@ -130,11 +130,11 @@ class WorkerSession extends EventEmitter { async function testBasicWorkerDebug(session, post) { /* - 1. Do 'enble' with waitForDebuggerOnStart = true + 1. Do 'enable' with waitForDebuggerOnStart = true 2. Run worker. It should break on start. 3. Enable Runtime (to get console message) and Debugger. Resume. 4. Breaks on the 'debugger' statement. Resume. - 5. Console message recieved, worker runs to a completion. + 5. Console message received, worker runs to a completion. 6. contextCreated/contextDestroyed had been properly dispatched */ console.log('Test basic debug scenario'); diff --git a/test/parallel/test-zlib-flush-drain.js b/test/parallel/test-zlib-flush-drain.js index 0619eecf3c..a470e32090 100644 --- a/test/parallel/test-zlib-flush-drain.js +++ b/test/parallel/test-zlib-flush-drain.js @@ -44,5 +44,5 @@ process.once('exit', function() { assert.strictEqual( drainCount, 1); assert.strictEqual( - flushCount, 2); + flushCount, 1); }); diff --git a/test/parallel/test-zlib-write-after-flush.js b/test/parallel/test-zlib-write-after-flush.js index 2ba6ba4550..6d8d787343 100644 --- a/test/parallel/test-zlib-write-after-flush.js +++ b/test/parallel/test-zlib-write-after-flush.js @@ -35,7 +35,7 @@ gunz.setEncoding('utf8'); gunz.on('data', (c) => output += c); gunz.on('end', common.mustCall(() => { assert.strictEqual(output, input); - assert.strictEqual(gzip._flushFlag, zlib.constants.Z_NO_FLUSH); + assert.strictEqual(gzip._nextFlush, -1); })); // make sure that flush/write doesn't trigger an assert failure diff --git a/test/sequential/test-http-regr-gh-2928.js b/test/sequential/test-http-regr-gh-2928.js index 0950b84bbe..3794eddaa0 100644 --- a/test/sequential/test-http-regr-gh-2928.js +++ b/test/sequential/test-http-regr-gh-2928.js @@ -7,6 +7,7 @@ const common = require('../common'); const assert = require('assert'); const httpCommon = require('_http_common'); const { internalBinding } = require('internal/test/binding'); +const is_reused_symbol = require('internal/freelist').symbols.is_reused_symbol; const { HTTPParser } = internalBinding('http_parser'); const net = require('net'); @@ -25,7 +26,7 @@ function execAndClose() { process.stdout.write('.'); const parser = parsers.pop(); - parser.reinitialize(HTTPParser.RESPONSE); + parser.reinitialize(HTTPParser.RESPONSE, parser[is_reused_symbol]); const socket = net.connect(common.PORT); socket.on('error', (e) => { diff --git a/tools/cpplint.py b/tools/cpplint.py index f31ce284b5..5f5f1400d7 100755 --- a/tools/cpplint.py +++ b/tools/cpplint.py @@ -129,7 +129,7 @@ def GetNonHeaderExtensions(): likely to be false positives. quiet - Supress output other than linting errors, such as information about + Suppress output other than linting errors, such as information about which files have been processed and excluded. filter=-x,+y,... @@ -650,7 +650,7 @@ def GetNonHeaderExtensions(): # Files to exclude from linting. This is set by the --exclude flag. _excludes = None -# Whether to supress PrintInfo messages +# Whether to suppress PrintInfo messages _quiet = False # The allowed line length of files. diff --git a/tools/doc/apilinks.js b/tools/doc/apilinks.js index d7ec5684b7..c86db14338 100644 --- a/tools/doc/apilinks.js +++ b/tools/doc/apilinks.js @@ -35,7 +35,7 @@ function execSync(command) { } } -// Determine orign repo and tag (or hash) of the most recent commit. +// Determine origin repo and tag (or hash) of the most recent commit. const local_branch = execSync('git name-rev --name-only HEAD'); const tracking_remote = execSync(`git config branch.${local_branch}.remote`); const remote_url = execSync(`git config remote.${tracking_remote}.url`); diff --git a/tools/genv8constants.py b/tools/genv8constants.py index b516728635..2b6ed84992 100755 --- a/tools/genv8constants.py +++ b/tools/genv8constants.py @@ -78,7 +78,7 @@ def out_define(): # format, but this is the most obvious robust approach. We could almost # rely on looking at numbered fields, but some instructions look very # much like hex numbers (e.g., "adc"), and we don't want to risk picking - # those up by mistake, so we look at character-based columns intead. + # those up by mistake, so we look at character-based columns instead. # for i in range (0, 3): # 6-character margin, 2-characters + 1 space for each field diff --git a/tools/lint-js.js b/tools/lint-js.js index 69e5dd10e1..4a7c2f08c3 100644 --- a/tools/lint-js.js +++ b/tools/lint-js.js @@ -192,7 +192,7 @@ if (cluster.isMaster) { const sliceLen = Math.min(maxWorkload, Math.ceil(files.length / numCPUs)); var slice; if (sliceLen === files.length) { - // Micro-ptimization to avoid splicing to an empty array + // Micro-optimization to avoid splicing to an empty array slice = files; files = null; } else { diff --git a/tools/lint-md.js b/tools/lint-md.js index 9d46816526..8dd8a623db 100644 --- a/tools/lint-md.js +++ b/tools/lint-md.js @@ -90,7 +90,7 @@ function wrap(fn, callback) { * pipeline), but later also threw an error. * We’re not about to restart the pipeline again, * so the only thing left to do is to throw the - * thing instea. */ + * thing instead. */ if (callback && invoked) { throw err } @@ -901,7 +901,7 @@ function representYamlFloat(object, style) { res = object.toString(10); // JS stringifier can build scientific format without dots: 5e-100, - // while YAML requres dot: 5.e-100. Fix it with simple hack + // while YAML requires dot: 5.e-100. Fix it with simple hack return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace('e', '.e') : res; } @@ -2322,7 +2322,7 @@ function readBlockScalar(state, nodeIndent) { } } - // Break this `while` cycle and go to the funciton's epilogue. + // Break this `while` cycle and go to the function's epilogue. break; }