Deokjin Kim
609cd7f5bf
tls: use validateFunction for options.SNICallback
...
If user uses invalid type for `options.SNICallback` in
TLSSocket(), it's not internal issue of Node.js. So
validateFunction() is more proper than assert().
PR-URL: https://github.com/nodejs/node/pull/50530
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2023-11-10 13:04:07 +00:00
Muthukumar
b4850f2ee4
lib: make event static properties non writable and configurable
...
The idl definition for Event makes the properties constant
this means that they shouldn't be configurable and writable.
However, they were, and this commit fixes that.
Fixes: https://github.com/nodejs/node/issues/50417
PR-URL: https://github.com/nodejs/node/pull/50425
Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br >
Reviewed-By: Matthew Aitken <maitken033380023@gmail.com >
2023-11-10 12:26:12 +00:00
Kevin Kühnemund
38cd4f7d51
test: replace forEach with for of
...
PR-URL: https://github.com/nodejs/node/pull/50597
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
2023-11-10 11:35:59 +00:00
CorrWu
a5a6fef0db
test: replace forEach with for of
...
PR-URL: https://github.com/nodejs/node/pull/49785
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2023-11-10 11:35:47 +00:00
kylo5aby
89c66ae1eb
buffer: improve Buffer.equals performance
...
PR-URL: https://github.com/nodejs/node/pull/50621
Refs: https://github.com/nodejs/node/issues/50620
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Debadree Chatterjee <debadree333@gmail.com >
Reviewed-By: Darshan Sen <raisinten@gmail.com >
2023-11-10 09:45:14 +00:00
Gabriel Bota
f662c9b63f
test: replace forEach with for [...] of
...
PR-URL: https://github.com/nodejs/node/pull/50615
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Debadree Chatterjee <debadree333@gmail.com >
2023-11-10 09:36:27 +00:00
Antoine du Hamel
0dfc59e4fc
esm: bypass CJS loader in default load under --default-type=module
...
This allows user to opt-out from using the monkey-patchable CJS loader,
even to load CJS modules.
PR-URL: https://github.com/nodejs/node/pull/50004
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
2023-11-10 09:20:46 +01:00
Damian Krzeminski
3e14cfbbcf
stream: add support for deflate-raw format to webstreams compression
...
this change makes `deflate-raw` a valid parameter for both
CompressionStream and DecompressionStream constructors
it makes node's implementation consistent with what modern browsers
support and what specification calls for
see: https://wicg.github.io/compression/#compression-stream
PR-URL: https://github.com/nodejs/node/pull/50097
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Filip Skokan <panva.ip@gmail.com >
2023-11-09 11:18:57 +00:00
Liu Jia
bb2dd0e90c
benchmark: change iterations in benchmark/es/string-concatenations.js
...
Increase the number of iterations from `1e3` to `1e6`
to avoid the test performance gap caused by inactive
V8 optimization caused by too few iterations.
Fixes: https://github.com/nodejs/node/issues/50571
PR-URL: https://github.com/nodejs/node/pull/50585
Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br >
Reviewed-By: Debadree Chatterjee <debadree333@gmail.com >
2023-11-09 05:45:33 +00:00
Luigi Pinca
95534ad82f
build: fix build with Python 3.12
...
Replace `distutils.version.StrictVersion` with
`packaging.version.Version`.
Refs: https://github.com/nodejs/node/pull/50209#issuecomment-1795852539
PR-URL: https://github.com/nodejs/node/pull/50582
Reviewed-By: Richard Lau <rlau@redhat.com >
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
2023-11-08 20:20:53 +00:00
Luigi Pinca
3e3467e77a
test: relax version check with shared OpenSSL
...
Relax the OpenSSL version check when Node.js is built with the
`--shared-openssl` option. Verify only that `process.versions.openssl`
is truthy.
Fixes: https://github.com/nodejs/node/issues/43078
PR-URL: https://github.com/nodejs/node/pull/50505
Reviewed-By: Richard Lau <rlau@redhat.com >
2023-11-08 20:20:43 +00:00
Antoine du Hamel
309c71ae38
lib: add --no-experimental-global-navigator CLI flag
...
PR-URL: https://github.com/nodejs/node/pull/50562
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
Reviewed-By: Richard Lau <rlau@redhat.com >
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev >
2023-11-08 17:24:51 +00:00
fwio
3607b92134
doc: fix typo in fs.md
...
PR-URL: https://github.com/nodejs/node/pull/50570
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
2023-11-08 16:46:22 +00:00
Filip Skokan
33a8923769
meta: add crypto as crypto and webcrypto docs owner
...
PR-URL: https://github.com/nodejs/node/pull/50579
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Darshan Sen <raisinten@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
2023-11-08 15:07:44 +00:00
Deokjin Kim
81a4a748d2
doc: add missing description of argument in subtle.encrypt
...
Description of third argument(data) in subtle.encrypt is missed,
so add it.
PR-URL: https://github.com/nodejs/node/pull/50578
Reviewed-By: Filip Skokan <panva.ip@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
2023-11-08 14:40:06 +00:00
Tom Haddad
8588ee1e4f
test_runner: replace forEach with for of
...
PR-URL: https://github.com/nodejs/node/pull/50595
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
2023-11-08 14:12:26 +00:00
Shubham Pandey
43dcaa3428
test_runner, cli: add --test-timeout flag
...
PR-URL: https://github.com/nodejs/node/pull/50443
Fixes: https://github.com/nodejs/node/issues/50431
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
Reviewed-By: Raz Luvaton <rluvaton@gmail.com >
Reviewed-By: Chemi Atlow <chemi@atlow.co.il >
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com >
2023-11-08 14:02:12 +00:00
Filip Skokan
b10f69873c
test: add WPT report test duration
...
PR-URL: https://github.com/nodejs/node/pull/50574
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com >
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
2023-11-08 11:11:28 +00:00
Ranieri Innocenti Spada
4d6c8a09e0
doc: update pm documentation to include resource
...
PR-URL: https://github.com/nodejs/node/pull/50601
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com >
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com >
2023-11-08 00:00:17 +00:00
Kajol
5e3217c829
test: replace forEach() with for ... of loop in test-global.js
...
PR-URL: https://github.com/nodejs/node/pull/49772
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2023-11-07 13:52:09 +00:00
Node.js GitHub Bot
55d2eb53d7
deps: update corepack to 0.23.0
...
PR-URL: https://github.com/nodejs/node/pull/50563
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
2023-11-07 11:10:10 +00:00
Jacob Smith
c5e1fd0530
doc: correct attribution in v20.6.0 changelog
...
PR-URL: https://github.com/nodejs/node/pull/50564
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Claudio Wunder <cwunder@gnome.org >
2023-11-07 10:25:57 +00:00
Node.js GitHub Bot
33704c46e3
tools: update eslint to 8.53.0
...
PR-URL: https://github.com/nodejs/node/pull/50559
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
2023-11-07 00:48:10 +00:00
Node.js GitHub Bot
15a2635c0a
tools: update lint-md-dependencies to rollup@4.3.0
...
PR-URL: https://github.com/nodejs/node/pull/50556
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com >
2023-11-07 00:48:01 +00:00
Jungku Lee
9a321dd4c0
doc: update to align console.table row to the left
...
PR-URL: https://github.com/nodejs/node/pull/50553
Refs: https://github.com/nodejs/node/pull/50135
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br >
Reviewed-By: Deokjin Kim <deokjin81.kim@gmail.com >
2023-11-06 16:47:53 +00:00
Levi Zim
223853264b
deps: V8: cherry-pick 13192d6e10fa
...
Original commit message:
[riscv][tagged-ptr] Convert more Objects to Tagged<>
Port commit 064b9a7903b793734b6c03a86ee53a2dc85f0f80
Bug: v8:12710
Change-Id: If076ca5cd9e9d175c20fc3611e03d39c0260404d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4837830
Reviewed-by: Ji Qiu <qiuji@iscas.ac.cn >
Commit-Queue: Ji Qiu <qiuji@iscas.ac.cn >
Auto-Submit: Yahan Lu <yahan@iscas.ac.cn >
Cr-Commit-Position: refs/heads/main@{#89780}
Refs: 13192d6e10
PR-URL: https://github.com/nodejs/node/pull/50552
Reviewed-By: Richard Lau <rlau@redhat.com >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Debadree Chatterjee <debadree333@gmail.com >
Reviewed-By: Jiawen Geng <technicalcute@gmail.com >
2023-11-06 15:19:55 +00:00
Shi Pujin
a709a7e0c5
build: support Python 3.12
...
PR-URL: https://github.com/nodejs/node/pull/50209
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Christian Clauss <cclauss@me.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Richard Lau <rlau@redhat.com >
2023-11-06 14:11:01 +00:00
Michaël Zasso
cde3296f5f
tools: compare ICU checksums before file changes
...
Otherwise we end up with an bad update PR when checksums don't match.
Refs: https://github.com/nodejs/node/pull/50495
PR-URL: https://github.com/nodejs/node/pull/50522
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com >
Reviewed-By: Richard Lau <rlau@redhat.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2023-11-06 11:21:49 +00:00
Joyee Cheung
036c89f917
src: use v8::Isolate::TryGetCurrent() in DumpJavaScriptBacktrace()
...
It was using Isolate::GetCurrent() which DCHECK on nullptr, even
though what we wanted was to return early if it is nullptr.
PR-URL: https://github.com/nodejs/node/pull/50518
Refs: https://github.com/nodejs/node/pull/50242
Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br >
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com >
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
2023-11-06 09:25:06 +00:00
Marco Ippolito
2a1bd660bd
tools: improve update acorn-walk script
...
PR-URL: https://github.com/nodejs/node/pull/50473
Refs: https://github.com/nodejs/security-wg/issues/1037
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Paolo Insogna <paolo@cowtech.it >
2023-11-05 09:43:08 +00:00
Aras Abbasi
77b0595518
lib: add navigator.language & navigator.languages
...
PR-URL: https://github.com/nodejs/node/pull/50303
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
2023-11-04 18:07:42 +00:00
dependabot[bot]
a5cd62975c
meta: bump actions/setup-node from 3.8.1 to 4.0.0
...
Bumps [actions/setup-node](https://github.com/actions/setup-node ) from 3.8.1 to 4.0.0.
- [Release notes](https://github.com/actions/setup-node/releases )
- [Commits](5e21ff4d9b...8f152de45c )
---
updated-dependencies:
- dependency-name: actions/setup-node
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <support@github.com >
PR-URL: https://github.com/nodejs/node/pull/50514
Reviewed-By: Richard Lau <rlau@redhat.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com >
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com >
Reviewed-By: Tierney Cyren <hello@bnb.im >
2023-11-04 06:36:13 +00:00
dependabot[bot]
d22e3a135c
meta: bump actions/checkout from 4.1.0 to 4.1.1
...
Bumps [actions/checkout](https://github.com/actions/checkout ) from 4.1.0 to 4.1.1.
- [Release notes](https://github.com/actions/checkout/releases )
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md )
- [Commits](8ade135a41...b4ffde65f4 )
---
updated-dependencies:
- dependency-name: actions/checkout
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com >
PR-URL: https://github.com/nodejs/node/pull/50511
Reviewed-By: Tierney Cyren <hello@bnb.im >
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com >
2023-11-04 06:36:04 +00:00
Joyee Cheung
94156e35df
test: skip test-diagnostics-channel-memory-leak.js
...
There is currently no reliable way to detect this leak because:
1. We cannot reliably get a reference to the channel from the
API to detect finalization without creating another strong reference.
2. This test does gc() and then checks memory usage - however the
use of gc() disables code aging which can actually lead to increased
memory usage overall, as it is not intended to be used to lower
memory usage in the first place.
3. The implementation of diagnostics channels relies on ephemeron gc
which is inefficient, it's not reliable to use the typical "create
a lot of objects and see if it crashes" trick to check leaks.
Skip the test for now until we find a way to test it reliably.
To avoid flakiness in the CI, it's better to remove an unreliable
test altogether.
PR-URL: https://github.com/nodejs/node/pull/50327
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com >
2023-11-03 21:50:03 +00:00
Yagiz Nizipli
4dbb017301
test: improve UV_THREADPOOL_SIZE tests on .env
...
PR-URL: https://github.com/nodejs/node/pull/49213
Reviewed-By: Chemi Atlow <chemi@atlow.co.il >
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
2023-11-03 17:25:54 +00:00
legendecas
a00f0b1f0a
test: recognize wpt completion error
...
PR-URL: https://github.com/nodejs/node/pull/50429
Reviewed-By: Filip Skokan <panva.ip@gmail.com >
2023-11-03 16:04:32 +00:00
legendecas
075ae82946
test: report error wpt test results
...
When a wpt test file is exited for uncaught error, its result should be
recorded in the `wptreport.json` and uploaded to wpt.fyi.
For instance, `html/webappapis/timers/evil-spec-example.any.js` is
exited for uncaught error in Node.js but it shows as "MISSING" at
https://wpt.fyi/results/html/webappapis/timers?label=master&label=experimental&product=chrome&product=node.js&aligned .
PR-URL: https://github.com/nodejs/node/pull/50429
Reviewed-By: Filip Skokan <panva.ip@gmail.com >
2023-11-03 16:04:31 +00:00
npm CLI robot
fd2368eafc
deps: upgrade npm to 10.2.3
...
PR-URL: https://github.com/nodejs/node/pull/50531
Reviewed-By: Richard Lau <rlau@redhat.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Debadree Chatterjee <debadree333@gmail.com >
2023-11-03 14:03:57 +00:00
Node.js GitHub Bot
83736436b2
tools: update lint-md-dependencies to rollup@4.2.0
...
PR-URL: https://github.com/nodejs/node/pull/50496
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2023-11-03 08:24:55 +00:00
Aras Abbasi
a450eedffa
lib: add navigator.platform
...
PR-URL: https://github.com/nodejs/node/pull/50385
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2023-11-02 20:21:21 +00:00
Ram
196224cb29
test: replace forEach() with for...of
...
Replace `forEach()` with `for...of` in in test-dgram-socket-buffer-size.
PR-URL: https://github.com/nodejs/node/pull/49794
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2023-11-02 19:47:11 +01:00
Chand
791611a997
test: replace forEach() with for...of in test-trace-events-http
...
PR-URL: https://github.com/nodejs/node/pull/49795
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2023-11-02 19:43:42 +01:00
Aras Abbasi
45f5c9ba4e
lib: use primordials for navigator.userAgent
...
PR-URL: https://github.com/nodejs/node/pull/50467
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com >
Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev >
2023-11-02 13:31:50 +00:00
Dominique Leuenberger
5d01042e34
test: fix testsuite against zlib version 1.3
...
In the past, zlib versions had major.minor.micro formats, but with 1.3
this has been changed.
Change the test code to accept one, two, or three elements past the
major version.
PR-URL: https://github.com/nodejs/node/pull/50364
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
Reviewed-By: Richard Lau <rlau@redhat.com >
2023-11-02 10:53:21 +00:00
Niya Shiyas
a1693c669c
test: replace forEach with for...of in test-fs-realpath-buffer-encoding
...
PR-URL: https://github.com/nodejs/node/pull/49804
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
2023-11-02 08:38:35 +01:00
Shi Pujin
1b74aa3cb2
test: fix timeout of test-cpu-prof-dir-worker.js in LoongArch devices
...
PR-URL: https://github.com/nodejs/node/pull/50363
Reviewed-By: Michael Dawson <midawson@redhat.com >
Reviewed-By: Richard Lau <rlau@redhat.com >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
2023-11-02 07:29:56 +00:00
Node.js GitHub Bot
9e30518107
deps: update nghttp2 to 1.58.0
...
PR-URL: https://github.com/nodejs/node/pull/50441
Reviewed-By: Michaël Zasso <targos@protonmail.com >
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com >
Reviewed-By: James M Snell <jasnell@gmail.com >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2023-11-02 07:22:34 +00:00
Rich Trott
401ea75bdd
doc: underline links
...
The current use of color only to differentiate links fails WCAG A
accessibility standards.
Possible solutions are:
1. Using a text indicator to show that the text is a link.
2. Using additional cues (such as underlining).
3. Providing color contrast of 3:1 or greater with surrounding text
(not the background--the adjacent text!) along with visual cues
on hover.
The solution here implements the second option.
Ref: https://www.w3.org/WAI/WCAG21/Understanding/use-of-color.html
Ref: https://www.w3.org/WAI/WCAG21/Techniques/failures/F73
Ref: https://www.w3.org/WAI/WCAG21/Techniques/general/G182
PR-URL: https://github.com/nodejs/node/pull/50481
Refs: https://www.w3.org/WAI/WCAG21/Understanding/use-of-color.html
Refs: https://www.w3.org/WAI/WCAG21/Techniques/failures/F73
Refs: https://www.w3.org/WAI/WCAG21/Techniques/general/G182
Reviewed-By: Claudio Wunder <cwunder@gnome.org >
Reviewed-By: Moshe Atlow <moshe@atlow.co.il >
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com >
Reviewed-By: Tobias Nießen <tniessen@tnie.de >
Reviewed-By: Tierney Cyren <hello@bnb.im >
Reviewed-By: Luigi Pinca <luigipinca@gmail.com >
2023-11-01 23:12:42 +00:00
Jacob Hummer
60e836427e
console: treat non-strings as separate argument in console.assert()
...
fixes #49680
PR-URL: https://github.com/nodejs/node/pull/49722
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com >
Reviewed-By: Matteo Collina <matteo.collina@gmail.com >
2023-11-01 17:54:05 +00:00
Joyee Cheung
30950864d3
src: print more information in C++ assertions
...
This patch:
- Introduce an internal GetCurrentStackTrace() utility to get the
current JavaScript stack trace with best effort.
- Indent the assertion message so that is separated from the native
stack trace for redability
- Print the JS stack trace when it's available
Previoiusly the abort message looks like this:
```
out/Release/node[24458]: ../../src/node_file.cc:2008:void node::fs::Ope
n(const FunctionCallbackInfo<v8::Value> &): Assertion `(argc) >= (3)' f
ailed.
1: 0x1043fb9a4 node::Abort() [node]
2: 0x1043fb6e4 node::PrintCaughtException(v8::Isolate*, v8::Local<v8::
Context>, v8::TryCatch const&) [node]
3: 0x104407708 node::fs::Open(v8::FunctionCallbackInfo<v8::Value> cons
t&) [node]
4: 0x104611e74 v8::internal::MaybeHandle<v8::internal::Object> v8::int
ernal::(anonymous namespace)::HandleApiCallHelper<false>(v8::internal::
Isolate*, v8::internal::Handle<v8::internal::HeapObject
>, v8::internal::Handle<v8::internal::FunctionTemplateInfo>, v8::intern
al::Handle<v8::internal::Object>, unsigned long*, int) [node
]
5: 0x1046116c8 v8::internal::Builtin_HandleApiCall(int, unsigned long*
, v8::internal::Isolate*) [node]
6: 0x104e9cb24 Builtins_CEntry_Return1_ArgvOnStack_BuiltinExit [node]
7: 0x104e143e4 Builtins_InterpreterEntryTrampoline [node]
8: 0x104e1250c Builtins_JSEntryTrampoline [node]
9: 0x104e121f4 Builtins_JSEntry [node]
10: 0x1046ed54c v8::internal::(anonymous namespace)::Invoke(v8::interna
l::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&)
[node]
11: 0x1046edb60 v8::internal::Execution::CallScript(v8::internal::Isola
te*, v8::internal::Handle<v8::internal::JSFunction>, v8::internal::Hand
le<v8::internal::Object>, v8::internal::Handle<v8::in
ternal::Object>) [node]
12: 0x1045a9fa0 v8::Script::Run(v8::Local<v8::Context>, v8::Local<v8::D
ata>) [node]
13: 0x1043efb68 node::contextify::ContextifyScript::EvalMachine(v8::Loc
al<v8::Context>, node::Environment*, long long, bool, bool, bool, v8::M
icrotaskQueue*, v8::FunctionCallbackInfo<v8::Value> const&) [node
]
14: 0x1043ef3e0 node::contextify::ContextifyScript::RunInContext(v8::Fu
nctionCallbackInfo<v8::Value> const&) [node]
15: 0x104611e74 v8::internal::MaybeHandle<v8::internal::Object> v8::int
ernal::(anonymous namespace)::HandleApiCallHelper<false>(v8::internal::
Isolate*, v8::internal::Handle<v8::internal::HeapObject>
, v8::internal::Handle<v8::internal::FunctionTemplateInfo>, v8::interna
l::Handle<v8::internal::Object>, unsigned long*, int) [node
]
16: 0x1046116c8 v8::internal::Builtin_HandleApiCall(int, unsigned long*
, v8::internal::Isolate*) [node]
17: 0x104e9cb24 Builtins_CEntry_Return1_ArgvOnStack_BuiltinExit [node]
18: 0x104e143e4 Builtins_InterpreterEntryTrampoline [node]
19: 0x104e143e4 Builtins_InterpreterEntryTrampoline [node]
20: 0x104e143e4 Builtins_InterpreterEntryTrampoline [node]
21: 0x104e143e4 Builtins_InterpreterEntryTrampoline [node]
22: 0x104e143e4 Builtins_InterpreterEntryTrampoline [node]
23: 0x104e143e4 Builtins_InterpreterEntryTrampoline [node]
24: 0x104e143e4 Builtins_InterpreterEntryTrampoline [node]
25: 0x104e1250c Builtins_JSEntryTrampoline [node]
26: 0x104e121f4 Builtins_JSEntry [node]
27: 0x1046ed54c v8::internal::(anonymous namespace)::Invoke(v8::interna
l::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&)
[node]
28: 0x1046ecdc8 v8::internal::Execution::Call(v8::internal::Isolate*, v
8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::int
ernal::Object>, int, v8::internal::Handle<v
8::internal::Object>*) [node]
29: 0x1045be23c v8::Function::Call(v8::Local<v8::Context>, v8::Local<v8
::Value>, int, v8::Local<v8::Value>*) [node]
30: 0x1043df704 node::builtins::BuiltinLoader::CompileAndCall(v8::Local
<v8::Context>, char const*, node::Realm*) [node]
31: 0x10446f2d4 node::Realm::ExecuteBootstrapper(char const*) [node]
32: 0x1043c3378 node::StartExecution(node::Environment*, std::__1::func
tion<v8::MaybeLocal<v8::Value> (node::StartExecutionCallbackInfo const&
)>) [node]
33: 0x10432dc28 node::LoadEnvironment(node::Environment*, std::__1::fun
ction<v8::MaybeLocal<v8::Value> (node::StartExecutionCallbackInfo const
&)>) [node]
34: 0x10443d1f4 node::NodeMainInstance::Run(node::ExitCode*, node::Envi
ronment*) [node]
35: 0x10443cfd0 node::NodeMainInstance::Run() [node]
36: 0x1043c5d18 node::Start(int, char**) [node]
37: 0x19a027f28 start [/usr/lib/dyld]
[1] 24458 abort out/Release/node -p "process.binding('fs').open
()"
```
Now it looks like this:
```
# out/Release/node[24856]: void node::fs::Open(const FunctionCallbac
kInfo<v8::Value> &) at ../../src/node_file.cc:2008
# Assertion failed: (argc) >= (3)
----- Native stack trace -----
1: 0x1001efe64 node::Abort() [node]
2: 0x1001efba4 node::PrintCaughtException(v8::Isolate*, v8::Local<v8::
Context>, v8::TryCatch const&) [node]
3: 0x1001fb868 node::fs::Open(v8::FunctionCallbackInfo<v8::Value> cons
t&) [node]
4: 0x100405fd4 v8::internal::MaybeHandle<v8::internal::Object> v8::int
ernal::(anonymous namespace)::HandleApiCallHelper<false>(v8::internal::
Isolate*, v8::internal::Handle<v8::internal::HeapObject
>, v8::internal::Handle<v8::internal::FunctionTemplateInfo>, v8::intern
al::Handle<v8::internal::Object>, unsigned long*, int) [node
]
5: 0x100405828 v8::internal::Builtin_HandleApiCall(int, unsigned long*
, v8::internal::Isolate*) [node]
6: 0x100c90b24 Builtins_CEntry_Return1_ArgvOnStack_BuiltinExit [node]
7: 0x100c083e4 Builtins_InterpreterEntryTrampoline [node]
8: 0x100c0650c Builtins_JSEntryTrampoline [node]
9: 0x100c061f4 Builtins_JSEntry [node]
10: 0x1004e16ac v8::internal::(anonymous namespace)::Invoke(v8::interna
l::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&)
[node]
11: 0x1004e1cc0 v8::internal::Execution::CallScript(v8::internal::Isola
te*, v8::internal::Handle<v8::internal::JSFunction>, v8::internal::Hand
le<v8::internal::Object>, v8::internal::Handle<v8::in
ternal::Object>) [node]
12: 0x10039e100 v8::Script::Run(v8::Local<v8::Context>, v8::Local<v8::D
ata>) [node]
13: 0x1001e4028 node::contextify::ContextifyScript::EvalMachine(v8::Loc
al<v8::Context>, node::Environment*, long long, bool, bool, bool, v8::M
icrotaskQueue*, v8::FunctionCallbackInfo<v8::Value> const&) [node
]
14: 0x1001e38a0 node::contextify::ContextifyScript::RunInContext(v8::Fu
nctionCallbackInfo<v8::Value> const&) [node]
15: 0x100405fd4 v8::internal::MaybeHandle<v8::internal::Object> v8::int
ernal::(anonymous namespace)::HandleApiCallHelper<false>(v8::internal::
Isolate*, v8::internal::Handle<v8::internal::HeapObject>
, v8::internal::Handle<v8::internal::FunctionTemplateInfo>, v8::interna
l::Handle<v8::internal::Object>, unsigned long*, int) [node
]
16: 0x100405828 v8::internal::Builtin_HandleApiCall(int, unsigned long*
, v8::internal::Isolate*) [node]
17: 0x100c90b24 Builtins_CEntry_Return1_ArgvOnStack_BuiltinExit [node]
18: 0x100c083e4 Builtins_InterpreterEntryTrampoline [node]
19: 0x100c083e4 Builtins_InterpreterEntryTrampoline [node]
20: 0x100c083e4 Builtins_InterpreterEntryTrampoline [node]
21: 0x100c083e4 Builtins_InterpreterEntryTrampoline [node]
22: 0x100c083e4 Builtins_InterpreterEntryTrampoline [node]
23: 0x100c083e4 Builtins_InterpreterEntryTrampoline [node]
24: 0x100c083e4 Builtins_InterpreterEntryTrampoline [node]
25: 0x100c0650c Builtins_JSEntryTrampoline [node]
26: 0x100c061f4 Builtins_JSEntry [node]
27: 0x1004e16ac v8::internal::(anonymous namespace)::Invoke(v8::interna
l::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&)
[node]
28: 0x1004e0f28 v8::internal::Execution::Call(v8::internal::Isolate*, v
8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::int
ernal::Object>, int, v8::internal::Handle<v
8::internal::Object>*) [node]
29: 0x1003b239c v8::Function::Call(v8::Local<v8::Context>, v8::Local<v8
::Value>, int, v8::Local<v8::Value>*) [node]
30: 0x1001d3bc4 node::builtins::BuiltinLoader::CompileAndCall(v8::Local
<v8::Context>, char const*, node::Realm*) [node]
31: 0x100263434 node::Realm::ExecuteBootstrapper(char const*) [node]
32: 0x1001b7838 node::StartExecution(node::Environment*, std::__1::func
tion<v8::MaybeLocal<v8::Value> (node::StartExecutionCallbackInfo const&
)>) [node]
33: 0x100121c28 node::LoadEnvironment(node::Environment*, std::__1::fun
ction<v8::MaybeLocal<v8::Value> (node::StartExecutionCallbackInfo const
&)>) [node]
34: 0x100231354 node::NodeMainInstance::Run(node::ExitCode*, node::Envi
ronment*) [node]
35: 0x100231130 node::NodeMainInstance::Run() [node]
36: 0x1001ba1d8 node::Start(int, char**) [node]
37: 0x19a027f28 start [/usr/lib/dyld]
----- JavaScript stack trace -----
1: [eval]:1:23
2: runScriptInThisContext (node:internal/vm:144:10)
3: node:internal/process/execution:109:14
4: [eval]-wrapper:6:24
5: runScript (node:internal/process/execution:92:62)
6: evalScript (node:internal/process/execution:123:10)
7: node:internal/main/eval_string:51:3
[1] 24856 abort out/Release/node -p "process.binding('fs').open
()"
```
PR-URL: https://github.com/nodejs/node/pull/50242
Reviewed-By: Chengzhong Wu <legendecas@gmail.com >
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com >
2023-11-01 16:20:18 +00:00