XadillaX
48655e17e1
lib,url: correct URL's argument to pass idlharness
...
`url.idl` defines URL's constructor as:
```
constructor(USVString url, optional USVString base);
```
`idlharness.any.js` checks its length as `1`. So we should remove
constructor's second argument and use `arguments[1]` in constructor's
logic.
Refs: https://url.spec.whatwg.org/#idl-index
PR-URL: https://github.com/nodejs/node/pull/39848
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-08-26 15:18:09 +08:00
Guy Bedford
18bb2cef83
module: support pattern trailers
...
PR-URL: https://github.com/nodejs/node/pull/39635
Reviewed-By: Bradley Farias <bradley.meck@gmail.com >
2021-08-25 12:49:33 -07:00
Robert Nagy
c04d621ecc
stream: add signal support to pipeline generators
...
Generators in pipeline must be able to be aborted or pipeline
can deadlock.
PR-URL: https://github.com/nodejs/node/pull/39067
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-08-25 17:44:28 +02:00
Yash Ladha
2acd866990
cluster: fix comment regarding child_process file
...
Fixed comment for the description of INTERNAL_PREFIX in child_process
whereas the value is present in the internal/child_process.js.
PR-URL: https://github.com/nodejs/node/pull/39308
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
2021-08-25 08:32:52 -07:00
Filip Skokan
4441c3e3b5
crypto: fix JWK RSA-PSS SubtleCrypto.exportKey
...
PR-URL: https://github.com/nodejs/node/pull/39828
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-08-25 08:24:41 -07:00
James M Snell
367c6245b4
events: protect property defs against prototype polution
...
Signed-off-by: James M Snell <jasnell@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/39773
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2021-08-25 08:21:00 -07:00
James M Snell
4ec64e320f
events: add brand checks for detached accessors
...
PR-URL: https://github.com/nodejs/node/pull/39773
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2021-08-25 08:20:50 -07:00
James M Snell
9c16305a3b
worker: add brand checks for detached MessageEvent accessors
...
Signed-off-by: James M Snell <jasnell@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/39773
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2021-08-25 08:20:44 -07:00
Brian White
f581f6da94
url: fix performance regression
...
PR-URL: https://github.com/nodejs/node/pull/39778
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de >
2021-08-25 16:40:29 +02:00
Robert Nagy
82ae00cae4
util: expose toUSVString
...
Expose toUSVString so it can be used by user libraries.
PR-URL: https://github.com/nodejs/node/pull/39814
Refs: https://github.com/nodejs/undici/pull/986
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2021-08-22 07:08:00 +02:00
cjihrig
1deafcd653
fs: combine require() and destructure
...
This commit combines two require() calls and subsequent
destructuring operations.
PR-URL: https://github.com/nodejs/node/pull/39806
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Beth Griggs <bgriggs@redhat.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-08-21 15:37:00 +00:00
90e2e78763
policy: canonicalize before resolving specifiers
...
PR-URL: https://github.com/nodejs/node/pull/37863
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com >
Co-authored-by: James M Snell <jasnell@gmail.com >
Reviewed-By: Guy Bedford <guybedford@gmail.com >
2021-08-19 12:43:21 -05:00
Don Jayamanne
3fe92a2554
repl: fix tla function hoisting
...
PR-URL: https://github.com/nodejs/node/pull/39745
Fixes: https://github.com/nodejs/node/issues/39744
Reviewed-By: Guy Bedford <guybedford@gmail.com >
2021-08-19 09:14:31 -07:00
James M Snell
966060df0e
worker: add brand checks for detached properties/methods
...
Add proper brand-checking for detached property and method
accesses. Also adds a note about non-standard APIs and
makes the standard accessors enumerable.
Signed-off-by: James M Snell <jasnell@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/39763
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
2021-08-16 07:09:35 -07:00
Tobias Nießen
fdce138e1d
policy: fix integrity when DEFAULT_ENCODING is set
...
PR-URL: https://github.com/nodejs/node/pull/39750
Reviewed-By: Bradley Farias <bradley.meck@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-08-15 11:10:12 -07:00
Voltrex
f037d29abe
dgram: use simplified validator
...
The `dgram` lib module should use the simplified `validatePort()`
validator.
PR-URL: https://github.com/nodejs/node/pull/39753
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Zijian Liu <lxxyxzj@gmail.com >
2021-08-15 11:08:47 -07:00
Voltrex
7b64e16916
lib: simplify validators
...
Some of the validators can be simplified by removing unnecessary
object parameters and using validators in another validators to keep
consistency.
PR-URL: https://github.com/nodejs/node/pull/39753
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Zijian Liu <lxxyxzj@gmail.com >
2021-08-15 11:08:45 -07:00
James M Snell
e1e669b109
url: throw invalid this on detached accessors
...
Previously, using Reflect.get/set or calling a member
method like toString() detached from the instance would
result in an obscure internal error. This adds a proper
brand check and throws `ERR_INVALID_THIS` when appropriate.
Signed-off-by: James M Snell <jasnell@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/39752
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Zijian Liu <lxxyxzj@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2021-08-15 07:26:52 -07:00
James M Snell
fcf8ba4269
buffer: add endings option, remove Node.js specific encoding option
...
Signed-off-by: James M Snell <jasnell@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/39708
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2021-08-14 07:23:54 -07:00
James M Snell
ca19775d0e
stream: ensure text() stream consumer flushes correctly
...
Signed-off-by: James M Snell <jasnell@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/39737
Reviewed-By: Robert Nagy <ronagy@icloud.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2021-08-13 15:16:48 -07:00
Voltrex
ae0cfc95d5
lib: cleanup validation
...
Used the `validateInteger()` validator to cleanup validation and keep
consistency.
PR-URL: https://github.com/nodejs/node/pull/39652
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Darshan Sen <raisinten@gmail.com >
2021-08-12 15:49:53 -07:00
Voltrex
0b69ac7851
lib: cleanup instance validation
...
Cleaned up the `URLSearchParams`'s `this` validation to increase
readability by moving them to an extra helper function.
PR-URL: https://github.com/nodejs/node/pull/39656
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Darshan Sen <raisinten@gmail.com >
2021-08-12 14:52:42 -07:00
Voltrex
937bbc5571
lib: use helper for readability
...
Used an extra `checkReusedHandle()` helper function to
increase readability.
PR-URL: https://github.com/nodejs/node/pull/39649
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Darshan Sen <raisinten@gmail.com >
2021-08-12 14:52:01 -07:00
Voltrex
2108f76b32
lib: use validators
...
Used more validators for the sake of consistency.
PR-URL: https://github.com/nodejs/node/pull/39663
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Darshan Sen <raisinten@gmail.com >
2021-08-12 14:41:20 -07:00
Voltrex
c3b4d3f043
lib: use validator
...
Used the `validateArray()` validator for array validation
for consistency. (Refs: #39536 )
PR-URL: https://github.com/nodejs/node/pull/39547
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Darshan Sen <raisinten@gmail.com >
2021-08-12 13:51:56 -07:00
Voltrex
fce2786754
lib: use validateObject
...
Used the validateObject() validator to keep consistency instead of a
custom validator which was only used to validate objects.
Refs: #39595
PR-URL: https://github.com/nodejs/node/pull/39605
Refs: https://github.com/nodejs/node/pull/39595
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Darshan Sen <raisinten@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-08-12 13:51:08 -07:00
James M Snell
31d1d0c4c1
url,buffer: implement URL.createObjectURL
...
Signed-off-by: James M Snell <jasnell@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/39693
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Bradley Farias <bradley.meck@gmail.com >
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com >
2021-08-12 07:23:15 -07:00
James M Snell
0bb2605f85
buffer: add Blob.prototype.stream method and other cleanups
...
Adds the `stream()` method to get a `ReadableStream` for the `Blob`.
Also makes some other improvements to get the implementation closer
to the API standard definition.
Signed-off-by: James M Snell <jasnell@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/39693
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Bradley Farias <bradley.meck@gmail.com >
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com >
2021-08-12 07:23:10 -07:00
bcoe
87d6fd7e69
fs: add recursive cp method
...
Introduces recursive cp method, based on fs-extra implementation.
PR-URL: https://github.com/nodejs/node/pull/39372
Fixes: https://github.com/nodejs/node/issues/35880
Refs: https://github.com/nodejs/tooling/issues/98
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Ian Sutherland <ian@iansutherland.ca >
2021-08-11 19:53:32 -07:00
Matteo Collina
635463cb92
tls: validate "rejectUnauthorized: undefined"
...
Incomplete validation of rejectUnauthorized parameter (Low)
If the Node.js https API was used incorrectly and "undefined" was passed
in for the "rejectUnauthorized" parameter, no error was returned and
connections to servers with an expired certificate would have been
accepted.
CVE-ID: CVE-2021-22939
Refs: https://nvd.nist.gov/vuln/detail/CVE-2021-22939
Refs: https://hackerone.com/reports/1278254
PR-URL: https://github.com/nodejs-private/node-private/pull/276
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Akshay K <iit.akshay@gmail.com >
Reviewed-By: Robert Nagy <ronagy@icloud.com >
Reviewed-By: Richard Lau <rlau@redhat.com >
2021-08-11 16:22:15 +01:00
Matteo Collina
33f9b7f80b
bootstrap: call _undestroy() inside _destroy for stdout and stderr
...
This change makes `process.stdout` and `process.stderr` to be
automatically undestroyed when ended/destrouyed, therefore making
it always possible to write/console.log to stdout.
Fixes: https://github.com/nodejs/node/issues/39447
PR-URL: https://github.com/nodejs/node/pull/39685
Reviewed-By: Robert Nagy <ronagy@icloud.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
2021-08-11 15:27:50 +02:00
James M Snell
c52410710e
stream: utility consumers for web and node.js streams
...
Signed-off-by: James M Snell <jasnell@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/39594
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2021-08-06 15:42:58 -07:00
XadillaX
e4b1fb5e64
lib: expose DOMException as global
...
Refs: https://github.com/nodejs/node/issues/39098
PR-URL: https://github.com/nodejs/node/pull/39176
Fixes: https://github.com/nodejs/node/issues/39098
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Zijian Liu <lxxyxzj@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-08-06 12:45:14 -07:00
Luan Devecchi
38d3c487e4
dns: add "tries" option to Resolve options
...
PR-URL: https://github.com/nodejs/node/pull/39610
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
2021-08-06 10:31:18 +00:00
Robert Nagy
4832d1c02c
stream: add isDisturbed helper
...
Adds a helper util used to determine whether a stream has been
disturbed (read or cancelled).
Refs: https://github.com/nodejs/node/issues/39627
PR-URL: https://github.com/nodejs/node/pull/39628
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2021-08-06 07:45:38 +02:00
Robert Nagy
0e841b45c2
stream: don't emit 'data' after 'error' or 'close'
...
As per doc we should not emit further events after 'close' and
only 'close' after 'error'.
Fixes: https://github.com/nodejs/node/issues/39630
PR-URL: https://github.com/nodejs/node/pull/39639
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
2021-08-06 07:44:09 +02:00
Mestery
712059a232
stream: clean endWritableNT
...
The `state` argument was unused.
PR-URL: https://github.com/nodejs/node/pull/39645
Reviewed-By: Robert Nagy <ronagy@icloud.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com >
2021-08-05 16:01:55 +00:00
Michaël Zasso
90736030d2
crypto: implement webcrypto.randomUUID
...
Refs: https://wicg.github.io/uuid/
Refs: https://www.chromestatus.com/feature/5689159362543616
PR-URL: https://github.com/nodejs/node/pull/39648
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
2021-08-05 16:52:13 +02:00
Rich Trott
16a9ab142c
debugger: prevent simultaneous heap snapshots
...
Fixes: https://github.com/nodejs/node/issues/39555
PR-URL: https://github.com/nodejs/node/pull/39638
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Richard Lau <rlau@redhat.com >
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com >
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2021-08-05 11:52:55 +00:00
Szymon Marczak
ef992f6de9
stream: do not emit end on readable error
...
PR-URL: https://github.com/nodejs/node/pull/39607
Reviewed-By: Robert Nagy <ronagy@icloud.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2021-08-05 09:58:01 +00:00
Robert Nagy
533cafcf7e
stream: duplexify
...
PR-URL: https://github.com/nodejs/node/pull/39519
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2021-08-03 10:47:10 +02:00
Robert Nagy
ac621ff5e7
stream: add readableDidRead if has been read from
...
Adds did read accessor used to determine whether a readable has been
read from.
PR-URL: https://github.com/nodejs/node/pull/39589
Refs: https://github.com/nodejs/undici/pull/907
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2021-08-02 05:59:18 -07:00
Antoine du Hamel
45f98fc60d
module: add some typings to internal/modules/esm/resolve
...
PR-URL: https://github.com/nodejs/node/pull/39504
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
2021-08-02 10:21:30 +02:00
James M Snell
afabd145d1
perf_hooks: fix PerformanceObserver gc crash
...
Signed-off-by: James M Snell <jasnell@gmail.com >
Fixes: https://github.com/nodejs/node/issues/39548
PR-URL: https://github.com/nodejs/node/pull/39550
Reviewed-By: Bryan English <bryan@bryanenglish.com >
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
2021-08-02 12:39:21 +08:00
Anna Henningsen
ba7368a1a9
repl: do not include legacy getter/setter methods in completion
...
For every object that inherits from `Object.prototype`, the REPL
includes the `Object.prototype` methods in its autocompletion.
This is already a little noisy, but in particular, this also
includes the legacy `__defineGetter__` family of methods;
since those are deprecated and not in practical use anymore,
it helps reduce noise a bit to remove them.
This commit does not remove `__proto__` as it is a little
more popular and, despite its downsides, a slightly more convenient
way to access the prototype of an object in the REPL than
`Object.getPrototypeOf(...)`.
PR-URL: https://github.com/nodejs/node/pull/39576
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Gus Caplan <me@gus.host >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2021-08-01 16:43:46 +02:00
Rich Trott
1c6f26d347
debugger: remove undefined parameter
...
The data parameter of unpackError() is typically undefined.
PR-URL: https://github.com/nodejs/node/pull/39570
Refs: https://github.com/nodejs/node-inspect/issues/101
Reviewed-By: Jan Krems <jan.krems@gmail.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
2021-08-01 14:24:35 +00:00
Mestery
2913211ba8
lib: use ERR_ILLEGAL_CONSTRUCTOR
...
Use ERR_ILLEGAL_CONSTRUCTOR error instead of `illegal constructor` or
`Illegal constructor` TypeError.
PR-URL: https://github.com/nodejs/node/pull/39556
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Darshan Sen <raisinten@gmail.com >
2021-08-01 14:24:26 +00:00
Guy Bedford
b0a6ade3bd
module: fix ERR_REQUIRE_ESM error for null frames
...
PR-URL: https://github.com/nodejs/node/pull/39593
Reviewed-By: Bradley Farias <bradley.meck@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2021-07-31 02:32:19 +00:00
legendecas
a27d245698
perf_hooks: fix performance timeline wpt failures
...
PR-URL: https://github.com/nodejs/node/pull/39532
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Khaidi Chu <i@2333.moe >
2021-07-30 07:29:44 -07:00
Darshan Sen
7ca2f13039
async_hooks: merge resource_symbol with owner_symbol
...
Signed-off-by: Darshan Sen <darshan.sen@postman.com >
PR-URL: https://github.com/nodejs/node/pull/38468
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2021-07-28 13:41:24 -07:00