chrome-devtools-frontend 1.0.1732697 → 1.0.1733843
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/front_end/core/host/AidaClientTypes.ts +5 -1
- package/front_end/core/host/AidaGcaTranslation.ts +29 -1
- package/front_end/core/platform/browser/HostRuntime.ts +5 -1
- package/front_end/design_system_tokens.css +5 -0
- package/front_end/generated/InspectorBackendCommands.ts +5 -5
- package/front_end/generated/SupportedCSSProperties.ts +6 -0
- package/front_end/generated/protocol.ts +29 -7
- package/front_end/models/ai_assistance/AiConversation.ts +1 -0
- package/front_end/models/ai_assistance/agents/AiAgent.ts +59 -6
- package/front_end/models/ai_assistance/agents/StylingAgent.snapshot.txt +2 -1
- package/front_end/models/web_mcp/WebMCPModel.ts +1 -1
- package/front_end/panels/ai_assistance/AiAssistancePanel.ts +35 -17
- package/front_end/panels/ai_assistance/components/chatMessage.css +1 -1
- package/front_end/panels/ai_assistance/components/exploreWidget.css +1 -1
- package/front_end/panels/application/backgroundServiceView.css +2 -2
- package/front_end/panels/application/deviceBoundSessionsView.css +1 -1
- package/front_end/panels/application/frameDetailsReportView.css +0 -4
- package/front_end/panels/application/resourcesPanel.css +0 -4
- package/front_end/panels/browser_debugger/XHRBreakpointsSidebarPane.ts +346 -286
- package/front_end/panels/common/CommentsOverlayWidget.ts +3 -2
- package/front_end/panels/console/consoleView.css +1 -1
- package/front_end/panels/elements/components/cssPropertyDocsView.css +1 -1
- package/front_end/panels/elements/components/stylePropertyEditor.css +1 -5
- package/front_end/panels/elements/layoutPane.css +1 -1
- package/front_end/panels/elements/stylesSidebarPane.css +3 -2
- package/front_end/panels/issues/issuesTree.css +4 -3
- package/front_end/panels/lighthouse/LighthousePanel.ts +16 -1
- package/front_end/panels/linear_memory_inspector/components/LinearMemoryHighlightChipList.ts +10 -6
- package/front_end/panels/linear_memory_inspector/components/linearMemoryHighlightChipList.css +1 -26
- package/front_end/panels/media/playerListView.css +3 -4
- package/front_end/panels/network/networkTimingTable.css +0 -4
- package/front_end/panels/profiler/ProfileFlameChartDataProvider.ts +114 -18
- package/front_end/panels/recorder/stepEditor.css +1 -1
- package/front_end/panels/search/searchResultsPane.css +1 -1
- package/front_end/panels/security/mainView.css +1 -1
- package/front_end/panels/settings/AISettingsTab.ts +1 -0
- package/front_end/panels/sources/NavigatorView.ts +120 -49
- package/front_end/panels/sources/components/HeadersView.css +2 -2
- package/front_end/panels/timeline/TimelinePanel.ts +24 -3
- package/front_end/panels/timeline/components/metricCard.css +1 -1
- package/front_end/panels/timeline/timelineMiniMap.css +1 -1
- package/front_end/panels/web_audio/WebAudioModel.ts +14 -5
- package/front_end/panels/web_audio/WebAudioView.ts +34 -1
- package/front_end/panels/web_audio/webAudio.css +17 -3
- package/front_end/panels/webauthn/webauthnPane.css +2 -4
- package/front_end/panels/whats_new/ReleaseNoteText.ts +19 -1
- package/front_end/panels/whats_new/ReleaseNoteView.ts +15 -1
- package/front_end/panels/whats_new/releaseNoteView.css +49 -0
- package/front_end/third_party/chromium/README.chromium +1 -1
- package/front_end/third_party/puppeteer-replay/README.chromium +9 -1
- package/front_end/third_party/puppeteer-replay/package/lib/main.d.ts +2 -2
- package/front_end/ui/components/markdown_view/codeBlock.css +1 -1
- package/front_end/ui/components/markdown_view/markdownView.css +1 -5
- package/front_end/ui/components/panel_introduction_steps/panelIntroductionSteps.css +1 -1
- package/front_end/ui/components/switch/switch.css +2 -1
- package/front_end/ui/legacy/TabbedPane.ts +1 -1
- package/front_end/ui/legacy/components/inline_editor/bezierEditor.css +10 -3
- package/front_end/ui/legacy/inspectorCommon.css +3 -2
- package/front_end/ui/legacy/listWidget.css +1 -1
- package/front_end/ui/legacy/reportView.css +1 -1
- package/front_end/ui/legacy/searchableView.css +2 -1
- package/front_end/ui/legacy/suggestBox.css +2 -1
- package/front_end/ui/legacy/tabbedPane.css +1 -1
- package/front_end/ui/visual_logging/KnownContextValues.ts +3 -0
- package/package.json +1 -1
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// Copyright 2015 The Chromium Authors
|
|
2
2
|
// Use of this source code is governed by a BSD-style license that can be
|
|
3
3
|
// found in the LICENSE file.
|
|
4
|
-
/* eslint-disable @devtools/no-imperative-dom-api */
|
|
5
4
|
|
|
6
5
|
import * as i18n from '../../core/i18n/i18n.js';
|
|
7
6
|
import * as Platform from '../../core/platform/platform.js';
|
|
@@ -9,12 +8,12 @@ import * as SDK from '../../core/sdk/sdk.js';
|
|
|
9
8
|
import * as Protocol from '../../generated/protocol.js';
|
|
10
9
|
import * as Buttons from '../../ui/components/buttons/buttons.js';
|
|
11
10
|
import * as UI from '../../ui/legacy/legacy.js';
|
|
12
|
-
import {Directives, html, render, type TemplateResult} from '../../ui/lit/lit.js';
|
|
11
|
+
import {Directives, html, nothing, render, type TemplateResult} from '../../ui/lit/lit.js';
|
|
13
12
|
import * as VisualLogging from '../../ui/visual_logging/visual_logging.js';
|
|
14
13
|
|
|
15
14
|
import xhrBreakpointsSidebarPaneStyles from './xhrBreakpointsSidebarPane.css.js';
|
|
16
15
|
|
|
17
|
-
const {classMap, ifDefined,
|
|
16
|
+
const {classMap, ifDefined, repeat} = Directives;
|
|
18
17
|
|
|
19
18
|
const UIStrings = {
|
|
20
19
|
/**
|
|
@@ -65,292 +64,261 @@ const UIStrings = {
|
|
|
65
64
|
} as const;
|
|
66
65
|
const str_ = i18n.i18n.registerUIStrings('panels/browser_debugger/XHRBreakpointsSidebarPane.ts', UIStrings);
|
|
67
66
|
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
|
68
|
-
const containerToBreakpointEntry = new WeakMap<Element, HTMLElement>();
|
|
69
67
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
readonly #breakpointElements: Map<string, Element>;
|
|
79
|
-
readonly #addButton: UI.Toolbar.ToolbarButton;
|
|
80
|
-
#hitBreakpoint?: string;
|
|
81
|
-
#editingBreakpoint: string|null = null;
|
|
82
|
-
|
|
83
|
-
private constructor() {
|
|
84
|
-
super({
|
|
85
|
-
jslog: `${VisualLogging.section('source.xhr-breakpoints')}`,
|
|
86
|
-
useShadowDom: true,
|
|
87
|
-
});
|
|
88
|
-
this.registerRequiredCSS(xhrBreakpointsSidebarPaneStyles);
|
|
89
|
-
|
|
90
|
-
this.#breakpoints = new UI.ListModel.ListModel();
|
|
91
|
-
this.#list = new UI.ListControl.ListControl(this.#breakpoints, this, UI.ListControl.ListMode.NonViewport);
|
|
92
|
-
this.contentElement.appendChild(this.#list.element);
|
|
93
|
-
this.#list.element.classList.add('breakpoint-list', 'hidden');
|
|
94
|
-
UI.ARIAUtils.markAsList(this.#list.element);
|
|
95
|
-
UI.ARIAUtils.setLabel(this.#list.element, i18nString(UIStrings.xhrfetchBreakpoints));
|
|
96
|
-
this.#emptyElement = this.contentElement.createChild('div', 'gray-info-message');
|
|
97
|
-
this.#emptyElement.textContent = i18nString(UIStrings.noBreakpoints);
|
|
98
|
-
|
|
99
|
-
this.#breakpointElements = new Map();
|
|
100
|
-
|
|
101
|
-
this.#addButton = new UI.Toolbar.ToolbarButton(
|
|
102
|
-
i18nString(UIStrings.addXhrfetchBreakpoint), 'plus', undefined, 'sources.add-xhr-fetch-breakpoint');
|
|
103
|
-
this.#addButton.setSize(Buttons.Button.Size.SMALL);
|
|
104
|
-
this.#addButton.addEventListener(UI.Toolbar.ToolbarButton.Events.CLICK, () => {
|
|
105
|
-
void this.addButtonClicked();
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
this.#emptyElement.addEventListener('contextmenu', this.emptyElementContextMenu.bind(this), true);
|
|
109
|
-
this.#emptyElement.tabIndex = -1;
|
|
110
|
-
this.restoreBreakpoints();
|
|
111
|
-
this.update();
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
static instance(): XHRBreakpointsSidebarPane {
|
|
115
|
-
if (!xhrBreakpointsSidebarPaneInstance) {
|
|
116
|
-
xhrBreakpointsSidebarPaneInstance = new XHRBreakpointsSidebarPane();
|
|
117
|
-
}
|
|
118
|
-
return xhrBreakpointsSidebarPaneInstance;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
static removeInstance(): void {
|
|
122
|
-
xhrBreakpointsSidebarPaneInstance = null;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
toolbarItems(): TemplateResult {
|
|
126
|
-
return html`${this.#addButton.element}`;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
get addButtonForTest(): UI.Toolbar.ToolbarButton {
|
|
130
|
-
return this.#addButton;
|
|
131
|
-
}
|
|
68
|
+
export interface BreakpointItem {
|
|
69
|
+
url: string;
|
|
70
|
+
enabled: boolean;
|
|
71
|
+
title: string;
|
|
72
|
+
isHit: boolean;
|
|
73
|
+
isFocused: boolean;
|
|
74
|
+
isEditing: boolean;
|
|
75
|
+
}
|
|
132
76
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
77
|
+
export interface ViewInput {
|
|
78
|
+
isAdding: boolean;
|
|
79
|
+
breakpoints: BreakpointItem[];
|
|
80
|
+
onAddCommit: (newUrl: string) => void;
|
|
81
|
+
onAddCancel: () => void;
|
|
82
|
+
onBreakpointClick: (url: string) => void;
|
|
83
|
+
onBreakpointCheckboxChange: (url: string) => void;
|
|
84
|
+
onBreakpointContextMenu: (url: string, event: Event) => void;
|
|
85
|
+
onBreakpointNavigate: (url: string, direction: 'ArrowUp'|'ArrowDown'|'Home'|'End') => void;
|
|
86
|
+
onStartEditing: (url: string) => void;
|
|
87
|
+
onEditCommit: (oldUrl: string, newUrl: string) => void;
|
|
88
|
+
onEditCancel: (url: string) => void;
|
|
89
|
+
onEmptyContextMenu: (event: Event) => void;
|
|
90
|
+
}
|
|
140
91
|
|
|
141
|
-
|
|
142
|
-
await UI.ViewManager.ViewManager.instance().showView('sources.xhr-breakpoints');
|
|
92
|
+
export type View = (input: ViewInput, output: undefined, target: HTMLElement|DocumentFragment) => void;
|
|
143
93
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
94
|
+
// clang-format off
|
|
95
|
+
export const DEFAULT_VIEW: View =
|
|
96
|
+
(input: ViewInput, _output: undefined, target: HTMLElement|DocumentFragment): void => {
|
|
97
|
+
const isEmpty = input.breakpoints.length === 0 && !input.isAdding;
|
|
148
98
|
|
|
99
|
+
const renderBreakpointItem = (item: BreakpointItem): TemplateResult => {
|
|
100
|
+
const isEditing = item.isEditing;
|
|
101
|
+
const isHit = item.isHit;
|
|
149
102
|
const commit = (e: UI.TextPrompt.TextPromptElement.CommitEvent): void => {
|
|
150
|
-
|
|
151
|
-
this.removeListElement(inputElementContainer);
|
|
152
|
-
SDK.DOMDebuggerModel.DOMDebuggerManager.instance().addXHRBreakpoint(newText, true);
|
|
153
|
-
this.setBreakpoint(newText);
|
|
154
|
-
this.update();
|
|
103
|
+
input.onEditCommit(item.url, e.detail);
|
|
155
104
|
};
|
|
156
|
-
|
|
157
105
|
const cancel = (): void => {
|
|
158
|
-
|
|
159
|
-
this.update();
|
|
106
|
+
input.onEditCancel(item.url);
|
|
160
107
|
};
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
class="breakpoint-condition-input"
|
|
173
|
-
@commit=${commit}
|
|
174
|
-
@cancel=${cancel}>
|
|
175
|
-
</devtools-prompt>
|
|
176
|
-
`,
|
|
177
|
-
inputElementContainer,
|
|
178
|
-
);
|
|
179
|
-
// clang-format on
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
heightForItem(_item: string): number {
|
|
183
|
-
return 0;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
isItemSelectable(_item: string): boolean {
|
|
187
|
-
return true;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
private setBreakpoint(breakKeyword: string): void {
|
|
191
|
-
if (this.#breakpoints.indexOf(breakKeyword) !== -1) {
|
|
192
|
-
this.#list.refreshItem(breakKeyword);
|
|
193
|
-
} else {
|
|
194
|
-
this.#breakpoints.insertWithComparator(breakKeyword, Platform.ArrayUtilities.DEFAULT_COMPARATOR);
|
|
195
|
-
}
|
|
196
|
-
if (!this.#list.selectedItem() || !this.hasFocus()) {
|
|
197
|
-
this.#list.selectItem(this.#breakpoints.at(0));
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
createElementForItem(item: string): Element {
|
|
202
|
-
const listItemElement = document.createElement('div');
|
|
203
|
-
UI.ARIAUtils.markAsListitem(listItemElement);
|
|
204
|
-
const enabled = SDK.DOMDebuggerModel.DOMDebuggerManager.instance().xhrBreakpoints().get(item) || false;
|
|
205
|
-
const title = item ? i18nString(UIStrings.urlContainsS, {PH1: item}) : i18nString(UIStrings.anyXhrOrFetch);
|
|
206
|
-
|
|
207
|
-
const commit = (e: UI.TextPrompt.TextPromptElement.CommitEvent): void => {
|
|
208
|
-
if (this.#editingBreakpoint !== item) {
|
|
209
|
-
return;
|
|
108
|
+
const onKeyDown = (event: KeyboardEvent): void => {
|
|
109
|
+
let handled = false;
|
|
110
|
+
if (event.key === ' ') {
|
|
111
|
+
input.onBreakpointCheckboxChange(item.url);
|
|
112
|
+
handled = true;
|
|
113
|
+
} else if ((event.key === 'Enter' && !event.isComposing) || event.key === 'F2') {
|
|
114
|
+
input.onStartEditing(item.url);
|
|
115
|
+
handled = true;
|
|
116
|
+
} else if (event.key === 'ArrowUp' || event.key === 'ArrowDown' || event.key === 'Home' || event.key === 'End') {
|
|
117
|
+
input.onBreakpointNavigate(item.url, event.key);
|
|
118
|
+
handled = true;
|
|
210
119
|
}
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
this.#removeBreakpoint(item);
|
|
214
|
-
this.#addBreakpoint(newText, enabled);
|
|
215
|
-
this.#list.selectItem(newText);
|
|
216
|
-
this.focus();
|
|
217
|
-
};
|
|
218
|
-
|
|
219
|
-
const cancel = (): void => {
|
|
220
|
-
if (this.#editingBreakpoint !== item) {
|
|
221
|
-
return;
|
|
120
|
+
if (handled) {
|
|
121
|
+
event.consume(true);
|
|
222
122
|
}
|
|
223
|
-
this.#editingBreakpoint = null;
|
|
224
|
-
this.#list.refreshItem(item);
|
|
225
|
-
this.focus();
|
|
226
123
|
};
|
|
227
124
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
125
|
+
return html`
|
|
126
|
+
<div role="listitem"
|
|
127
|
+
jslog=${VisualLogging.item().track({
|
|
128
|
+
click: true,
|
|
129
|
+
dblclick: true,
|
|
130
|
+
resize: true,
|
|
131
|
+
keydown: 'ArrowUp|ArrowDown|PageUp|PageDown|Enter|Space',
|
|
132
|
+
})}>
|
|
133
|
+
<div class=${classMap({'breakpoint-entry': true, 'breakpoint-hit': isHit})}
|
|
233
134
|
role="checkbox"
|
|
234
|
-
aria-checked=${enabled ? 'true' : 'false'}
|
|
235
|
-
aria-label=${title}
|
|
236
|
-
aria-description=${ifDefined(
|
|
237
|
-
tabindex=${item
|
|
238
|
-
?autofocus=${item
|
|
239
|
-
|
|
240
|
-
if (el instanceof HTMLElement) {
|
|
241
|
-
containerToBreakpointEntry.set(listItemElement, el);
|
|
242
|
-
this.#breakpointElements.set(item, listItemElement);
|
|
243
|
-
}
|
|
244
|
-
})}
|
|
245
|
-
@click=${(event: Event) => {
|
|
135
|
+
aria-checked=${item.enabled ? 'true' : 'false'}
|
|
136
|
+
aria-label=${item.title}
|
|
137
|
+
aria-description=${ifDefined(isHit ? i18nString(UIStrings.breakpointHit) : undefined)}
|
|
138
|
+
tabindex=${item.isFocused && !isEditing ? '0' : '-1'}
|
|
139
|
+
?autofocus=${item.isFocused && !isEditing && !input.isAdding}
|
|
140
|
+
@click=${(event: MouseEvent) => {
|
|
246
141
|
if (event.target === event.currentTarget) {
|
|
247
|
-
|
|
142
|
+
input.onBreakpointClick(item.url);
|
|
248
143
|
}
|
|
249
144
|
}}
|
|
250
|
-
@contextmenu=${(
|
|
251
|
-
@keydown=${
|
|
252
|
-
let handled = false;
|
|
253
|
-
if (event.key === ' ') {
|
|
254
|
-
this.checkboxClicked(item, enabled);
|
|
255
|
-
handled = true;
|
|
256
|
-
} else if (event.key === 'Enter') {
|
|
257
|
-
this.#startEditing(item);
|
|
258
|
-
handled = true;
|
|
259
|
-
}
|
|
260
|
-
if (handled) {
|
|
261
|
-
event.consume(true);
|
|
262
|
-
}
|
|
263
|
-
}}>
|
|
145
|
+
@contextmenu=${(event: Event) => input.onBreakpointContextMenu(item.url, event)}
|
|
146
|
+
@keydown=${onKeyDown}>
|
|
264
147
|
<devtools-checkbox
|
|
265
148
|
class="cursor-auto"
|
|
266
149
|
aria-hidden="true"
|
|
267
|
-
.checked=${enabled}
|
|
150
|
+
.checked=${item.enabled}
|
|
268
151
|
.small=${true}
|
|
269
|
-
.title=${title}
|
|
152
|
+
.title=${item.title}
|
|
270
153
|
@click=${(e: Event) => e.stopPropagation()}
|
|
271
|
-
@change=${() =>
|
|
272
|
-
@dblclick=${() =>
|
|
154
|
+
@change=${() => input.onBreakpointCheckboxChange(item.url)}
|
|
155
|
+
@dblclick=${() => input.onStartEditing(item.url)}
|
|
273
156
|
tabindex="-1"
|
|
274
157
|
jslog=${VisualLogging.toggle().track({click: true})}>
|
|
275
158
|
<devtools-prompt
|
|
276
|
-
value=${item}
|
|
159
|
+
value=${item.url}
|
|
277
160
|
render-as-block
|
|
278
|
-
?editing=${
|
|
279
|
-
|
|
280
|
-
|
|
161
|
+
?editing=${isEditing}
|
|
162
|
+
?autofocus=${isEditing}
|
|
163
|
+
aria-label=${item.url ? i18nString(UIStrings.urlBreakpoint) : i18nString(UIStrings.anyXhrOrFetch)}
|
|
164
|
+
class=${classMap({'breakpoint-condition-input': isEditing})}
|
|
281
165
|
jslog=${VisualLogging.value('condition').track({change: true})}
|
|
282
166
|
@commit=${commit}
|
|
283
167
|
@cancel=${cancel}>
|
|
284
|
-
${title}
|
|
168
|
+
${item.title}
|
|
285
169
|
</devtools-prompt>
|
|
286
170
|
</devtools-checkbox>
|
|
287
171
|
</div>
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
172
|
+
</div>
|
|
173
|
+
`;
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
render(
|
|
177
|
+
html`
|
|
178
|
+
<style>${xhrBreakpointsSidebarPaneStyles}</style>
|
|
179
|
+
<div class="breakpoint-list"
|
|
180
|
+
role="list"
|
|
181
|
+
aria-label=${i18nString(UIStrings.xhrfetchBreakpoints)}
|
|
182
|
+
?hidden=${isEmpty}>
|
|
183
|
+
${input.isAdding ? html`
|
|
184
|
+
<p class="breakpoint-condition" jslog=${VisualLogging.value('condition').track({change: true})}>
|
|
185
|
+
${i18nString(UIStrings.breakWhenUrlContains)}
|
|
186
|
+
<devtools-prompt
|
|
187
|
+
value=""
|
|
188
|
+
render-as-block
|
|
189
|
+
?editing=${true}
|
|
190
|
+
?autofocus=${true}
|
|
191
|
+
aria-label=${i18nString(UIStrings.urlBreakpoint)}
|
|
192
|
+
class="breakpoint-condition-input"
|
|
193
|
+
@commit=${(e: UI.TextPrompt.TextPromptElement.CommitEvent) => input.onAddCommit(e.detail)}
|
|
194
|
+
@cancel=${input.onAddCancel}>
|
|
195
|
+
</devtools-prompt>
|
|
196
|
+
</p>
|
|
197
|
+
` : nothing}
|
|
198
|
+
${repeat(input.breakpoints, item => item.url, renderBreakpointItem)}
|
|
199
|
+
</div>
|
|
200
|
+
<div class="gray-info-message"
|
|
201
|
+
tabindex="-1"
|
|
202
|
+
?autofocus=${isEmpty}
|
|
203
|
+
@contextmenu=${input.onEmptyContextMenu}
|
|
204
|
+
?hidden=${!isEmpty}>
|
|
205
|
+
${i18nString(UIStrings.noBreakpoints)}
|
|
206
|
+
</div>
|
|
207
|
+
`,
|
|
208
|
+
target,
|
|
209
|
+
{
|
|
210
|
+
container: {
|
|
211
|
+
attributes: {
|
|
212
|
+
jslog: `${VisualLogging.section('source.xhr-breakpoints')}`,
|
|
213
|
+
},
|
|
214
|
+
},
|
|
215
|
+
},
|
|
216
|
+
);
|
|
217
|
+
};
|
|
218
|
+
// clang-format on
|
|
219
|
+
|
|
220
|
+
let xhrBreakpointsSidebarPaneInstance: XHRBreakpointsSidebarPane|null = null;
|
|
221
|
+
|
|
222
|
+
export class XHRBreakpointsSidebarPane extends UI.Widget.VBox<ShadowRoot> implements
|
|
223
|
+
UI.ContextFlavorListener.ContextFlavorListener, UI.Toolbar.ItemsProvider {
|
|
224
|
+
readonly #breakpoints: string[] = [];
|
|
225
|
+
readonly #view: View;
|
|
226
|
+
#hitBreakpoint?: string;
|
|
227
|
+
#editingBreakpoint: string|null = null;
|
|
228
|
+
#focusedBreakpoint: string|null = null;
|
|
229
|
+
#isAddingBreakpoint = false;
|
|
230
|
+
|
|
231
|
+
constructor(view: View = DEFAULT_VIEW) {
|
|
232
|
+
super({
|
|
233
|
+
useShadowDom: 'pure',
|
|
234
|
+
delegatesFocus: true,
|
|
235
|
+
});
|
|
236
|
+
this.#view = view;
|
|
237
|
+
|
|
238
|
+
this.#restoreBreakpoints();
|
|
239
|
+
this.update();
|
|
240
|
+
this.performUpdate();
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
static instance(opts: {forceNew: boolean|null, view?: View} = {forceNew: null}): XHRBreakpointsSidebarPane {
|
|
244
|
+
const {forceNew, view} = opts;
|
|
245
|
+
if (!xhrBreakpointsSidebarPaneInstance || forceNew) {
|
|
246
|
+
xhrBreakpointsSidebarPaneInstance = new XHRBreakpointsSidebarPane(view);
|
|
247
|
+
}
|
|
248
|
+
return xhrBreakpointsSidebarPaneInstance;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
static removeInstance(): void {
|
|
252
|
+
xhrBreakpointsSidebarPaneInstance = null;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
toolbarItems(): TemplateResult {
|
|
256
|
+
// clang-format off
|
|
257
|
+
return html`
|
|
258
|
+
<devtools-button .data=${{
|
|
259
|
+
variant: Buttons.Button.Variant.TOOLBAR,
|
|
260
|
+
iconName: 'plus',
|
|
261
|
+
size: Buttons.Button.Size.SMALL,
|
|
262
|
+
title: i18nString(UIStrings.addXhrfetchBreakpoint),
|
|
263
|
+
jslogContext: 'sources.add-xhr-fetch-breakpoint',
|
|
264
|
+
} as Buttons.Button.ButtonData}
|
|
265
|
+
@click=${() => {
|
|
266
|
+
void this.addButtonClicked();
|
|
267
|
+
}}></devtools-button>
|
|
268
|
+
`;
|
|
291
269
|
// clang-format on
|
|
270
|
+
}
|
|
292
271
|
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
keydown: 'ArrowUp|ArrowDown|PageUp|PageDown|Enter|Space',
|
|
298
|
-
})}`);
|
|
299
|
-
return listItemElement;
|
|
272
|
+
async addButtonClicked(): Promise<void> {
|
|
273
|
+
this.#isAddingBreakpoint = true;
|
|
274
|
+
this.performUpdate();
|
|
275
|
+
await UI.ViewManager.ViewManager.instance().showView('sources.xhr-breakpoints');
|
|
300
276
|
}
|
|
301
277
|
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
const breakpointEntryElement = containerToBreakpointEntry.get(fromElement);
|
|
306
|
-
if (!breakpointEntryElement) {
|
|
307
|
-
throw new Error('Expected breakpoint entry to be found for an element');
|
|
308
|
-
}
|
|
309
|
-
breakpointEntryElement.tabIndex = -1;
|
|
278
|
+
setBreakpoint(breakKeyword: string, enabled?: boolean): void {
|
|
279
|
+
if (enabled !== undefined) {
|
|
280
|
+
SDK.DOMDebuggerModel.DOMDebuggerManager.instance().addXHRBreakpoint(breakKeyword, enabled);
|
|
310
281
|
}
|
|
311
|
-
if (
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
throw new Error('Expected breakpoint entry to be found for an element');
|
|
315
|
-
}
|
|
316
|
-
const prompt =
|
|
317
|
-
_to === this.#editingBreakpoint ? toElement.querySelector('devtools-prompt') as HTMLElement | null : null;
|
|
318
|
-
this.setDefaultFocusedElement(prompt || breakpointEntryElement);
|
|
319
|
-
breakpointEntryElement.tabIndex = 0;
|
|
320
|
-
if (this.hasFocus()) {
|
|
321
|
-
if (prompt) {
|
|
322
|
-
prompt.focus();
|
|
323
|
-
return;
|
|
324
|
-
}
|
|
325
|
-
breakpointEntryElement.focus();
|
|
326
|
-
}
|
|
282
|
+
if (!this.#breakpoints.includes(breakKeyword)) {
|
|
283
|
+
this.#breakpoints.push(breakKeyword);
|
|
284
|
+
this.#breakpoints.sort(Platform.ArrayUtilities.DEFAULT_COMPARATOR);
|
|
327
285
|
}
|
|
286
|
+
this.#synchronizeFocusedBreakpoint();
|
|
287
|
+
this.performUpdate();
|
|
328
288
|
}
|
|
329
289
|
|
|
330
|
-
|
|
331
|
-
|
|
290
|
+
#restoreBreakpoints(): void {
|
|
291
|
+
const breakpoints = SDK.DOMDebuggerModel.DOMDebuggerManager.instance().xhrBreakpoints();
|
|
292
|
+
for (const url of breakpoints.keys()) {
|
|
293
|
+
if (!this.#breakpoints.includes(url)) {
|
|
294
|
+
this.#breakpoints.push(url);
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
this.#breakpoints.sort(Platform.ArrayUtilities.DEFAULT_COMPARATOR);
|
|
298
|
+
this.#synchronizeFocusedBreakpoint();
|
|
332
299
|
}
|
|
333
300
|
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
if (index >= 0) {
|
|
337
|
-
this.#breakpoints.remove(index);
|
|
338
|
-
}
|
|
339
|
-
this.#breakpointElements.delete(breakKeyword);
|
|
340
|
-
this.update();
|
|
301
|
+
get focusedBreakpoint(): string|null {
|
|
302
|
+
return this.#focusedBreakpoint;
|
|
341
303
|
}
|
|
342
304
|
|
|
343
|
-
|
|
344
|
-
this.#
|
|
345
|
-
|
|
346
|
-
|
|
305
|
+
set focusedBreakpoint(url: string|null) {
|
|
306
|
+
if (this.#focusedBreakpoint === url) {
|
|
307
|
+
return;
|
|
308
|
+
}
|
|
309
|
+
this.#focusedBreakpoint = url;
|
|
310
|
+
this.#synchronizeFocusedBreakpoint();
|
|
311
|
+
this.requestUpdate();
|
|
347
312
|
}
|
|
348
313
|
|
|
349
|
-
|
|
350
|
-
this.#
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
314
|
+
#synchronizeFocusedBreakpoint(): void {
|
|
315
|
+
if (this.#focusedBreakpoint && !this.#breakpoints.includes(this.#focusedBreakpoint)) {
|
|
316
|
+
this.#focusedBreakpoint = null;
|
|
317
|
+
}
|
|
318
|
+
if (!this.#focusedBreakpoint && this.#breakpoints.length > 0) {
|
|
319
|
+
this.#focusedBreakpoint = (this.#hitBreakpoint && this.#breakpoints.includes(this.#hitBreakpoint)) ?
|
|
320
|
+
this.#hitBreakpoint :
|
|
321
|
+
this.#breakpoints[0];
|
|
354
322
|
}
|
|
355
323
|
}
|
|
356
324
|
|
|
@@ -361,83 +329,175 @@ export class XHRBreakpointsSidebarPane extends UI.Widget.VBox implements UI.Cont
|
|
|
361
329
|
|
|
362
330
|
#removeBreakpoint(url: string): void {
|
|
363
331
|
SDK.DOMDebuggerModel.DOMDebuggerManager.instance().removeXHRBreakpoint(url);
|
|
364
|
-
this.
|
|
332
|
+
const index = this.#breakpoints.indexOf(url);
|
|
333
|
+
if (index >= 0) {
|
|
334
|
+
this.#breakpoints.splice(index, 1);
|
|
335
|
+
}
|
|
336
|
+
this.#synchronizeFocusedBreakpoint();
|
|
337
|
+
this.performUpdate();
|
|
365
338
|
}
|
|
366
339
|
|
|
367
340
|
#removeAllBreakpoints(): void {
|
|
368
|
-
for (const url of this.#
|
|
341
|
+
for (const url of [...this.#breakpoints]) {
|
|
369
342
|
this.#removeBreakpoint(url);
|
|
370
343
|
}
|
|
371
|
-
this.update();
|
|
372
344
|
}
|
|
373
345
|
|
|
374
|
-
#toggleBreakpoint(url: string
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
346
|
+
#toggleBreakpoint(url: string): void {
|
|
347
|
+
const hadFocus = this.hasFocus();
|
|
348
|
+
const current = SDK.DOMDebuggerModel.DOMDebuggerManager.instance().xhrBreakpoints().get(url) ?? false;
|
|
349
|
+
SDK.DOMDebuggerModel.DOMDebuggerManager.instance().toggleXHRBreakpoint(url, !current);
|
|
350
|
+
this.#focusedBreakpoint = url;
|
|
351
|
+
this.performUpdate();
|
|
352
|
+
if (hadFocus) {
|
|
353
|
+
this.focus();
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
#startEditing(url: string): void {
|
|
358
|
+
this.#editingBreakpoint = url;
|
|
359
|
+
this.#focusedBreakpoint = url;
|
|
360
|
+
this.performUpdate();
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
#onBreakpointNavigate(url: string, direction: 'ArrowUp'|'ArrowDown'|'Home'|'End'): void {
|
|
364
|
+
const index = this.#breakpoints.indexOf(url);
|
|
365
|
+
let newIndex = index;
|
|
366
|
+
if (direction === 'ArrowUp') {
|
|
367
|
+
newIndex = Math.max(0, index - 1);
|
|
368
|
+
} else if (direction === 'ArrowDown') {
|
|
369
|
+
newIndex = Math.min(this.#breakpoints.length - 1, index + 1);
|
|
370
|
+
} else if (direction === 'Home') {
|
|
371
|
+
newIndex = 0;
|
|
372
|
+
} else if (direction === 'End') {
|
|
373
|
+
newIndex = this.#breakpoints.length - 1;
|
|
374
|
+
}
|
|
375
|
+
if (newIndex >= 0 && newIndex < this.#breakpoints.length) {
|
|
376
|
+
this.focusedBreakpoint = this.#breakpoints[newIndex];
|
|
377
|
+
void this.updateComplete.then(() => {
|
|
378
|
+
const entry = this.contentElement.querySelectorAll<HTMLElement>('.breakpoint-entry')[newIndex];
|
|
379
|
+
entry?.focus();
|
|
380
|
+
entry?.scrollIntoView({block: 'nearest'});
|
|
381
|
+
});
|
|
382
|
+
}
|
|
378
383
|
}
|
|
379
384
|
|
|
380
|
-
|
|
385
|
+
#onBreakpointContextMenu(url: string, event: Event): void {
|
|
386
|
+
this.#focusedBreakpoint = url;
|
|
381
387
|
const contextMenu = new UI.ContextMenu.ContextMenu(event);
|
|
382
388
|
const removeAllTitle = i18nString(UIStrings.removeAllBreakpoints);
|
|
383
389
|
|
|
384
|
-
contextMenu.defaultSection().appendItem(
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
contextMenu.defaultSection().appendItem(i18nString(UIStrings.removeBreakpoint),
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
contextMenu.defaultSection().appendItem(removeAllTitle,
|
|
391
|
-
|
|
390
|
+
contextMenu.defaultSection().appendItem(i18nString(UIStrings.addBreakpoint), () => {
|
|
391
|
+
void this.addButtonClicked();
|
|
392
|
+
}, {jslogContext: 'sources.add-xhr-fetch-breakpoint'});
|
|
393
|
+
contextMenu.defaultSection().appendItem(i18nString(UIStrings.removeBreakpoint), () => {
|
|
394
|
+
this.#removeBreakpoint(url);
|
|
395
|
+
}, {jslogContext: 'sources.remove-xhr-fetch-breakpoint'});
|
|
396
|
+
contextMenu.defaultSection().appendItem(removeAllTitle, () => {
|
|
397
|
+
this.#removeAllBreakpoints();
|
|
398
|
+
}, {jslogContext: 'sources.remove-all-xhr-fetch-breakpoints'});
|
|
392
399
|
void contextMenu.show();
|
|
393
400
|
}
|
|
394
401
|
|
|
395
|
-
|
|
396
|
-
const
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
402
|
+
#onEmptyContextMenu(event: Event): void {
|
|
403
|
+
const contextMenu = new UI.ContextMenu.ContextMenu(event);
|
|
404
|
+
contextMenu.defaultSection().appendItem(i18nString(UIStrings.addBreakpoint), () => {
|
|
405
|
+
void this.addButtonClicked();
|
|
406
|
+
}, {jslogContext: 'sources.add-xhr-fetch-breakpoint'});
|
|
407
|
+
void contextMenu.show();
|
|
401
408
|
}
|
|
402
409
|
|
|
403
|
-
|
|
404
|
-
this
|
|
405
|
-
this.#list.refreshItem(item);
|
|
410
|
+
flavorChanged(_object: Object|null): void {
|
|
411
|
+
this.update();
|
|
406
412
|
}
|
|
407
413
|
|
|
408
|
-
|
|
414
|
+
override wasShown(): void {
|
|
415
|
+
super.wasShown();
|
|
409
416
|
this.update();
|
|
417
|
+
this.performUpdate();
|
|
410
418
|
}
|
|
411
419
|
|
|
412
420
|
update(): void {
|
|
413
|
-
const isEmpty = this.#breakpoints.length === 0;
|
|
414
|
-
this.#list.element.classList.toggle('hidden', isEmpty);
|
|
415
|
-
this.#emptyElement.classList.toggle('hidden', !isEmpty);
|
|
416
|
-
|
|
417
421
|
const details = UI.Context.Context.instance().flavor(SDK.DebuggerModel.DebuggerPausedDetails);
|
|
418
422
|
if (!details || details.reason !== Protocol.Debugger.PausedEventReason.XHR) {
|
|
419
423
|
if (this.#hitBreakpoint) {
|
|
420
|
-
const oldHitBreakpoint = this.#hitBreakpoint;
|
|
421
424
|
this.#hitBreakpoint = undefined;
|
|
422
|
-
|
|
423
|
-
this.#list.refreshItem(oldHitBreakpoint);
|
|
424
|
-
}
|
|
425
|
+
this.performUpdate();
|
|
425
426
|
}
|
|
426
427
|
return;
|
|
427
428
|
}
|
|
428
429
|
const url = details.auxData?.['breakpointURL'];
|
|
429
430
|
this.#hitBreakpoint = url;
|
|
430
|
-
if (this.#breakpoints.
|
|
431
|
-
|
|
431
|
+
if (this.#breakpoints.includes(url)) {
|
|
432
|
+
void UI.ViewManager.ViewManager.instance().showView('sources.xhr-breakpoints');
|
|
432
433
|
}
|
|
433
|
-
this
|
|
434
|
-
void UI.ViewManager.ViewManager.instance().showView('sources.xhr-breakpoints');
|
|
434
|
+
this.performUpdate();
|
|
435
435
|
}
|
|
436
436
|
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
437
|
+
override performUpdate(): void {
|
|
438
|
+
this.#synchronizeFocusedBreakpoint();
|
|
439
|
+
const xhrBreakpoints = SDK.DOMDebuggerModel.DOMDebuggerManager.instance().xhrBreakpoints();
|
|
440
|
+
const breakpointItems: BreakpointItem[] = this.#breakpoints.map(url => {
|
|
441
|
+
const enabled = xhrBreakpoints.get(url) ?? false;
|
|
442
|
+
const title = url ? i18nString(UIStrings.urlContainsS, {PH1: url}) : i18nString(UIStrings.anyXhrOrFetch);
|
|
443
|
+
return {
|
|
444
|
+
url,
|
|
445
|
+
enabled,
|
|
446
|
+
title,
|
|
447
|
+
isHit: url === this.#hitBreakpoint,
|
|
448
|
+
isFocused: url === this.#focusedBreakpoint,
|
|
449
|
+
isEditing: url === this.#editingBreakpoint,
|
|
450
|
+
};
|
|
451
|
+
});
|
|
452
|
+
|
|
453
|
+
const viewInput: ViewInput = {
|
|
454
|
+
isAdding: this.#isAddingBreakpoint,
|
|
455
|
+
breakpoints: breakpointItems,
|
|
456
|
+
onAddCommit: (newUrl: string) => {
|
|
457
|
+
this.#isAddingBreakpoint = false;
|
|
458
|
+
this.#addBreakpoint(newUrl, true);
|
|
459
|
+
this.focusedBreakpoint = newUrl;
|
|
460
|
+
this.performUpdate();
|
|
461
|
+
},
|
|
462
|
+
onAddCancel: () => {
|
|
463
|
+
this.#isAddingBreakpoint = false;
|
|
464
|
+
this.performUpdate();
|
|
465
|
+
},
|
|
466
|
+
onBreakpointClick: (url: string) => {
|
|
467
|
+
this.focusedBreakpoint = url;
|
|
468
|
+
this.#toggleBreakpoint(url);
|
|
469
|
+
},
|
|
470
|
+
onBreakpointCheckboxChange: (url: string) => {
|
|
471
|
+
this.#toggleBreakpoint(url);
|
|
472
|
+
},
|
|
473
|
+
onBreakpointContextMenu: (url: string, event: Event) => {
|
|
474
|
+
this.#onBreakpointContextMenu(url, event);
|
|
475
|
+
},
|
|
476
|
+
onBreakpointNavigate: (url: string, direction: 'ArrowUp'|'ArrowDown'|'Home'|'End') => {
|
|
477
|
+
this.#onBreakpointNavigate(url, direction);
|
|
478
|
+
},
|
|
479
|
+
onStartEditing: (url: string) => {
|
|
480
|
+
this.#startEditing(url);
|
|
481
|
+
},
|
|
482
|
+
onEditCommit: (oldUrl: string, newUrl: string) => {
|
|
483
|
+
this.#editingBreakpoint = null;
|
|
484
|
+
const enabled = SDK.DOMDebuggerModel.DOMDebuggerManager.instance().xhrBreakpoints().get(oldUrl) ?? true;
|
|
485
|
+
this.#removeBreakpoint(oldUrl);
|
|
486
|
+
this.#addBreakpoint(newUrl, enabled);
|
|
487
|
+
this.#focusedBreakpoint = newUrl;
|
|
488
|
+
this.performUpdate();
|
|
489
|
+
this.focus();
|
|
490
|
+
},
|
|
491
|
+
onEditCancel: (_url: string) => {
|
|
492
|
+
this.#editingBreakpoint = null;
|
|
493
|
+
this.performUpdate();
|
|
494
|
+
this.focus();
|
|
495
|
+
},
|
|
496
|
+
onEmptyContextMenu: (event: Event) => {
|
|
497
|
+
this.#onEmptyContextMenu(event);
|
|
498
|
+
},
|
|
499
|
+
};
|
|
500
|
+
|
|
501
|
+
this.#view(viewInput, undefined, this.contentElement);
|
|
442
502
|
}
|
|
443
503
|
}
|