chrome-devtools-frontend 1.0.1153166 → 1.0.1155899
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 +3 -2
- package/front_end/core/common/Revealer.ts +1 -1
- package/front_end/core/host/InspectorFrontendHostAPI.ts +2 -0
- package/front_end/core/host/UserMetrics.ts +32 -12
- package/front_end/core/platform/array-utilities.ts +25 -9
- package/front_end/core/sdk/ChildTargetManager.ts +2 -1
- package/front_end/core/sdk/FilmStripModel.ts +35 -25
- package/front_end/devtools_compatibility.js +2 -0
- package/front_end/entrypoints/lighthouse_worker/LighthouseWorkerService.ts +8 -2
- package/front_end/entrypoints/worker_app/worker_app.ts +0 -1
- package/front_end/generated/InspectorBackendCommands.js +2 -1
- package/front_end/generated/protocol.ts +36 -0
- package/front_end/models/bindings/PresentationConsoleMessageHelper.ts +90 -73
- package/front_end/models/issues_manager/IssuesManager.ts +5 -0
- package/front_end/models/issues_manager/SourceFrameIssuesManager.ts +31 -61
- package/front_end/models/issues_manager/StylesheetLoadingIssue.ts +69 -0
- package/front_end/models/issues_manager/descriptions/stylesheetLateImport.md +4 -0
- package/front_end/models/issues_manager/descriptions/stylesheetRequestFailed.md +3 -0
- package/front_end/models/issues_manager/issues_manager.ts +2 -0
- package/front_end/models/timeline_model/TimelineModel.ts +4 -0
- package/front_end/models/trace/ModelImpl.ts +1 -0
- package/front_end/models/trace/README.md +73 -17
- package/front_end/models/trace/handlers/NetworkRequestsHandler.ts +1 -1
- package/front_end/models/trace/handlers/RendererHandler.ts +33 -143
- package/front_end/models/trace/handlers/UserTimings.md +1 -1
- package/front_end/models/trace/types/TraceEvents.ts +3 -2
- package/front_end/panels/application/ApplicationPanelSidebar.ts +9 -6
- package/front_end/panels/application/PreloadingTreeElement.ts +25 -7
- package/front_end/panels/application/preloading/PreloadingView.ts +64 -31
- package/front_end/panels/application/preloading/components/UsedPreloadingView.ts +19 -9
- package/front_end/panels/console/ConsoleViewMessage.ts +14 -2
- package/front_end/panels/elements/ElementsPanel.ts +2 -3
- package/front_end/panels/elements/components/LayoutPane.ts +256 -60
- package/front_end/panels/elements/elements-legacy.ts +0 -3
- package/front_end/panels/elements/elements-meta.ts +10 -2
- package/front_end/panels/elements/elements.ts +0 -2
- package/front_end/panels/network/NetworkDataGridNode.ts +8 -0
- package/front_end/panels/network/NetworkLogView.ts +2 -1
- package/front_end/panels/network/NetworkPanel.ts +12 -1
- package/front_end/panels/recorder/components/ExtensionView.ts +1 -1
- package/front_end/panels/sources/DebuggerPlugin.ts +7 -4
- package/front_end/panels/sources/SourcesPanel.ts +1 -1
- package/front_end/panels/sources/components/BreakpointsView.ts +406 -89
- package/front_end/panels/sources/sources-meta.ts +13 -4
- package/front_end/panels/sources/sources.ts +0 -2
- package/front_end/panels/timeline/TimelineFlameChartDataProvider.ts +1 -1
- package/front_end/panels/timeline/TimelineFlameChartNetworkDataProvider.ts +106 -95
- package/front_end/panels/timeline/TimelineFlameChartView.ts +1 -1
- package/front_end/panels/timeline/TimelinePaintProfilerView.ts +5 -0
- package/front_end/panels/timeline/TimelinePanel.ts +8 -8
- package/front_end/ui/legacy/UIUtils.ts +1 -1
- package/front_end/ui/legacy/components/perf_ui/.eslintrc.js +18 -0
- package/front_end/ui/legacy/components/perf_ui/FlameChart.ts +5 -1
- package/front_end/ui/legacy/components/perf_ui/TimelineOverviewPane.ts +5 -2
- package/front_end/ui/legacy/components/utils/Linkifier.ts +10 -0
- package/package.json +1 -1
- package/scripts/build/generate_deprecations.py +3 -0
- package/front_end/panels/elements/LayoutSidebarPane.ts +0 -249
- package/front_end/panels/sources/BreakpointsSidebarPane.ts +0 -480
- package/front_end/ui/components/docs/layout_pane/basic.html +0 -25
- package/front_end/ui/components/docs/layout_pane/basic.ts +0 -78
@@ -1,480 +0,0 @@
|
|
1
|
-
// Copyright (c) 2022 The Chromium Authors. All rights reserved.
|
2
|
-
// Use of this source code is governed by a BSD-style license that can be
|
3
|
-
// found in the LICENSE file.
|
4
|
-
|
5
|
-
import * as Common from '../../core/common/common.js';
|
6
|
-
import * as Host from '../../core/host/host.js';
|
7
|
-
import * as Platform from '../../core/platform/platform.js';
|
8
|
-
import {assertNotNullOrUndefined} from '../../core/platform/platform.js';
|
9
|
-
import * as SDK from '../../core/sdk/sdk.js';
|
10
|
-
import * as Bindings from '../../models/bindings/bindings.js';
|
11
|
-
import * as Breakpoints from '../../models/breakpoints/breakpoints.js';
|
12
|
-
import * as TextUtils from '../../models/text_utils/text_utils.js';
|
13
|
-
import * as Workspace from '../../models/workspace/workspace.js';
|
14
|
-
import * as UI from '../../ui/legacy/legacy.js';
|
15
|
-
|
16
|
-
import * as SourcesComponents from './components/components.js';
|
17
|
-
|
18
|
-
let breakpointsSidebarPaneInstance: BreakpointsSidebarPane;
|
19
|
-
let breakpointsViewControllerInstance: BreakpointsSidebarController|null;
|
20
|
-
|
21
|
-
export class BreakpointsSidebarPane extends UI.ThrottledWidget.ThrottledWidget {
|
22
|
-
readonly #breakpointsView: SourcesComponents.BreakpointsView.BreakpointsView;
|
23
|
-
readonly #controller: BreakpointsSidebarController;
|
24
|
-
|
25
|
-
static instance(): BreakpointsSidebarPane {
|
26
|
-
if (!breakpointsSidebarPaneInstance) {
|
27
|
-
breakpointsSidebarPaneInstance = new BreakpointsSidebarPane();
|
28
|
-
}
|
29
|
-
return breakpointsSidebarPaneInstance;
|
30
|
-
}
|
31
|
-
|
32
|
-
constructor() {
|
33
|
-
super(true);
|
34
|
-
this.#controller = BreakpointsSidebarController.instance();
|
35
|
-
this.#breakpointsView = new SourcesComponents.BreakpointsView.BreakpointsView();
|
36
|
-
this.#breakpointsView.addEventListener(
|
37
|
-
SourcesComponents.BreakpointsView.CheckboxToggledEvent.eventName, (event: Event) => {
|
38
|
-
const {data: {breakpointItem, checked}} = event as SourcesComponents.BreakpointsView.CheckboxToggledEvent;
|
39
|
-
this.#controller.breakpointStateChanged(breakpointItem, checked);
|
40
|
-
event.consume();
|
41
|
-
});
|
42
|
-
this.#breakpointsView.addEventListener(
|
43
|
-
SourcesComponents.BreakpointsView.BreakpointSelectedEvent.eventName, (event: Event) => {
|
44
|
-
const {data: {breakpointItem}} = event as SourcesComponents.BreakpointsView.BreakpointSelectedEvent;
|
45
|
-
void this.#controller.jumpToSource(breakpointItem);
|
46
|
-
event.consume();
|
47
|
-
});
|
48
|
-
this.#breakpointsView.addEventListener(
|
49
|
-
SourcesComponents.BreakpointsView.BreakpointEditedEvent.eventName, (event: Event) => {
|
50
|
-
const {data: {breakpointItem, editButtonClicked}} =
|
51
|
-
event as SourcesComponents.BreakpointsView.BreakpointEditedEvent;
|
52
|
-
void this.#controller.breakpointEdited(breakpointItem, editButtonClicked);
|
53
|
-
event.consume();
|
54
|
-
});
|
55
|
-
this.#breakpointsView.addEventListener(
|
56
|
-
SourcesComponents.BreakpointsView.BreakpointsRemovedEvent.eventName, (event: Event) => {
|
57
|
-
const {data: {breakpointItems}} = event as SourcesComponents.BreakpointsView.BreakpointsRemovedEvent;
|
58
|
-
void this.#controller.breakpointsRemoved(breakpointItems);
|
59
|
-
event.consume();
|
60
|
-
});
|
61
|
-
this.#breakpointsView.addEventListener(
|
62
|
-
SourcesComponents.BreakpointsView.ExpandedStateChangedEvent.eventName, (event: Event) => {
|
63
|
-
const {data: {url, expanded}} = event as SourcesComponents.BreakpointsView.ExpandedStateChangedEvent;
|
64
|
-
void this.#controller.expandedStateChanged(url, expanded);
|
65
|
-
event.consume();
|
66
|
-
});
|
67
|
-
this.#breakpointsView.addEventListener(
|
68
|
-
SourcesComponents.BreakpointsView.PauseOnUncaughtExceptionsStateChangedEvent.eventName, (event: Event) => {
|
69
|
-
const {data: {checked}} =
|
70
|
-
event as SourcesComponents.BreakpointsView.PauseOnUncaughtExceptionsStateChangedEvent;
|
71
|
-
this.#controller.setPauseOnUncaughtExceptions(checked);
|
72
|
-
event.consume();
|
73
|
-
});
|
74
|
-
this.#breakpointsView.addEventListener(
|
75
|
-
SourcesComponents.BreakpointsView.PauseOnCaughtExceptionsStateChangedEvent.eventName, (event: Event) => {
|
76
|
-
const {data: {checked}} = event as SourcesComponents.BreakpointsView.PauseOnCaughtExceptionsStateChangedEvent;
|
77
|
-
this.#controller.setPauseOnCaughtExceptions(checked);
|
78
|
-
event.consume();
|
79
|
-
});
|
80
|
-
|
81
|
-
this.contentElement.appendChild(this.#breakpointsView);
|
82
|
-
this.update();
|
83
|
-
}
|
84
|
-
|
85
|
-
override doUpdate(): Promise<void> {
|
86
|
-
return this.#controller.update();
|
87
|
-
}
|
88
|
-
|
89
|
-
set data(data: SourcesComponents.BreakpointsView.BreakpointsViewData) {
|
90
|
-
this.#breakpointsView.data = data;
|
91
|
-
}
|
92
|
-
}
|
93
|
-
|
94
|
-
export class BreakpointsSidebarController implements UI.ContextFlavorListener.ContextFlavorListener {
|
95
|
-
readonly #breakpointManager: Breakpoints.BreakpointManager.BreakpointManager;
|
96
|
-
readonly #breakpointItemToLocationMap = new WeakMap<
|
97
|
-
SourcesComponents.BreakpointsView.BreakpointItem, Breakpoints.BreakpointManager.BreakpointLocation[]>();
|
98
|
-
readonly #breakpointsActiveSetting: Common.Settings.Setting<boolean>;
|
99
|
-
readonly #pauseOnUncaughtExceptionSetting: Common.Settings.Setting<boolean>;
|
100
|
-
readonly #pauseOnCaughtExceptionSetting: Common.Settings.Setting<boolean>;
|
101
|
-
|
102
|
-
readonly #collapsedFilesSettings: Common.Settings.Setting<Platform.DevToolsPath.UrlString[]>;
|
103
|
-
readonly #collapsedFiles: Set<Platform.DevToolsPath.UrlString>;
|
104
|
-
|
105
|
-
// This is used to keep track of outstanding edits to breakpoints that were initiated
|
106
|
-
// by the breakpoint edit button (for UMA).
|
107
|
-
#outstandingBreakpointEdited: Breakpoints.BreakpointManager.Breakpoint|undefined;
|
108
|
-
#updateScheduled = false;
|
109
|
-
#updateRunning = false;
|
110
|
-
|
111
|
-
private constructor(
|
112
|
-
breakpointManager: Breakpoints.BreakpointManager.BreakpointManager, settings: Common.Settings.Settings) {
|
113
|
-
this.#collapsedFilesSettings = Common.Settings.Settings.instance().createSetting('collapsedFiles', []);
|
114
|
-
this.#collapsedFiles = new Set(this.#collapsedFilesSettings.get());
|
115
|
-
this.#breakpointManager = breakpointManager;
|
116
|
-
this.#breakpointManager.addEventListener(
|
117
|
-
Breakpoints.BreakpointManager.Events.BreakpointAdded, this.#onBreakpointAdded, this);
|
118
|
-
this.#breakpointManager.addEventListener(
|
119
|
-
Breakpoints.BreakpointManager.Events.BreakpointRemoved, this.#onBreakpointRemoved, this);
|
120
|
-
this.#breakpointsActiveSetting = settings.moduleSetting('breakpointsActive');
|
121
|
-
this.#breakpointsActiveSetting.addChangeListener(this.update, this);
|
122
|
-
this.#pauseOnUncaughtExceptionSetting = settings.moduleSetting('pauseOnUncaughtException');
|
123
|
-
this.#pauseOnUncaughtExceptionSetting.addChangeListener(this.update, this);
|
124
|
-
this.#pauseOnCaughtExceptionSetting = settings.moduleSetting('pauseOnCaughtException');
|
125
|
-
this.#pauseOnCaughtExceptionSetting.addChangeListener(this.update, this);
|
126
|
-
}
|
127
|
-
|
128
|
-
static instance({forceNew, breakpointManager, settings}: {
|
129
|
-
forceNew: boolean|null,
|
130
|
-
breakpointManager: Breakpoints.BreakpointManager.BreakpointManager,
|
131
|
-
settings: Common.Settings.Settings,
|
132
|
-
} = {
|
133
|
-
forceNew: null,
|
134
|
-
breakpointManager: Breakpoints.BreakpointManager.BreakpointManager.instance(),
|
135
|
-
settings: Common.Settings.Settings.instance(),
|
136
|
-
}): BreakpointsSidebarController {
|
137
|
-
if (!breakpointsViewControllerInstance || forceNew) {
|
138
|
-
breakpointsViewControllerInstance = new BreakpointsSidebarController(breakpointManager, settings);
|
139
|
-
}
|
140
|
-
return breakpointsViewControllerInstance;
|
141
|
-
}
|
142
|
-
|
143
|
-
static removeInstance(): void {
|
144
|
-
breakpointsViewControllerInstance = null;
|
145
|
-
}
|
146
|
-
|
147
|
-
static targetSupportsIndependentPauseOnExceptionToggles(): boolean {
|
148
|
-
const hasNodeTargets =
|
149
|
-
SDK.TargetManager.TargetManager.instance().targets().some(target => target.type() === SDK.Target.Type.Node);
|
150
|
-
return !hasNodeTargets;
|
151
|
-
}
|
152
|
-
|
153
|
-
flavorChanged(_object: Object|null): void {
|
154
|
-
void this.update();
|
155
|
-
}
|
156
|
-
|
157
|
-
breakpointEditFinished(breakpoint: Breakpoints.BreakpointManager.Breakpoint|null, edited: boolean): void {
|
158
|
-
if (this.#outstandingBreakpointEdited && this.#outstandingBreakpointEdited === breakpoint) {
|
159
|
-
if (edited) {
|
160
|
-
Host.userMetrics.actionTaken(Host.UserMetrics.Action.BreakpointConditionEditedFromSidebar);
|
161
|
-
}
|
162
|
-
this.#outstandingBreakpointEdited = undefined;
|
163
|
-
}
|
164
|
-
}
|
165
|
-
|
166
|
-
breakpointStateChanged(breakpointItem: SourcesComponents.BreakpointsView.BreakpointItem, checked: boolean): void {
|
167
|
-
const locations = this.#getLocationsForBreakpointItem(breakpointItem);
|
168
|
-
locations.forEach((value: Breakpoints.BreakpointManager.BreakpointLocation) => {
|
169
|
-
const breakpoint = value.breakpoint;
|
170
|
-
breakpoint.setEnabled(checked);
|
171
|
-
});
|
172
|
-
}
|
173
|
-
|
174
|
-
async breakpointEdited(breakpointItem: SourcesComponents.BreakpointsView.BreakpointItem, editButtonClicked: boolean):
|
175
|
-
Promise<void> {
|
176
|
-
const locations = this.#getLocationsForBreakpointItem(breakpointItem);
|
177
|
-
let location: Breakpoints.BreakpointManager.BreakpointLocation|undefined;
|
178
|
-
for (const locationCandidate of locations) {
|
179
|
-
if (!location || locationCandidate.uiLocation.compareTo(location.uiLocation) < 0) {
|
180
|
-
location = locationCandidate;
|
181
|
-
}
|
182
|
-
}
|
183
|
-
if (location) {
|
184
|
-
if (editButtonClicked) {
|
185
|
-
this.#outstandingBreakpointEdited = location.breakpoint;
|
186
|
-
}
|
187
|
-
await Common.Revealer.reveal(location);
|
188
|
-
}
|
189
|
-
}
|
190
|
-
|
191
|
-
breakpointsRemoved(breakpointItems: SourcesComponents.BreakpointsView.BreakpointItem[]): void {
|
192
|
-
const locations = breakpointItems.flatMap(breakpointItem => this.#getLocationsForBreakpointItem(breakpointItem));
|
193
|
-
locations.forEach(location => location?.breakpoint.remove(false /* keepInStorage */));
|
194
|
-
}
|
195
|
-
|
196
|
-
expandedStateChanged(url: Platform.DevToolsPath.UrlString, expanded: boolean): void {
|
197
|
-
if (expanded) {
|
198
|
-
this.#collapsedFiles.delete(url);
|
199
|
-
} else {
|
200
|
-
this.#collapsedFiles.add(url);
|
201
|
-
}
|
202
|
-
|
203
|
-
this.#saveSettings();
|
204
|
-
}
|
205
|
-
|
206
|
-
async jumpToSource(breakpointItem: SourcesComponents.BreakpointsView.BreakpointItem): Promise<void> {
|
207
|
-
const uiLocations = this.#getLocationsForBreakpointItem(breakpointItem).map(location => location.uiLocation);
|
208
|
-
let uiLocation: Workspace.UISourceCode.UILocation|undefined;
|
209
|
-
for (const uiLocationCandidate of uiLocations) {
|
210
|
-
if (!uiLocation || uiLocationCandidate.compareTo(uiLocation) < 0) {
|
211
|
-
uiLocation = uiLocationCandidate;
|
212
|
-
}
|
213
|
-
}
|
214
|
-
if (uiLocation) {
|
215
|
-
await Common.Revealer.reveal(uiLocation);
|
216
|
-
}
|
217
|
-
}
|
218
|
-
|
219
|
-
setPauseOnUncaughtExceptions(value: boolean): void {
|
220
|
-
this.#pauseOnUncaughtExceptionSetting.set(value);
|
221
|
-
}
|
222
|
-
|
223
|
-
setPauseOnCaughtExceptions(value: boolean): void {
|
224
|
-
this.#pauseOnCaughtExceptionSetting.set(value);
|
225
|
-
}
|
226
|
-
|
227
|
-
async update(): Promise<void> {
|
228
|
-
this.#updateScheduled = true;
|
229
|
-
if (this.#updateRunning) {
|
230
|
-
return;
|
231
|
-
}
|
232
|
-
this.#updateRunning = true;
|
233
|
-
while (this.#updateScheduled) {
|
234
|
-
this.#updateScheduled = false;
|
235
|
-
const data = await this.getUpdatedBreakpointViewData();
|
236
|
-
BreakpointsSidebarPane.instance().data = data;
|
237
|
-
}
|
238
|
-
this.#updateRunning = false;
|
239
|
-
}
|
240
|
-
|
241
|
-
async getUpdatedBreakpointViewData(): Promise<SourcesComponents.BreakpointsView.BreakpointsViewData> {
|
242
|
-
const breakpointsActive = this.#breakpointsActiveSetting.get();
|
243
|
-
const independentPauseToggles = BreakpointsSidebarController.targetSupportsIndependentPauseOnExceptionToggles();
|
244
|
-
const pauseOnUncaughtExceptions = this.#pauseOnUncaughtExceptionSetting.get();
|
245
|
-
const pauseOnCaughtExceptions = this.#pauseOnCaughtExceptionSetting.get();
|
246
|
-
|
247
|
-
const breakpointLocations = this.#getBreakpointLocations();
|
248
|
-
if (!breakpointLocations.length) {
|
249
|
-
return {
|
250
|
-
breakpointsActive,
|
251
|
-
pauseOnCaughtExceptions,
|
252
|
-
pauseOnUncaughtExceptions,
|
253
|
-
independentPauseToggles,
|
254
|
-
groups: [],
|
255
|
-
};
|
256
|
-
}
|
257
|
-
|
258
|
-
const locationsGroupedById = this.#groupBreakpointLocationsById(breakpointLocations);
|
259
|
-
const locationIdsByLineId = this.#getLocationIdsByLineId(breakpointLocations);
|
260
|
-
|
261
|
-
const [content, selectedUILocation] = await Promise.all([
|
262
|
-
this.#getContent(locationsGroupedById),
|
263
|
-
this.#getHitUILocation(),
|
264
|
-
]);
|
265
|
-
|
266
|
-
const scriptIdToGroup = new Map<string, SourcesComponents.BreakpointsView.BreakpointGroup>();
|
267
|
-
|
268
|
-
for (let idx = 0; idx < locationsGroupedById.length; idx++) {
|
269
|
-
const locations = locationsGroupedById[idx];
|
270
|
-
const fstLocation = locations[0];
|
271
|
-
const sourceURL = fstLocation.uiLocation.uiSourceCode.url();
|
272
|
-
const scriptId = fstLocation.uiLocation.uiSourceCode.canononicalScriptId();
|
273
|
-
const uiLocation = fstLocation.uiLocation;
|
274
|
-
|
275
|
-
const isHit = selectedUILocation !== null &&
|
276
|
-
locations.some(location => location.uiLocation.id() === selectedUILocation.id());
|
277
|
-
|
278
|
-
const numBreakpointsOnLine = locationIdsByLineId.get(uiLocation.lineId()).size;
|
279
|
-
const showColumn = numBreakpointsOnLine > 1;
|
280
|
-
const locationText = uiLocation.lineAndColumnText(showColumn) as string;
|
281
|
-
|
282
|
-
const text = content[idx];
|
283
|
-
const codeSnippet = text instanceof TextUtils.Text.Text ?
|
284
|
-
text.lineAt(uiLocation.lineNumber) :
|
285
|
-
text.lines[text.bytecodeOffsetToLineNumber(uiLocation.columnNumber ?? 0)] ?? '';
|
286
|
-
|
287
|
-
if (isHit && this.#collapsedFiles.has(sourceURL)) {
|
288
|
-
this.#collapsedFiles.delete(sourceURL);
|
289
|
-
this.#saveSettings();
|
290
|
-
}
|
291
|
-
const expanded = !this.#collapsedFiles.has(sourceURL);
|
292
|
-
|
293
|
-
const status: SourcesComponents.BreakpointsView.BreakpointStatus = this.#getBreakpointState(locations);
|
294
|
-
const {type, hoverText} = this.#getBreakpointTypeAndDetails(locations);
|
295
|
-
const item = {
|
296
|
-
id: fstLocation.breakpoint.breakpointStorageId(),
|
297
|
-
location: locationText,
|
298
|
-
codeSnippet,
|
299
|
-
isHit,
|
300
|
-
status,
|
301
|
-
type,
|
302
|
-
hoverText,
|
303
|
-
};
|
304
|
-
this.#breakpointItemToLocationMap.set(item, locations);
|
305
|
-
|
306
|
-
let group = scriptIdToGroup.get(scriptId);
|
307
|
-
if (group) {
|
308
|
-
group.breakpointItems.push(item);
|
309
|
-
group.expanded ||= expanded;
|
310
|
-
} else {
|
311
|
-
const editable = this.#breakpointManager.supportsConditionalBreakpoints(uiLocation.uiSourceCode);
|
312
|
-
group = {
|
313
|
-
url: sourceURL,
|
314
|
-
name: uiLocation.uiSourceCode.displayName(),
|
315
|
-
editable,
|
316
|
-
expanded,
|
317
|
-
breakpointItems: [item],
|
318
|
-
};
|
319
|
-
scriptIdToGroup.set(scriptId, group);
|
320
|
-
}
|
321
|
-
}
|
322
|
-
return {
|
323
|
-
breakpointsActive,
|
324
|
-
pauseOnCaughtExceptions,
|
325
|
-
pauseOnUncaughtExceptions,
|
326
|
-
independentPauseToggles,
|
327
|
-
groups: Array.from(scriptIdToGroup.values()),
|
328
|
-
};
|
329
|
-
}
|
330
|
-
|
331
|
-
#onBreakpointAdded(event: Common.EventTarget.EventTargetEvent<Breakpoints.BreakpointManager.BreakpointLocation>):
|
332
|
-
Promise<void> {
|
333
|
-
const breakpoint = event.data.breakpoint;
|
334
|
-
if (breakpoint.origin === Breakpoints.BreakpointManager.BreakpointOrigin.USER_ACTION &&
|
335
|
-
this.#collapsedFiles.has(breakpoint.url())) {
|
336
|
-
// Auto-expand if a new breakpoint was added to a collapsed group.
|
337
|
-
this.#collapsedFiles.delete(breakpoint.url());
|
338
|
-
this.#saveSettings();
|
339
|
-
}
|
340
|
-
return this.update();
|
341
|
-
}
|
342
|
-
|
343
|
-
#onBreakpointRemoved(event: Common.EventTarget.EventTargetEvent<Breakpoints.BreakpointManager.BreakpointLocation>):
|
344
|
-
Promise<void> {
|
345
|
-
const breakpoint = event.data.breakpoint;
|
346
|
-
if (this.#collapsedFiles.has(breakpoint.url())) {
|
347
|
-
const locations = Breakpoints.BreakpointManager.BreakpointManager.instance().allBreakpointLocations();
|
348
|
-
const otherBreakpointsOnSameFileExist =
|
349
|
-
locations.some(location => location.breakpoint.url() === breakpoint.url());
|
350
|
-
if (!otherBreakpointsOnSameFileExist) {
|
351
|
-
// Clear up the #collapsedFiles set from this url if no breakpoint is left in this group.
|
352
|
-
this.#collapsedFiles.delete(breakpoint.url());
|
353
|
-
this.#saveSettings();
|
354
|
-
}
|
355
|
-
}
|
356
|
-
return this.update();
|
357
|
-
}
|
358
|
-
|
359
|
-
#saveSettings(): void {
|
360
|
-
this.#collapsedFilesSettings.set(Array.from(this.#collapsedFiles.values()));
|
361
|
-
}
|
362
|
-
|
363
|
-
#getBreakpointTypeAndDetails(locations: Breakpoints.BreakpointManager.BreakpointLocation[]):
|
364
|
-
{type: SDK.DebuggerModel.BreakpointType, hoverText?: string} {
|
365
|
-
const breakpointWithCondition = locations.find(location => Boolean(location.breakpoint.condition()));
|
366
|
-
const breakpoint = breakpointWithCondition?.breakpoint;
|
367
|
-
if (!breakpoint || !breakpoint.condition()) {
|
368
|
-
return {type: SDK.DebuggerModel.BreakpointType.REGULAR_BREAKPOINT};
|
369
|
-
}
|
370
|
-
|
371
|
-
const condition = breakpoint.condition();
|
372
|
-
if (breakpoint.isLogpoint()) {
|
373
|
-
return {type: SDK.DebuggerModel.BreakpointType.LOGPOINT, hoverText: condition};
|
374
|
-
}
|
375
|
-
|
376
|
-
return {type: SDK.DebuggerModel.BreakpointType.CONDITIONAL_BREAKPOINT, hoverText: condition};
|
377
|
-
}
|
378
|
-
|
379
|
-
#getLocationsForBreakpointItem(breakpointItem: SourcesComponents.BreakpointsView.BreakpointItem):
|
380
|
-
Breakpoints.BreakpointManager.BreakpointLocation[] {
|
381
|
-
const locations = this.#breakpointItemToLocationMap.get(breakpointItem);
|
382
|
-
assertNotNullOrUndefined(locations);
|
383
|
-
return locations;
|
384
|
-
}
|
385
|
-
|
386
|
-
async #getHitUILocation(): Promise<Workspace.UISourceCode.UILocation|null> {
|
387
|
-
const details = UI.Context.Context.instance().flavor(SDK.DebuggerModel.DebuggerPausedDetails);
|
388
|
-
if (details && details.callFrames.length) {
|
389
|
-
return await Bindings.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding.instance().rawLocationToUILocation(
|
390
|
-
details.callFrames[0].location());
|
391
|
-
}
|
392
|
-
return null;
|
393
|
-
}
|
394
|
-
|
395
|
-
#getBreakpointLocations(): Breakpoints.BreakpointManager.BreakpointLocation[] {
|
396
|
-
const locations = this.#breakpointManager.allBreakpointLocations().filter(
|
397
|
-
breakpointLocation =>
|
398
|
-
breakpointLocation.uiLocation.uiSourceCode.project().type() !== Workspace.Workspace.projectTypes.Debugger);
|
399
|
-
|
400
|
-
locations.sort((item1, item2) => item1.uiLocation.compareTo(item2.uiLocation));
|
401
|
-
|
402
|
-
const result = [];
|
403
|
-
let lastBreakpoint: Breakpoints.BreakpointManager.Breakpoint|null = null;
|
404
|
-
let lastLocation: Workspace.UISourceCode.UILocation|null = null;
|
405
|
-
for (const location of locations) {
|
406
|
-
if (location.breakpoint !== lastBreakpoint || (lastLocation && location.uiLocation.compareTo(lastLocation))) {
|
407
|
-
result.push(location);
|
408
|
-
lastBreakpoint = location.breakpoint;
|
409
|
-
lastLocation = location.uiLocation;
|
410
|
-
}
|
411
|
-
}
|
412
|
-
return result;
|
413
|
-
}
|
414
|
-
|
415
|
-
#groupBreakpointLocationsById(breakpointLocations: Breakpoints.BreakpointManager.BreakpointLocation[]):
|
416
|
-
Breakpoints.BreakpointManager.BreakpointLocation[][] {
|
417
|
-
const map = new Platform.MapUtilities.Multimap<string, Breakpoints.BreakpointManager.BreakpointLocation>();
|
418
|
-
for (const breakpointLocation of breakpointLocations) {
|
419
|
-
const uiLocation = breakpointLocation.uiLocation;
|
420
|
-
map.set(uiLocation.id(), breakpointLocation);
|
421
|
-
}
|
422
|
-
const arr: Breakpoints.BreakpointManager.BreakpointLocation[][] = [];
|
423
|
-
for (const id of map.keysArray()) {
|
424
|
-
const locations = Array.from(map.get(id));
|
425
|
-
if (locations.length) {
|
426
|
-
arr.push(locations);
|
427
|
-
}
|
428
|
-
}
|
429
|
-
return arr;
|
430
|
-
}
|
431
|
-
|
432
|
-
#getLocationIdsByLineId(breakpointLocations: Breakpoints.BreakpointManager.BreakpointLocation[]):
|
433
|
-
Platform.MapUtilities.Multimap<string, string> {
|
434
|
-
const result = new Platform.MapUtilities.Multimap<string, string>();
|
435
|
-
|
436
|
-
for (const breakpointLocation of breakpointLocations) {
|
437
|
-
const uiLocation = breakpointLocation.uiLocation;
|
438
|
-
result.set(uiLocation.lineId(), uiLocation.id());
|
439
|
-
}
|
440
|
-
|
441
|
-
return result;
|
442
|
-
}
|
443
|
-
|
444
|
-
#getBreakpointState(locations: Breakpoints.BreakpointManager.BreakpointLocation[]):
|
445
|
-
SourcesComponents.BreakpointsView.BreakpointStatus {
|
446
|
-
const hasEnabled = locations.some(location => location.breakpoint.enabled());
|
447
|
-
const hasDisabled = locations.some(location => !location.breakpoint.enabled());
|
448
|
-
let status: SourcesComponents.BreakpointsView.BreakpointStatus;
|
449
|
-
if (hasEnabled) {
|
450
|
-
status = hasDisabled ? SourcesComponents.BreakpointsView.BreakpointStatus.INDETERMINATE :
|
451
|
-
SourcesComponents.BreakpointsView.BreakpointStatus.ENABLED;
|
452
|
-
} else {
|
453
|
-
status = SourcesComponents.BreakpointsView.BreakpointStatus.DISABLED;
|
454
|
-
}
|
455
|
-
return status;
|
456
|
-
}
|
457
|
-
|
458
|
-
#getContent(locations: Breakpoints.BreakpointManager.BreakpointLocation[][]):
|
459
|
-
Promise<Array<TextUtils.Text.Text|Common.WasmDisassembly.WasmDisassembly>> {
|
460
|
-
// Use a cache to share the Text objects between all breakpoints. This way
|
461
|
-
// we share the cached line ending information that Text calculates. This
|
462
|
-
// was very slow to calculate with a lot of breakpoints in the same very
|
463
|
-
// large source file.
|
464
|
-
const contentToTextMap = new Map<string, TextUtils.Text.Text>();
|
465
|
-
|
466
|
-
return Promise.all(locations.map(async ([{uiLocation: {uiSourceCode}}]) => {
|
467
|
-
const deferredContent = await uiSourceCode.requestContent({cachedWasmOnly: true});
|
468
|
-
if ('wasmDisassemblyInfo' in deferredContent && deferredContent.wasmDisassemblyInfo) {
|
469
|
-
return deferredContent.wasmDisassemblyInfo;
|
470
|
-
}
|
471
|
-
const contentText = deferredContent.content || '';
|
472
|
-
if (contentToTextMap.has(contentText)) {
|
473
|
-
return contentToTextMap.get(contentText) as TextUtils.Text.Text;
|
474
|
-
}
|
475
|
-
const text = new TextUtils.Text.Text(contentText);
|
476
|
-
contentToTextMap.set(contentText, text);
|
477
|
-
return text;
|
478
|
-
}));
|
479
|
-
}
|
480
|
-
}
|
@@ -1,25 +0,0 @@
|
|
1
|
-
<!--
|
2
|
-
Copyright 2020 The Chromium Authors. All rights reserved.
|
3
|
-
Use of this source code is governed by a BSD-style license that can be
|
4
|
-
found in the LICENSE file.
|
5
|
-
-->
|
6
|
-
<!DOCTYPE html>
|
7
|
-
<html>
|
8
|
-
<head>
|
9
|
-
<meta charset="UTF-8" />
|
10
|
-
<meta name="viewport" content="width=device-width" />
|
11
|
-
<title>Basic Layout Pane example</title>
|
12
|
-
<style>
|
13
|
-
#container {
|
14
|
-
width: 300px;
|
15
|
-
border: 1px solid black;
|
16
|
-
}
|
17
|
-
</style>
|
18
|
-
</head>
|
19
|
-
<body>
|
20
|
-
<div id="container">
|
21
|
-
</div>
|
22
|
-
|
23
|
-
<script type="module" src="./basic.js"></script>
|
24
|
-
</body>
|
25
|
-
</html>
|
@@ -1,78 +0,0 @@
|
|
1
|
-
// Copyright 2020 The Chromium Authors. All rights reserved.
|
2
|
-
// Use of this source code is governed by a BSD-style license that can be
|
3
|
-
// found in the LICENSE file.
|
4
|
-
|
5
|
-
import * as FrontendHelpers from '../../../../../test/unittests/front_end/helpers/EnvironmentHelpers.js';
|
6
|
-
import * as Common from '../../../../core/common/common.js';
|
7
|
-
import * as Elements from '../../../../panels/elements/components/components.js';
|
8
|
-
import * as ComponentHelpers from '../../helpers/helpers.js';
|
9
|
-
|
10
|
-
await ComponentHelpers.ComponentServerSetup.setup();
|
11
|
-
await FrontendHelpers.initializeGlobalVars();
|
12
|
-
|
13
|
-
const component = new Elements.LayoutPane.LayoutPane();
|
14
|
-
|
15
|
-
document.getElementById('container')?.appendChild(component);
|
16
|
-
|
17
|
-
component.data = {
|
18
|
-
gridElements: [
|
19
|
-
{
|
20
|
-
id: 1,
|
21
|
-
name: 'div',
|
22
|
-
domId: 'foo',
|
23
|
-
color: 'blue',
|
24
|
-
enabled: false,
|
25
|
-
reveal: (): void => {},
|
26
|
-
setColor: (): void => {},
|
27
|
-
toggle: (): void => {},
|
28
|
-
highlight: (): void => {},
|
29
|
-
hideHighlight: (): void => {},
|
30
|
-
},
|
31
|
-
{
|
32
|
-
id: 2,
|
33
|
-
name: 'div',
|
34
|
-
domClasses: ['for', 'bar', 'some-very-long-class-name-very-very-very-very-very-long'],
|
35
|
-
enabled: true,
|
36
|
-
color: 'blue',
|
37
|
-
reveal: (): void => {},
|
38
|
-
setColor: (): void => {},
|
39
|
-
toggle: (): void => {},
|
40
|
-
highlight: (): void => {},
|
41
|
-
hideHighlight: (): void => {},
|
42
|
-
},
|
43
|
-
],
|
44
|
-
settings: [
|
45
|
-
{
|
46
|
-
name: 'showGridTracks',
|
47
|
-
type: Common.Settings.SettingType.BOOLEAN,
|
48
|
-
value: false,
|
49
|
-
title: 'Show grid tracks',
|
50
|
-
options: [
|
51
|
-
{
|
52
|
-
title: 'Show grid tracks',
|
53
|
-
value: true,
|
54
|
-
},
|
55
|
-
{
|
56
|
-
title: 'Do not show grid tracks',
|
57
|
-
value: false,
|
58
|
-
},
|
59
|
-
],
|
60
|
-
},
|
61
|
-
{
|
62
|
-
name: 'showGridBorders',
|
63
|
-
type: Common.Settings.SettingType.ENUM,
|
64
|
-
value: 'both',
|
65
|
-
title: 'Show grid borders',
|
66
|
-
options: [
|
67
|
-
{
|
68
|
-
title: 'Show grid borders',
|
69
|
-
value: 'both',
|
70
|
-
},
|
71
|
-
{
|
72
|
-
title: 'Do not show grid borders',
|
73
|
-
value: 'none',
|
74
|
-
},
|
75
|
-
],
|
76
|
-
},
|
77
|
-
],
|
78
|
-
};
|