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
|
@@ -16,19 +16,19 @@ import {StylesSourceMapping} from './StylesSourceMapping.js';
|
|
|
16
16
|
let cssWorkspaceBindingInstance: CSSWorkspaceBinding|undefined;
|
|
17
17
|
|
|
18
18
|
export class CSSWorkspaceBinding implements SDK.TargetManager.SDKModelObserver<SDK.CSSModel.CSSModel> {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
readonly #workspace: Workspace.Workspace.WorkspaceImpl;
|
|
20
|
+
readonly #modelToInfo: Map<SDK.CSSModel.CSSModel, ModelInfo>;
|
|
21
|
+
readonly #sourceMappings: SourceMapping[];
|
|
22
|
+
readonly #liveLocationPromises: Set<Promise<unknown>>;
|
|
23
23
|
|
|
24
24
|
private constructor(targetManager: SDK.TargetManager.TargetManager, workspace: Workspace.Workspace.WorkspaceImpl) {
|
|
25
|
-
this
|
|
25
|
+
this.#workspace = workspace;
|
|
26
26
|
|
|
27
|
-
this
|
|
28
|
-
this
|
|
27
|
+
this.#modelToInfo = new Map();
|
|
28
|
+
this.#sourceMappings = [];
|
|
29
29
|
targetManager.observeModels(SDK.CSSModel.CSSModel, this);
|
|
30
30
|
|
|
31
|
-
this
|
|
31
|
+
this.#liveLocationPromises = new Set();
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
static instance(opts: {
|
|
@@ -53,17 +53,21 @@ export class CSSWorkspaceBinding implements SDK.TargetManager.SDKModelObserver<S
|
|
|
53
53
|
cssWorkspaceBindingInstance = undefined;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
+
get modelToInfo(): Map<SDK.CSSModel.CSSModel, ModelInfo> {
|
|
57
|
+
return this.#modelToInfo;
|
|
58
|
+
}
|
|
59
|
+
|
|
56
60
|
private getCSSModelInfo(cssModel: SDK.CSSModel.CSSModel): ModelInfo {
|
|
57
|
-
return this
|
|
61
|
+
return this.#modelToInfo.get(cssModel) as ModelInfo;
|
|
58
62
|
}
|
|
59
63
|
|
|
60
64
|
modelAdded(cssModel: SDK.CSSModel.CSSModel): void {
|
|
61
|
-
this
|
|
65
|
+
this.#modelToInfo.set(cssModel, new ModelInfo(cssModel, this.#workspace));
|
|
62
66
|
}
|
|
63
67
|
|
|
64
68
|
modelRemoved(cssModel: SDK.CSSModel.CSSModel): void {
|
|
65
69
|
this.getCSSModelInfo(cssModel).dispose();
|
|
66
|
-
this
|
|
70
|
+
this.#modelToInfo.delete(cssModel);
|
|
67
71
|
}
|
|
68
72
|
|
|
69
73
|
/**
|
|
@@ -71,14 +75,14 @@ export class CSSWorkspaceBinding implements SDK.TargetManager.SDKModelObserver<S
|
|
|
71
75
|
* pending LiveLocations are processed.
|
|
72
76
|
*/
|
|
73
77
|
async pendingLiveLocationChangesPromise(): Promise<void> {
|
|
74
|
-
await Promise.all(this
|
|
78
|
+
await Promise.all(this.#liveLocationPromises);
|
|
75
79
|
}
|
|
76
80
|
|
|
77
81
|
private recordLiveLocationChange(promise: Promise<unknown>): void {
|
|
78
82
|
promise.then(() => {
|
|
79
|
-
this
|
|
83
|
+
this.#liveLocationPromises.delete(promise);
|
|
80
84
|
});
|
|
81
|
-
this
|
|
85
|
+
this.#liveLocationPromises.add(promise);
|
|
82
86
|
}
|
|
83
87
|
|
|
84
88
|
async updateLocations(header: SDK.CSSStyleSheetHeader.CSSStyleSheetHeader): Promise<void> {
|
|
@@ -120,8 +124,8 @@ export class CSSWorkspaceBinding implements SDK.TargetManager.SDKModelObserver<S
|
|
|
120
124
|
}
|
|
121
125
|
|
|
122
126
|
rawLocationToUILocation(rawLocation: SDK.CSSModel.CSSLocation): Workspace.UISourceCode.UILocation|null {
|
|
123
|
-
for (let i = this
|
|
124
|
-
const uiLocation = this
|
|
127
|
+
for (let i = this.#sourceMappings.length - 1; i >= 0; --i) {
|
|
128
|
+
const uiLocation = this.#sourceMappings[i].rawLocationToUILocation(rawLocation);
|
|
125
129
|
if (uiLocation) {
|
|
126
130
|
return uiLocation;
|
|
127
131
|
}
|
|
@@ -130,21 +134,21 @@ export class CSSWorkspaceBinding implements SDK.TargetManager.SDKModelObserver<S
|
|
|
130
134
|
}
|
|
131
135
|
|
|
132
136
|
uiLocationToRawLocations(uiLocation: Workspace.UISourceCode.UILocation): SDK.CSSModel.CSSLocation[] {
|
|
133
|
-
for (let i = this
|
|
134
|
-
const rawLocations = this
|
|
137
|
+
for (let i = this.#sourceMappings.length - 1; i >= 0; --i) {
|
|
138
|
+
const rawLocations = this.#sourceMappings[i].uiLocationToRawLocations(uiLocation);
|
|
135
139
|
if (rawLocations.length) {
|
|
136
140
|
return rawLocations;
|
|
137
141
|
}
|
|
138
142
|
}
|
|
139
143
|
const rawLocations = [];
|
|
140
|
-
for (const modelInfo of this
|
|
144
|
+
for (const modelInfo of this.#modelToInfo.values()) {
|
|
141
145
|
rawLocations.push(...modelInfo.uiLocationToRawLocations(uiLocation));
|
|
142
146
|
}
|
|
143
147
|
return rawLocations;
|
|
144
148
|
}
|
|
145
149
|
|
|
146
150
|
addSourceMapping(sourceMapping: SourceMapping): void {
|
|
147
|
-
this
|
|
151
|
+
this.#sourceMappings.push(sourceMapping);
|
|
148
152
|
}
|
|
149
153
|
}
|
|
150
154
|
|
|
@@ -158,13 +162,13 @@ export interface SourceMapping {
|
|
|
158
162
|
}
|
|
159
163
|
|
|
160
164
|
export class ModelInfo {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
165
|
+
readonly #eventListeners: Common.EventTarget.EventDescriptor[];
|
|
166
|
+
#stylesSourceMapping: StylesSourceMapping;
|
|
167
|
+
#sassSourceMapping: SASSSourceMapping;
|
|
168
|
+
readonly #locations: Platform.MapUtilities.Multimap<SDK.CSSStyleSheetHeader.CSSStyleSheetHeader, LiveLocation>;
|
|
169
|
+
readonly #unboundLocations: Platform.MapUtilities.Multimap<string, LiveLocation>;
|
|
166
170
|
constructor(cssModel: SDK.CSSModel.CSSModel, workspace: Workspace.Workspace.WorkspaceImpl) {
|
|
167
|
-
this
|
|
171
|
+
this.#eventListeners = [
|
|
168
172
|
cssModel.addEventListener(
|
|
169
173
|
SDK.CSSModel.Events.StyleSheetAdded,
|
|
170
174
|
event => {
|
|
@@ -179,12 +183,16 @@ export class ModelInfo {
|
|
|
179
183
|
this),
|
|
180
184
|
];
|
|
181
185
|
|
|
182
|
-
this
|
|
186
|
+
this.#stylesSourceMapping = new StylesSourceMapping(cssModel, workspace);
|
|
183
187
|
const sourceMapManager = cssModel.sourceMapManager();
|
|
184
|
-
this
|
|
188
|
+
this.#sassSourceMapping = new SASSSourceMapping(cssModel.target(), sourceMapManager, workspace);
|
|
189
|
+
|
|
190
|
+
this.#locations = new Platform.MapUtilities.Multimap();
|
|
191
|
+
this.#unboundLocations = new Platform.MapUtilities.Multimap();
|
|
192
|
+
}
|
|
185
193
|
|
|
186
|
-
|
|
187
|
-
this
|
|
194
|
+
get locations(): Platform.MapUtilities.Multimap<SDK.CSSStyleSheetHeader.CSSStyleSheetHeader, LiveLocation> {
|
|
195
|
+
return this.#locations;
|
|
188
196
|
}
|
|
189
197
|
|
|
190
198
|
async createLiveLocation(
|
|
@@ -194,10 +202,10 @@ export class ModelInfo {
|
|
|
194
202
|
const header = rawLocation.header();
|
|
195
203
|
if (header) {
|
|
196
204
|
location.setHeader(header);
|
|
197
|
-
this
|
|
205
|
+
this.#locations.set(header, location);
|
|
198
206
|
await location.update();
|
|
199
207
|
} else {
|
|
200
|
-
this
|
|
208
|
+
this.#unboundLocations.set(rawLocation.url, location);
|
|
201
209
|
}
|
|
202
210
|
return location;
|
|
203
211
|
}
|
|
@@ -205,15 +213,15 @@ export class ModelInfo {
|
|
|
205
213
|
disposeLocation(location: LiveLocation): void {
|
|
206
214
|
const header = location.header();
|
|
207
215
|
if (header) {
|
|
208
|
-
this
|
|
216
|
+
this.#locations.delete(header, location);
|
|
209
217
|
} else {
|
|
210
|
-
this
|
|
218
|
+
this.#unboundLocations.delete(location.url, location);
|
|
211
219
|
}
|
|
212
220
|
}
|
|
213
221
|
|
|
214
222
|
updateLocations(header: SDK.CSSStyleSheetHeader.CSSStyleSheetHeader): Promise<void[]> {
|
|
215
223
|
const promises = [];
|
|
216
|
-
for (const location of this
|
|
224
|
+
for (const location of this.#locations.get(header)) {
|
|
217
225
|
promises.push(location.update());
|
|
218
226
|
}
|
|
219
227
|
return Promise.all(promises);
|
|
@@ -227,42 +235,42 @@ export class ModelInfo {
|
|
|
227
235
|
}
|
|
228
236
|
|
|
229
237
|
const promises = [];
|
|
230
|
-
for (const location of this
|
|
238
|
+
for (const location of this.#unboundLocations.get(header.sourceURL)) {
|
|
231
239
|
location.setHeader(header);
|
|
232
|
-
this
|
|
240
|
+
this.#locations.set(header, location);
|
|
233
241
|
promises.push(location.update());
|
|
234
242
|
}
|
|
235
243
|
await Promise.all(promises);
|
|
236
|
-
this
|
|
244
|
+
this.#unboundLocations.deleteAll(header.sourceURL);
|
|
237
245
|
}
|
|
238
246
|
|
|
239
247
|
private async styleSheetRemoved(
|
|
240
248
|
event: Common.EventTarget.EventTargetEvent<SDK.CSSStyleSheetHeader.CSSStyleSheetHeader>): Promise<void> {
|
|
241
249
|
const header = event.data;
|
|
242
250
|
const promises = [];
|
|
243
|
-
for (const location of this
|
|
251
|
+
for (const location of this.#locations.get(header)) {
|
|
244
252
|
location.setHeader(header);
|
|
245
|
-
this
|
|
253
|
+
this.#unboundLocations.set(location.url, location);
|
|
246
254
|
promises.push(location.update());
|
|
247
255
|
}
|
|
248
256
|
await Promise.all(promises);
|
|
249
|
-
this
|
|
257
|
+
this.#locations.deleteAll(header);
|
|
250
258
|
}
|
|
251
259
|
|
|
252
260
|
rawLocationToUILocation(rawLocation: SDK.CSSModel.CSSLocation): Workspace.UISourceCode.UILocation|null {
|
|
253
261
|
let uiLocation: (Workspace.UISourceCode.UILocation|null)|null = null;
|
|
254
|
-
uiLocation = uiLocation || this
|
|
255
|
-
uiLocation = uiLocation || this
|
|
262
|
+
uiLocation = uiLocation || this.#sassSourceMapping.rawLocationToUILocation(rawLocation);
|
|
263
|
+
uiLocation = uiLocation || this.#stylesSourceMapping.rawLocationToUILocation(rawLocation);
|
|
256
264
|
uiLocation = uiLocation || ResourceMapping.instance().cssLocationToUILocation(rawLocation);
|
|
257
265
|
return uiLocation;
|
|
258
266
|
}
|
|
259
267
|
|
|
260
268
|
uiLocationToRawLocations(uiLocation: Workspace.UISourceCode.UILocation): SDK.CSSModel.CSSLocation[] {
|
|
261
|
-
let rawLocations = this
|
|
269
|
+
let rawLocations = this.#sassSourceMapping.uiLocationToRawLocations(uiLocation);
|
|
262
270
|
if (rawLocations.length) {
|
|
263
271
|
return rawLocations;
|
|
264
272
|
}
|
|
265
|
-
rawLocations = this
|
|
273
|
+
rawLocations = this.#stylesSourceMapping.uiLocationToRawLocations(uiLocation);
|
|
266
274
|
if (rawLocations.length) {
|
|
267
275
|
return rawLocations;
|
|
268
276
|
}
|
|
@@ -270,26 +278,26 @@ export class ModelInfo {
|
|
|
270
278
|
}
|
|
271
279
|
|
|
272
280
|
dispose(): void {
|
|
273
|
-
Common.EventTarget.removeEventListeners(this
|
|
274
|
-
this
|
|
275
|
-
this
|
|
281
|
+
Common.EventTarget.removeEventListeners(this.#eventListeners);
|
|
282
|
+
this.#stylesSourceMapping.dispose();
|
|
283
|
+
this.#sassSourceMapping.dispose();
|
|
276
284
|
}
|
|
277
285
|
}
|
|
278
286
|
|
|
279
287
|
export class LiveLocation extends LiveLocationWithPool {
|
|
280
288
|
readonly url: string;
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
289
|
+
readonly #lineNumber: number;
|
|
290
|
+
readonly #columnNumber: number;
|
|
291
|
+
readonly #info: ModelInfo;
|
|
284
292
|
headerInternal: SDK.CSSStyleSheetHeader.CSSStyleSheetHeader|null;
|
|
285
293
|
constructor(
|
|
286
294
|
rawLocation: SDK.CSSModel.CSSLocation, info: ModelInfo,
|
|
287
295
|
updateDelegate: (arg0: LiveLocationInterface) => Promise<void>, locationPool: LiveLocationPool) {
|
|
288
296
|
super(updateDelegate, locationPool);
|
|
289
297
|
this.url = rawLocation.url;
|
|
290
|
-
this
|
|
291
|
-
this
|
|
292
|
-
this
|
|
298
|
+
this.#lineNumber = rawLocation.lineNumber;
|
|
299
|
+
this.#columnNumber = rawLocation.columnNumber;
|
|
300
|
+
this.#info = info;
|
|
293
301
|
this.headerInternal = null;
|
|
294
302
|
}
|
|
295
303
|
|
|
@@ -305,13 +313,13 @@ export class LiveLocation extends LiveLocationWithPool {
|
|
|
305
313
|
if (!this.headerInternal) {
|
|
306
314
|
return null;
|
|
307
315
|
}
|
|
308
|
-
const rawLocation = new SDK.CSSModel.CSSLocation(this.headerInternal, this
|
|
316
|
+
const rawLocation = new SDK.CSSModel.CSSLocation(this.headerInternal, this.#lineNumber, this.#columnNumber);
|
|
309
317
|
return CSSWorkspaceBinding.instance().rawLocationToUILocation(rawLocation);
|
|
310
318
|
}
|
|
311
319
|
|
|
312
320
|
dispose(): void {
|
|
313
321
|
super.dispose();
|
|
314
|
-
this
|
|
322
|
+
this.#info.disposeLocation(this);
|
|
315
323
|
}
|
|
316
324
|
|
|
317
325
|
async isIgnoreListed(): Promise<boolean> {
|
|
@@ -40,53 +40,53 @@ import {IgnoreListManager} from './IgnoreListManager.js';
|
|
|
40
40
|
import {NetworkProject} from './NetworkProject.js';
|
|
41
41
|
|
|
42
42
|
export class CompilerScriptMapping implements DebuggerSourceMapping {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
43
|
+
readonly #debuggerModel: SDK.DebuggerModel.DebuggerModel;
|
|
44
|
+
readonly #sourceMapManager: SDK.SourceMapManager.SourceMapManager<SDK.Script.Script>;
|
|
45
|
+
readonly #workspace: Workspace.Workspace.WorkspaceImpl;
|
|
46
|
+
readonly #debuggerWorkspaceBinding: DebuggerWorkspaceBinding;
|
|
47
|
+
readonly #regularProject: ContentProviderBasedProject;
|
|
48
|
+
readonly #contentScriptsProject: ContentProviderBasedProject;
|
|
49
|
+
readonly #regularBindings: Map<string, Binding>;
|
|
50
|
+
readonly #contentScriptsBindings: Map<string, Binding>;
|
|
51
|
+
readonly #stubUISourceCodes: Map<SDK.Script.Script, Workspace.UISourceCode.UISourceCode>;
|
|
52
|
+
readonly #stubProject: ContentProviderBasedProject;
|
|
53
|
+
readonly #eventListeners: Common.EventTarget.EventDescriptor[];
|
|
54
54
|
constructor(
|
|
55
55
|
debuggerModel: SDK.DebuggerModel.DebuggerModel, workspace: Workspace.Workspace.WorkspaceImpl,
|
|
56
56
|
debuggerWorkspaceBinding: DebuggerWorkspaceBinding) {
|
|
57
|
-
this
|
|
58
|
-
this
|
|
59
|
-
this
|
|
60
|
-
this
|
|
57
|
+
this.#debuggerModel = debuggerModel;
|
|
58
|
+
this.#sourceMapManager = this.#debuggerModel.sourceMapManager();
|
|
59
|
+
this.#workspace = workspace;
|
|
60
|
+
this.#debuggerWorkspaceBinding = debuggerWorkspaceBinding;
|
|
61
61
|
|
|
62
62
|
const target = debuggerModel.target();
|
|
63
|
-
this
|
|
63
|
+
this.#regularProject = new ContentProviderBasedProject(
|
|
64
64
|
workspace, 'jsSourceMaps::' + target.id(), Workspace.Workspace.projectTypes.Network, '',
|
|
65
65
|
false /* isServiceProject */);
|
|
66
|
-
this
|
|
66
|
+
this.#contentScriptsProject = new ContentProviderBasedProject(
|
|
67
67
|
workspace, 'jsSourceMaps:extensions:' + target.id(), Workspace.Workspace.projectTypes.ContentScripts, '',
|
|
68
68
|
false /* isServiceProject */);
|
|
69
|
-
NetworkProject.setTargetForProject(this
|
|
70
|
-
NetworkProject.setTargetForProject(this
|
|
69
|
+
NetworkProject.setTargetForProject(this.#regularProject, target);
|
|
70
|
+
NetworkProject.setTargetForProject(this.#contentScriptsProject, target);
|
|
71
71
|
|
|
72
|
-
this
|
|
73
|
-
this
|
|
72
|
+
this.#regularBindings = new Map();
|
|
73
|
+
this.#contentScriptsBindings = new Map();
|
|
74
74
|
|
|
75
|
-
this
|
|
75
|
+
this.#stubUISourceCodes = new Map();
|
|
76
76
|
|
|
77
|
-
this
|
|
77
|
+
this.#stubProject = new ContentProviderBasedProject(
|
|
78
78
|
workspace, 'jsSourceMaps:stub:' + target.id(), Workspace.Workspace.projectTypes.Service, '',
|
|
79
79
|
true /* isServiceProject */);
|
|
80
|
-
this
|
|
81
|
-
this
|
|
80
|
+
this.#eventListeners = [
|
|
81
|
+
this.#sourceMapManager.addEventListener(
|
|
82
82
|
SDK.SourceMapManager.Events.SourceMapWillAttach, this.sourceMapWillAttach, this),
|
|
83
|
-
this
|
|
83
|
+
this.#sourceMapManager.addEventListener(
|
|
84
84
|
SDK.SourceMapManager.Events.SourceMapFailedToAttach, this.sourceMapFailedToAttach, this),
|
|
85
|
-
this
|
|
85
|
+
this.#sourceMapManager.addEventListener(
|
|
86
86
|
SDK.SourceMapManager.Events.SourceMapAttached, this.sourceMapAttached, this),
|
|
87
|
-
this
|
|
87
|
+
this.#sourceMapManager.addEventListener(
|
|
88
88
|
SDK.SourceMapManager.Events.SourceMapDetached, this.sourceMapDetached, this),
|
|
89
|
-
this
|
|
89
|
+
this.#workspace.addEventListener(
|
|
90
90
|
Workspace.Workspace.Events.UISourceCodeAdded,
|
|
91
91
|
event => {
|
|
92
92
|
this.onUiSourceCodeAdded(event);
|
|
@@ -98,29 +98,29 @@ export class CompilerScriptMapping implements DebuggerSourceMapping {
|
|
|
98
98
|
private onUiSourceCodeAdded(event: Common.EventTarget.EventTargetEvent<Workspace.UISourceCode.UISourceCode>): void {
|
|
99
99
|
const uiSourceCode = event.data;
|
|
100
100
|
if (uiSourceCode.contentType().isDocument()) {
|
|
101
|
-
for (const script of this
|
|
102
|
-
this
|
|
101
|
+
for (const script of this.#debuggerModel.scriptsForSourceURL(uiSourceCode.url())) {
|
|
102
|
+
this.#debuggerWorkspaceBinding.updateLocations(script);
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
private addStubUISourceCode(script: SDK.Script.Script): void {
|
|
108
|
-
const stubUISourceCode = this
|
|
108
|
+
const stubUISourceCode = this.#stubProject.addContentProvider(
|
|
109
109
|
script.sourceURL + ':sourcemap',
|
|
110
110
|
TextUtils.StaticContentProvider.StaticContentProvider.fromString(
|
|
111
111
|
script.sourceURL, Common.ResourceType.resourceTypes.Script,
|
|
112
112
|
'\n\n\n\n\n// Please wait a bit.\n// Compiled script is not shown while source map is being loaded!'),
|
|
113
113
|
'text/javascript');
|
|
114
|
-
this
|
|
114
|
+
this.#stubUISourceCodes.set(script, stubUISourceCode);
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
private async removeStubUISourceCode(script: SDK.Script.Script): Promise<void> {
|
|
118
|
-
const uiSourceCode = this
|
|
119
|
-
this
|
|
118
|
+
const uiSourceCode = this.#stubUISourceCodes.get(script);
|
|
119
|
+
this.#stubUISourceCodes.delete(script);
|
|
120
120
|
if (uiSourceCode) {
|
|
121
|
-
this
|
|
121
|
+
this.#stubProject.removeFile(uiSourceCode.url());
|
|
122
122
|
}
|
|
123
|
-
await this
|
|
123
|
+
await this.#debuggerWorkspaceBinding.updateLocations(script);
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
static uiSourceCodeOrigin(uiSourceCode: Workspace.UISourceCode.UISourceCode): string[] {
|
|
@@ -137,7 +137,7 @@ export class CompilerScriptMapping implements DebuggerSourceMapping {
|
|
|
137
137
|
if (!script) {
|
|
138
138
|
return [];
|
|
139
139
|
}
|
|
140
|
-
const sourceMap = this
|
|
140
|
+
const sourceMap = this.#sourceMapManager.sourceMapForClient(script);
|
|
141
141
|
if (!sourceMap) {
|
|
142
142
|
return [];
|
|
143
143
|
}
|
|
@@ -161,8 +161,8 @@ export class CompilerScriptMapping implements DebuggerSourceMapping {
|
|
|
161
161
|
}
|
|
162
162
|
|
|
163
163
|
uiSourceCodeForURL(url: string, isContentScript: boolean): Workspace.UISourceCode.UISourceCode|null {
|
|
164
|
-
return isContentScript ? this
|
|
165
|
-
this
|
|
164
|
+
return isContentScript ? this.#contentScriptsProject.uiSourceCodeForURL(url) :
|
|
165
|
+
this.#regularProject.uiSourceCodeForURL(url);
|
|
166
166
|
}
|
|
167
167
|
|
|
168
168
|
rawLocationToUILocation(rawLocation: SDK.DebuggerModel.Location): Workspace.UISourceCode.UILocation|null {
|
|
@@ -177,12 +177,12 @@ export class CompilerScriptMapping implements DebuggerSourceMapping {
|
|
|
177
177
|
columnNumber -= script.columnOffset;
|
|
178
178
|
}
|
|
179
179
|
|
|
180
|
-
const stubUISourceCode = this
|
|
180
|
+
const stubUISourceCode = this.#stubUISourceCodes.get(script);
|
|
181
181
|
if (stubUISourceCode) {
|
|
182
182
|
return new Workspace.UISourceCode.UILocation(stubUISourceCode, lineNumber, columnNumber);
|
|
183
183
|
}
|
|
184
184
|
|
|
185
|
-
const sourceMap = this
|
|
185
|
+
const sourceMap = this.#sourceMapManager.sourceMapForClient(script);
|
|
186
186
|
if (!sourceMap) {
|
|
187
187
|
return null;
|
|
188
188
|
}
|
|
@@ -190,8 +190,8 @@ export class CompilerScriptMapping implements DebuggerSourceMapping {
|
|
|
190
190
|
if (!entry || !entry.sourceURL) {
|
|
191
191
|
return null;
|
|
192
192
|
}
|
|
193
|
-
const uiSourceCode = script.isContentScript() ? this
|
|
194
|
-
this
|
|
193
|
+
const uiSourceCode = script.isContentScript() ? this.#contentScriptsProject.uiSourceCodeForURL(entry.sourceURL) :
|
|
194
|
+
this.#regularProject.uiSourceCodeForURL(entry.sourceURL);
|
|
195
195
|
if (!uiSourceCode) {
|
|
196
196
|
return null;
|
|
197
197
|
}
|
|
@@ -211,8 +211,8 @@ export class CompilerScriptMapping implements DebuggerSourceMapping {
|
|
|
211
211
|
if (!entry) {
|
|
212
212
|
continue;
|
|
213
213
|
}
|
|
214
|
-
for (const script of this
|
|
215
|
-
locations.push(this
|
|
214
|
+
for (const script of this.#sourceMapManager.clientsForSourceMap(sourceMap)) {
|
|
215
|
+
locations.push(this.#debuggerModel.createRawLocation(
|
|
216
216
|
script, entry.lineNumber + script.lineOffset,
|
|
217
217
|
!entry.lineNumber ? entry.columnNumber + script.columnOffset : entry.columnNumber));
|
|
218
218
|
}
|
|
@@ -225,7 +225,7 @@ export class CompilerScriptMapping implements DebuggerSourceMapping {
|
|
|
225
225
|
const script = event.data.client;
|
|
226
226
|
// Create stub UISourceCode for the time source mapping is being loaded.
|
|
227
227
|
this.addStubUISourceCode(script);
|
|
228
|
-
await this
|
|
228
|
+
await this.#debuggerWorkspaceBinding.updateLocations(script);
|
|
229
229
|
}
|
|
230
230
|
|
|
231
231
|
private async sourceMapFailedToAttach(event: Common.EventTarget.EventTargetEvent<{client: SDK.Script.Script}>):
|
|
@@ -255,7 +255,7 @@ export class CompilerScriptMapping implements DebuggerSourceMapping {
|
|
|
255
255
|
Promise<void> {
|
|
256
256
|
const script = event.data.client;
|
|
257
257
|
const sourceMap = event.data.sourceMap;
|
|
258
|
-
const bindings = script.isContentScript() ? this
|
|
258
|
+
const bindings = script.isContentScript() ? this.#contentScriptsBindings : this.#regularBindings;
|
|
259
259
|
for (const sourceURL of sourceMap.sourceURLs()) {
|
|
260
260
|
const binding = bindings.get(sourceURL);
|
|
261
261
|
if (binding) {
|
|
@@ -265,11 +265,11 @@ export class CompilerScriptMapping implements DebuggerSourceMapping {
|
|
|
265
265
|
}
|
|
266
266
|
}
|
|
267
267
|
}
|
|
268
|
-
await this
|
|
268
|
+
await this.#debuggerWorkspaceBinding.updateLocations(script);
|
|
269
269
|
}
|
|
270
270
|
|
|
271
271
|
sourceMapForScript(script: SDK.Script.Script): SDK.SourceMap.SourceMap|null {
|
|
272
|
-
return this
|
|
272
|
+
return this.#sourceMapManager.sourceMapForClient(script);
|
|
273
273
|
}
|
|
274
274
|
|
|
275
275
|
scriptsForUISourceCode(uiSourceCode: Workspace.UISourceCode.UISourceCode): SDK.Script.Script[] {
|
|
@@ -280,7 +280,7 @@ export class CompilerScriptMapping implements DebuggerSourceMapping {
|
|
|
280
280
|
|
|
281
281
|
const scripts: SDK.Script.Script[] = [];
|
|
282
282
|
for (const sourceMap of binding.getReferringSourceMaps()) {
|
|
283
|
-
this
|
|
283
|
+
this.#sourceMapManager.clientsForSourceMap(sourceMap).forEach(script => scripts.push(script));
|
|
284
284
|
}
|
|
285
285
|
return scripts;
|
|
286
286
|
}
|
|
@@ -289,8 +289,8 @@ export class CompilerScriptMapping implements DebuggerSourceMapping {
|
|
|
289
289
|
}
|
|
290
290
|
|
|
291
291
|
private async populateSourceMapSources(script: SDK.Script.Script, sourceMap: SDK.SourceMap.SourceMap): Promise<void> {
|
|
292
|
-
const project = script.isContentScript() ? this
|
|
293
|
-
const bindings = script.isContentScript() ? this
|
|
292
|
+
const project = script.isContentScript() ? this.#contentScriptsProject : this.#regularProject;
|
|
293
|
+
const bindings = script.isContentScript() ? this.#contentScriptsBindings : this.#regularBindings;
|
|
294
294
|
for (const sourceURL of sourceMap.sourceURLs()) {
|
|
295
295
|
let binding = bindings.get(sourceURL);
|
|
296
296
|
if (!binding) {
|
|
@@ -299,7 +299,7 @@ export class CompilerScriptMapping implements DebuggerSourceMapping {
|
|
|
299
299
|
}
|
|
300
300
|
binding.addSourceMap(sourceMap, script.frameId);
|
|
301
301
|
}
|
|
302
|
-
await this
|
|
302
|
+
await this.#debuggerWorkspaceBinding.updateLocations(script);
|
|
303
303
|
}
|
|
304
304
|
|
|
305
305
|
static uiLineHasMapping(uiSourceCode: Workspace.UISourceCode.UISourceCode, lineNumber: number): boolean {
|
|
@@ -316,25 +316,25 @@ export class CompilerScriptMapping implements DebuggerSourceMapping {
|
|
|
316
316
|
}
|
|
317
317
|
|
|
318
318
|
dispose(): void {
|
|
319
|
-
Common.EventTarget.removeEventListeners(this
|
|
320
|
-
this
|
|
321
|
-
this
|
|
322
|
-
this
|
|
319
|
+
Common.EventTarget.removeEventListeners(this.#eventListeners);
|
|
320
|
+
this.#regularProject.dispose();
|
|
321
|
+
this.#contentScriptsProject.dispose();
|
|
322
|
+
this.#stubProject.dispose();
|
|
323
323
|
}
|
|
324
324
|
}
|
|
325
325
|
|
|
326
326
|
const uiSourceCodeToBinding = new WeakMap<Workspace.UISourceCode.UISourceCode, Binding>();
|
|
327
327
|
|
|
328
328
|
class Binding {
|
|
329
|
-
|
|
330
|
-
|
|
329
|
+
readonly #project: ContentProviderBasedProject;
|
|
330
|
+
readonly #url: string;
|
|
331
331
|
referringSourceMaps: SDK.SourceMap.SourceMap[];
|
|
332
|
-
|
|
332
|
+
readonly #activeSourceMap?: SDK.SourceMap.SourceMap|null;
|
|
333
333
|
uiSourceCode: Workspace.UISourceCode.UISourceCode|null;
|
|
334
334
|
|
|
335
335
|
constructor(project: ContentProviderBasedProject, url: string) {
|
|
336
|
-
this
|
|
337
|
-
this
|
|
336
|
+
this.#project = project;
|
|
337
|
+
this.#url = url;
|
|
338
338
|
|
|
339
339
|
this.referringSourceMaps = [];
|
|
340
340
|
this.uiSourceCode = null;
|
|
@@ -344,24 +344,24 @@ class Binding {
|
|
|
344
344
|
const sourceMap = this.referringSourceMaps[this.referringSourceMaps.length - 1];
|
|
345
345
|
|
|
346
346
|
const newUISourceCode =
|
|
347
|
-
this
|
|
347
|
+
this.#project.createUISourceCode(this.#url, Common.ResourceType.resourceTypes.SourceMapScript);
|
|
348
348
|
uiSourceCodeToBinding.set(newUISourceCode, this);
|
|
349
349
|
const contentProvider =
|
|
350
|
-
sourceMap.sourceContentProvider(this
|
|
351
|
-
const mimeType = Common.ResourceType.ResourceType.mimeFromURL(this
|
|
352
|
-
const embeddedContent = sourceMap.embeddedContentByURL(this
|
|
350
|
+
sourceMap.sourceContentProvider(this.#url, Common.ResourceType.resourceTypes.SourceMapScript);
|
|
351
|
+
const mimeType = Common.ResourceType.ResourceType.mimeFromURL(this.#url) || 'text/javascript';
|
|
352
|
+
const embeddedContent = sourceMap.embeddedContentByURL(this.#url);
|
|
353
353
|
const metadata = typeof embeddedContent === 'string' ?
|
|
354
354
|
new Workspace.UISourceCode.UISourceCodeMetadata(null, embeddedContent.length) :
|
|
355
355
|
null;
|
|
356
356
|
|
|
357
357
|
if (this.uiSourceCode) {
|
|
358
358
|
NetworkProject.cloneInitialFrameAttribution(this.uiSourceCode, newUISourceCode);
|
|
359
|
-
this
|
|
359
|
+
this.#project.removeFile(this.uiSourceCode.url());
|
|
360
360
|
} else {
|
|
361
361
|
NetworkProject.setInitialFrameAttribution(newUISourceCode, frameId);
|
|
362
362
|
}
|
|
363
363
|
this.uiSourceCode = newUISourceCode;
|
|
364
|
-
this
|
|
364
|
+
this.#project.addUISourceCodeWithProvider(this.uiSourceCode, contentProvider, metadata, mimeType);
|
|
365
365
|
}
|
|
366
366
|
|
|
367
367
|
addSourceMap(sourceMap: SDK.SourceMap.SourceMap, frameId: Protocol.Page.FrameId): void {
|
|
@@ -380,7 +380,7 @@ class Binding {
|
|
|
380
380
|
this.referringSourceMaps.splice(lastIndex, 1);
|
|
381
381
|
}
|
|
382
382
|
if (!this.referringSourceMaps.length) {
|
|
383
|
-
this
|
|
383
|
+
this.#project.removeFile(uiSourceCode.url());
|
|
384
384
|
this.uiSourceCode = null;
|
|
385
385
|
} else {
|
|
386
386
|
this.recreateUISourceCodeIfNeeded(frameId);
|