Commit graph

32 commits

Author SHA1 Message Date
Chengzhong Wu
b18153598b inspector: add Network.Initiator in inspector protocol
Add initiator stack trace in inspector network events, reflecting
the location where the script created the request.

The `http.client.request.created` event is closer to where user code
creates the http request, and correctly reflects which script
initiated the request.

PR-URL: https://github.com/nodejs/node/pull/56805
Refs: https://github.com/nodejs/node/issues/53946
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Kohei Ueno <kohei.ueno119@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
2025-02-08 13:39:19 +00:00
Chengzhong Wu
4f45acef19
inspector: add undici http tracking support
Add basic undici http tracking support via inspector protocol. This
allows tracking `fetch` calls with an inspector.

PR-URL: https://github.com/nodejs/node/pull/56488
Refs: https://github.com/nodejs/node/issues/53946
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2025-01-08 16:56:42 +00:00
Chengzhong Wu
9400eae52e
inspector: report loadingFinished until the response data is consumed
The `Network.loadingFinished` should be deferred until the response is
complete and the data is fully consumed. Also, report correct request
url with the specified port by retrieving the host from the request
headers.

PR-URL: https://github.com/nodejs/node/pull/56372
Refs: https://github.com/nodejs/node/issues/53946
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Kohei Ueno <kohei.ueno119@gmail.com>
2025-01-05 11:43:44 +00:00
Rich Trott
4330fb757f debugger: rename internal library for clarity
When I moved these files from node-inspect to Node.js core, I put them
in lib/internal/inspector. That was a mistake. They should be in
lib/internal/debugger.

PR-URL: https://github.com/nodejs/node/pull/39080
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2021-06-20 22:33:32 -07:00
Rich Trott
767996047c debugger: use ERR_DEBUGGER_STARTUP_ERROR in _inspect.js
PR-URL: https://github.com/nodejs/node/pull/39024
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Jan Krems <jan.krems@gmail.com>
2021-06-15 18:43:16 -07:00
Rich Trott
fa009e1428 debugger: use error codes in debugger REPL
PR-URL: https://github.com/nodejs/node/pull/39024
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Jan Krems <jan.krems@gmail.com>
2021-06-15 18:43:12 -07:00
Rich Trott
c22eec85b4 debugger: use ERR_DEBUGGER_ERROR in debugger client
PR-URL: https://github.com/nodejs/node/pull/39024
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Jan Krems <jan.krems@gmail.com>
2021-06-15 18:43:10 -07:00
Rich Trott
f461158feb debugger: remove unnecessary boilerplate copyright comment
PR-URL: https://github.com/nodejs/node/pull/38952
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2021-06-09 19:07:34 -07:00
Rich Trott
fa86b36124 debugger: reduce scope of eslint disable comment
Current code masks setInterval and setTimeout with promisified versions.
This can be confusing to read and causes lint errors. Replace masking
with use of pSetInterval and pSetTimeout instead.

Move disabling of lint rule from entire file to the one remaining line
(after the above changes) that still needs it.

PR-URL: https://github.com/nodejs/node/pull/38946
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2021-06-07 22:11:44 -07:00
Rich Trott
fc264dfd8d debugger: revise async iterator usage to comply with lint rules
I'm not sure that this is any clearer than the existing code, but I
don't think it's significantly less clear, and it avoids comment
disabling a lint rule.

PR-URL: https://github.com/nodejs/node/pull/38847
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2021-06-01 19:46:52 -07:00
Rich Trott
910009d5c6 debugger: removed unused function argument
PR-URL: https://github.com/nodejs/node/pull/38850
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2021-05-31 22:19:49 -07:00
Michaël Zasso
f1cbaea74b
debugger: wait for V8 debugger to be enabled
Refs: https://github.com/nodejs/node/pull/38273#issuecomment-848438189

PR-URL: https://github.com/nodejs/node/pull/38811
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Beth Griggs <bgriggs@redhat.com>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2021-05-28 23:06:13 +02:00
Antoine du Hamel
284f74d6f9
debugger: refactor inspect_repl to use primordials
PR-URL: https://github.com/nodejs/node/pull/38551
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2021-05-14 15:53:34 -07:00
Antoine du Hamel
9158d61deb debugger: refactor to use internal modules
This avoids loading the entirety of `node:util` and `node:url` and their
dependencies while only a subset is actually used by this module.

PR-URL: https://github.com/nodejs/node/pull/38550
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
2021-05-07 11:43:26 +02:00
Rich Trott
7eb28e3176
debugger: disable only the lint rules required by current file state
PR-URL: https://github.com/nodejs/node/pull/38529
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2021-05-06 10:33:18 -07:00
Rich Trott
c42849fde4
debugger: avoid non-ASCII char in code file
Avoid non-ASCII char in lib code as a single non-ASCII char forces all
the chars to be stored inefficiently, bloating the binary size. This
also brings the file closer to compatibility with our lint rules.

