(params: Dap.RestartFrameParams)
| 381 | } |
| 382 | |
| 383 | async restartFrame(params: Dap.RestartFrameParams): Promise<Dap.RestartFrameResult | Dap.Error> { |
| 384 | const stackFrame = this._pausedDetails?.stackTrace.frame(params.frameId)?.root; |
| 385 | if (!stackFrame) { |
| 386 | return this._stackFrameNotFoundError(); |
| 387 | } |
| 388 | |
| 389 | const callFrameId = stackFrame.callFrameId(); |
| 390 | if (!callFrameId) { |
| 391 | return errors.createUserError(l10n.t('Cannot restart asynchronous frame')); |
| 392 | } |
| 393 | |
| 394 | // Cast is necessary since the devtools-protocol is being slow to update: |
| 395 | // https://github.com/microsoft/vscode-js-debug/issues/1283#issuecomment-1148219994 |
| 396 | // https://github.com/ChromeDevTools/devtools-protocol/issues/263 |
| 397 | const ok = await this._cdp.Debugger.restartFrame({ |
| 398 | callFrameId, |
| 399 | mode: 'StepInto', |
| 400 | } as Cdp.Debugger.RestartFrameParams); |
| 401 | if (!ok) { |
| 402 | return errors.createUserError(l10n.t('Frame could not be restarted')); |
| 403 | } |
| 404 | |
| 405 | this._expectedPauseReason = { |
| 406 | reason: 'frame_entry', |
| 407 | description: l10n.t('Paused on frame entry'), |
| 408 | }; |
| 409 | |
| 410 | // Chromium versions before 104 didn't have an explicit `canBeRestarted` |
| 411 | // flag on their call frame. And on those versions, when we `restartFrame`, |
| 412 | // we need to manually `stepInto` to unpause. However, with 104, restarting |
| 413 | // the frame will automatically resume execution. |
| 414 | if (!stackFrame.canExplicitlyBeRestarted) { |
| 415 | await this._cdp.Debugger.stepInto({}); |
| 416 | } |
| 417 | |
| 418 | return {}; |
| 419 | } |
| 420 | |
| 421 | async stackTrace(params: Dap.StackTraceParams): Promise<Dap.StackTraceResult | Dap.Error> { |
| 422 | if (!this._pausedDetails) return errors.createSilentError(l10n.t('Thread is not paused')); |
nothing calls this directly
no test coverage detected