Skip to content

Commit 9bc57a3

Browse files
committed
debugger: preserve overlapping CDP request state
A Debugger.paused event can arrive before the response to the resume request that triggered it. The resulting probe evaluation replaces the resume request in `inFlight`, but the resume cleanup then clears the newer request's state. Only clear `inFlight` when it still refers to the request being completed. This preserves probe attribution when the target exits during evaluation. Clarify the existing end-to-end test coverage for this case. Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com> Assisted-by: openai:gpt-5.6-sol
1 parent 71812d1 commit 9bc57a3

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

lib/internal/debugger/inspect_probe.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -707,7 +707,8 @@ class ProbeInspectorSession {
707707

708708
async callCdp(method, params, probe = null) {
709709
if (this.finished) { throw kInspectorFailedSentinel; }
710-
this.inFlight = { __proto__: null, method, probe };
710+
const request = { __proto__: null, method, probe };
711+
this.inFlight = request;
711712
debug('CDP -> %s%s', method, probe !== null ? `, probe=${probe.index}` : '');
712713
try {
713714
const result = await this.client.callMethod(method, params);
@@ -763,7 +764,9 @@ class ProbeInspectorSession {
763764
}
764765
throw kInspectorFailedSentinel;
765766
} finally {
766-
this.inFlight = null;
767+
if (this.inFlight === request) {
768+
this.inFlight = null;
769+
}
767770
}
768771
}
769772

0 commit comments

Comments
 (0)