chrome-devtools-frontend 1.0.930109 → 1.0.930993
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/config/gni/devtools_grd_files.gni +2 -1
- package/front_end/core/host/InspectorFrontendHost.ts +8 -1
- package/front_end/core/host/InspectorFrontendHostAPI.ts +12 -0
- package/front_end/core/i18n/locales/en-US.json +3 -0
- package/front_end/core/i18n/locales/en-XL.json +3 -0
- package/front_end/core/protocol_client/InspectorBackend.ts +71 -71
- package/front_end/core/sdk/NetworkManager.ts +6 -2
- package/front_end/devtools_compatibility.js +8 -0
- package/front_end/legacy_test_runner/sources_test_runner/DebuggerTestRunner.js +2 -2
- package/front_end/legacy_test_runner/test_runner/TestRunner.js +2 -3
- package/front_end/models/bindings/BreakpointManager.ts +158 -154
- package/front_end/models/bindings/CSSWorkspaceBinding.ts +64 -56
- package/front_end/models/bindings/CompilerScriptMapping.ts +70 -70
- package/front_end/models/bindings/ContentProviderBasedProject.ts +20 -20
- package/front_end/models/bindings/DebuggerLanguagePlugins.ts +132 -132
- package/front_end/models/bindings/DebuggerWorkspaceBinding.ts +73 -72
- package/front_end/models/bindings/DefaultScriptMapping.ts +22 -22
- package/front_end/models/bindings/FileUtils.ts +81 -81
- package/front_end/models/bindings/IgnoreListManager.ts +17 -17
- package/front_end/models/bindings/LiveLocation.ts +21 -21
- package/front_end/models/bindings/PresentationConsoleMessageHelper.ts +28 -28
- package/front_end/models/bindings/ResourceMapping.ts +50 -50
- package/front_end/models/bindings/ResourceScriptMapping.ts +71 -71
- package/front_end/models/bindings/SASSSourceMapping.ts +32 -32
- package/front_end/models/bindings/StylesSourceMapping.ts +57 -57
- package/front_end/models/bindings/TempFile.ts +34 -34
- package/front_end/models/emulation/DeviceModeModel.ts +208 -203
- package/front_end/models/emulation/EmulatedDevices.ts +34 -34
- package/front_end/panels/console/ConsoleView.ts +2 -1
- package/front_end/panels/console/ConsoleViewMessage.ts +3 -3
- package/front_end/panels/css_overview/CSSOverviewCompletedView.ts +133 -133
- package/front_end/panels/css_overview/CSSOverviewModel.ts +16 -16
- package/front_end/panels/css_overview/CSSOverviewPanel.ts +77 -77
- package/front_end/panels/css_overview/CSSOverviewProcessingView.ts +5 -5
- package/front_end/panels/css_overview/components/CSSOverviewStartView.ts +4 -4
- package/front_end/panels/elements/ElementsTreeElement.ts +6 -10
- package/front_end/panels/elements/ElementsTreeOutline.ts +3 -1
- package/front_end/panels/elements/components/LayoutPane.ts +6 -0
- package/front_end/panels/elements/elementsPanel.css +0 -1
- package/front_end/panels/elements/elementsTreeOutline.css +0 -4
- package/front_end/panels/lighthouse/LighthouseProtocolService.ts +7 -2
- package/front_end/panels/network/BlockedURLsPane.ts +8 -5
- package/front_end/panels/network/blockedURLsPane.css +0 -1
- package/front_end/panels/search/SearchView.ts +0 -2
- package/front_end/panels/sources/BreakpointEditDialog.ts +98 -81
- package/front_end/panels/sources/DebuggerPlugin.ts +15 -14
- package/front_end/ui/components/code_highlighter/CodeHighlighter.ts +18 -2
- package/front_end/ui/components/text_editor/config.ts +6 -0
- package/front_end/ui/components/text_editor/cursor_tooltip.ts +70 -0
- package/front_end/ui/components/text_editor/javascript.ts +590 -0
- package/front_end/ui/components/text_editor/text_editor.ts +1 -0
- package/front_end/ui/components/text_editor/theme.ts +11 -0
- package/front_end/ui/components/tree_outline/TreeOutline.ts +3 -1
- package/front_end/ui/legacy/ARIAUtils.ts +24 -8
- package/front_end/ui/legacy/components/text_editor/cmdevtools.css +1 -0
- package/front_end/ui/legacy/components/text_editor/text_editor-legacy.ts +0 -3
- package/front_end/ui/legacy/components/text_editor/text_editor.ts +0 -2
- package/package.json +1 -1
- package/scripts/migration/class-fields/migrate.js +15 -2
- package/scripts/migration/class-fields/migrate.sh +10 -0
- package/front_end/ui/legacy/components/text_editor/SyntaxHighlighter.ts +0 -62
|
@@ -22,23 +22,23 @@ let debuggerWorkspaceBindingInstance: DebuggerWorkspaceBinding|undefined;
|
|
|
22
22
|
|
|
23
23
|
export class DebuggerWorkspaceBinding implements SDK.TargetManager.SDKModelObserver<SDK.DebuggerModel.DebuggerModel> {
|
|
24
24
|
readonly workspace: Workspace.Workspace.WorkspaceImpl;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
readonly #sourceMappings: DebuggerSourceMapping[];
|
|
26
|
+
readonly #debuggerModelToData: Map<SDK.DebuggerModel.DebuggerModel, ModelData>;
|
|
27
|
+
readonly #liveLocationPromises: Set<Promise<void|Location|StackTraceTopFrameLocation|null>>;
|
|
28
28
|
pluginManager: DebuggerLanguagePluginManager|null;
|
|
29
29
|
private constructor(targetManager: SDK.TargetManager.TargetManager, workspace: Workspace.Workspace.WorkspaceImpl) {
|
|
30
30
|
this.workspace = workspace;
|
|
31
31
|
|
|
32
|
-
this
|
|
32
|
+
this.#sourceMappings = [];
|
|
33
33
|
|
|
34
|
-
this
|
|
34
|
+
this.#debuggerModelToData = new Map();
|
|
35
35
|
targetManager.addModelListener(
|
|
36
36
|
SDK.DebuggerModel.DebuggerModel, SDK.DebuggerModel.Events.GlobalObjectCleared, this.globalObjectCleared, this);
|
|
37
37
|
targetManager.addModelListener(
|
|
38
38
|
SDK.DebuggerModel.DebuggerModel, SDK.DebuggerModel.Events.DebuggerResumed, this.debuggerResumed, this);
|
|
39
39
|
targetManager.observeModels(SDK.DebuggerModel.DebuggerModel, this);
|
|
40
40
|
|
|
41
|
-
this
|
|
41
|
+
this.#liveLocationPromises = new Set();
|
|
42
42
|
|
|
43
43
|
this.pluginManager = Root.Runtime.experiments.isEnabled('wasmDWARFDebugging') ?
|
|
44
44
|
new DebuggerLanguagePluginManager(targetManager, workspace, this) :
|
|
@@ -68,7 +68,7 @@ export class DebuggerWorkspaceBinding implements SDK.TargetManager.SDKModelObser
|
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
addSourceMapping(sourceMapping: DebuggerSourceMapping): void {
|
|
71
|
-
this
|
|
71
|
+
this.#sourceMappings.push(sourceMapping);
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
private async computeAutoStepRanges(mode: SDK.DebuggerModel.StepMode, callFrame: SDK.DebuggerModel.CallFrame):
|
|
@@ -116,7 +116,7 @@ export class DebuggerWorkspaceBinding implements SDK.TargetManager.SDKModelObser
|
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
-
const compilerMapping = this
|
|
119
|
+
const compilerMapping = this.#debuggerModelToData.get(rawLocation.debuggerModel)?.compilerMapping;
|
|
120
120
|
if (!compilerMapping) {
|
|
121
121
|
return [];
|
|
122
122
|
}
|
|
@@ -126,16 +126,16 @@ export class DebuggerWorkspaceBinding implements SDK.TargetManager.SDKModelObser
|
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
modelAdded(debuggerModel: SDK.DebuggerModel.DebuggerModel): void {
|
|
129
|
-
this
|
|
129
|
+
this.#debuggerModelToData.set(debuggerModel, new ModelData(debuggerModel, this));
|
|
130
130
|
debuggerModel.setComputeAutoStepRangesCallback(this.computeAutoStepRanges.bind(this));
|
|
131
131
|
}
|
|
132
132
|
|
|
133
133
|
modelRemoved(debuggerModel: SDK.DebuggerModel.DebuggerModel): void {
|
|
134
134
|
debuggerModel.setComputeAutoStepRangesCallback(null);
|
|
135
|
-
const modelData = this
|
|
135
|
+
const modelData = this.#debuggerModelToData.get(debuggerModel);
|
|
136
136
|
if (modelData) {
|
|
137
137
|
modelData.dispose();
|
|
138
|
-
this
|
|
138
|
+
this.#debuggerModelToData.delete(debuggerModel);
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
141
|
|
|
@@ -144,18 +144,18 @@ export class DebuggerWorkspaceBinding implements SDK.TargetManager.SDKModelObser
|
|
|
144
144
|
* pending LiveLocations are processed.
|
|
145
145
|
*/
|
|
146
146
|
async pendingLiveLocationChangesPromise(): Promise<void|Location|StackTraceTopFrameLocation|null> {
|
|
147
|
-
await Promise.all(this
|
|
147
|
+
await Promise.all(this.#liveLocationPromises);
|
|
148
148
|
}
|
|
149
149
|
|
|
150
150
|
private recordLiveLocationChange(promise: Promise<void|Location|StackTraceTopFrameLocation|null>): void {
|
|
151
151
|
promise.then(() => {
|
|
152
|
-
this
|
|
152
|
+
this.#liveLocationPromises.delete(promise);
|
|
153
153
|
});
|
|
154
|
-
this
|
|
154
|
+
this.#liveLocationPromises.add(promise);
|
|
155
155
|
}
|
|
156
156
|
|
|
157
157
|
async updateLocations(script: SDK.Script.Script): Promise<void> {
|
|
158
|
-
const modelData = this
|
|
158
|
+
const modelData = this.#debuggerModelToData.get(script.debuggerModel);
|
|
159
159
|
if (modelData) {
|
|
160
160
|
const updatePromise = modelData.updateLocations(script);
|
|
161
161
|
this.recordLiveLocationChange(updatePromise);
|
|
@@ -166,7 +166,7 @@ export class DebuggerWorkspaceBinding implements SDK.TargetManager.SDKModelObser
|
|
|
166
166
|
async createLiveLocation(
|
|
167
167
|
rawLocation: SDK.DebuggerModel.Location, updateDelegate: (arg0: LiveLocation) => Promise<void>,
|
|
168
168
|
locationPool: LiveLocationPool): Promise<Location|null> {
|
|
169
|
-
const modelData = this
|
|
169
|
+
const modelData = this.#debuggerModelToData.get(rawLocation.debuggerModel);
|
|
170
170
|
if (!modelData) {
|
|
171
171
|
return null;
|
|
172
172
|
}
|
|
@@ -205,7 +205,7 @@ export class DebuggerWorkspaceBinding implements SDK.TargetManager.SDKModelObser
|
|
|
205
205
|
|
|
206
206
|
async rawLocationToUILocation(rawLocation: SDK.DebuggerModel.Location):
|
|
207
207
|
Promise<Workspace.UISourceCode.UILocation|null> {
|
|
208
|
-
for (const sourceMapping of this
|
|
208
|
+
for (const sourceMapping of this.#sourceMappings) {
|
|
209
209
|
const uiLocation = sourceMapping.rawLocationToUILocation(rawLocation);
|
|
210
210
|
if (uiLocation) {
|
|
211
211
|
return uiLocation;
|
|
@@ -217,14 +217,14 @@ export class DebuggerWorkspaceBinding implements SDK.TargetManager.SDKModelObser
|
|
|
217
217
|
return uiLocation;
|
|
218
218
|
}
|
|
219
219
|
}
|
|
220
|
-
const modelData = this
|
|
220
|
+
const modelData = this.#debuggerModelToData.get(rawLocation.debuggerModel);
|
|
221
221
|
return modelData ? modelData.rawLocationToUILocation(rawLocation) : null;
|
|
222
222
|
}
|
|
223
223
|
|
|
224
224
|
uiSourceCodeForSourceMapSourceURL(
|
|
225
225
|
debuggerModel: SDK.DebuggerModel.DebuggerModel, url: string,
|
|
226
226
|
isContentScript: boolean): Workspace.UISourceCode.UISourceCode|null {
|
|
227
|
-
const modelData = this
|
|
227
|
+
const modelData = this.#debuggerModelToData.get(debuggerModel);
|
|
228
228
|
if (!modelData) {
|
|
229
229
|
return null;
|
|
230
230
|
}
|
|
@@ -234,7 +234,7 @@ export class DebuggerWorkspaceBinding implements SDK.TargetManager.SDKModelObser
|
|
|
234
234
|
async uiLocationToRawLocations(
|
|
235
235
|
uiSourceCode: Workspace.UISourceCode.UISourceCode, lineNumber: number,
|
|
236
236
|
columnNumber?: number): Promise<SDK.DebuggerModel.Location[]> {
|
|
237
|
-
for (const sourceMapping of this
|
|
237
|
+
for (const sourceMapping of this.#sourceMappings) {
|
|
238
238
|
const locations = sourceMapping.uiLocationToRawLocations(uiSourceCode, lineNumber, columnNumber);
|
|
239
239
|
if (locations.length) {
|
|
240
240
|
return locations;
|
|
@@ -244,7 +244,7 @@ export class DebuggerWorkspaceBinding implements SDK.TargetManager.SDKModelObser
|
|
|
244
244
|
if (locations) {
|
|
245
245
|
return locations;
|
|
246
246
|
}
|
|
247
|
-
for (const modelData of this
|
|
247
|
+
for (const modelData of this.#debuggerModelToData.values()) {
|
|
248
248
|
const locations = modelData.uiLocationToRawLocations(uiSourceCode, lineNumber, columnNumber);
|
|
249
249
|
if (locations.length) {
|
|
250
250
|
return locations;
|
|
@@ -258,7 +258,7 @@ export class DebuggerWorkspaceBinding implements SDK.TargetManager.SDKModelObser
|
|
|
258
258
|
columnNumber: number): SDK.DebuggerModel.Location[] {
|
|
259
259
|
console.assert(uiSourceCode.contentType().isScript());
|
|
260
260
|
const locations = [];
|
|
261
|
-
for (const modelData of this
|
|
261
|
+
for (const modelData of this.#debuggerModelToData.values()) {
|
|
262
262
|
locations.push(...modelData.uiLocationToRawLocations(uiSourceCode, lineNumber, columnNumber));
|
|
263
263
|
}
|
|
264
264
|
return locations;
|
|
@@ -278,7 +278,7 @@ export class DebuggerWorkspaceBinding implements SDK.TargetManager.SDKModelObser
|
|
|
278
278
|
|
|
279
279
|
scriptFile(uiSourceCode: Workspace.UISourceCode.UISourceCode, debuggerModel: SDK.DebuggerModel.DebuggerModel):
|
|
280
280
|
ResourceScriptFile|null {
|
|
281
|
-
const modelData = this
|
|
281
|
+
const modelData = this.#debuggerModelToData.get(debuggerModel);
|
|
282
282
|
return modelData ? modelData.getResourceMapping().scriptFile(uiSourceCode) : null;
|
|
283
283
|
}
|
|
284
284
|
|
|
@@ -287,7 +287,7 @@ export class DebuggerWorkspaceBinding implements SDK.TargetManager.SDKModelObser
|
|
|
287
287
|
if (this.pluginManager) {
|
|
288
288
|
this.pluginManager.scriptsForUISourceCode(uiSourceCode).forEach(script => scripts.add(script));
|
|
289
289
|
}
|
|
290
|
-
for (const modelData of this
|
|
290
|
+
for (const modelData of this.#debuggerModelToData.values()) {
|
|
291
291
|
const resourceScriptFile = modelData.getResourceMapping().scriptFile(uiSourceCode);
|
|
292
292
|
if (resourceScriptFile && resourceScriptFile.script) {
|
|
293
293
|
scripts.add(resourceScriptFile.script);
|
|
@@ -299,7 +299,7 @@ export class DebuggerWorkspaceBinding implements SDK.TargetManager.SDKModelObser
|
|
|
299
299
|
|
|
300
300
|
scriptsForResource(uiSourceCode: Workspace.UISourceCode.UISourceCode): SDK.Script.Script[] {
|
|
301
301
|
const scripts = new Set<SDK.Script.Script>();
|
|
302
|
-
for (const modelData of this
|
|
302
|
+
for (const modelData of this.#debuggerModelToData.values()) {
|
|
303
303
|
const resourceScriptFile = modelData.getResourceMapping().scriptFile(uiSourceCode);
|
|
304
304
|
if (resourceScriptFile && resourceScriptFile.script) {
|
|
305
305
|
scripts.add(resourceScriptFile.script);
|
|
@@ -319,7 +319,7 @@ export class DebuggerWorkspaceBinding implements SDK.TargetManager.SDKModelObser
|
|
|
319
319
|
}
|
|
320
320
|
|
|
321
321
|
sourceMapForScript(script: SDK.Script.Script): SDK.SourceMap.SourceMap|null {
|
|
322
|
-
const modelData = this
|
|
322
|
+
const modelData = this.#debuggerModelToData.get(script.debuggerModel);
|
|
323
323
|
if (!modelData) {
|
|
324
324
|
return null;
|
|
325
325
|
}
|
|
@@ -331,7 +331,7 @@ export class DebuggerWorkspaceBinding implements SDK.TargetManager.SDKModelObser
|
|
|
331
331
|
}
|
|
332
332
|
|
|
333
333
|
private reset(debuggerModel: SDK.DebuggerModel.DebuggerModel): void {
|
|
334
|
-
const modelData = this
|
|
334
|
+
const modelData = this.#debuggerModelToData.get(debuggerModel);
|
|
335
335
|
if (!modelData) {
|
|
336
336
|
return;
|
|
337
337
|
}
|
|
@@ -343,14 +343,14 @@ export class DebuggerWorkspaceBinding implements SDK.TargetManager.SDKModelObser
|
|
|
343
343
|
|
|
344
344
|
private resetForTest(target: SDK.Target.Target): void {
|
|
345
345
|
const debuggerModel = (target.model(SDK.DebuggerModel.DebuggerModel) as SDK.DebuggerModel.DebuggerModel);
|
|
346
|
-
const modelData = this
|
|
346
|
+
const modelData = this.#debuggerModelToData.get(debuggerModel);
|
|
347
347
|
if (modelData) {
|
|
348
348
|
modelData.getResourceMapping().resetForTest();
|
|
349
349
|
}
|
|
350
350
|
}
|
|
351
351
|
|
|
352
352
|
private registerCallFrameLiveLocation(debuggerModel: SDK.DebuggerModel.DebuggerModel, location: Location): void {
|
|
353
|
-
const modelData = this
|
|
353
|
+
const modelData = this.#debuggerModelToData.get(debuggerModel);
|
|
354
354
|
if (modelData) {
|
|
355
355
|
const locations = modelData.callFrameLocations;
|
|
356
356
|
locations.add(location);
|
|
@@ -358,7 +358,7 @@ export class DebuggerWorkspaceBinding implements SDK.TargetManager.SDKModelObser
|
|
|
358
358
|
}
|
|
359
359
|
|
|
360
360
|
removeLiveLocation(location: Location): void {
|
|
361
|
-
const modelData = this
|
|
361
|
+
const modelData = this.#debuggerModelToData.get(location.rawLocation.debuggerModel);
|
|
362
362
|
if (modelData) {
|
|
363
363
|
modelData.disposeLocation(location);
|
|
364
364
|
}
|
|
@@ -370,25 +370,25 @@ export class DebuggerWorkspaceBinding implements SDK.TargetManager.SDKModelObser
|
|
|
370
370
|
}
|
|
371
371
|
|
|
372
372
|
class ModelData {
|
|
373
|
-
|
|
374
|
-
|
|
373
|
+
readonly #debuggerModel: SDK.DebuggerModel.DebuggerModel;
|
|
374
|
+
readonly #debuggerWorkspaceBinding: DebuggerWorkspaceBinding;
|
|
375
375
|
callFrameLocations: Set<Location>;
|
|
376
|
-
|
|
376
|
+
#defaultMapping: DefaultScriptMapping;
|
|
377
377
|
resourceMapping: ResourceScriptMapping;
|
|
378
378
|
readonly compilerMapping: CompilerScriptMapping;
|
|
379
|
-
|
|
379
|
+
readonly #locations: Platform.MapUtilities.Multimap<string, Location>;
|
|
380
380
|
constructor(debuggerModel: SDK.DebuggerModel.DebuggerModel, debuggerWorkspaceBinding: DebuggerWorkspaceBinding) {
|
|
381
|
-
this
|
|
382
|
-
this
|
|
381
|
+
this.#debuggerModel = debuggerModel;
|
|
382
|
+
this.#debuggerWorkspaceBinding = debuggerWorkspaceBinding;
|
|
383
383
|
|
|
384
384
|
this.callFrameLocations = new Set();
|
|
385
385
|
|
|
386
386
|
const workspace = debuggerWorkspaceBinding.workspace;
|
|
387
|
-
this
|
|
387
|
+
this.#defaultMapping = new DefaultScriptMapping(debuggerModel, workspace, debuggerWorkspaceBinding);
|
|
388
388
|
this.resourceMapping = new ResourceScriptMapping(debuggerModel, workspace, debuggerWorkspaceBinding);
|
|
389
389
|
this.compilerMapping = new CompilerScriptMapping(debuggerModel, workspace, debuggerWorkspaceBinding);
|
|
390
390
|
|
|
391
|
-
this
|
|
391
|
+
this.#locations = new Platform.MapUtilities.Multimap();
|
|
392
392
|
|
|
393
393
|
debuggerModel.setBeforePausedCallback(this.beforePaused.bind(this));
|
|
394
394
|
}
|
|
@@ -398,19 +398,19 @@ class ModelData {
|
|
|
398
398
|
locationPool: LiveLocationPool): Promise<Location> {
|
|
399
399
|
console.assert(rawLocation.scriptId !== '');
|
|
400
400
|
const scriptId = rawLocation.scriptId;
|
|
401
|
-
const location = new Location(scriptId, rawLocation, this
|
|
402
|
-
this
|
|
401
|
+
const location = new Location(scriptId, rawLocation, this.#debuggerWorkspaceBinding, updateDelegate, locationPool);
|
|
402
|
+
this.#locations.set(scriptId, location);
|
|
403
403
|
await location.update();
|
|
404
404
|
return location;
|
|
405
405
|
}
|
|
406
406
|
|
|
407
407
|
disposeLocation(location: Location): void {
|
|
408
|
-
this
|
|
408
|
+
this.#locations.delete(location.scriptId, location);
|
|
409
409
|
}
|
|
410
410
|
|
|
411
411
|
async updateLocations(script: SDK.Script.Script): Promise<void> {
|
|
412
412
|
const promises = [];
|
|
413
|
-
for (const location of this
|
|
413
|
+
for (const location of this.#locations.get(script.scriptId)) {
|
|
414
414
|
promises.push(location.update());
|
|
415
415
|
}
|
|
416
416
|
await Promise.all(promises);
|
|
@@ -420,14 +420,14 @@ class ModelData {
|
|
|
420
420
|
let uiLocation = this.compilerMapping.rawLocationToUILocation(rawLocation);
|
|
421
421
|
uiLocation = uiLocation || this.resourceMapping.rawLocationToUILocation(rawLocation);
|
|
422
422
|
uiLocation = uiLocation || ResourceMapping.instance().jsLocationToUILocation(rawLocation);
|
|
423
|
-
uiLocation = uiLocation || this
|
|
423
|
+
uiLocation = uiLocation || this.#defaultMapping.rawLocationToUILocation(rawLocation);
|
|
424
424
|
return /** @type {!Workspace.UISourceCode.UILocation} */ uiLocation as Workspace.UISourceCode.UILocation;
|
|
425
425
|
}
|
|
426
426
|
|
|
427
427
|
uiLocationToRawLocations(
|
|
428
428
|
uiSourceCode: Workspace.UISourceCode.UISourceCode, lineNumber: number,
|
|
429
429
|
columnNumber: number|undefined = 0): SDK.DebuggerModel.Location[] {
|
|
430
|
-
// TODO(crbug.com/1153123): Revisit the
|
|
430
|
+
// TODO(crbug.com/1153123): Revisit the `#columnNumber = 0` and also preserve `undefined` for source maps?
|
|
431
431
|
let locations = this.compilerMapping.uiLocationToRawLocations(uiSourceCode, lineNumber, columnNumber);
|
|
432
432
|
locations = locations.length ?
|
|
433
433
|
locations :
|
|
@@ -435,8 +435,9 @@ class ModelData {
|
|
|
435
435
|
locations = locations.length ?
|
|
436
436
|
locations :
|
|
437
437
|
ResourceMapping.instance().uiLocationToJSLocations(uiSourceCode, lineNumber, columnNumber);
|
|
438
|
-
locations = locations.length ?
|
|
439
|
-
|
|
438
|
+
locations = locations.length ?
|
|
439
|
+
locations :
|
|
440
|
+
this.#defaultMapping.uiLocationToRawLocations(uiSourceCode, lineNumber, columnNumber);
|
|
440
441
|
return locations;
|
|
441
442
|
}
|
|
442
443
|
|
|
@@ -445,10 +446,10 @@ class ModelData {
|
|
|
445
446
|
}
|
|
446
447
|
|
|
447
448
|
dispose(): void {
|
|
448
|
-
this
|
|
449
|
+
this.#debuggerModel.setBeforePausedCallback(null);
|
|
449
450
|
this.compilerMapping.dispose();
|
|
450
451
|
this.resourceMapping.dispose();
|
|
451
|
-
this
|
|
452
|
+
this.#defaultMapping.dispose();
|
|
452
453
|
}
|
|
453
454
|
|
|
454
455
|
getResourceMapping(): ResourceScriptMapping {
|
|
@@ -459,7 +460,7 @@ class ModelData {
|
|
|
459
460
|
export class Location extends LiveLocationWithPool {
|
|
460
461
|
readonly scriptId: string;
|
|
461
462
|
readonly rawLocation: SDK.DebuggerModel.Location;
|
|
462
|
-
|
|
463
|
+
readonly #binding: DebuggerWorkspaceBinding;
|
|
463
464
|
|
|
464
465
|
constructor(
|
|
465
466
|
scriptId: string, rawLocation: SDK.DebuggerModel.Location, binding: DebuggerWorkspaceBinding,
|
|
@@ -467,17 +468,17 @@ export class Location extends LiveLocationWithPool {
|
|
|
467
468
|
super(updateDelegate, locationPool);
|
|
468
469
|
this.scriptId = scriptId;
|
|
469
470
|
this.rawLocation = rawLocation;
|
|
470
|
-
this
|
|
471
|
+
this.#binding = binding;
|
|
471
472
|
}
|
|
472
473
|
|
|
473
474
|
async uiLocation(): Promise<Workspace.UISourceCode.UILocation|null> {
|
|
474
475
|
const debuggerModelLocation = this.rawLocation;
|
|
475
|
-
return this
|
|
476
|
+
return this.#binding.rawLocationToUILocation(debuggerModelLocation);
|
|
476
477
|
}
|
|
477
478
|
|
|
478
479
|
dispose(): void {
|
|
479
480
|
super.dispose();
|
|
480
|
-
this
|
|
481
|
+
this.#binding.removeLiveLocation(this);
|
|
481
482
|
}
|
|
482
483
|
|
|
483
484
|
async isIgnoreListed(): Promise<boolean> {
|
|
@@ -487,14 +488,14 @@ export class Location extends LiveLocationWithPool {
|
|
|
487
488
|
}
|
|
488
489
|
|
|
489
490
|
class StackTraceTopFrameLocation extends LiveLocationWithPool {
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
491
|
+
#updateScheduled: boolean;
|
|
492
|
+
#current: LiveLocation|null;
|
|
493
|
+
#locations: LiveLocation[]|null;
|
|
493
494
|
constructor(updateDelegate: (arg0: LiveLocation) => Promise<void>, locationPool: LiveLocationPool) {
|
|
494
495
|
super(updateDelegate, locationPool);
|
|
495
|
-
this
|
|
496
|
-
this
|
|
497
|
-
this
|
|
496
|
+
this.#updateScheduled = true;
|
|
497
|
+
this.#current = null;
|
|
498
|
+
this.#locations = null;
|
|
498
499
|
}
|
|
499
500
|
|
|
500
501
|
static async createStackTraceTopFrameLocation(
|
|
@@ -504,50 +505,50 @@ class StackTraceTopFrameLocation extends LiveLocationWithPool {
|
|
|
504
505
|
const location = new StackTraceTopFrameLocation(updateDelegate, locationPool);
|
|
505
506
|
const locationsPromises = rawLocations.map(
|
|
506
507
|
rawLocation => binding.createLiveLocation(rawLocation, location.scheduleUpdate.bind(location), locationPool));
|
|
507
|
-
location
|
|
508
|
+
location.#locations = ((await Promise.all(locationsPromises)).filter(l => Boolean(l)) as Location[]);
|
|
508
509
|
await location.updateLocation();
|
|
509
510
|
return location;
|
|
510
511
|
}
|
|
511
512
|
|
|
512
513
|
async uiLocation(): Promise<Workspace.UISourceCode.UILocation|null> {
|
|
513
|
-
return this
|
|
514
|
+
return this.#current ? this.#current.uiLocation() : null;
|
|
514
515
|
}
|
|
515
516
|
|
|
516
517
|
async isIgnoreListed(): Promise<boolean> {
|
|
517
|
-
return this
|
|
518
|
+
return this.#current ? this.#current.isIgnoreListed() : false;
|
|
518
519
|
}
|
|
519
520
|
|
|
520
521
|
dispose(): void {
|
|
521
522
|
super.dispose();
|
|
522
|
-
if (this
|
|
523
|
-
for (const location of this
|
|
523
|
+
if (this.#locations) {
|
|
524
|
+
for (const location of this.#locations) {
|
|
524
525
|
location.dispose();
|
|
525
526
|
}
|
|
526
527
|
}
|
|
527
|
-
this
|
|
528
|
-
this
|
|
528
|
+
this.#locations = null;
|
|
529
|
+
this.#current = null;
|
|
529
530
|
}
|
|
530
531
|
|
|
531
532
|
private async scheduleUpdate(): Promise<void> {
|
|
532
|
-
if (this
|
|
533
|
+
if (this.#updateScheduled) {
|
|
533
534
|
return;
|
|
534
535
|
}
|
|
535
|
-
this
|
|
536
|
+
this.#updateScheduled = true;
|
|
536
537
|
queueMicrotask(() => {
|
|
537
538
|
this.updateLocation();
|
|
538
539
|
});
|
|
539
540
|
}
|
|
540
541
|
|
|
541
542
|
private async updateLocation(): Promise<void> {
|
|
542
|
-
this
|
|
543
|
-
if (!this
|
|
543
|
+
this.#updateScheduled = false;
|
|
544
|
+
if (!this.#locations || this.#locations.length === 0) {
|
|
544
545
|
return;
|
|
545
546
|
}
|
|
546
547
|
|
|
547
|
-
this
|
|
548
|
-
for (const location of this
|
|
548
|
+
this.#current = this.#locations[0];
|
|
549
|
+
for (const location of this.#locations) {
|
|
549
550
|
if (!(await location.isIgnoreListed())) {
|
|
550
|
-
this
|
|
551
|
+
this.#current = location;
|
|
551
552
|
break;
|
|
552
553
|
}
|
|
553
554
|
}
|
|
@@ -39,26 +39,26 @@ const uiSourceCodeToScriptsMap = new WeakMap<Workspace.UISourceCode.UISourceCode
|
|
|
39
39
|
const scriptToUISourceCodeMap = new WeakMap<SDK.Script.Script, Workspace.UISourceCode.UISourceCode>();
|
|
40
40
|
|
|
41
41
|
export class DefaultScriptMapping implements DebuggerSourceMapping {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
42
|
+
readonly #debuggerModel: SDK.DebuggerModel.DebuggerModel;
|
|
43
|
+
readonly #debuggerWorkspaceBinding: DebuggerWorkspaceBinding;
|
|
44
|
+
readonly #project: ContentProviderBasedProject;
|
|
45
|
+
readonly #eventListeners: Common.EventTarget.EventDescriptor[];
|
|
46
|
+
readonly #uiSourceCodeToScriptsMap: WeakMap<Workspace.UISourceCode.UISourceCode, SDK.Script.Script>;
|
|
47
47
|
constructor(
|
|
48
48
|
debuggerModel: SDK.DebuggerModel.DebuggerModel, workspace: Workspace.Workspace.WorkspaceImpl,
|
|
49
49
|
debuggerWorkspaceBinding: DebuggerWorkspaceBinding) {
|
|
50
|
-
this
|
|
51
|
-
this
|
|
52
|
-
this
|
|
50
|
+
this.#debuggerModel = debuggerModel;
|
|
51
|
+
this.#debuggerWorkspaceBinding = debuggerWorkspaceBinding;
|
|
52
|
+
this.#project = new ContentProviderBasedProject(
|
|
53
53
|
workspace, 'debugger:' + debuggerModel.target().id(), Workspace.Workspace.projectTypes.Debugger, '',
|
|
54
54
|
true /* isServiceProject */);
|
|
55
|
-
this
|
|
55
|
+
this.#eventListeners = [
|
|
56
56
|
debuggerModel.addEventListener(SDK.DebuggerModel.Events.GlobalObjectCleared, this.debuggerReset, this),
|
|
57
57
|
debuggerModel.addEventListener(SDK.DebuggerModel.Events.ParsedScriptSource, this.parsedScriptSource, this),
|
|
58
58
|
debuggerModel.addEventListener(
|
|
59
59
|
SDK.DebuggerModel.Events.DiscardedAnonymousScriptSource, this.discardedScriptSource, this),
|
|
60
60
|
];
|
|
61
|
-
this
|
|
61
|
+
this.#uiSourceCodeToScriptsMap = new WeakMap();
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
static scriptForUISourceCode(uiSourceCode: Workspace.UISourceCode.UISourceCode): SDK.Script.Script|null {
|
|
@@ -85,15 +85,15 @@ export class DefaultScriptMapping implements DebuggerSourceMapping {
|
|
|
85
85
|
|
|
86
86
|
uiLocationToRawLocations(uiSourceCode: Workspace.UISourceCode.UISourceCode, lineNumber: number, columnNumber: number):
|
|
87
87
|
SDK.DebuggerModel.Location[] {
|
|
88
|
-
const script = this
|
|
88
|
+
const script = this.#uiSourceCodeToScriptsMap.get(uiSourceCode);
|
|
89
89
|
if (!script) {
|
|
90
90
|
return [];
|
|
91
91
|
}
|
|
92
92
|
if (script.isInlineScriptWithSourceURL()) {
|
|
93
|
-
return [this
|
|
93
|
+
return [this.#debuggerModel.createRawLocation(
|
|
94
94
|
script, lineNumber + script.lineOffset, lineNumber ? columnNumber : columnNumber + script.columnOffset)];
|
|
95
95
|
}
|
|
96
|
-
return [this
|
|
96
|
+
return [this.#debuggerModel.createRawLocation(script, lineNumber, columnNumber)];
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
private parsedScriptSource(event: Common.EventTarget.EventTargetEvent<SDK.Script.Script>): void {
|
|
@@ -101,8 +101,8 @@ export class DefaultScriptMapping implements DebuggerSourceMapping {
|
|
|
101
101
|
const name = Common.ParsedURL.ParsedURL.extractName(script.sourceURL);
|
|
102
102
|
const url = 'debugger:///VM' + script.scriptId + (name ? ' ' + name : '');
|
|
103
103
|
|
|
104
|
-
const uiSourceCode = this
|
|
105
|
-
this
|
|
104
|
+
const uiSourceCode = this.#project.createUISourceCode(url, Common.ResourceType.resourceTypes.Script);
|
|
105
|
+
this.#uiSourceCodeToScriptsMap.set(uiSourceCode, script);
|
|
106
106
|
const scriptSet = uiSourceCodeToScriptsMap.get(uiSourceCode);
|
|
107
107
|
if (!scriptSet) {
|
|
108
108
|
uiSourceCodeToScriptsMap.set(uiSourceCode, new Set([script]));
|
|
@@ -110,8 +110,8 @@ export class DefaultScriptMapping implements DebuggerSourceMapping {
|
|
|
110
110
|
scriptSet.add(script);
|
|
111
111
|
}
|
|
112
112
|
scriptToUISourceCodeMap.set(script, uiSourceCode);
|
|
113
|
-
this
|
|
114
|
-
this
|
|
113
|
+
this.#project.addUISourceCodeWithProvider(uiSourceCode, script, null, 'text/javascript');
|
|
114
|
+
this.#debuggerWorkspaceBinding.updateLocations(script);
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
private discardedScriptSource(event: Common.EventTarget.EventTargetEvent<SDK.Script.Script>): void {
|
|
@@ -121,7 +121,7 @@ export class DefaultScriptMapping implements DebuggerSourceMapping {
|
|
|
121
121
|
return;
|
|
122
122
|
}
|
|
123
123
|
scriptToUISourceCodeMap.delete(script);
|
|
124
|
-
this
|
|
124
|
+
this.#uiSourceCodeToScriptsMap.delete(uiSourceCode);
|
|
125
125
|
const scripts = uiSourceCodeToScriptsMap.get(uiSourceCode);
|
|
126
126
|
if (scripts) {
|
|
127
127
|
scripts.delete(script);
|
|
@@ -129,16 +129,16 @@ export class DefaultScriptMapping implements DebuggerSourceMapping {
|
|
|
129
129
|
uiSourceCodeToScriptsMap.delete(uiSourceCode);
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
|
-
this
|
|
132
|
+
this.#project.removeUISourceCode(uiSourceCode.url());
|
|
133
133
|
}
|
|
134
134
|
|
|
135
135
|
private debuggerReset(): void {
|
|
136
|
-
this
|
|
136
|
+
this.#project.reset();
|
|
137
137
|
}
|
|
138
138
|
|
|
139
139
|
dispose(): void {
|
|
140
|
-
Common.EventTarget.removeEventListeners(this
|
|
140
|
+
Common.EventTarget.removeEventListeners(this.#eventListeners);
|
|
141
141
|
this.debuggerReset();
|
|
142
|
-
this
|
|
142
|
+
this.#project.dispose();
|
|
143
143
|
}
|
|
144
144
|
}
|