MCPcopy
hub / github.com/microsoft/vscode-js-debug / updateCustomBreakpoints

Method updateCustomBreakpoints

src/adapter/threads.ts:1370–1408  ·  view source on GitHub ↗
(xhr: string[], events: string[])

Source from the content-addressed store, hash-verified

1368 }
1369
1370 async updateCustomBreakpoints(xhr: string[], events: string[]): Promise<void> {
1371 if (!this.target.supportsCustomBreakpoints()) return;
1372 this._enabledCustomBreakpoints ??= new Set();
1373
1374 // Do not fail for custom breakpoints, to account for
1375 // future changes in cdp vs stale breakpoints saved in the workspace.
1376 const newIds = new Set<string>();
1377 for (const x of xhr) {
1378 newIds.add(CustomBreakpointPrefix.XHR + x);
1379 }
1380 for (const e of events) {
1381 newIds.add(CustomBreakpointPrefix.Event + e);
1382 }
1383 const todo: (Promise<unknown> | undefined)[] = [];
1384
1385 for (const newId of newIds) {
1386 if (!this._enabledCustomBreakpoints.has(newId)) {
1387 const id = newId.slice(CustomBreakpointPrefix.XHR.length);
1388 todo.push(
1389 newId.startsWith(CustomBreakpointPrefix.XHR)
1390 ? this._cdp.DOMDebugger.setXHRBreakpoint({ url: id })
1391 : customBreakpoints().get(id)?.apply(this._cdp, true),
1392 );
1393 }
1394 }
1395 for (const oldId of this._enabledCustomBreakpoints) {
1396 if (!newIds.has(oldId)) {
1397 const id = oldId.slice(CustomBreakpointPrefix.XHR.length);
1398 todo.push(
1399 oldId.startsWith(CustomBreakpointPrefix.XHR)
1400 ? this._cdp.DOMDebugger.removeXHRBreakpoint({ url: id })
1401 : customBreakpoints().get(id)?.apply(this._cdp, false),
1402 );
1403 }
1404 }
1405
1406 this._enabledCustomBreakpoints = newIds;
1407 await Promise.all(todo);
1408 }
1409
1410 private async _createPausedDetails(event: Cdp.Debugger.PausedEvent): Promise<IPausedDetails> {
1411 // When hitting breakpoint in compiled source, we ignore source maps during the stepping

Callers 2

createThreadMethod · 0.80
setCustomBreakpointsMethod · 0.80

Calls 10

customBreakpointsFunction · 0.90
setXHRBreakpointMethod · 0.80
allMethod · 0.80
addMethod · 0.65
hasMethod · 0.65
pushMethod · 0.65
applyMethod · 0.65
getMethod · 0.65
removeXHRBreakpointMethod · 0.65

Tested by

no test coverage detected