Rich Trott
55ceaec111
tools,benchmark,lib,test: enable no-case-declarations lint rule
...
PR-URL: https://github.com/nodejs/node/pull/41385
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Tierney Cyren <hello@bnb.im >
Reviewed-By: Ricky Zhou <0x19951125@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2022-01-05 07:42:19 -08:00
Cheng Zhao
a706342368
src: add kNoBrowserGlobals flag for Environment
...
PR-URL: https://github.com/nodejs/node/pull/40532
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2022-01-05 11:01:49 +00:00
Antoine du Hamel
f34c0e0bc0
tls: use optional chaining to simplify checks
...
PR-URL: https://github.com/nodejs/node/pull/41337
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com >
2022-01-05 11:01:29 +00:00
Shaw
bad65ea69d
http: remove duplicate code
...
This line of code has been implemented in the prepareError function.
PR-URL: https://github.com/nodejs/node/pull/39239
Reviewed-By: Robert Nagy <ronagy@icloud.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com >
2022-01-04 19:55:40 -08:00
Robert Nagy
48e784043d
stream: don't emit finish after destroy
...
PR-URL: https://github.com/nodejs/node/pull/40852
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2022-01-03 16:32:44 +01:00
Darshan Sen
64cc066f59
timers: use ref counts to count timers
...
The additional objects that were getting added and deleted from the
activeTimersMap object were slowing down the rest of the timers code,
so this change falls back to using the ref counts to count the active
timers inside process.getActiveResourcesInfo().
Fixes: https://github.com/nodejs/node/issues/41219
Signed-off-by: Darshan Sen <darshan.sen@postman.com >
PR-URL: https://github.com/nodejs/node/pull/41231
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2022-01-02 15:28:23 +00:00
Benjamin Gruenbaum and Robert Nagy
55c5120b07
stream: add filter method to readable
...
This continues the work in https://github.com/nodejs/node/pull/40815 to
make streams compatible with upcoming ECMAScript language features. It
adds an experimental `filter` api to streams and tests/docs for it.
See https://github.com/tc39/proposal-iterator-helpers/
Co-Authored-By: Robert Nagy <ronagy@icloud.com >
PR-URL: https://github.com/nodejs/node/pull/41354
Reviewed-By: Robert Nagy <ronagy@icloud.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2022-01-02 09:52:50 +02:00
Colin Ihrig
d0c1176533
fs: use async directory processing in cp()
...
The readdir() functions do not scale well, which is why
opendir(), etc. were introduced. This is exacerbated in the
current cp() implementation, which calls readdir() recursively.
This commit updates cp() to use the opendir() style iteration.
PR-URL: https://github.com/nodejs/node/pull/41351
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Tierney Cyren <hello@bnb.im >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com >
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com >
2021-12-31 20:22:56 +00:00
Qingyu Deng
a100a93e6f
typings: add JSDoc for string_decoder
...
PR-URL: https://github.com/nodejs/node/pull/38229
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2021-12-31 00:44:32 +01:00
Erick Wendel
de12141dd0
child_process: queue pending messages
...
It fixes the problem of the child process not receiving messages.
Fixes: https://github.com/nodejs/node/issues/41134
PR-URL: https://github.com/nodejs/node/pull/41221
Reviewed-By: Adrian Estrada <edsadr@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com >
2021-12-30 05:59:49 -08:00
Rich Trott
26c973d4b3
child_process: improve argument validation
...
For execFile() and fork(), use INVALID_ARG_TYPE as appropriate instead
of INVALID_ARG_VALUE. Use validator functions where sensible.
PR-URL: https://github.com/nodejs/node/pull/41305
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2021-12-29 16:41:45 -08:00
Robert Nagy
a698c49993
stream: add isReadable helper
...
PR-URL: https://github.com/nodejs/node/pull/41199
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-12-29 20:42:10 +01:00
Benjamin Gruenbaum and Robert Nagy
b97b81d4ec
stream: add map method to Readable
...
Implement the map method on readable stream. This starts the alignment
with the tc39-iterator-helpers proposal and adds a `.map` method to
every Node.js readable stream.
Co-Authored-By: Robert Nagy <ronag@icloud.com >
PR-URL: https://github.com/nodejs/node/pull/40815
Reviewed-By: Robert Nagy <ronagy@icloud.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2021-12-29 20:32:36 +01:00
Rich Trott
43371dd5d2
events: clarify JSDoc entries
...
Split the JSDoc entries into separate blocks.
This is in preparation for enabling jsdoc/check-param-names lint rule.
PR-URL: https://github.com/nodejs/node/pull/41311
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2021-12-28 13:16:58 -08:00
James M Snell
353532b9c3
crypto: alias webcrypto.subtle and webcrypto.getRandomValues on crypto
...
The aliases allow code written to assume that `crypto.subtle` and
`crypto.getRandomValues()` exist on the `crypto` global to just work.
Signed-off-by: James M Snell <jasnell@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/41266
Reviewed-By: Filip Skokan <panva.ip@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2021-12-27 14:48:59 +00:00
CallMeLaNN
077c75beae
tls: permit null as a pfx value
...
Allow null along with undefined for pfx value.
This is to avoid breaking change when upgrading v14 to v16 and
3rd party library passing null to pfx
Fixes: https://github.com/nodejs/node/issues/36292
PR-URL: https://github.com/nodejs/node/pull/41170
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Filip Skokan <panva.ip@gmail.com >
2021-12-27 14:14:56 +00:00
James M Snell
ce4d3adf50
worker: expose BroadcastChannel as a global
...
Signed-off-by: James M Snell <jasnell@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/41271
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2021-12-24 08:32:48 -08:00
James M Snell
6486a304d3
worker: graduate BroadcastChannel to supported
...
Signed-off-by: James M Snell <jasnell@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/41271
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2021-12-24 08:32:46 -08:00
Ruben Bridgewater
54e9cba336
util: do not reduce to a single line if not appropriate using inspect
...
This makes sure entries are not lined up on a single line if the
content contains any new line. That would otherwise cause confusing
output.
Signed-off-by: Ruben Bridgewater <ruben@bridgewater.de >
PR-URL: https://github.com/nodejs/node/pull/41083
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-12-24 07:32:59 -08:00
James M Snell
cea76dbf33
buffer: expose Blob as a global
...
`Blob` is defined as a global in the spec. We have WPT's for it,
and it's graduated experimental. Time to expose it as a global.
Signed-off-by: James M Snell <jasnell@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/41270
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Robert Nagy <ronagy@icloud.com >
2021-12-24 07:26:38 -08:00
James M Snell
99c18f4786
buffer: graduate Blob from experimental
...
It's time.
Signed-off-by: James M Snell <jasnell@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/41270
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Robert Nagy <ronagy@icloud.com >
2021-12-24 07:26:25 -08:00
James M Snell
9d6bd102ee
events: add jsdoc details for Event and EventTarget
...
Signed-off-by: James M Snell <jasnell@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/41274
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Adrian Estrada <edsadr@gmail.com >
2021-12-24 07:08:57 -08:00
Rich Trott
4069e7eddb
child_process: revise argument processing
...
execFile() and fork() have complicated argument processing. Clarify code
and avoid using `arguments`.
PR-URL: https://github.com/nodejs/node/pull/41280
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2021-12-24 14:53:05 +00:00
Tim Perry
cadeabc5f7
http2: handle existing socket data when creating HTTP/2 server sessions
...
When emitting a 'connection' event to manually inject connections into a
server, it's common for the provided stream to already contain readable
data, e.g. after sniffing a connection to detect HTTP/2 from the initial
bytes.
Previously this was supported only for outgoing HTTP/2 sessions created
with http2.connect(). This change ensures that HTTP/2 over existing
streams is supported on both outgoing and incoming sessions.
PR-URL: https://github.com/nodejs/node/pull/41185
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
2021-12-23 18:33:52 +00:00
James M Snell
895c3d937e
events: add EventEmitterAsyncResource to core
...
Signd-off-by: James M Snell <jasnell@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/41246
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2021-12-23 00:56:57 +00:00
Gabriel Bota
34e3dd5034
loader: fix package resolution for edge case
...
this commit solves a regression introduced with PR-40980.
if a resolve call results in a script with .mjs extension the
is automatically set to . This avoids the case where an additional
in the same directory as the .mjs file would declare the
to commonjs
PR-URL: https://github.com/nodejs/node/pull/41218
Refs: https://github.com/nodejs/node/pull/40980
Refs: https://github.com/yargs/yargs/issues/2068
Reviewed-By: Guy Bedford <guybedford@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-12-22 18:43:19 +00:00
Jordan Harband
8d1f13b376
util: display a present-but-undefined error cause
...
See https://github.com/nodejs/node/pull/41097#issuecomment-997055761
PR-URL: https://github.com/nodejs/node/pull/41247
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-12-21 23:46:36 +00:00
Rich Trott
0264f2395f
lib: remove spurious JSDoc entry
...
PR-URL: https://github.com/nodejs/node/pull/41240
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2021-12-21 23:19:51 +00:00
Rich Trott
1d34f0fefd
fs: correct param names in JSDoc comments
...
PR-URL: https://github.com/nodejs/node/pull/41237
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2021-12-21 17:53:57 +00:00
Rich Trott
23f1b22725
esm: reconcile JSDoc vs. actual parameter name
...
PR-URL: https://github.com/nodejs/node/pull/41238
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2021-12-21 17:53:47 +00:00
Rich Trott
73d2d90122
policy: add missing JSDoc @param entry
...
PR-URL: https://github.com/nodejs/node/pull/41239
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2021-12-21 17:53:39 +00:00
Bradley Farias
c3866b09c1
async_hooks: fix AsyncLocalStorage in unhandledRejection cases
...
PR-URL: https://github.com/nodejs/node/pull/41202
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Vladimir de Turckheim <vlad2t@hotmail.com >
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com >
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com >
2021-12-21 09:33:45 -06:00
Rafael Gonzaga
113133badb
stream: fix enqueue race condition on esm modules
...
stream: use nextTick on close
PR-URL: https://github.com/nodejs/node/pull/40901
Reviewed-By: Robert Nagy <ronagy@icloud.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2021-12-21 10:24:15 +00:00
Qingyu Deng
3f7dabdfdc
lib: fix checking syntax of esm module
...
Fixes: https://github.com/nodejs/node/issues/41189
PR-URL: https://github.com/nodejs/node/pull/41198
Refs: https://github.com/nodejs/node/pull/37468
Reviewed-By: Derek Lewis <DerekNonGeneric@inf.is >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Richard Lau <rlau@redhat.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
2021-12-19 23:33:34 +00:00
Antoine du Hamel
81812bad7b
child_process: add support for URL to cp.fork
...
PR-URL: https://github.com/nodejs/node/pull/41225
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-12-19 22:40:53 +00:00
James M Snell
23637e9a3b
perf_hooks: multiple fixes for Histogram
...
* The createHistogram(options) options weren't actually implemented
* Add a new count property that tracks the number of samples
* Adds BigInt options for relevant properties
* Adds add(other) method for RecordableHistogram
* Cleans up and expands tests
* Eliminates unnecessary ELDHistogram native class
* Improve/Simplify histogram transfer impl
Signed-off-by: James M Snell <jasnell@gmail.com >
perf_hooks: simplify Histogram constructor options
Signed-off-by: James M Snell <jasnell@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/41153
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2021-12-19 09:56:36 -08:00
Rich Trott
29f714b152
lib,tools: remove empty lines between JSDoc tags
...
This is in preparation for enabling a recommended JSDoc lint rule.
PR-URL: https://github.com/nodejs/node/pull/41147
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2021-12-19 05:30:09 +00:00
Robert Nagy
752d75d8bc
stream: add isErrored helper
...
Refs: https://github.com/nodejs/undici/pull/1134
PR-URL: https://github.com/nodejs/node/pull/41121
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com >
2021-12-16 14:28:31 +01:00
Darshan Sen
ced5fc3930
assert: prefer reference comparison over string comparison
...
Pointer comparison takes constant time and string comparison takes
linear time unless there is some string interning going on, so this
might be a little bit faster.
Signed-off-by: Darshan Sen <darshan.sen@postman.com >
PR-URL: https://github.com/nodejs/node/pull/41015
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Zijian Liu <lxxyxzj@gmail.com >
2021-12-14 14:58:47 +00:00
Darshan Sen
0d9f3bd9e8
process: add getActiveResourcesInfo()
...
This is supposed to be a public alternative of the private APIs,
`process._getActiveResources()` and `process._getActiveHandles()`. When
called, it returns an array of strings containing the types of the
active resources that are currently keeping the event loop alive.
Signed-off-by: Darshan Sen <darshan.sen@postman.com >
PR-URL: https://github.com/nodejs/node/pull/40813
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com >
Reviewed-By: Vladimir de Turckheim <vlad2t@hotmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2021-12-14 14:09:08 +00:00
Gabriel Bota
85d4cd3079
loader: return package format from defaultResolve if known
...
This is a proposed modification of defaultResolve to return the package
format in case it has been found during package resolution.
The format will be returned as described in the documentation:
https://nodejs.org/api/esm.html#resolvespecifier-context-defaultresolve
There is one new unit test as well:
test/es-module/test-esm-resolve-type.js
PR-URL: https://github.com/nodejs/node/pull/40980
Reviewed-By: Bradley Farias <bradley.meck@gmail.com >
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2021-12-13 20:44:00 +00:00
Antoine du Hamel
e5c1fd7a2a
fs: accept URL as argument for fs.rm and fs.rmSync
...
PR-URL: https://github.com/nodejs/node/pull/41132
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2021-12-13 14:45:09 +00:00
Rich Trott
88dd9724b0
lib: include return types in JSDoc
...
Add types to @returns JSDoc annotations where the type is missing.
PR-URL: https://github.com/nodejs/node/pull/41130
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2021-12-12 03:51:00 +00:00
Ruben Bridgewater
c2ff69db4c
util: serialize falsy cause values while inspecting errors
...
Signed-off-by: Ruben Bridgewater <ruben@bridgewater.de >
PR-URL: https://github.com/nodejs/node/pull/41097
Fixes: https://github.com/nodejs/node/issues/41096
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com >
2021-12-11 12:05:41 +00:00
Ruben Bridgewater
1133796dbf
util: make sure error causes of any type may be inspected
...
An error cause may be of any type. Handle all of them, no matter
if they are an error or not.
Fixes: https://github.com/nodejs/node/issues/41096
Signed-off-by: Ruben Bridgewater <ruben@bridgewater.de >
PR-URL: https://github.com/nodejs/node/pull/41097
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com >
2021-12-11 12:05:41 +00:00
Ruben Bridgewater
4569674e39
util: pass through the inspect function to custom inspect functions
...
This allows to use more portable custom inspect functions.
Fixes: https://github.com/nodejs/node/issues/35956
Signed-off-by: Ruben Bridgewater <ruben@bridgewater.de >
PR-URL: https://github.com/nodejs/node/pull/41019
Reviewed-By: Michaël Zasso <targos@protonmail.com >
2021-12-11 11:49:45 +00:00
James M Snell
29a909ab22
lib: make AbortSignal cloneable/transferable
...
Allows for using `AbortSignal` across worker threads and contexts.
```js
const ac = new AbortController();
const mc = new MessageChannel();
mc.port1.onmessage = ({ data }) => {
data.addEventListener('abort', () => {
console.log('aborted!');
});
};
mc.port2.postMessage(ac.signal, [ac.signal]);
```
Signed-off-by: James M Snell <jasnell@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/41050
Refs: https://github.com/whatwg/dom/issues/948
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Robert Nagy <ronagy@icloud.com >
2021-12-10 19:22:05 -08:00
Irakli Gozalishvili
2e1fa8ab28
buffer: fix Blob constructor on various TypedArrays
...
Fixes: https://github.com/nodejs/node/issues/40705
PR-URL: https://github.com/nodejs/node/pull/40706
Reviewed-By: Robert Nagy <ronagy@icloud.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-12-11 00:36:20 +01:00
Santiago Gimeno
ef7a686ed9
http: don't write empty data on req/res end()
...
When calling OutgoingMessage.end() with empty data argument, avoid
writing to the socket unless there's still pending data to be sent.
Fixes: https://github.com/nodejs/node/issues/41062
PR-URL: https://github.com/nodejs/node/pull/41116
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-12-10 19:44:24 +00:00
James M Snell
3f72c72bbb
lib: add abortSignal.throwIfAborted()
...
Refs: https://github.com/whatwg/dom/pull/1034
Signed-off-by: James M Snell <jasnell@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/40951
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2021-12-10 07:51:41 -08:00