| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 57d060e commit b0bfcb9
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -624,6 +624,10 @@ class ProbeInspectorSession { | |||
| 624 | 624 | ||
| 625 | 625 | async handlePaused(params) { | |
| 626 | 626 | if (this.finished) { return; } | |
| 627 | + // Ignore pauses that arrive before breakpoint setup is complete. Once | ||
| 628 | + // startup is marked complete, `Runtime.runIfWaitingForDebugger` may surface | ||
| 629 | + // the initial --inspect-brk pause, which the normal resume path handles. | ||
| 630 | + if (!this.started) { return; } | ||
| 627 | 631 | ||
| 628 | 632 | const hitBreakpoints = params.hitBreakpoints; | |
| 629 | 633 | if (hitBreakpoints === undefined || hitBreakpoints.length === 0) { | |
@@ -1025,5 +1029,6 @@ async function runProbeMode(stdout, probeOptions) { | |||
| 1025 | 1029 | ||
| 1026 | 1030 | module.exports = { | |
| 1027 | 1031 | parseProbeTokens, | |
| 1032 | + ProbeInspectorSession, | ||
| 1028 | 1033 | runProbeMode, | |
| 1029 | 1034 | }; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,32 @@ | |||
| 1 | + // Flags: --expose-internals | ||
| 2 | + // This tests that probe mode ignores pauses until startup has finished binding | ||
| 3 | + // breakpoints. | ||
| 4 | + 'use strict'; | ||
| 5 | + | ||
| 6 | + const common = require('../common'); | ||
| 7 | + common.skipIfInspectorDisabled(); | ||
| 8 | + | ||
| 9 | + const assert = require('assert'); | ||
| 10 | + const { ProbeInspectorSession } = require('internal/debugger/inspect_probe'); | ||
| 11 | + | ||
| 12 | + const session = new ProbeInspectorSession({ | ||
| 13 | + probes: [], | ||
| 14 | + }); | ||
| 15 | + | ||
| 16 | + const cdpCalls = []; | ||
| 17 | + session.client = { | ||
| 18 | + callMethod: common.mustCall(async (method) => { | ||
| 19 | + cdpCalls.push(method); | ||
| 20 | + }), | ||
| 21 | + }; | ||
| 22 | + | ||
| 23 | + async function testStartupPauseHandling() { | ||
| 24 | + await session.handlePaused({}); | ||
| 25 | + assert.deepStrictEqual(cdpCalls, []); | ||
| 26 | + | ||
| 27 | + session.started = true; | ||
| 28 | + await session.handlePaused({}); | ||
| 29 | + assert.deepStrictEqual(cdpCalls, ['Debugger.resume']); | ||
| 30 | + } | ||
| 31 | + | ||
| 32 | + testStartupPauseHandling().then(common.mustCall()); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments