MCPcopy Create free account
hub / github.com/Snapchat/Valdi / _handleSourceMapPause

Method _handleSourceMapPause

valdi/vscode_debugger/src/adapter/threads.ts:1231–1257  ·  view source on GitHub ↗

* Wait for source map to load and set all breakpoints in this particular * script. Returns true if the debugger should remain paused.

(scriptId: string, brokenOn: Cdp.Debugger.Location)

Source from the content-addressed store, hash-verified

1229 * script. Returns true if the debugger should remain paused.
1230 */
1231 async _handleSourceMapPause(scriptId: string, brokenOn: Cdp.Debugger.Location): Promise<boolean> {
1232 this._pausedForSourceMapScriptId = scriptId;
1233 const timeout = this._sourceContainer.sourceMapTimeouts().scriptPaused;
1234 const script = this._sourceContainer.scriptsById.get(scriptId);
1235 if (!script) {
1236 this._pausedForSourceMapScriptId = undefined;
1237 return false;
1238 }
1239
1240 const result = await Promise.race([
1241 this._getOrStartLoadingSourceMaps(script, brokenOn),
1242 delay(timeout),
1243 ]);
1244 console.assert(this._pausedForSourceMapScriptId === scriptId);
1245 this._pausedForSourceMapScriptId = undefined;
1246
1247 return (
1248 !!result &&
1249 result
1250 .map(base1To0)
1251 .some(
1252 b =>
1253 b.lineNumber === brokenOn.lineNumber &&
1254 (brokenOn.columnNumber === undefined || brokenOn.columnNumber === b.columnNumber),
1255 )
1256 );
1257 }
1258
1259 /**
1260 * Loads sourcemaps for the given script and invokes the handler, if we

Callers 1

_onPausedMethod · 0.95

Calls 6

delayFunction · 0.90
sourceMapTimeoutsMethod · 0.80
getMethod · 0.65
assertMethod · 0.65
mapMethod · 0.45

Tested by

no test coverage detected