Filip Skokan
3f3966cb82
crypto: fix globalThis.crypto this check
...
PR-URL: https://github.com/nodejs/node/pull/45857
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2022-12-20 13:36:00 +00:00
Filip Skokan
560b24398c
crypto: fix CryptoKey prototype WPT
...
PR-URL: https://github.com/nodejs/node/pull/45857
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2022-12-20 13:35:58 +00:00
Geoffrey Booth
7738844fe3
esm: move hooks handling into separate class
...
PR-URL: https://github.com/nodejs/node/pull/45869
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Jacob Smith <jacob@frende.me >
Reviewed-By: Rich Trott <rtrott@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2022-12-20 07:36:45 +00:00
Moshe Atlow
a1b27b25bb
test_runner: add reporters
...
PR-URL: https://github.com/nodejs/node/pull/45712
Fixes: https://github.com/nodejs/node/issues/45648
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2022-12-19 17:35:57 +00:00
Antoine du Hamel
3ce4cef4e6
tools: enforce use of trailing commas in tools/
...
PR-URL: https://github.com/nodejs/node/pull/45889
Reviewed-By: Anna Henningsen <anna@addaleax.net >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
2022-12-18 16:39:39 +00:00
Antoine du Hamel
ca2ec902e9
tools: add ArrayPrototypeConcat to the list of primordials to avoid
...
PR-URL: https://github.com/nodejs/node/pull/44445
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
2022-12-17 19:15:24 +00:00
Erick Wendel
929aada39d
test: fix mock.method to support class instances
...
It fixes a problem when trying to spy a method
from a class instance or static functions
on a class instance
PR-URL: https://github.com/nodejs/node/pull/45608
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2022-12-17 14:35:09 +00:00
Colin Ihrig
385d595a4f
test_runner: run t.after() if test body throws
...
This commit fixes a bug where t.after() was not called if the
test body threw an exception.
PR-URL: https://github.com/nodejs/node/pull/45870
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2022-12-17 06:36:15 +00:00
Maël Nison
12f6da731c
esm: leverage loaders when resolving subsequent loaders
...
PR-URL: https://github.com/nodejs/node/pull/43772
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Jacob Smith <jacob@frende.me >
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
2022-12-17 04:23:11 +00:00
Filip Skokan
43b7189883
crypto: fix CryptoKey WebIDL conformance
...
PR-URL: https://github.com/nodejs/node/pull/45855
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
2022-12-16 14:11:52 +01:00
Filip Skokan
3014c5d511
crypto: fix error when getRandomValues is called without arguments
...
PR-URL: https://github.com/nodejs/node/pull/45854
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
2022-12-16 14:11:15 +01:00
Joyee Cheung
3dbd686218
bootstrap: optimize modules loaded in the built-in snapshot
...
Preload essential modules and lazy-load non-essential ones.
After this patch, all modules listed by running this snippet:
```
const list = process.moduleLoadList.join('\n');
require('fs').writeSync(1, list, 'utf-8');
```
(which is roughly the same list as the one in
test-bootstrap-module.js for the main thread)
are loaded from the snapshot so no additional compilation cost
is incurred.
PR-URL: https://github.com/nodejs/node/pull/45849
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
2022-12-16 12:44:18 +01:00
Joyee Cheung
995440b791
bootstrap: make CJS loader snapshotable
...
This patch makes the top-level access to runtime states in the
CJS loader lazy, and move the side-effects into a
initializeCJS() function that gets called during pre-execution.
As a result the CJS loader can be included into the built-in
snapshot.
PR-URL: https://github.com/nodejs/node/pull/45849
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
2022-12-16 12:44:14 +01:00
Joyee Cheung
36608c14b7
modules: move callbacks and conditions into modules/esm/utils.js
...
This moves the following utils into modules/esm/utils.js:
- Code related to default conditions
- The callbackMap (which is now created in the module instead of
hanging off the module_wrap binding, since the C++ land
does not need it).
- Per-isolate module callbacks
These are self-contained code that can be included into the
built-in snapshot.
PR-URL: https://github.com/nodejs/node/pull/45849
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
2022-12-16 12:44:10 +01:00
Joyee Cheung
0c4f5c40ad
lib: lazy-load deps in modules/run_main.js
...
So that the file can be snapshotted
PR-URL: https://github.com/nodejs/node/pull/45849
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
2022-12-16 12:44:06 +01:00
Joyee Cheung
f1a84aee19
lib: lazy-load deps in source_map_cache.js
...
So that the file can be snapshotted.
PR-URL: https://github.com/nodejs/node/pull/45849
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
2022-12-16 12:44:03 +01:00
Joyee Cheung
58762bbfe8
lib: add getLazy() method to internal/util
...
This patch adds a getLazy() method to facilitate initialize-once
lazy loading in the internals.
PR-URL: https://github.com/nodejs/node/pull/45849
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
2022-12-16 12:44:00 +01:00
Joyee Cheung
9d9bdfc693
modules: move modules/cjs/helpers.js to modules/helpers.js
...
The helpers are actually shared by the two loaders, so move them
under modules/ directly.
PR-URL: https://github.com/nodejs/node/pull/45849
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
2022-12-16 12:43:56 +01:00
Joyee Cheung
60177f5fd1
bootstrap: include event_target into the built-in snapshot
...
Since the module has to be loaded during bootstrap anyway.
PR-URL: https://github.com/nodejs/node/pull/45849
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
2022-12-16 12:43:52 +01:00
Antoine du Hamel
1c3ba4c5fa
repl: improve robustness wrt to prototype pollution
...
PR-URL: https://github.com/nodejs/node/pull/45604
Reviewed-By: James M Snell <jasnell@gmail.com >
2022-12-14 15:48:50 +01:00
Moshe Atlow
232efb06fe
test_runner: parse yaml
...
PR-URL: https://github.com/nodejs/node/pull/45815
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2022-12-13 14:51:35 +00:00
Antoine du Hamel
aa2ca81f60
lib: remove unnecessary lazy loading in internal/encoding
...
PR-URL: https://github.com/nodejs/node/pull/45810
Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
2022-12-12 15:17:53 +00:00
Antoine du Hamel
bb908fc886
crypto: simplify lazy loading of internal modules
...
The internal `require()` is actually just one map load (to see if the
module is already loaded) + one property load (state check for circular
dependencies) for modules that are already loaded.
Refs: https://github.com/nodejs/node/pull/45659#discussion_r1033762328
PR-URL: https://github.com/nodejs/node/pull/45809
Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com >
2022-12-12 15:17:44 +00:00
Antoine du Hamel
6cef4a6b5d
buffer: remove unnecessary lazy loading
...
PR-URL: https://github.com/nodejs/node/pull/45807
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
2022-12-12 13:53:27 +00:00
Antoine du Hamel
2483da743c
test_runner: refactor tap_lexer to use more primordials
...
PR-URL: https://github.com/nodejs/node/pull/45744
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2022-12-12 07:30:47 +01:00
Antoine du Hamel
7a42a206ac
test_runner: refactor tap_parser to use more primordials
...
PR-URL: https://github.com/nodejs/node/pull/45745
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
2022-12-11 22:34:31 +00:00
Debadree Chatterjee
79a977ae31
watch: add CLI flag to preserve output
...
Fixes: https://github.com/nodejs/node/issues/45713
PR-URL: https://github.com/nodejs/node/pull/45717
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
2022-12-11 23:23:11 +01:00
Pulkit Gupta
22dc987fde
test: fix invalid output TAP if there newline in test name
...
PR-URL: https://github.com/nodejs/node/pull/45742
Fixes: https://github.com/nodejs/node/issues/45396
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2022-12-11 20:02:37 +00:00
cjihrig
215c5317d4
test_runner: add t.after() hook
...
This commit adds an after() hook to the TestContext class. This
hook can be used to clean up after a test finishes.
PR-URL: https://github.com/nodejs/node/pull/45792
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2022-12-11 19:19:07 +00:00
cjihrig
8302b0add0
test_runner: don't use a symbol for runHook()
...
This is not exposed to userland, so there is no need to put it
behind a symbol.
PR-URL: https://github.com/nodejs/node/pull/45792
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2022-12-11 19:19:06 +00:00
Debadree Chatterjee
2ec418984b
lib: allow Writeable.toWeb() to work on http.Outgoing message
...
Attempted to fix the issue by watering down the condition being
checked in internal/streams/utils isWritableNodeStream utility
Fixes: https://github.com/nodejs/node/issues/44188
PR-URL: https://github.com/nodejs/node/pull/45642
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
2022-12-10 17:06:40 +00:00
Antoine du Hamel
c17231054b
readline: improve robustness against prototype mutation
...
PR-URL: https://github.com/nodejs/node/pull/45614
Reviewed-By: James M Snell <jasnell@gmail.com >
2022-12-10 17:51:51 +01:00
Joyee Cheung
265ea1e74e
bootstrap: lazy load non-essential modules
...
It turns out that even with startup snapshots, there is a non-trivial
overhead for loading internal modules. This patch makes the loading
of the non-essential modules lazy again.
Caveat: we have to make some of the globals lazily-loaded too,
so the WPT runner is updated to test what the state of the global
scope is after the globals are accessed (and replaced with the
loaded value).
PR-URL: https://github.com/nodejs/node/pull/45659
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com >
Reviewed-By: Jacob Smith <jacob@frende.me >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com >
Reviewed-By: Tierney Cyren <hello@bnb.im >
2022-12-09 22:37:35 +00:00
Deokjin Kim
c776324f0a
lib: check number of arguments in EventTarget's function
...
For now, addEventListener() only checks number of arguments.
removeEventListener() and dispatchEvent() also need checking
number of arguments.
PR-URL: https://github.com/nodejs/node/pull/45668
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com >
2022-12-09 06:07:20 +00:00
Daeyeon Jeong
8aa15dedb6
lib: disambiguate native module to binding
...
Signed-off-by: Daeyeon Jeong <daeyeon.dev@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/45673
Refs: https://github.com/nodejs/node/pull/44135
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
2022-12-09 05:28:59 +00:00
Daeyeon Jeong
cb940b950f
lib: disambiguate native module to builtin module
...
Signed-off-by: Daeyeon Jeong <daeyeon.dev@gmail.com >
PR-URL: https://github.com/nodejs/node/pull/45673
Refs: https://github.com/nodejs/node/pull/44135
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com >
2022-12-09 05:28:58 +00:00
MURAKAMI Masahiko
01b7ac6051
test_runner: add resetCalls to MockFunctionContext
...
This commit allows tests in test runner to reset
the calls of mock function
Refs: https://github.com/nodejs/node/pull/45326#discussion_r1014728750
PR-URL: https://github.com/nodejs/node/pull/45710
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
2022-12-08 20:28:38 +00:00
Deokjin Kim
3f98be90ea
net: check autoSelectFamilyAttemptTimeout is positive
...
In document, `autoSelectFamilyAttemptTimeout` is described as
positive integer because it's time unit. But there is no checking
whether it's positive integer.
PR-URL: https://github.com/nodejs/node/pull/45740
Refs: https://github.com/nodejs/node/blob/main/doc/api/net.md#socketconnectoptions-connectlistener
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Paolo Insogna <paolo@cowtech.it >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2022-12-08 09:45:54 +01:00
Paolo Insogna
f6052c68c1
net: add autoSelectFamily and autoSelectFamilyAttemptTimeout options
...
PR-URL: https://github.com/nodejs/node/pull/44731
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Robert Nagy <ronagy@icloud.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
2022-12-03 17:55:57 +00:00
Robert Nagy
d385106302
http: make OutgoingMessage more streamlike
...
Implement missing getters error & closed. Add support for
proper "writable" check through `isWritable` helper.
We cannot fix the `OutgoingMessage.writable` property as that
would break the ecosystem.
PR-URL: https://github.com/nodejs/node/pull/45672
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de >
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2022-12-02 10:40:44 +01:00
Debadree Chatterjee
8541b3a4c0
lib: added SuiteContext class
...
added SuiteContext class to replace object literal
Fixes: https://github.com/nodejs/node/issues/45641
Refs: https://github.com/nodejs/node/issues/45641#issuecomment-1329130581
PR-URL: https://github.com/nodejs/node/pull/45687
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
2022-12-02 06:29:48 +00:00
Colin Ihrig
cc2732d764
test_runner: don't parse TAP from stderr
...
This commit stops the test runner CLI from parsing child
process stderr as TAP. Per the TAP spec, TAP can only come from
stdout. To avoid losing stderr data, those logs are injected
into the parser as unknown tokens so that they are output as
comments.
PR-URL: https://github.com/nodejs/node/pull/45618
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
2022-12-02 03:12:07 +00:00
Deokjin Kim
59678813e7
lib: add missing type of removeEventListener in question
...
removeEventListener of signal is not working because
event type is missed.
PR-URL: https://github.com/nodejs/node/pull/45676
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2022-12-01 14:39:39 +00:00
Rich Trott
3bed5f11e0
url: runtime-deprecate url.parse() with invalid ports
...
These URLs throw with WHATWG URL. They are permitted with url.parse()
but that allows potential host spoofing by sending a domain name as the
port.
PR-URL: https://github.com/nodejs/node/pull/45526
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Robert Nagy <ronagy@icloud.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2022-11-30 13:41:23 -08:00
Filip Skokan
08af023b1f
crypto: runtime deprecate replaced rsa-pss keygen parameters
...
PR-URL: https://github.com/nodejs/node/pull/45653
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com >
Reviewed-By: Rich Trott <rtrott@gmail.com >
2022-11-30 21:14:33 +00:00
theanarkh
d579bc16b3
diagnostics_channel: fix diagnostics channel memory leak
...
PR-URL: https://github.com/nodejs/node/pull/45633
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com >
Reviewed-By: Darshan Sen <raisinten@gmail.com >
2022-11-29 10:58:43 +00:00
ed3604cd64
http: server check Host header, to meet RFC 7230 5.4 requirement
...
PR-URL: https://github.com/nodejs/node/pull/45597
Fixes: https://github.com/nodejs/node/issues/39033
Co-authored-by: Luigi Pinca <luigipinca@gmail.com >
Co-authored-by: mscdex <mscdex@users.noreply.github.com >
Reviewed-By: Robert Nagy <ronagy@icloud.com >
Reviewed-By: Paolo Insogna <paolo@cowtech.it >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2022-11-28 18:35:31 +01:00
MURAKAMI Masahiko
afed1afa55
test_runner: add getter and setter to MockTracker
...
This commit allows tests in test runner to use the
`getter` and `setter` methods as "syntax sugar" for
`MockTracker.method` with the `options.getter` or
`options.setter` set to true in the options.
Refs: https://github.com/nodejs/node/pull/45326#discussion_r1014727289
PR-URL: https://github.com/nodejs/node/pull/45506
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
Reviewed-By: Colin Ihrig <cjihrig@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
2022-11-27 23:12:13 +00:00
Moshe Atlow
147d8109a9
fs: fix nonNativeWatcher watching folder with existing files
...
PR-URL: https://github.com/nodejs/node/pull/45500
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
2022-11-27 22:03:42 +00:00
Antoine du Hamel
e7f172c191
crypto: refactor ArrayBuffer to bigint conversion utils
...
PR-URL: https://github.com/nodejs/node/pull/45567
Refs: https://github.com/nodejs/performance/issues/16
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2022-11-27 18:27:21 +00:00