Skip to content

feat(ext/node): implement NodeRuntime.notifyWhenWaitingForDisconnect - #34204

Merged
bartlomieju merged 2 commits into
mainfrom
feat/inspector-noderuntime-notify-disconnect
May 18, 2026
Merged

bartlomieju merged 2 commits into
mainfrom
feat/inspector-noderuntime-notify-disconnect

Conversation

@bartlomieju

Copy link
Copy Markdown
Member

Adds the missing CDP command. When a session opts in via
NodeRuntime.notifyWhenWaitingForDisconnect(enabled: true), the
process-exit handler now emits NodeRuntime.waitingForDisconnect to it
instead of the generic Runtime.executionContextDestroyed, matching
Node's behavior where the two notifications are mutually exclusive per
session. Sessions that did not opt in continue to receive
executionContextDestroyed as before.

The wait-for-disconnect loop itself was already in place; this just
plumbs the new per-session flag through the WebSocket dispatcher and
splits the existing context-destroyed broadcast.

Clears test-inspector-waiting-for-disconnect.js, which connects two
sessions to a child running with --inspect-brk, opts one of them in,
and verifies the opted-in session sees waitingForDisconnect while the
other still sees executionContextDestroyed.

Adds the missing CDP command and emits the matching
NodeRuntime.waitingForDisconnect notification at process-exit time for
sessions that opted in. Sessions with the opt-in flag are skipped from
the existing Runtime.executionContextDestroyed broadcast, matching
Node's behavior where the two notifications are mutually exclusive per
session.

Clears test-inspector-waiting-for-disconnect.js, which connects two
sessions to a child running with --inspect-brk, opts one of them in,
and verifies that the opted-in session receives waitingForDisconnect
(but not executionContextDestroyed) while the second session still
sees executionContextDestroyed as before.
…ntime-notify-disconnect

# Conflicts:
#	tests/node_compat/config.jsonc
@bartlomieju
bartlomieju enabled auto-merge (squash) May 18, 2026 09:05
@bartlomieju
bartlomieju merged commit 794fb11 into main May 18, 2026
136 checks passed
@bartlomieju
bartlomieju deleted the feat/inspector-noderuntime-notify-disconnect branch May 18, 2026 09:10
littledivy pushed a commit to crowlKats/deno that referenced this pull request Jun 10, 2026
…enoland#34204)

Adds the missing CDP command. When a session opts in via
NodeRuntime.notifyWhenWaitingForDisconnect(enabled: true), the
process-exit handler now emits NodeRuntime.waitingForDisconnect to it
instead of the generic Runtime.executionContextDestroyed, matching
Node's behavior where the two notifications are mutually exclusive per
session. Sessions that did not opt in continue to receive
executionContextDestroyed as before.

The wait-for-disconnect loop itself was already in place; this just
plumbs the new per-session flag through the WebSocket dispatcher and
splits the existing context-destroyed broadcast.

Clears test-inspector-waiting-for-disconnect.js, which connects two
sessions to a child running with --inspect-brk, opts one of them in,
and verifies the opted-in session sees waitingForDisconnect while the
other still sees executionContextDestroyed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant