* Sets a breakpoint on the thread using the given set of arguments * to Debugger.setBreakpoint or Debugger.setBreakpointByUrl.
(thread: Thread, args: AnyCdpBreakpointArgs)
| 466 | * to Debugger.setBreakpoint or Debugger.setBreakpointByUrl. |
| 467 | */ |
| 468 | protected async _setAny(thread: Thread, args: AnyCdpBreakpointArgs) { |
| 469 | const state: Partial<IBreakpointCdpReferencePending> = { |
| 470 | state: CdpReferenceState.Pending, |
| 471 | args, |
| 472 | deadletter: false, |
| 473 | }; |
| 474 | |
| 475 | state.done = (async () => { |
| 476 | const result = isSetByLocation(args) |
| 477 | ? await thread.cdp().Debugger.setBreakpoint(args) |
| 478 | : await thread.cdp().Debugger.setBreakpointByUrl(args); |
| 479 | if (!result) { |
| 480 | return; |
| 481 | } |
| 482 | |
| 483 | if (state.deadletter) { |
| 484 | await thread.cdp().Debugger.removeBreakpoint({ breakpointId: result.breakpointId }); |
| 485 | return; |
| 486 | } |
| 487 | |
| 488 | const locations = 'actualLocation' in result ? [result.actualLocation] : result.locations; |
| 489 | this._manager._resolvedBreakpoints.set(result.breakpointId, this); |
| 490 | |
| 491 | // Note that we add the record after calling breakpointResolved() |
| 492 | // to avoid duplicating locations. |
| 493 | const next: IBreakpointCdpReferenceApplied = { |
| 494 | state: CdpReferenceState.Applied, |
| 495 | cdpId: result.breakpointId, |
| 496 | args, |
| 497 | locations, |
| 498 | uiLocations: [], |
| 499 | }; |
| 500 | this.updateCdpRefs(list => list.map(r => (r === state ? next : r))); |
| 501 | this.updateUiLocations(thread, result.breakpointId, locations); |
| 502 | return next; |
| 503 | })(); |
| 504 | |
| 505 | this.updateCdpRefs(list => [...list, state as IBreakpointCdpReferencePending]); |
| 506 | await state.done; |
| 507 | } |
| 508 | |
| 509 | /** |
| 510 | * Removes a CDP breakpoint attached to this one. Deadletters it if it |
nothing calls this directly
no test coverage detected