()
| 1157 | } |
| 1158 | |
| 1159 | const createSource = async () => { |
| 1160 | const prevSource = event.url && event.hash && urlHashMap && urlHashMap.get(event.hash); |
| 1161 | if (prevSource) { |
| 1162 | prevSource.addScriptId(event.scriptId); |
| 1163 | return prevSource; |
| 1164 | } |
| 1165 | |
| 1166 | const contentGetter = async () => { |
| 1167 | const response = await this._cdp.Debugger.getScriptSource({ scriptId: event.scriptId }); |
| 1168 | return response ? response.scriptSource : undefined; |
| 1169 | }; |
| 1170 | const inlineSourceOffset = |
| 1171 | event.startLine || event.startColumn |
| 1172 | ? { lineOffset: event.startLine, columnOffset: event.startColumn } |
| 1173 | : undefined; |
| 1174 | let resolvedSourceMapUrl: string | undefined; |
| 1175 | if (event.sourceMapURL && this.launchConfig.sourceMaps) { |
| 1176 | // Note: we should in theory refetch source maps with relative urls, if the base url has changed, |
| 1177 | // but in practice that usually means new scripts with new source maps anyway. |
| 1178 | resolvedSourceMapUrl = urlUtils.isDataUri(event.sourceMapURL) |
| 1179 | ? event.sourceMapURL |
| 1180 | : event.url && urlUtils.completeUrl(event.url, event.sourceMapURL); |
| 1181 | if (!resolvedSourceMapUrl) { |
| 1182 | this._dap.with(dap => |
| 1183 | errors.reportToConsole(dap, `Could not load source map from ${event.sourceMapURL}`), |
| 1184 | ); |
| 1185 | } |
| 1186 | } |
| 1187 | |
| 1188 | const hash = this._delegate.shouldCheckContentHash() ? event.hash : undefined; |
| 1189 | const source = await this._sourceContainer.addSource( |
| 1190 | event.url, |
| 1191 | contentGetter, |
| 1192 | resolvedSourceMapUrl, |
| 1193 | inlineSourceOffset, |
| 1194 | hash, |
| 1195 | ); |
| 1196 | this._sourceContainer.scriptSkipper.initializeSkippingValueForSource(source, event.scriptId); |
| 1197 | // eslint-disable-next-line @typescript-eslint/no-non-null-assertion |
| 1198 | urlHashMap!.set(event.hash, source); |
| 1199 | source.addScriptId(event.scriptId); |
| 1200 | |
| 1201 | let scriptSet = this._sourceScripts.get(source); |
| 1202 | if (!scriptSet) { |
| 1203 | scriptSet = new Set(); |
| 1204 | this._sourceScripts.set(source, scriptSet); |
| 1205 | } |
| 1206 | scriptSet.add(script); |
| 1207 | |
| 1208 | return source; |
| 1209 | }; |
| 1210 | |
| 1211 | const script = { |
| 1212 | url: event.url, |
nothing calls this directly
no test coverage detected