Shelley Vohr
d68bff2e6f
2020-10-06, Version 12.19.0 'Erbium' (LTS)
...
Notable changes:
assert:
* (SEMVER-MINOR) port common.mustCall() to assert (ConorDavenport) https://github.com/nodejs/node/pull/31982
async_hooks:
* (SEMVER-MINOR) add AsyncResource.bind utility (James M Snell) https://github.com/nodejs/node/pull/34574
buffer:
* (SEMVER-MINOR) also alias BigUInt methods (Anna Henningsen) https://github.com/nodejs/node/pull/34960
* (SEMVER-MINOR) alias UInt ➡️ Uint in buffer methods (Anna Henningsen) https://github.com/nodejs/node/pull/34729
build:
* (SEMVER-MINOR) add build flag for OSS-Fuzz integration (davkor) https://github.com/nodejs/node/pull/34761
cli:
* (SEMVER-MINOR) add alias for report-directory to make it consistent (Ash Cripps) https://github.com/nodejs/node/pull/33587
crypto:
* (SEMVER-MINOR) allow KeyObjects in postMessage (Tobias Nießen) https://github.com/nodejs/node/pull/33360
* (SEMVER-MINOR) add randomInt function (Oli Lalonde) https://github.com/nodejs/node/pull/34600
deps:
* upgrade to libuv 1.39.0 (Colin Ihrig) https://github.com/nodejs/node/pull/34915
* upgrade npm to 6.14.7 (claudiahdz) https://github.com/nodejs/node/pull/34468
* upgrade to libuv 1.38.1 (Colin Ihrig) https://github.com/nodejs/node/pull/34187
dgram:
* (SEMVER-MINOR) add IPv6 scope id suffix to received udp6 dgrams (Pekka Nikander) https://github.com/nodejs/node/pull/14500
* (SEMVER-MINOR) allow typed arrays in .send() (Sarat Addepalli) https://github.com/nodejs/node/pull/22413
doc:
* (SEMVER-MINOR) Add maxTotalSockets option to agent constructor (rickyes) https://github.com/nodejs/node/pull/33617
* (SEMVER-MINOR) add basic embedding example documentation (Anna Henningsen) https://github.com/nodejs/node/pull/30467
* add Ricky Zhou to collaborators (rickyes) https://github.com/nodejs/node/pull/34676
* add release key for Ruy Adorno (Ruy Adorno) https://github.com/nodejs/node/pull/34628
* add DerekNonGeneric to collaborators (Derek Lewis) https://github.com/nodejs/node/pull/34602
* add AshCripps to collaborators (Ash Cripps) https://github.com/nodejs/node/pull/34494
* add HarshithaKP to collaborators (Harshitha K P) https://github.com/nodejs/node/pull/34417
* add rexagod to collaborators (Pranshu Srivastava) https://github.com/nodejs/node/pull/34457
* add release key for Richard Lau (Richard Lau) https://github.com/nodejs/node/pull/34397
* add danielleadams to collaborators (Danielle Adams) https://github.com/nodejs/node/pull/34360
* add sxa as collaborator (Stewart X Addison) https://github.com/nodejs/node/pull/34338
* add ruyadorno to collaborators (Ruy Adorno) https://github.com/nodejs/node/pull/34297
* (SEMVER-MAJOR) deprecate process.umask() with no arguments (Colin Ihrig) https://github.com/nodejs/node/pull/32499
embedding:
* (SEMVER-MINOR) make Stop() stop Workers (Anna Henningsen) https://github.com/nodejs/node/pull/32531
* (SEMVER-MINOR) provide hook for custom process.exit() behaviour (Anna Henningsen) https://github.com/nodejs/node/pull/32531
fs:
* (SEMVER-MINOR) implement lutimes (Maël Nison) https://github.com/nodejs/node/pull/33399
http:
* (SEMVER-MINOR) add maxTotalSockets to agent class (rickyes) https://github.com/nodejs/node/pull/33617
* (SEMVER-MINOR) return this from IncomingMessage#destroy() (Colin Ihrig) https://github.com/nodejs/node/pull/32789
* (SEMVER-MINOR) expose host and protocol on ClientRequest (wenningplus) https://github.com/nodejs/node/pull/33803
http2:
* (SEMVER-MINOR) return this for Http2ServerRequest#setTimeout (Pranshu Srivastava) https://github.com/nodejs/node/pull/33994
* (SEMVER-MINOR) do not modify explicity set date headers (Pranshu Srivastava) https://github.com/nodejs/node/pull/33160
module:
* (SEMVER-MINOR) named exports for CJS via static analysis (Guy Bedford) https://github.com/nodejs/node/pull/35249
* (SEMVER-MINOR) exports pattern support (Guy Bedford) https://github.com/nodejs/node/pull/34718
* (SEMVER-MINOR) package "imports" field (Guy Bedford) https://github.com/nodejs/node/pull/34117
* (SEMVER-MINOR) deprecate module.parent (Antoine du HAMEL) https://github.com/nodejs/node/pull/32217
n-api:
* (SEMVER-MINOR) create N-API version 7 (Gabriel Schulhof) https://github.com/nodejs/node/pull/35199
* (SEMVER-MINOR) support type-tagging objects (Gabriel Schulhof) https://github.com/nodejs/node/pull/28237
n-api,src:
* (SEMVER-MINOR) provide asynchronous cleanup hooks (Anna Henningsen) https://github.com/nodejs/node/pull/34572
perf_hooks:
* (SEMVER-MINOR) add idleTime and event loop util (Trevor Norris) https://github.com/nodejs/node/pull/34938
timers:
* (SEMVER-MINOR) allow timers to be used as primitives (Denys Otrishko) https://github.com/nodejs/node/pull/34017
tls:
* (SEMVER-MINOR) make 'createSecureContext' honor more options (Mateusz Krawczuk) https://github.com/nodejs/node/pull/33974
worker:
* (SEMVER-MINOR) add public method for marking objects as untransferable (Anna Henningsen) https://github.com/nodejs/node/pull/33979
* (SEMVER-MINOR) emit `'messagerror'` events for failed deserialization (Anna Henningsen) https://github.com/nodejs/node/pull/33772
* (SEMVER-MINOR) allow passing JS wrapper objects via postMessage (Anna Henningsen) https://github.com/nodejs/node/pull/33772
* (SEMVER-MINOR) allow transferring/cloning generic BaseObjects (Anna Henningsen) https://github.com/nodejs/node/pull/33772
* (SEMVER-MINOR) add option to track unmanaged file descriptors (Anna Henningsen) https://github.com/nodejs/node/pull/34303
* (SEMVER-MINOR) add stack size resource limit option (Anna Henningsen) https://github.com/nodejs/node/pull/33085
worker,fs:
* (SEMVER-MINOR) make FileHandle transferable (Anna Henningsen) https://github.com/nodejs/node/pull/33772
zlib:
* (SEMVER-MINOR) add `maxOutputLength` option (unknown) https://github.com/nodejs/node/pull/33516
* switch to lazy init for zlib streams (Andrey Pechkurov) https://github.com/nodejs/node/pull/34048
PR-URL: https://github.com/nodejs/node/pull/35401
v12.19.0
2020-10-06 10:37:45 -07:00
Christoph Tavan
ed3278d55d
module: fix crash on multiline named cjs imports
...
The node process crashes when trying to parse a multiline import
statement for named exports of a CommonJS module:
TypeError: Cannot read property '0' of null
at ModuleJob._instantiate (internal/modules/esm/module_job.js:112:77)
at async ModuleJob.run (internal/modules/esm/module_job.js:137:5)
at async Loader.import (internal/modules/esm/loader.js:165:24)
at async rejects.name (file:///***/node/test/es-module/test-esm-cjs-named-error.mjs:56:3)
at async waitForActual (assert.js:721:5)
at async rejects (assert.js:830:25),
The reason is that the regexp that is currently used to decorate the
original error fails for multi line import statements.
Unfortunately the undecorated error stack only contains the single line
which causes the import to fail:
file:///***/node/test/fixtures/es-modules/package-cjs-named-error/multi-line.mjs:2
comeOn,
^^^^^^
SyntaxError: The requested module './fail.cjs' does not provide an export named 'comeOn'
at ModuleJob._instantiate (internal/modules/esm/module_job.js:98:21)
at async ModuleJob.run (internal/modules/esm/module_job.js:141:5)
at async Loader.import (internal/modules/esm/loader.js:165:24)
at async rejects.name (file:///***/node/test/es-module/test-esm-cjs-named-error.mjs:56:3)
at async waitForActual (assert.js:721:5)
at async rejects (assert.js:830:25)
Hence, for multiline import statements we cannot create an equivalent
piece of code that uses default import followed by an object
destructuring assignment.
In any case the node process should definitely not crash. So until we
have a more sophisticated way of extracting the entire problematic
multiline import statement, show the code example only for single-line
imports where the current regexp approach works well.
Refs: https://github.com/nodejs/node/issues/35259
PR-URL: https://github.com/nodejs/node/pull/35275
Backport-PR-URL: https://github.com/nodejs/node/pull/35385
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Myles Borins <myles.borins@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2020-10-01 11:32:58 -07:00
Antoine du HAMEL
89a58f61d7
module: use isURLInstance instead of instanceof
...
PR-URL: https://github.com/nodejs/node/pull/34951
Backport-PR-URL: https://github.com/nodejs/node/pull/35385
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Derek Lewis <DerekNonGeneric@inf.is >
2020-10-01 11:32:56 -07:00
Guy Bedford
bf7b796491
esm: better package.json parser errors
...
PR-URL: https://github.com/nodejs/node/pull/35117
Backport-PR-URL: https://github.com/nodejs/node/pull/35385
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2020-10-01 11:32:54 -07:00
Rich Trott
9159649395
esm: shorten ERR_UNSUPPORTED_ESM_URL_SCHEME message
...
I know it just got modified to include new information, but this
shortens the message a bit without (I hope) losing clarity or meaning.
PR-URL: https://github.com/nodejs/node/pull/34836
Backport-PR-URL: https://github.com/nodejs/node/pull/35385
Reviewed-By: Guy Bedford <guybedford@gmail.com >
Reviewed-By: Denys Otrishko <shishugi@gmail.com >
2020-10-01 11:32:52 -07:00
Denys Otrishko
551be2aeb9
esm: improve error message of ERR_UNSUPPORTED_ESM_URL_SCHEME
...
Refs: https://github.com/nodejs/node/issues/34765
PR-URL: https://github.com/nodejs/node/pull/34795
Backport-PR-URL: https://github.com/nodejs/node/pull/35385
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Jan Krems <jan.krems@gmail.com >
Reviewed-By: Guy Bedford <guybedford@gmail.com >
Reviewed-By: Bradley Farias <bradley.meck@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2020-10-01 11:32:51 -07:00
Richard Lau
fc93cc95d8
module: drop -u alias for --conditions
...
Old versions of mocha break after https://github.com/nodejs/node/pull/34637 .
This was a bug in mocha, but since this is a widely used module
we can expect ecosystem breakage until modules are updated to
the latest version of mocha. Drop the conflicting `-u` alias --
we can potentially bring it back once modules have been updated.
PR-URL: https://github.com/nodejs/node/pull/34935
Backport-PR-URL: https://github.com/nodejs/node/pull/35385
Refs: https://github.com/mochajs/mocha/issues/4417
Refs: https://github.com/nodejs/node/pull/34637
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Jan Krems <jan.krems@gmail.com >
Reviewed-By: Beth Griggs <Bethany.Griggs@uk.ibm.com >
Reviewed-By: Myles Borins <myles.borins@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Shelley Vohr <codebytere@gmail.com >
2020-10-01 11:32:49 -07:00
Derek Lewis and Guy Bedford
740c95819f
module: fix check for package.json at volume root
...
This patch converts the "read package scope" algorithm's while loop
into a do-while loop enabling items at the filesystem root dir to
be considered within the scope of a sibling package.json also at the
filesystem root dir.
Fixes: https://github.com/nodejs/node/issues/33438
Co-authored-by: Guy Bedford <guybedford@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/34595
Backport-PR-URL: https://github.com/nodejs/node/pull/35385
Reviewed-By: Jan Krems <jan.krems@gmail.com >
Reviewed-By: Mary Marchini <oss@mmarchini.me >
2020-10-01 11:32:47 -07:00
Guy Bedford
cecc193abc
module: share CJS/ESM resolver fns, refactoring
...
PR-URL: https://github.com/nodejs/node/pull/34744
Backport-PR-URL: https://github.com/nodejs/node/pull/35385
Reviewed-By: Jan Krems <jan.krems@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2020-10-01 11:32:46 -07:00
Guy Bedford
d9857fdbc2
module: custom --conditions flag option
...
PR-URL: https://github.com/nodejs/node/pull/34637
Backport-PR-URL: https://github.com/nodejs/node/pull/35385
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Geoffrey Booth <webmaster@geoffreybooth.com >
Reviewed-By: Jan Krems <jan.krems@gmail.com >
2020-10-01 11:32:44 -07:00
Guy Bedford
3ad146d474
module: use cjsCache over esm injection
...
PR-URL: https://github.com/nodejs/node/pull/34605
Backport-PR-URL: https://github.com/nodejs/node/pull/35385
Reviewed-By: Bradley Farias <bradley.meck@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2020-10-01 11:32:42 -07:00
Daniele Belardi
00aa935f5c
module: self referential modules in repl or -r
...
Load self referential modules from the repl and using the preload flag
`-r`. In both cases the base path used for resolution is the current
`process.cwd()`. Also fixes an internal cycle bug in the REPL exports
resolution.
PR-URL: https://github.com/nodejs/node/pull/32261
Backport-PR-URL: https://github.com/nodejs/node/pull/35385
Fixes: https://github.com/nodejs/node/issues/31595
Reviewed-By: Guy Bedford <guybedford@gmail.com >
Reviewed-By: Jan Krems <jan.krems@gmail.com >
2020-10-01 11:32:40 -07:00
Guy Bedford
d065334d42
module: package "imports" field
...
PR-URL: https://github.com/nodejs/node/pull/34117
Backport-PR-URL: https://github.com/nodejs/node/pull/35385
Reviewed-By: Jan Krems <jan.krems@gmail.com >
Reviewed-By: Bradley Farias <bradley.meck@gmail.com >
2020-10-01 11:32:36 -07:00
Michaël Zasso
b7be751447
repl: support --loader option in builtin REPL
...
Fixes: https://github.com/nodejs/node/issues/33435
PR-URL: https://github.com/nodejs/node/pull/33437
Backport-PR-URL: https://github.com/nodejs/node/pull/35394
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2020-09-29 00:02:24 +02:00
rickyes
1a8669d6ec
doc: Add maxTotalSockets option to agent constructor
...
PR-URL: https://github.com/nodejs/node/pull/34013
Backport-PR-URL: https://github.com/nodejs/node/pull/35396
Refs: https://github.com/nodejs/node/pull/33617
Reviewed-By: Robert Nagy <ronagy@icloud.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/33617
Fixes: https://github.com/nodejs/node/issues/31942
2020-09-29 00:01:12 +02:00
rickyes
3d1bdc254c
http: add maxTotalSockets to agent class
...
Add maxTotalSockets to determine how many sockets an agent can open.
Unlike maxSockets, The maxTotalSockets does not count by per origin.
PR-URL: https://github.com/nodejs/node/pull/33617
Backport-PR-URL: https://github.com/nodejs/node/pull/35396
Fixes: https://github.com/nodejs/node/issues/31942
Reviewed-By: Robert Nagy <ronagy@icloud.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2020-09-29 00:01:11 +02:00
Gabriel Schulhof
b9d0f73c7c
n-api: create N-API version 7
...
Mark `napi_detach_arraybuffer` and `napi_is_detached_arraybuffer` as
stable.
Signed-off-by: Gabriel Schulhof <gabriel.schulhof@intel.com >
PR-URL: https://github.com/nodejs/node/pull/35199
Backport-PR-URL: https://github.com/nodejs/node/pull/35337
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Jiawen Geng <technicalcute@gmail.com >
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
Reviewed-By: Michael Dawson <mdawson@devrus.com >
2020-09-29 00:00:06 +02:00
rickyes
2f67e99a0b
test: add arrayOfStreams to pipeline
...
PR-URL: https://github.com/nodejs/node/pull/34156
Backport-PR-URL: https://github.com/nodejs/node/pull/35388
Reviewed-By: Robert Nagy <ronagy@icloud.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2020-09-28 10:59:41 +02:00
Rich Trott
05da376c05
doc: remove errors that were never released
...
Refs: https://github.com/nodejs/node/pull/33764#issuecomment-653667275
PR-URL: https://github.com/nodejs/node/pull/34197
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2020-09-28 10:59:41 +02:00
James M Snell
831328bdb2
doc: add note about multiple sync events and once
...
Fixes: https://github.com/nodejs/node/issues/32431
PR-URL: https://github.com/nodejs/node/pull/34220
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
2020-09-28 10:59:40 +02:00
James M Snell
a9f0fc9896
doc: document behavior for once(ee, 'error')
...
Fixes: https://github.com/nodejs/node/issues/31244
PR-URL: https://github.com/nodejs/node/pull/34225
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2020-09-28 10:59:40 +02:00
sapics
ed055c010d
doc: replace http to https of link urls
...
PR-URL: https://github.com/nodejs/node/pull/34158
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2020-09-28 10:59:39 +02:00
James M Snell and zombieleet
cef9921c74
doc: specify how fs.WriteStream/ReadStreams are created
...
Alternative to https://github.com/nodejs/node/pull/33841
Co-authored-by: zombieleet <zombieleetnca@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/34188
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2020-09-28 10:59:39 +02:00
Anna Henningsen
8d0c21fd24
util: restrict custom inspect function + vm.Context interaction
...
When `util.inspect()` is called on an object with a custom inspect
function, and that object is from a different `vm.Context`,
that function will not receive any arguments that access
context-specific data anymore.
PR-URL: https://github.com/nodejs/node/pull/33690
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2020-09-28 10:59:38 +02:00
Evan Lucas
4a2accb3d0
internal: rename error-serdes for consistency
...
All other JavaScript files in lib use snake case, so make this
one consistent.
PR-URL: https://github.com/nodejs/node/pull/33793
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2020-09-28 10:59:38 +02:00
Brian White
9f16b7f332
lib: improve debuglog() performance
...
PR-URL: https://github.com/nodejs/node/pull/32260
Reviewed-By: James M Snell <jasnell@gmail.com >
2020-09-28 10:59:37 +02:00
Anna Henningsen
3598056ac1
test: add vm crash regression test
...
Refs: https://github.com/nodejs/node/issues/34606
PR-URL: https://github.com/nodejs/node/pull/34673
Reviewed-By: Jiawen Geng <technicalcute@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2020-09-28 10:59:36 +02:00
Anna Henningsen
4ff6c77e17
deps: V8: cherry-pick e06ace6b5cdb
...
Original commit message:
[api] Fix empty Maybe crash in GetRealNamedPropertyAttributes
`Object::GetRealNamedPropertyAttributes()` can crash if an empty
`Maybe` is returned by `JSReceiver::GetPropertyAttributes()` because
it was not checking for that. Fix that.
Refs: https://github.com/nodejs/node/issues/34606
Change-Id: Ic83f904ba7134786bcd8f786eb2ce98adb4fea1e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2335057
Commit-Queue: Leszek Swirski <leszeks@chromium.org >
Reviewed-by: Leszek Swirski <leszeks@chromium.org >
Cr-Commit-Position: refs/heads/master@{#69258}
Refs: https://github.com/v8/v8/commit/e06ace6b5cdb64b6abfe8e1229f2159b7a38b4e7
PR-URL: https://github.com/nodejs/node/pull/34673
Fixes: https://github.com/nodejs/node/issues/34606
Reviewed-By: Jiawen Geng <technicalcute@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2020-09-28 10:59:36 +02:00
sapics
63cd05b1d6
src: fix ParseEncoding
...
"utf-16LE" was parsed "UNKNOWN", this fixes to "UCS2"
"utf-buffer" was parsed "BUFFER", this fixes to "UNKNOWN"
"utf-16leNOT" was parsed "UCS2", this fixes to "UNKNOWN"
PR-URL: https://github.com/nodejs/node/pull/33957
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
2020-09-28 10:59:35 +02:00
Anna Henningsen
6ee800f0c3
buffer: also alias BigUInt methods
...
These were overlooked in 5864fca7bc because of the extra
`Big` in the name. :)
Refs: https://github.com/nodejs/node/pull/34729
PR-URL: https://github.com/nodejs/node/pull/34960
Reviewed-By: Richard Lau <riclau@uk.ibm.com >
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2020-09-28 10:59:35 +02:00
Anna Henningsen
139442c34e
worker: add public method for marking objects as untransferable
...
We currently mark a number of `ArrayBuffer`s as not transferable,
including the `Buffer` pool and ones with finalizers provided
by C++ addons.
There is no good reason to assume that userland code might not
encounter similar problems, for example when doing `ArrayBuffer`
pooling similar to ours. Therefore, provide an API that lets
userland code also mark objects as not transferable.
PR-URL: https://github.com/nodejs/node/pull/33979
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Gus Caplan <me@gus.host >
2020-09-28 10:59:35 +02:00
Anna Henningsen
44864d7385
worker: do not crash when JSTransferable lists untransferable value
...
This can currently be triggered when posting a closing FileHandle.
Refs: https://github.com/nodejs/node/pull/34746#issuecomment-673675333
PR-URL: https://github.com/nodejs/node/pull/34766
Backport-PR-URL: https://github.com/nodejs/node/pull/34814
Reviewed-By: Richard Lau <riclau@uk.ibm.com >
Reviewed-By: David Carlier <devnexen@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2020-09-28 10:59:34 +02:00
Rich Trott
ed72d83802
crypto: simplify KeyObject constructor
...
Inline a function that only gets called in the constructor. Make call to
`super()` more straightforward in the process by removing conditional
involving the function as it only ever returns `undefined` or else
throws. That made the code a little hard to understand, as without
looking at the function, one would likely expect it to return `true`
on success rather than `undefined`.
PR-URL: https://github.com/nodejs/node/pull/35064
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Denys Otrishko <shishugi@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2020-09-28 10:59:33 +02:00
Daniel Bevenius
090f86955f
src: fix minor comment typo in KeyObjectData
...
PR-URL: https://github.com/nodejs/node/pull/34167
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Richard Lau <riclau@uk.ibm.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: David Carlier <devnexen@gmail.com >
2020-09-28 10:59:32 +02:00
Tobias Nießen and Anna Henningsen
b828560908
crypto: allow KeyObjects in postMessage
...
This change allows sharing KeyObjects between threads via postMessage.
The receiver acquires a new KeyObject and a new KeyObjectHandle, but
refers to the same KeyObjectData:
+-------------------+
| NativeKeyObject 1 | ------------------------------------------+
+-------------------+ |
^ |
extends |
| |
+-------------------+ +-------------------+ |
| KeyObject 1 (JS) | -> | KeyObjectHandle 1 | --------------+ |
+-------------------+ +-------------------+ | |
| |
| |
| |
| |
| |
+-------------------+ | |
| NativeKeyObject 2 | ------------------------------------+ | |
+-------------------+ | | |
^ | | |
extends | | |
| | | |
+-------------------+ +-------------------+ | | |
| KeyObject 2 (JS) | -> | KeyObjectHandle 2 | --------+ | | |
+-------------------+ +-------------------+ | | | |
| | | |
| | | |
| | | |
| | | |
| | | |
+-------------------+ | | | |
| NativeKeyObject 3 | ------------------------------+ | | | |
+-------------------+ | | | | |
^ | | | | |
extends | | | | |
| v v v v v
+-------------------+ +-------------------+ +---------------+
| KeyObject 3 (JS) | -> | KeyObjectHandle 3 | -> | KeyObjectData |
+-------------------+ +-------------------+ +---------------+
Co-authored-by: Anna Henningsen <anna@addaleax.net >
PR-URL: https://github.com/nodejs/node/pull/33360
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
2020-09-28 10:59:32 +02:00
Tobias Nießen
50b1cde872
src: store key data in separate class
...
This separates key handles from the actual key data:
+-----------------+
| NativeKeyObject |
+-----------------+
^
extends
|
+-----------------+ +-----------------+ +---------------+
| KeyObject (JS) | -> | KeyObjectHandle | -> | KeyObjectData |
+-----------------+ +-----------------+ +---------------+
PR-URL: https://github.com/nodejs/node/pull/33360
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
2020-09-28 10:59:32 +02:00
Tobias Nießen
bf3aaa31d0
src: add NativeKeyObject base class
...
+---------------------+
| BaseObject |
+---------------------+
|
|
|
+---------------------+
| NativeKeyObject |
+---------------------+
|
|
|
+---------------------+
| KeyObject |
+---------------------+
/ \
/ \
/ \
/ \
+---------------------+ +---------------------+
| SecretKeyObject | | AsymmetricKeyObject |
+---------------------+ +---------------------+
/ \
/ \
/ \
/ \
+---------------------+ +---------------------+
| PublicKeyObject | | PrivateKeyObject |
+---------------------+ +---------------------+
PR-URL: https://github.com/nodejs/node/pull/33360
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
2020-09-28 10:59:31 +02:00
Tobias Nießen
91978820fa
src: rename internal key handles to KeyObjectHandle
...
PR-URL: https://github.com/nodejs/node/pull/33360
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
2020-09-28 10:59:31 +02:00
Anna Henningsen
dafa380732
worker: emit 'messagerror' events for failed deserialization
...
This is much nicer than just treating exceptions as uncaught, and
enables reporting of exceptions from the internal C++ deserialization
machinery.
PR-URL: https://github.com/nodejs/node/pull/33772
Backport-PR-URL: https://github.com/nodejs/node/pull/33965
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2020-09-28 10:59:30 +02:00
Anna Henningsen
dd51ba3f93
worker,fs: make FileHandle transferable
...
Allow passing `FileHandle` instances in the transfer list
of a `.postMessage()` call.
PR-URL: https://github.com/nodejs/node/pull/33772
Backport-PR-URL: https://github.com/nodejs/node/pull/33965
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2020-09-28 10:59:30 +02:00
Anna Henningsen
0d35eaa034
worker: allow passing JS wrapper objects via postMessage
...
Enable JS wrapper objects to be used as transferable or cloneable
objects in `postMessage()` calls, by having them extend a C++-backed
class.
This requires a few internal changes:
- This commit adds the possibility for transferred objects to
read/write JS values at the end of the serialization/deserialization
phases.
- This commit adds the possibility for transferred objects to list
sub-transferables, e.g. typically the public JS wrapper class
would list its C++ handle in there.
- This commit adds usage of `BaseObject` in a few more places, because
now during deserialization weakly held objects can also be involved,
in addition to `MessagePort`s.
PR-URL: https://github.com/nodejs/node/pull/33772
Backport-PR-URL: https://github.com/nodejs/node/pull/33965
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2020-09-27 12:32:00 +02:00
Anna Henningsen
8e1698a784
worker: allow transferring/cloning generic BaseObjects
...
Extend support for transferring objects à la `MessagePort` to other
types of `BaseObject` subclasses, as well as implement cloning
support for cases in which destructive transferring is not needed
or optional.
PR-URL: https://github.com/nodejs/node/pull/33772
Backport-PR-URL: https://github.com/nodejs/node/pull/33965
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2020-09-27 12:01:49 +02:00
Anna Henningsen
667d520148
src: introduce BaseObject base FunctionTemplate
...
PR-URL: https://github.com/nodejs/node/pull/33772
Backport-PR-URL: https://github.com/nodejs/node/pull/33965
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2020-09-27 11:57:43 +02:00
Anna Henningsen
b4819dba5c
worker: add option to track unmanaged file descriptors
...
Add a public option for Workers which adds tracking for raw
file descriptors, as currently, those resources are not cleaned
up, unlike e.g. `FileHandle`s.
PR-URL: https://github.com/nodejs/node/pull/34303
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2020-09-27 11:57:39 +02:00
Anna Henningsen
3e21dd91c1
src: add option to track unmanaged file descriptors
...
Add the ability to track “raw” file descriptors, i.e. integers returned
by `fs.open()`, and close them on `Environment` shutdown, to match the
behavior for all other resource types (which are also closed on
shutdown).
PR-URL: https://github.com/nodejs/node/pull/34303
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2020-09-27 11:57:35 +02:00
Gabriel Schulhof and Anna Henningsen
a5aa3ddacf
n-api: re-implement async env cleanup hooks
...
* Avoid passing core `void*` and function pointers into add-on.
* Document `napi_async_cleanup_hook_handle` type.
* Render receipt of the handle mandatory from the point where the
hook gets called. Removal of the handle remains mandatory.
Fixes: https://github.com/nodejs/node/issues/34715
Signed-off-by: Gabriel Schulhof <gabriel.schulhof@intel.com >
Co-authored-by: Anna Henningsen <github@addaleax.net >
PR-URL: https://github.com/nodejs/node/pull/34819
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com >
Reviewed-By: Zeyu Yang <himself65@outlook.com >
2020-09-26 15:30:27 +02:00
James M Snell
8545fb2aa9
test: add common/udppair utility
...
Extracted from the QUIC PR. This adds a utility used to
deterministically test UDP traffic. It is currently only
used by the experimental QUIC implementation. Separated
out on request to make review easier.
PR-URL: https://github.com/nodejs/node/pull/33380
Reviewed-By: Sam Roberts <vieuxtech@gmail.com >
2020-09-26 14:23:41 +02:00
Anna Henningsen
0affe8622e
src: add public APIs to manage v8::TracingController
...
We added a hack for this a while ago for Electron, so let’s remove
that hack and make this an official API.
Refs: https://github.com/nodejs/node/pull/28724
Refs: https://github.com/nodejs/node/issues/33800
PR-URL: https://github.com/nodejs/node/pull/33850
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com >
2020-09-25 16:55:43 +02:00
Maël Nison
a19933f7fc
fs: implement lutimes
...
PR-URL: https://github.com/nodejs/node/pull/33399
Backport-PR-URL: https://github.com/nodejs/node/pull/35320
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Jiawen Geng <technicalcute@gmail.com >
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com >
2020-09-25 16:50:48 +02:00
Gerhard Stoebich
232f6e1154
test: AsyncLocalStorage works with thenables
...
This adds a test to verify that AsyncLocalStorage works with thenables.
Backport-PR-URL: https://github.com/nodejs/node/pull/34776
PR-URL: https://github.com/nodejs/node/pull/34008
Refs: https://github.com/nodejs/node/pull/33778
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2020-09-23 22:46:54 +02:00