PR-URL: https://github.com/nodejs/node/pull/38529
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2021-05-06 10:33:16 -07:00
Rich Trott
d5f0c83d80
debugger: wrap lines longer than 80 chars
Wrap lines more than 80 chararcters long in inspect_repl.js so we can
disable specific rules.

PR-URL: https://github.com/nodejs/node/pull/38529
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2021-05-06 10:33:14 -07:00
Antoine du Hamel
2c0fd32db3 debugger: enable linter on internal/inspector/inspect_client
PR-URL: https://github.com/nodejs/node/pull/38417
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
2021-05-03 13:57:15 +02:00
Antoine du Hamel
f331a1894f debugger: refactor internal/inspector/_inspect to use more primordials
PR-URL: https://github.com/nodejs/node/pull/38406
Reviewed-By: Rich Trott <rtrott@gmail.com>
2021-05-03 13:55:51 +02:00
Rich Trott
bdb6c597a7 debugger: apply automatic lint fixes for inspect_repl.js
For issues that ESLint can fix automatically, fix them.

PR-URL: https://github.com/nodejs/node/pull/38411
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
2021-04-28 07:02:24 -07:00
Rich Trott
ea47bd2137 debugger: apply automatic lint fixes for _inspect.js
For issues that ESLint can fix automatically, fix them.

PR-URL: https://github.com/nodejs/node/pull/38411
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
2021-04-28 07:02:23 -07:00
Rich Trott
751d215eb8 debugger: remove unused function argument
The `{colors: true}` removed here is ignored by the function it is being
sent to.

PR-URL: https://github.com/nodejs/node/pull/38400
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2021-04-27 08:59:38 -07:00
Rich Trott
01e0e3212d debugger: align message with Node.js standard
Node.js uses (or will use) _Ctrl+C_ with no spaces. To unify the
messages from inspect with other messages from the REPL and elsewhere,
make that change in node-inspect too.

PR-URL: https://github.com/nodejs/node/pull/38400
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2021-04-27 08:59:34 -07:00
Rafael Gonzaga
302cc9e92c debugger: add usage example for --port
PR-URL: https://github.com/nodejs/node/pull/38400
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2021-04-27 08:59:28 -07:00
Rich Trott
60a0764501 debugger: fix race condition/deadlock on initialization
PR-URL: https://github.com/nodejs/node/pull/38161
Refs: https://github.com/nodejs/node/discussions/36481
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Jan Krems <jan.krems@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2021-04-25 01:50:27 -07:00
Rich Trott
e10525f76e debugger: replace internal use of deprecated API
Change process.binding() use to internalBinding().

PR-URL: https://github.com/nodejs/node/pull/38161
Refs: https://github.com/nodejs/node/discussions/36481
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Jan Krems <jan.krems@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2021-04-25 01:50:21 -07:00
Rich Trott
3ef3501e49 test,debugger: migrate node-inspect tests to core
Migrate the node-inspect tests to core (where node-inspect code now
lives) and remove node-inspect from deps directory.

PR-URL: https://github.com/nodejs/node/pull/38161
Refs: https://github.com/nodejs/node/discussions/36481
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Jan Krems <jan.krems@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2021-04-25 01:50:18 -07:00
Rich Trott
c4c9614e96 debugger: allow longer time to connect
Make five attempts with a timeout of 1 second each rather than 10
attempts with a timeout of 500ms each. This is to allow for
slower-connecting devices like Raspberry Pi.

PR-URL: https://github.com/nodejs/node/pull/38161
Refs: https://github.com/nodejs/node/discussions/36481
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Jan Krems <jan.krems@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2021-04-25 01:50:10 -07:00
Rich Trott
807ede70fa debugger: accommodate line chunking in Windows
PR-URL: https://github.com/nodejs/node/pull/38161
Refs: https://github.com/nodejs/node/discussions/36481
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Jan Krems <jan.krems@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2021-04-25 01:50:06 -07:00
Rich Trott
b0713b4186 debugger: fix inspect restart on Windows
Fixes: https://github.com/nodejs/node/issues/37224

PR-URL: https://github.com/nodejs/node/pull/38161
Refs: https://github.com/nodejs/node/discussions/36481
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Jan Krems <jan.krems@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2021-04-25 01:50:03 -07:00
Rich Trott
21dc0b0b22 debugger: remove unused code
Remove code that was for when `node-inspect` was called as a standalone
process.

PR-URL: https://github.com/nodejs/node/pull/38161
Refs: https://github.com/nodejs/node/discussions/36481
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Jan Krems <jan.krems@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2021-04-25 01:50:00 -07:00
Rich Trott
0ca876ac96 debugger: move node-inspect to internal library
node-inspect developers have agreed to move node-inspect into core
rather than vendor it as a dependency.

Refs: https://github.com/nodejs/node/discussions/36481

PR-URL: https://github.com/nodejs/node/pull/38161
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Jan Krems <jan.krems@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2021-04-25 01:49:45 -07:00