0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-22 07:37:56 +01:00
Commit Graph

490 Commits

Author SHA1 Message Date
Filip Skokan
16184633f6
crypto: allow length=0 for HKDF and PBKDF2 in SubtleCrypto.deriveBits
PR-URL: https://github.com/nodejs/node/pull/55866
Reviewed-By: Matthew Aitken <maitken033380023@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Jason Zhang <xzha4350@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
2024-11-17 13:13:47 +00:00
jakecastelli
66a2cb210a
test: deflake test/pummel/test-timers.js
PR-URL: https://github.com/nodejs/node/pull/55098
Fixes: https://github.com/nodejs/node/issues/55092
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2024-09-27 06:16:20 +00:00
Chengzhong Wu
84966703e0
src: track BaseObjects with an efficient list
PR-URL: https://github.com/nodejs/node/pull/55104
Refs: https://github.com/nodejs/node/pull/54880
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
2024-09-26 18:40:33 +01:00
Luigi Pinca
61ad74fb0f
Revert "test: mark test-fs-watch-non-recursive flaky on Windows"
This reverts commit 2a871df3df.

It has been almost three years since the test was marked flaky. Remove
the unstable designation to see if the problem persists on Windows.

Fixes: https://github.com/nodejs/node/issues/40728
PR-URL: https://github.com/nodejs/node/pull/55079
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Stefan Stojanovic <stefan.stojanovic@janeasystems.com>
2024-09-25 13:18:52 +00:00
Santiago Gimeno
b345118e1e
test: refactor fs-watch tests due to macOS issue
In `macOS`, fsevents generated immediately before start watching may
leak into the event callback. See: https://github.com/nodejs/node/issues/54450
for an explanation. This might be fixed at some point in `libuv` though
it may take some time (see: https://github.com/libuv/libuv/issues/3866).
This commit comes in anticipation of the soon-to-be-released
`libuv@1.49.0` which was making these tests very flaky.

PR-URL: https://github.com/nodejs/node/pull/54498
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
2024-09-06 17:38:28 +00:00
Joyee Cheung
3b0617dd19 vm: migrate ContextifyScript to cppgc
This patch migrates ContextifyScript to cppgc-based memory
management using CppgcMixin.

PR-URL: https://github.com/nodejs/node/pull/52295
Refs: https://github.com/nodejs/node/issues/40786
Refs: https://docs.google.com/document/d/1ny2Qz_EsUnXGKJRGxoA-FXIE2xpLgaMAN6jD7eAkqFQ/edit
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
2024-08-30 16:58:31 +00:00
Stefan Stojanovic
1f69085db5
test: set test-structuredclone-jstransferable non-flaky
Fixes: https://github.com/nodejs/node/issues/50260
PR-URL: https://github.com/nodejs/node/pull/54115
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
2024-08-06 08:24:15 +00:00
Mathis Wiehl
85f56aed11
test: use python3 instead of python in pummel test
As f9bfe785ee already did for a regular test, replace `python` with
`python3` in the only `pummel` test spawning it so that it can be run on
platforms that don't provide a `python` binary anymore, like modern
macOS or some Linux distributions (e.g. Fedora) without specifying a
`PYTHON` env var.

PR-URL: https://github.com/nodejs/node/pull/53057
Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io>
Reviewed-By: James M Snell <jasnell@gmail.com>
2024-07-04 13:08:38 +00:00
Filip Skokan
d65b17082b
crypto: make deriveBits length parameter optional and nullable
PR-URL: https://github.com/nodejs/node/pull/53601
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2024-06-28 22:21:29 +00:00
Rafael Gonzaga
951af83033
lib,src: remove --experimental-policy
Signed-off-by: RafaelGSS <rafael.nunu@hotmail.com>
PR-URL: https://github.com/nodejs/node/pull/52583
Refs: https://github.com/nodejs/node/issues/52575
Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io>
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
2024-05-07 16:25:45 +00:00
Zhenwei Jin
bf8afe7644
buffer: remove lines setting indexes to integer value
PR-URL: https://github.com/nodejs/node/pull/52588
Refs: https://github.com/nodejs/node/issues/52585
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2024-05-06 12:45:31 +00:00
zhenweijin
8123be16a5 string_decoder: throw an error when writing a too long buffer
PR-URL: https://github.com/nodejs/node/pull/52215
Fixes: https://github.com/nodejs/node/issues/52214
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: theanarkh <theratliter@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2024-05-04 08:41:05 -07:00
Rafael Gonzaga
b876e00b47
test: drop test-crypto-timing-safe-equal-benchmarks
PR-URL: https://github.com/nodejs/node/pull/52751
Refs: https://github.com/nodejs/node/issues/38226
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Daniel Lemire <daniel@lemire.me>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2024-05-01 18:27:29 +00:00
Michaël Zasso
05cb16dc1a
test: simplify ASan build checks
Always use `process.config.variables.asan`.
This removes the need for a special ASAN env var.

PR-URL: https://github.com/nodejs/node/pull/52430
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io>
2024-04-11 07:29:27 +00:00
Jungku Lee
26d39e875f
test: fix inconsistency write size in test-fs-readfile-tostring-fail
PR-URL: https://github.com/nodejs/node/pull/51141
Refs: https://github.com/nodejs/node/issues/51133
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Deokjin Kim <deokjin81.kim@gmail.com>
2023-12-25 03:38:40 +00:00
Yagiz Nizipli
eed33c9dea
test: set crypto-timing test as flaky
PR-URL: https://github.com/nodejs/node/pull/50232
Refs: https://github.com/nodejs/node/issues/38226
Reviewed-By: Ruy Adorno <ruyadorno@google.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
2023-10-20 02:15:13 +00:00
Yagiz Nizipli
f9c290f0e9
test: set test-structuredclone-* as flaky
PR-URL: https://github.com/nodejs/node/pull/50261
Refs: https://github.com/nodejs/node/issues/50260
Reviewed-By: Zeyu "Alex" Yang <himself65@outlook.com>
Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br>
2023-10-19 16:03:49 +00:00
Chengzhong Wu
224f3ae974
test: reduce number of repetition in test-heapdump-shadowrealm.js
ShadowRealm garbage-collection is covered in another test. Reduce the
number of repetition in test-heapdump-shadowrealm.js trying to fix the
flakiness of the test.

PR-URL: https://github.com/nodejs/node/pull/50104
Refs: https://github.com/nodejs/node/issues/49572
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
2023-10-12 09:32:42 +00:00
Chengzhong Wu
78a15702dd
src: avoid making JSTransferable wrapper object weak
JSTransferable wrapper object is a short-lived wrapper in the scope of
the serialization or the deserialization. Make the JSTransferable
wrapper object pointer as a strongly-referenced detached BaseObjectPtr
so that a JSTransferable wrapper object and its target object will never
be garbage-collected during a ser-des process, and the wrapper object
will be immediately destroyed when the process is completed.

PR-URL: https://github.com/nodejs/node/pull/50026
Fixes: https://github.com/nodejs/node/issues/49852
Fixes: https://github.com/nodejs/node/issues/49844
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2023-10-10 07:42:30 +00:00
Joyee Cheung
dca4d84349
test: use setImmediate() in test-heapdump-shadowrealm.js
With a tight loop the GC may not have enough time to kick in.
Try setImmediate() instead.

PR-URL: https://github.com/nodejs/node/pull/49573
Refs: https://github.com/nodejs/node/issues/49572
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
2023-09-11 15:56:01 +00:00
Livia Medeiros
052434a0c1
test: use tmpdir.resolve()
PR-URL: https://github.com/nodejs/node/pull/49136
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2023-08-21 16:41:53 +00:00
Michaël Zasso
b0cc131e8f
test: delete test-net-bytes-per-incoming-chunk-overhead
The test's assumptions about RSS are no longer valid, at least with
Fedora 38.

Closes: https://github.com/nodejs/node/issues/48490
PR-URL: https://github.com/nodejs/node/pull/48811
Fixes: https://github.com/nodejs/node/issues/48490
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
2023-07-20 13:20:44 +00:00
Luigi Pinca
01233410f7 test: move test-net-throttle to parallel
The test is not very resource intensive. It just writes data to a TCP
socket until backpressure is reached. Move it parallel.

PR-URL: https://github.com/nodejs/node/pull/48599
Fixes: https://github.com/nodejs/node/issues/40507
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Jacob Smith <jacob@frende.me>
Reviewed-By: LiviaMedeiros <livia@cirno.name>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Nitzan Uziely <linkgoron@gmail.com>
2023-07-12 12:17:18 +00:00
legendecas
ac0853c4ee src: make realm binding data store weak
The binding data must be weak so that it won't keep the realm reachable
from strong GC roots indefinitely. The wrapper object of binding data
should be referenced from JavaScript, thus the binding data should be
reachable throughout the lifetime of the realm.

PR-URL: https://github.com/nodejs/node/pull/47688
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
2023-06-14 02:05:00 +00:00
Tobias Nießen
609d2b0ff2
test: add and use tmpdir.hasEnoughSpace()
In general, we assume that the tmpdir will provide sufficient space for
most tests. Some tests, however, require hundreds of megabytes or even
gigabytes of space, which often causes them to fail, especially on our
macOS infrastructure. The most recent reliability report contains more
than 20 related CI failures.

This change adds a new function hasEnoughSpace() to the tmpdir module
that uses statfsSync() to guess whether allocating a certain amount of
space within the temporary directory will succeed.

This change also updates the most frequently failing tests to use the
new function such that the relevant parts of the tests are skipped if
tmpdir has insufficient space.

Refs: https://github.com/nodejs/reliability/issues/549
PR-URL: https://github.com/nodejs/node/pull/47767
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Richard Lau <rlau@redhat.com>
2023-05-01 15:23:49 +00:00
Chengzhong Wu
e6b4d30a2f
src: bootstrap Web [Exposed=*] APIs in the shadow realm
This is the initial work to bootstrap Web interfaces that are defined
with extended attributes `[Exposed=*]`.

The ShadowRealm instances are garbage-collected once it is
unreachable. However, V8 can not infer the reference cycles between
the per-realm strong persistent function handles and the realm's
context handle. To allow the context to be gc-ed once it is not
reachable, the per-realm persistent handles are attached to the
context's global object and the persistent handles are set as weak.

PR-URL: https://github.com/nodejs/node/pull/46809
Refs: https://github.com/nodejs/node/issues/42528
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
2023-03-16 00:22:06 +08:00
Michaël Zasso
d0153aee36
Revert "vm: fix leak in vm.compileFunction when importModuleDynamically is used"
This reverts commit 986498b7b3.

Fixes: https://github.com/nodejs/node/issues/47096
PR-URL: https://github.com/nodejs/node/pull/47101
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Danielle Adams <adamzdanielle@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Debadree Chatterjee <debadree333@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
2023-03-15 14:35:06 +00:00
Joyee Cheung
3646a66044
src: fix AliasedBuffer memory attribution in heap snapshots
Before the AliasedBuffers were represented solely by the TypedArrays
event though they also retain additional memory themselves.
Make the accounting more accurate by implementing MemoryRetainer in
AliasedBuffer.

PR-URL: https://github.com/nodejs/node/pull/46817
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2023-03-01 17:45:04 +01:00
Joyee Cheung
986498b7b3 vm: fix leak in vm.compileFunction when importModuleDynamically is used
Previously in the implementation there was a cycle that V8 could not
detect:

Strong global reference to CompiledFnEntry (JS wrapper)
    -> strong reference to callback setting (through the
       callbackMap key-value pair)
    -> importModuleDynamically (wrapper in internalCompileFunction())
    -> Strong reference to the compiled function (through closure in
       internalCompileFunction())

The CompiledFnEntry only gets GC'ed when the compiled function is GC'ed.
Since the compiled function is always reachable as described above,
there is a leak.

We only needed the first strong global reference because we didn't want
the function to outlive the CompiledFnEntry. In this case it can be
solved by using a private symbol instead of going with the global
reference + destruction in the weak callback, which V8's GC is not
going to understand.

PR-URL: https://github.com/nodejs/node/pull/46785
Fixes: https://github.com/nodejs/node/issues/42080
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2023-03-01 16:18:53 +08:00
Antoine du Hamel
873e5ce54a
test: add trailing commas in test/pummel
PR-URL: https://github.com/nodejs/node/pull/46610
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
2023-02-12 17:36:39 +01:00
Joyee Cheung
138696897e
src: make edge names in BaseObjects more descriptive in heap snapshots
Previously these were named "wrapper" and "wrapped", which can be
somewhat difficult to understand. This patch renames them to
"javascript_to_native" and "native_to_javascript".

PR-URL: https://github.com/nodejs/node/pull/46492
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
2023-02-06 15:44:16 +00:00
Filip Skokan
3ef38c4bd7
crypto: use WebIDL converters in WebCryptoAPI
WebCryptoAPI functions' arguments are now coersed and validated as per
their WebIDL definitions like in other Web Crypto API implementations.
This further improves interoperability with other implementations of
Web Crypto API.

PR-URL: https://github.com/nodejs/node/pull/46067
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
2023-01-17 08:57:58 +00:00
Deokjin Kim
d8014f6aa9 test: use os.availableParallelism()
Refs: https://github.com/nodejs/node/pull/45895
PR-URL: https://github.com/nodejs/node/pull/46003
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
2023-01-11 20:07:56 +00:00
Jordan Harband
757c104147
tools: add prefer-proto rule
fixup: add support for `Object.create(null)`

fixup: extend to any 1-argument Object.create call

fixup: add tests
PR-URL: https://github.com/nodejs/node/pull/46083
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Jacob Smith <jacob@frende.me>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2023-01-10 05:38:36 +00:00
Filip Skokan
7ad069c53c
crypto: use globalThis.crypto over require('crypto').webcrypto
PR-URL: https://github.com/nodejs/node/pull/45817
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2022-12-16 19:55:42 +00:00
Rich Trott
e080331a01 test: skip test-fs-largefile if not enough disk space
Fixes: https://github.com/nodejs/build/issues/3071

PR-URL: https://github.com/nodejs/node/pull/45339
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Nitzan Uziely <linkgoron@gmail.com>
2022-11-07 11:12:19 -08:00
Filip Skokan
40a0757b21
crypto: remove webcrypto HKDF and PBKDF2 default-applied lengths
PR-URL: https://github.com/nodejs/node/pull/44945
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2022-10-12 18:38:33 +00:00
Michaël Zasso
1acf0339dd
test: fix test-hash-seed for new V8 versions
The test relied on V8 not optimizing functions that use `set.has()`.
Force V8 to not optimize it now that TurboFan knows about this method.

PR-URL: https://github.com/nodejs/node/pull/44741
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2022-10-11 07:27:47 +02:00
Joyee Cheung
3ab2d4f362
src: implement GetDetachedness() in MemoryRetainerNode
This allows us to mark weak/detached references in the heap snapshot.
Also mark weak/detached BaseObject with Detachedness::kDetached
so that the state of the reference can be displayed by frontend
consuming the heap snapshot.

PR-URL: https://github.com/nodejs/node/pull/44803
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2022-10-05 19:38:39 +08:00
Chengzhong Wu
717465433c src: create BaseObject with node::Realm
BaseObject is a wrapper around JS objects. These objects should be
created in a node::Realm and destroyed when their associated realm is
cleaning up.

PR-URL: https://github.com/nodejs/node/pull/44348
Refs: https://github.com/nodejs/node/issues/42528
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
2022-09-27 16:39:53 +08:00
theanarkh
e62f6ce630
v8: add setHeapSnapshotNearHeapLimit
PR-URL: https://github.com/nodejs/node/pull/44420
Refs: https://github.com/nodejs/node/pull/33010
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
2022-09-08 09:33:20 +00:00
legendecas
0b5b5edd86
src: consolidate environment cleanup queue
Each Realm tracks its own cleanup hooks and drains the hooks when it is
going to be destroyed.

Moves the implementations of the cleanup queue to its own class so that
it can be used in `node::Realm` too.

PR-URL: https://github.com/nodejs/node/pull/44379
Refs: https://github.com/nodejs/node/pull/44348
Refs: https://github.com/nodejs/node/issues/42528
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
2022-09-08 00:06:47 +08:00
Chengzhong Wu
81d9cdb8cd
src: introduce node::Realm
To distinguish per-context values from the node::Environment, split
those values to a new node::Realm structure and consolidate
bootstrapping methods with it.

PR-URL: https://github.com/nodejs/node/pull/44179
Refs: https://github.com/nodejs/node/issues/42528
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2022-08-31 14:41:42 +00:00
Filip Skokan
159b4d7a94 crypto: allow zero-length IKM in HKDF and in webcrypto PBKDF2
PR-URL: https://github.com/nodejs/node/pull/44201
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
2022-08-12 21:36:29 +02:00
Filip Skokan
c6c4cdab36 crypto: fix webcrypto deriveBits validations
PR-URL: https://github.com/nodejs/node/pull/44173
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
2022-08-12 21:31:14 +02:00
Tobias Nießen
7abbbf2ff3
test: change misleading variable name
The return value of getPrime() is not a private key in any way.

Refs: https://github.com/nodejs/node-v0.x-archive/pull/2638

PR-URL: https://github.com/nodejs/node/pull/43990
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Feng Yu <F3n67u@outlook.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2022-07-26 09:51:42 +01:00
theanarkh
8f0dee1a5b
test: fix test http upload timeout
PR-URL: https://github.com/nodejs/node/pull/43935
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2022-07-24 13:42:25 +01:00
Tobias Nießen
373bbcea24
test: merge test-crypto-dh-hash with modp18 test
This test file was split because it was taking a long time in some
versions of OpenSSL 1.1.1, but that is not the case anymore with
OpenSSL 3.0, so merge the tests again.

Refs: https://github.com/nodejs/node/pull/34631

PR-URL: https://github.com/nodejs/node/pull/43891
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2022-07-22 10:54:41 +01:00
Richard Lau
604ac4bc6c
test: add check to test-fs-readfile-tostring-fail
Check that all of the bytes were written to the temporary file before
reading it to catch the case where there is insufficient disk space.

PR-URL: https://github.com/nodejs/node/pull/43850
Refs: https://github.com/nodejs/node/issues/43833
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: LiviaMedeiros <livia@cirno.name>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2022-07-18 12:24:48 +01:00
Feng Yu
ea99431586
test: mark flaky tests on smartos
PR-URL: https://github.com/nodejs/node/pull/43596
Refs: https://github.com/nodejs/node/issues/43457
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
2022-06-28 18:06:48 +01:00