(event: Cdp.Debugger.PausedEvent)
| 588 | } |
| 589 | |
| 590 | private async _onPaused(event: Cdp.Debugger.PausedEvent) { |
| 591 | const hitBreakpoints = (event.hitBreakpoints ?? []).filter( |
| 592 | bp => bp !== this._pauseOnSourceMapBreakpointId, |
| 593 | ); |
| 594 | const isInspectBrk = (event.reason as string) === 'Break on start'; |
| 595 | const isSourceMapPause = |
| 596 | (event.reason === 'instrumentation' && event.data?.scriptId) || |
| 597 | this._breakpointManager.isEntrypointBreak(hitBreakpoints); |
| 598 | this.evaluator.setReturnedValue(event.callFrames[0]?.returnValue); |
| 599 | |
| 600 | let shouldPause: boolean; |
| 601 | if (isSourceMapPause) { |
| 602 | const location = event.callFrames[0].location; |
| 603 | const scriptId = event.data?.scriptId || location.scriptId; |
| 604 | |
| 605 | if (this._isWebpackModuleEvalPause(event)) { |
| 606 | await this._handleWebpackModuleEval(); |
| 607 | } |
| 608 | |
| 609 | // Set shouldPause=true if we just resolved a breakpoint that's on this |
| 610 | // location; this won't have existed before now. |
| 611 | shouldPause = await this._handleSourceMapPause(scriptId, location); |
| 612 | // Set shouldPause=true if there's a non-entry, user defined breakpoint |
| 613 | // among the remaining points--or an inspect-brk. |
| 614 | shouldPause = |
| 615 | shouldPause || |
| 616 | isInspectBrk || |
| 617 | (await this._breakpointManager.shouldPauseAt( |
| 618 | event, |
| 619 | hitBreakpoints, |
| 620 | this._delegate.entryBreakpoint, |
| 621 | true, |
| 622 | )); |
| 623 | |
| 624 | if ( |
| 625 | scheduledPauseOnAsyncCall && |
| 626 | event.asyncStackTraceId && |
| 627 | scheduledPauseOnAsyncCall.debuggerId === event.asyncStackTraceId.debuggerId && |
| 628 | scheduledPauseOnAsyncCall.id === event.asyncStackTraceId.id |
| 629 | ) { |
| 630 | // Paused on the script which is run as a task for scheduled async call. |
| 631 | // We are waiting for this pause, no need to resume. |
| 632 | } else if (shouldPause) { |
| 633 | // If should stay paused, that means the user set a breakpoint on |
| 634 | // the first line (which we are already on!), so pretend it's |
| 635 | // a breakpoint and let it bubble up. |
| 636 | if (event.data) { |
| 637 | event.data.__rewriteAsBreakpoint = true; |
| 638 | } |
| 639 | } else { |
| 640 | await this._pauseOnScheduledAsyncCall(); |
| 641 | this.resume(); |
| 642 | return; |
| 643 | } |
| 644 | } else { |
| 645 | shouldPause = await this._breakpointManager.shouldPauseAt( |
| 646 | event, |
| 647 | hitBreakpoints, |
no test coverage detected