chrome-devtools-frontend 1.0.1696961 → 1.0.1697595

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.
Files changed (94) hide show
  1. package/.geminiignore +0 -1
  2. package/front_end/core/common/Color.ts +5 -2
  3. package/front_end/core/host/InspectorFrontendHostAPI.ts +16 -3
  4. package/front_end/core/host/InspectorFrontendHostStub.ts +3 -2
  5. package/front_end/core/host/ResourceLoader.ts +1 -2
  6. package/front_end/core/platform/api/HostRuntime.ts +1 -0
  7. package/front_end/core/platform/browser/HostRuntime.ts +4 -0
  8. package/front_end/core/platform/node/HostRuntime.ts +5 -0
  9. package/front_end/core/root/Runtime.ts +5 -0
  10. package/front_end/core/sdk/DOMModel.ts +13 -0
  11. package/front_end/core/sdk/SourceMapScopeChainEntry.ts +9 -6
  12. package/front_end/core/sdk/SourceMapScopesInfo.ts +3 -1
  13. package/front_end/foundation/Universe.ts +8 -0
  14. package/front_end/generated/InspectorBackendCommands.ts +3 -0
  15. package/front_end/generated/protocol-mapping.d.ts +19 -0
  16. package/front_end/generated/protocol-proxy-api.d.ts +15 -0
  17. package/front_end/generated/protocol.ts +35 -0
  18. package/front_end/models/ai_assistance/AiAgent2.ts +20 -18
  19. package/front_end/models/ai_assistance/AiConversation.ts +38 -12
  20. package/front_end/models/ai_assistance/agents/AccessibilityAgent.ts +9 -2
  21. package/front_end/models/ai_assistance/agents/StylingAgent.ts +13 -4
  22. package/front_end/models/ai_assistance/tools/CookieUtils.ts +10 -8
  23. package/front_end/models/ai_assistance/tools/ExecuteJavaScript.ts +1 -1
  24. package/front_end/models/ai_assistance/tools/GetElementAccessibilityDetails.ts +1 -3
  25. package/front_end/models/ai_assistance/tools/GetNetworkRequestDetails.ts +9 -8
  26. package/front_end/models/ai_assistance/tools/GetSourceContent.ts +5 -6
  27. package/front_end/models/ai_assistance/tools/GetStorageValues.ts +6 -25
  28. package/front_end/models/ai_assistance/tools/GetStyles.ts +1 -3
  29. package/front_end/models/ai_assistance/tools/ListNetworkRequests.ts +7 -6
  30. package/front_end/models/ai_assistance/tools/ListPageOrigins.ts +8 -5
  31. package/front_end/models/ai_assistance/tools/ListSources.ts +8 -10
  32. package/front_end/models/ai_assistance/tools/ListStorageKeys.ts +6 -25
  33. package/front_end/models/ai_assistance/tools/README.md +5 -3
  34. package/front_end/models/ai_assistance/tools/ResolveDevtoolsNodePath.ts +1 -2
  35. package/front_end/models/ai_assistance/tools/Tool.ts +52 -14
  36. package/front_end/models/change_tracker/ChangeTracker.ts +89 -0
  37. package/front_end/models/change_tracker/change_tracker.ts +9 -0
  38. package/front_end/models/issues_manager/MarkdownIssueDescription.ts +2 -2
  39. package/front_end/models/live-metrics/LiveMetrics.ts +1 -2
  40. package/front_end/models/trace/ModelImpl.ts +0 -6
  41. package/front_end/models/trace/Processor.ts +4 -7
  42. package/front_end/models/trace/helpers/Timing.ts +2 -1
  43. package/front_end/models/trace/types/Overlays.ts +12 -1
  44. package/front_end/panels/accessibility/AccessibilityAnnouncementRecordingView.ts +67 -19
  45. package/front_end/panels/application/IndexedDBViews.ts +1 -1
  46. package/front_end/panels/elements/DOMTreeContextMenu.ts +16 -23
  47. package/front_end/panels/elements/ElementsTreeElement.ts +286 -59
  48. package/front_end/panels/elements/ElementsTreeOutline.ts +273 -42
  49. package/front_end/panels/network/NetworkPanel.ts +137 -52
  50. package/front_end/panels/network/RequestHeadersView.ts +65 -32
  51. package/front_end/panels/network/components/RequestHeadersView.css +7 -1
  52. package/front_end/panels/network/forward/BackendLinking.ts +49 -0
  53. package/front_end/panels/network/forward/forward.ts +2 -0
  54. package/front_end/panels/settings/BackendLinkingSettingsTab.ts +303 -0
  55. package/front_end/panels/settings/backendLinkingSettingsTab.css +78 -0
  56. package/front_end/panels/settings/settings-meta.ts +25 -0
  57. package/front_end/panels/settings/settings.ts +2 -0
  58. package/front_end/panels/timeline/README.md +3 -2
  59. package/front_end/panels/timeline/TimelineFlameChartView.ts +23 -2
  60. package/front_end/panels/timeline/overlays/OverlaysImpl.ts +64 -4
  61. package/front_end/panels/timeline/timelineFlameChartView.css +47 -0
  62. package/front_end/panels/whats_new/ReleaseNoteText.ts +8 -8
  63. package/front_end/panels/whats_new/resources/WNDT.md +6 -6
  64. package/front_end/third_party/chromium/README.chromium +1 -1
  65. package/front_end/third_party/puppeteer/README.chromium +2 -2
  66. package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.d.ts +6 -0
  67. package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.js +5 -8
  68. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Coverage.d.ts +6 -0
  69. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Coverage.d.ts.map +1 -1
  70. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Coverage.js.map +1 -1
  71. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/ScreenRecording.d.ts.map +1 -1
  72. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/ScreenRecording.js +1 -5
  73. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/ScreenRecording.js.map +1 -1
  74. package/front_end/third_party/puppeteer/package/lib/puppeteer/revisions.d.ts +3 -3
  75. package/front_end/third_party/puppeteer/package/lib/puppeteer/revisions.js +3 -3
  76. package/front_end/third_party/puppeteer/package/lib/puppeteer/revisions.js.map +1 -1
  77. package/front_end/third_party/puppeteer/package/lib/puppeteer/util/version.d.ts +1 -1
  78. package/front_end/third_party/puppeteer/package/lib/puppeteer/util/version.js +1 -1
  79. package/front_end/third_party/puppeteer/package/lib/types.d.ts +6 -0
  80. package/front_end/third_party/puppeteer/package/package.json +2 -2
  81. package/front_end/third_party/puppeteer/package/src/cdp/Coverage.ts +6 -0
  82. package/front_end/third_party/puppeteer/package/src/cdp/ScreenRecording.ts +3 -7
  83. package/front_end/third_party/puppeteer/package/src/revisions.ts +3 -3
  84. package/front_end/third_party/puppeteer/package/src/util/version.ts +1 -1
  85. package/front_end/third_party/web-vitals/README.chromium +2 -2
  86. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onINP.js +8 -5
  87. package/front_end/third_party/web-vitals/package/package.json +1 -1
  88. package/front_end/third_party/web-vitals/package/src/attribution/onINP.ts +8 -4
  89. package/front_end/third_party/web-vitals/rebuild.sh +2 -2
  90. package/front_end/ui/legacy/ContextMenu.ts +19 -0
  91. package/front_end/ui/legacy/SoftContextMenu.ts +6 -0
  92. package/front_end/ui/legacy/components/perf_ui/FlameChart.ts +62 -22
  93. package/front_end/ui/visual_logging/KnownContextValues.ts +4 -0
  94. package/package.json +5 -4
@@ -0,0 +1,303 @@
1
+ // Copyright 2026 The Chromium Authors
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 '../../ui/legacy/components/data_grid/data_grid.js';
6
+
7
+ import * as Common from '../../core/common/common.js';
8
+ import * as i18n from '../../core/i18n/i18n.js';
9
+ import * as UI from '../../ui/legacy/legacy.js';
10
+ import {Directives, html, nothing, render} from '../../ui/lit/lit.js';
11
+ import * as VisualLogging from '../../ui/visual_logging/visual_logging.js';
12
+ import * as NetworkForward from '../network/forward/forward.js';
13
+
14
+ import backendLinkingSettingsTabStyles from './backendLinkingSettingsTab.css.js';
15
+
16
+ const {ifDefined} = Directives;
17
+
18
+ const UIStrings = {
19
+ /**
20
+ * @description Title for the backend linking settings tab card in DevTools Settings.
21
+ */
22
+ rulesSectionHeading: 'Backend linking rules',
23
+ /**
24
+ * @description Title for the backend linking settings tab card in DevTools Settings.
25
+ */
26
+ placeholderDocHeading: 'Available placeholders',
27
+ /**
28
+ * @description Description explaining what backend linking rules do.
29
+ */
30
+ description:
31
+ 'Configure links to external backend debugging, APM, or tracing tools for matching network requests. Use placeholders to insert correlation IDs extracted from request and response headers.',
32
+ /**
33
+ * @description Header column title in the backend linking rules table for the URL pattern.
34
+ */
35
+ urlPatternColumn: 'URL pattern',
36
+ /**
37
+ * @description Header column title in the backend linking rules table for the target URL template.
38
+ */
39
+ targetUrlTemplateColumn: 'Target URL template',
40
+ /**
41
+ * @description Header column title in the backend linking rules table for the label.
42
+ */
43
+ labelColumn: 'Label',
44
+ /**
45
+ * @description Header column title in the placeholder reference table.
46
+ */
47
+ placeholderColumn: 'Placeholder',
48
+ /**
49
+ * @description Header source column title in the placeholder reference table.
50
+ */
51
+ headerColumn: 'Referenced header / property',
52
+ /**
53
+ * @description Description of the devtoolsDebugId placeholder. The placeholder values will always be `desc`, `devtools-debug-id`, and `Server-Timing`.
54
+ */
55
+ devtoolsDebugIdDescription: 'Value of the `desc` parameter in the `devtools-debug-id` `Server-Timing` entry',
56
+ /**
57
+ * @description Description of the requestId placeholder. The placeholder value will always be `X-Request-ID`.
58
+ */
59
+ requestIdDescription: 'Value of the `X-Request-ID` response header',
60
+ /**
61
+ * @description Description of the correlationId placeholder. The placeholder values will always be `X-Correlation-ID` and `Correlation-ID`.
62
+ */
63
+ correlationIdDescription: 'Value of the `X-Correlation-ID` or `Correlation-ID` response header',
64
+ /**
65
+ * @description Description of the traceId placeholder. The placeholder values will always be `trace-id`, `Server-Timing`, and `traceparent`.
66
+ */
67
+ traceIdDescription: '16-byte hex trace ID from the `trace-id` response header or `Server-Timing` `traceparent` entry',
68
+ /**
69
+ * @description Description of the spanId placeholder. The placeholder values will always be `Server-Timing` and `traceparent`.
70
+ */
71
+ spanIdDescription: '8-byte hex parent span ID from the `Server-Timing` `traceparent` entry',
72
+ /**
73
+ * @description Error message in the backend linking settings tab when the URL pattern is empty.
74
+ */
75
+ urlPatternCannotBeEmpty: 'URL pattern can’t be empty',
76
+ /**
77
+ * @description Error message in the backend linking settings tab when the URL pattern is invalid.
78
+ */
79
+ invalidUrlPattern: 'URL pattern must be a valid URL pattern',
80
+ /**
81
+ * @description Error message in the backend linking settings tab when the target URL template is empty.
82
+ */
83
+ targetUrlTemplateCannotBeEmpty: 'Target URL template can’t be empty',
84
+ /**
85
+ * @description Error message in the backend linking settings tab when the target URL template does not contain a
86
+ * placeholder.
87
+ */
88
+ templateRequiresPlaceholder: 'Target URL template must contain at least one placeholder',
89
+ /**
90
+ * @description Error message in the backend linking settings tab when the label is empty.
91
+ */
92
+ labelCannotBeEmpty: 'Label can’t be empty',
93
+ /**
94
+ * @description Warning message displayed below the backend linking rules table when one or more rules are invalid.
95
+ */
96
+ invalidRulesWarning: 'Invalid rules will not be applied or saved.',
97
+ } as const;
98
+
99
+ const str_ = i18n.i18n.registerUIStrings('panels/settings/BackendLinkingSettingsTab.ts', UIStrings);
100
+ const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
101
+
102
+ function validPattern(urlPattern: string): boolean {
103
+ try {
104
+ new URLPattern(urlPattern);
105
+ return true;
106
+ } catch {
107
+ return false;
108
+ }
109
+ }
110
+
111
+ function hasPlaceholder(targetUrlTemplate: string): boolean {
112
+ return NetworkForward.BackendLinking.BACKEND_LINKING_PLACEHOLDERS.some(placeholder =>
113
+ targetUrlTemplate.includes(placeholder));
114
+ }
115
+
116
+ function isRuleValid(rule: NetworkForward.BackendLinking.BackendLinkingRule): boolean {
117
+ return Boolean(rule.urlPattern) && validPattern(rule.urlPattern) && Boolean(rule.targetUrlTemplate) &&
118
+ hasPlaceholder(rule.targetUrlTemplate) && Boolean(rule.label);
119
+ }
120
+
121
+ export interface ViewInput {
122
+ rules: NetworkForward.BackendLinking.BackendLinkingRule[];
123
+ onAddRule: (rule: NetworkForward.BackendLinking.BackendLinkingRule) => void;
124
+ onUpdateRule: (oldRule: NetworkForward.BackendLinking.BackendLinkingRule,
125
+ newRule: NetworkForward.BackendLinking.BackendLinkingRule) => void;
126
+ onDeleteRule: (rule: NetworkForward.BackendLinking.BackendLinkingRule) => void;
127
+ }
128
+ export type View = (input: ViewInput, output: object, target: HTMLElement) => void;
129
+ export const DEFAULT_VIEW: View = (input, output, target) => {
130
+ const onCreate = (event: CustomEvent<{urlPattern?: string, targetUrlTemplate?: string, label?: string}>): void => {
131
+ const data = event.detail;
132
+ const urlPattern = data.urlPattern?.trim();
133
+ const targetUrlTemplate = data.targetUrlTemplate?.trim();
134
+ const label = data.label?.trim();
135
+ if (!urlPattern && !targetUrlTemplate && !label) {
136
+ return;
137
+ }
138
+ input.onAddRule({
139
+ urlPattern: urlPattern ?? '',
140
+ targetUrlTemplate: targetUrlTemplate ?? '',
141
+ label: label ?? '',
142
+ });
143
+ };
144
+
145
+ const onEdit = (rule: NetworkForward.BackendLinking.BackendLinkingRule,
146
+ event: CustomEvent<{columnId: string, valueBeforeEditing: string, newText: string}>): void => {
147
+ const {columnId, newText} = event.detail;
148
+ const newRule = {...rule};
149
+ if (columnId === 'urlPattern') {
150
+ newRule.urlPattern = newText.trim();
151
+ } else if (columnId === 'targetUrlTemplate') {
152
+ newRule.targetUrlTemplate = newText.trim();
153
+ } else if (columnId === 'label') {
154
+ newRule.label = newText.trim();
155
+ }
156
+ input.onUpdateRule(rule, newRule);
157
+ };
158
+
159
+ // clang-format off
160
+ render(html`
161
+ <style>${backendLinkingSettingsTabStyles}</style>
162
+ <style>${UI.inspectorCommonStyles}</style>
163
+ <div class="settings-card-container-wrapper" jslog=${VisualLogging.pane('backend-linking')}>
164
+ <div class="settings-card-container">
165
+ <devtools-card heading=${i18nString(UIStrings.rulesSectionHeading)}>
166
+ <p class="description-text">${i18nString(UIStrings.description)}</p>
167
+ <devtools-data-grid
168
+ name=${i18nString(UIStrings.rulesSectionHeading)}
169
+ striped
170
+ inline
171
+ @delete=${() => {}}
172
+ @create=${onCreate}>
173
+ <table>
174
+ <style>${backendLinkingSettingsTabStyles}</style>
175
+ <thead>
176
+ <tr>
177
+ <th id="urlPattern" editable>${i18nString(UIStrings.urlPatternColumn)}</th>
178
+ <th id="targetUrlTemplate" editable>${i18nString(UIStrings.targetUrlTemplateColumn)}</th>
179
+ <th id="label" editable>${i18nString(UIStrings.labelColumn)}</th>
180
+ </tr>
181
+ </thead>
182
+ <tbody>
183
+ ${input.rules.map(rule => {
184
+ return html`
185
+ <tr @edit=${
186
+ (event: CustomEvent<{columnId: string, valueBeforeEditing: string, newText: string}>) =>
187
+ onEdit(rule, event)}
188
+ @delete=${() => input.onDeleteRule(rule)}>
189
+ <td title=${ifDefined(
190
+ !rule.urlPattern ? i18nString(UIStrings.urlPatternCannotBeEmpty) :
191
+ !validPattern(rule.urlPattern) ? i18nString(UIStrings.invalidUrlPattern) :
192
+ undefined)}>
193
+ <devtools-icon name="warning-filled" class="small warning-icon"
194
+ ?hidden=${Boolean(rule.urlPattern) && validPattern(rule.urlPattern)}></devtools-icon>
195
+ ${rule.urlPattern}
196
+ </td>
197
+ <td title=${ifDefined(
198
+ !rule.targetUrlTemplate ? i18nString(UIStrings.targetUrlTemplateCannotBeEmpty) :
199
+ !hasPlaceholder(rule.targetUrlTemplate) ? i18nString(UIStrings.templateRequiresPlaceholder) :
200
+ undefined)}>
201
+ <devtools-icon name="warning-filled" class="small warning-icon"
202
+ ?hidden=${Boolean(rule.targetUrlTemplate) && hasPlaceholder(rule.targetUrlTemplate)}></devtools-icon>
203
+ ${rule.targetUrlTemplate}
204
+ </td>
205
+ <td title=${ifDefined(!rule.label ? i18nString(UIStrings.labelCannotBeEmpty) : undefined)}>
206
+ <devtools-icon name="warning-filled" class="small warning-icon"
207
+ ?hidden=${Boolean(rule.label)}></devtools-icon>
208
+ ${rule.label}
209
+ </td>
210
+ </tr>
211
+ `;
212
+ })}
213
+ <tr placeholder></tr>
214
+ </tbody>
215
+ </table>
216
+ </devtools-data-grid>
217
+ ${input.rules.some(rule => !isRuleValid(rule)) ? html`
218
+ <div class="warning-footer">
219
+ <devtools-icon name="warning-filled" class="small"></devtools-icon>
220
+ <span>${i18nString(UIStrings.invalidRulesWarning)}</span>
221
+ </div>
222
+ ` : nothing}
223
+ </devtools-card>
224
+ <devtools-card heading=${i18nString(UIStrings.placeholderDocHeading)}>
225
+ <dl class="intro-section">
226
+ <div class="column-header">${i18nString(UIStrings.placeholderColumn)}</div>
227
+ <div class="column-header">${i18nString(UIStrings.headerColumn)}</div>
228
+ <dt class="placeholder">${'${devtoolsDebugId}'}</dt>
229
+ <dd class="source-header">Server-Timing: devtools-debug-id</dd>
230
+ <dd class="placeholder-description">${i18nString(UIStrings.devtoolsDebugIdDescription)}</dd>
231
+ <dt class="placeholder">${'${requestId}'}</dt>
232
+ <dd class="source-header">X-Request-ID</dd>
233
+ <dd class="placeholder-description">${i18nString(UIStrings.requestIdDescription)}</dd>
234
+ <dt class="placeholder">${'${correlationId}'}</dt>
235
+ <dd class="source-header">X-Correlation-ID / Correlation-ID</dd>
236
+ <dd class="placeholder-description">${i18nString(UIStrings.correlationIdDescription)}</dd>
237
+ <dt class="placeholder">${'${traceId}'}</dt>
238
+ <dd class="source-header">trace-id / Server-Timing: traceparent</dd>
239
+ <dd class="placeholder-description">${i18nString(UIStrings.traceIdDescription)}</dd>
240
+ <dt class="placeholder">${'${spanId}'}</dt>
241
+ <dd class="source-header">Server-Timing: traceparent</dd>
242
+ <dd class="placeholder-description">${i18nString(UIStrings.spanIdDescription)}</dd>
243
+ </dl>
244
+ </devtools-card>
245
+ </div>
246
+ </div>`,
247
+ // clang-format on
248
+ target);
249
+ };
250
+
251
+ export class BackendLinkingSettingsTab extends UI.Widget.VBox {
252
+ readonly #view: View;
253
+ readonly #rulesSetting: Common.Settings.Setting<NetworkForward.BackendLinking.BackendLinkingRule[]> =
254
+ Common.Settings.Settings.instance().resolve(NetworkForward.BackendLinking.backendLinkingRulesSettingDescriptor);
255
+
256
+ constructor(target?: HTMLElement, view: View = DEFAULT_VIEW) {
257
+ super(target);
258
+ this.#view = view;
259
+ }
260
+
261
+ override wasShown(): void {
262
+ super.wasShown();
263
+ this.#rulesSetting.addChangeListener(this.requestUpdate, this);
264
+ this.requestUpdate();
265
+ }
266
+
267
+ override willHide(): void {
268
+ super.willHide();
269
+ this.#rulesSetting.removeChangeListener(this.requestUpdate, this);
270
+ }
271
+
272
+ override performUpdate(): void {
273
+ const input: ViewInput = {
274
+ rules: this.#rulesSetting.get(),
275
+ onAddRule: rule => {
276
+ if (!isRuleValid(rule)) {
277
+ return;
278
+ }
279
+ this.#rulesSetting.set([...this.#rulesSetting.get(), rule]);
280
+ },
281
+ onUpdateRule: (oldRule, newRule) => {
282
+ if (!isRuleValid(newRule)) {
283
+ return;
284
+ }
285
+ const rules = [...this.#rulesSetting.get()];
286
+ const index = rules.indexOf(oldRule);
287
+ if (index !== -1) {
288
+ rules[index] = newRule;
289
+ this.#rulesSetting.set(rules);
290
+ }
291
+ },
292
+ onDeleteRule: rule => {
293
+ const rules = [...this.#rulesSetting.get()];
294
+ const index = rules.indexOf(rule);
295
+ if (index !== -1) {
296
+ rules.splice(index, 1);
297
+ this.#rulesSetting.set(rules);
298
+ }
299
+ },
300
+ };
301
+ this.#view(input, {}, this.contentElement);
302
+ }
303
+ }
@@ -0,0 +1,78 @@
1
+ /*
2
+ * Copyright 2026 The Chromium Authors
3
+ * Use of this source code is governed by a BSD-style license that can be
4
+ * found in the LICENSE file.
5
+ */
6
+
7
+ @scope to (devtools-widget > *) {
8
+ .settings-card-container {
9
+ align-items: stretch;
10
+ padding: 0 var(--sys-size-8);
11
+ }
12
+
13
+ devtools-card {
14
+ max-width: 100%;
15
+ }
16
+
17
+ .description-text {
18
+ color: var(--sys-color-on-surface-subtle);
19
+ font-size: var(--sys-typescale-body-medium-size);
20
+ line-height: var(--sys-typescale-body-medium-line-height);
21
+ margin: 0 0 var(--sys-size-5);
22
+ }
23
+
24
+ .intro-section {
25
+ display: grid;
26
+ grid-template-columns: max-content 1fr;
27
+ gap: var(--sys-size-2) var(--sys-size-6);
28
+ align-items: baseline;
29
+ font-size: var(--sys-typescale-body-small-size);
30
+ line-height: var(--sys-typescale-body-medium-line-height);
31
+ margin: 0;
32
+
33
+ dd {
34
+ margin: 0;
35
+ }
36
+
37
+ .column-header {
38
+ font-size: var(--sys-typescale-label-small-size);
39
+ font-weight: var(--ref-typeface-weight-medium);
40
+ border-bottom: 1px solid var(--sys-color-neutral-outline);
41
+ padding-bottom: var(--sys-size-2);
42
+ margin-bottom: var(--sys-size-3);
43
+ }
44
+
45
+ .placeholder,
46
+ .source-header {
47
+ font-family: var(--monospace-font-family);
48
+ }
49
+
50
+ .placeholder {
51
+ color: var(--sys-color-primary);
52
+ }
53
+
54
+ .placeholder-description {
55
+ grid-column: 1 / -1;
56
+ color: var(--sys-color-on-surface-subtle);
57
+ margin-bottom: var(--sys-size-6);
58
+ }
59
+ }
60
+
61
+ .warning-icon {
62
+ margin-right: var(--sys-size-3);
63
+ vertical-align: text-bottom;
64
+ }
65
+
66
+ td.editing .warning-icon {
67
+ display: none;
68
+ }
69
+
70
+ .warning-footer {
71
+ display: flex;
72
+ align-items: center;
73
+ gap: var(--sys-size-3);
74
+ color: var(--sys-color-on-surface-subtle);
75
+ font-size: var(--sys-typescale-body-small-size);
76
+ line-height: var(--sys-typescale-body-medium-line-height);
77
+ }
78
+ }
@@ -68,6 +68,14 @@ const UIStrings = {
68
68
  * @description Command for showing the Workspace tool in Settings.
69
69
  */
70
70
  showWorkspace: 'Show Workspace settings',
71
+ /**
72
+ * @description Title of the Backend linking settings tab in Settings.
73
+ */
74
+ backendLinking: 'Backend linking',
75
+ /**
76
+ * @description Command for showing the Backend linking settings tab in Settings.
77
+ */
78
+ showBackendLinking: 'Show Backend linking',
71
79
  } as const;
72
80
 
73
81
  const str_ = i18n.i18n.registerUIStrings('panels/settings/settings-meta.ts', UIStrings);
@@ -154,6 +162,23 @@ UI.ViewManager.registerViewExtension({
154
162
  iconName: 'clear-list',
155
163
  });
156
164
 
165
+ UI.ViewManager.registerViewExtension({
166
+ location: UI.ViewManager.ViewLocationValues.SETTINGS_VIEW,
167
+ id: 'backend-linking',
168
+ commandPrompt: i18nLazyString(UIStrings.showBackendLinking),
169
+ title: i18nLazyString(UIStrings.backendLinking),
170
+ order: 36,
171
+ async loadView() {
172
+ const Settings = await loadSettingsModule();
173
+ return new Settings.BackendLinkingSettingsTab.BackendLinkingSettingsTab();
174
+ },
175
+ iconName: 'open-externally',
176
+ settings: [
177
+ 'network.backend-linking-rules',
178
+ ],
179
+ condition: config => config?.devToolsNetworkBackendLinking?.enabled ?? false,
180
+ });
181
+
157
182
  UI.ViewManager.registerViewExtension({
158
183
  location: UI.ViewManager.ViewLocationValues.SETTINGS_VIEW,
159
184
  id: 'keybinds',
@@ -5,6 +5,7 @@
5
5
  import './SettingsScreen.js';
6
6
 
7
7
  import * as AISettingsTab from './AISettingsTab.js';
8
+ import * as BackendLinkingSettingsTab from './BackendLinkingSettingsTab.js';
8
9
  import * as EditFileSystemView from './EditFileSystemView.js';
9
10
  import * as FrameworkIgnoreListSettingsTab from './FrameworkIgnoreListSettingsTab.js';
10
11
  import * as KeybindsSettingsTab from './KeybindsSettingsTab.js';
@@ -13,6 +14,7 @@ import * as WorkspaceSettingsTab from './WorkspaceSettingsTab.js';
13
14
 
14
15
  export {
15
16
  AISettingsTab,
17
+ BackendLinkingSettingsTab,
16
18
  EditFileSystemView,
17
19
  FrameworkIgnoreListSettingsTab,
18
20
  KeybindsSettingsTab,
@@ -108,6 +108,7 @@ As of July 2024, they are used to power:
108
108
  2. Annotations; the user has the ability to create labels and attach them to entries. These are drawn with overlays.
109
109
  3. Selected entry; the box drawn around the entry a user selects is drawn as an overlay.
110
110
  4. Vertical ruler: when holding shift and moving their mouse, the vertical cursor drawn is drawn as an overlay.
111
+ 5. Comment pins: comment threads anchored to flame chart entries.
111
112
 
112
113
  Overlays are drawn in **DOM**, not Canvas, and are drawn on a layer that sits above the entire timeline. This is important because it means they are drawn over both the canvases we have in the panel (network + main/rest).
113
114
 
@@ -123,7 +124,7 @@ To remove one or some overlays, check out the `remove()` or `removeOverlaysOfTyp
123
124
 
124
125
  ### Creating a new overlay
125
126
 
126
- To create a new overlay, add it in the `OverlaysImpl.ts` file, first define its type. This is done as an interface, and must contain a `type` field.
127
+ To create a new overlay, define its interface in `front_end/models/trace/types/Overlays.ts`, ensuring it contains a `type` field.
127
128
 
128
129
  All other fields are completely custom and depend on the specifics of the overlay.
129
130
 
@@ -137,7 +138,7 @@ export interface EntrySelected {
137
138
  }
138
139
  ```
139
140
 
140
- Once you have done this, add the interface to the union type `TimelineOverlay`. This will likely trigger some TypeScript errors because there are some places in the code where we check we have exhaustively dealt with every possible overlay type.
141
+ Once you have done this, add the interface to the union type `Overlay` in `front_end/models/trace/types/Overlays.ts`. This will likely trigger some TypeScript errors because there are some places in the code where we check we have exhaustively dealt with every possible overlay type.
141
142
  Also if you want to make this overlay a singleton, add the interface to the union type `SingletonOverlay`.
142
143
 
143
144
  When you create an overlay by default it will be created as a `div` with a class, and no contents. Sometimes this is all you need (for example, the `ENTRY_SELECTED` outline has no other HTML), but if you need more you can tell the Overlays class what DOM to create for your overlay. To do this, modify the `#createElementForNewOverlay` method. You will see examples there of how we use custom elements to build out overlays.
@@ -142,6 +142,7 @@ export class TimelineFlameChartView extends TimelineFlameChartViewBase implement
142
142
  #eventToRelatedInsightsMap: TimelineComponents.RelatedInsightChips.EventToRelatedInsightsMap|null = null;
143
143
  #selectedGroupName: string|null = null;
144
144
  #onTraceBoundsChangeBound = this.#onTraceBoundsChange.bind(this);
145
+ #overlaysUpdateScheduled = false;
145
146
  #debouncedUpdateSearchResults: () => void = Common.Debouncer.debounce(() => this.updateSearchResults(false, false),
146
147
  100);
147
148
 
@@ -255,7 +256,7 @@ export class TimelineFlameChartView extends TimelineFlameChartViewBase implement
255
256
  this.mainFlameChart.addEventListener(PerfUI.FlameChart.Events.LATEST_DRAW_DIMENSIONS, dimensions => {
256
257
  this.#overlays.updateChartDimensions('main', dimensions.data.chart);
257
258
  this.#overlays.updateVisibleWindow(dimensions.data.traceWindow);
258
- void this.#overlays.update();
259
+ this.#scheduleOverlaysUpdate();
259
260
  });
260
261
 
261
262
  this.networkDataProvider = new TimelineFlameChartNetworkDataProvider();
@@ -271,7 +272,7 @@ export class TimelineFlameChartView extends TimelineFlameChartViewBase implement
271
272
  this.networkFlameChart.addEventListener(PerfUI.FlameChart.Events.LATEST_DRAW_DIMENSIONS, dimensions => {
272
273
  this.#overlays.updateChartDimensions('network', dimensions.data.chart);
273
274
  this.#overlays.updateVisibleWindow(dimensions.data.traceWindow);
274
- void this.#overlays.update();
275
+ this.#scheduleOverlaysUpdate();
275
276
 
276
277
  // If the height of the network chart has changed, we need to tell the
277
278
  // main flame chart because its tooltips are positioned based in part on
@@ -1573,6 +1574,26 @@ export class TimelineFlameChartView extends TimelineFlameChartViewBase implement
1573
1574
  }
1574
1575
  }
1575
1576
 
1577
+ /**
1578
+ * Schedules an update pass for the overlays via a microtask.
1579
+ *
1580
+ * Both the main flame chart and network flame chart emit LATEST_DRAW_DIMENSIONS
1581
+ * when they redraw (e.g. during zoom or pan). Scheduling via a microtask
1582
+ * ensures that if both charts redraw in the same animation frame or event loop
1583
+ * turn, their dimensions are recorded first and the overlay positioning pass
1584
+ * runs only once before the browser paints.
1585
+ */
1586
+ #scheduleOverlaysUpdate(): void {
1587
+ if (this.#overlaysUpdateScheduled) {
1588
+ return;
1589
+ }
1590
+ this.#overlaysUpdateScheduled = true;
1591
+ queueMicrotask(() => {
1592
+ this.#overlaysUpdateScheduled = false;
1593
+ void this.#overlays.update();
1594
+ });
1595
+ }
1596
+
1576
1597
  /**
1577
1598
  * Used to create multiple overlays at once without triggering a redraw for each one.
1578
1599
  */
@@ -37,6 +37,10 @@ const UIStrings = {
37
37
  * @description Text for the page scope option that selects the entire origin instead of its specific URL in the Performance panel.
38
38
  */
39
39
  originOption: 'Origin',
40
+ /**
41
+ * @description Accessible label for the comment pin overlay button on a flame chart entry.
42
+ */
43
+ commentPin: 'Comment',
40
44
  } as const;
41
45
  const str_ = i18n.i18n.registerUIStrings('panels/timeline/overlays/OverlaysImpl.ts', UIStrings);
42
46
  const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
@@ -116,6 +120,10 @@ export function entriesForOverlay(overlay: Trace.Types.Overlays.Overlay): readon
116
120
  }
117
121
  case 'BOTTOM_INFO_BAR':
118
122
  break;
123
+ case 'COMMENT_PIN': {
124
+ entries.push(overlay.entry);
125
+ break;
126
+ }
119
127
  default:
120
128
  Platform.assertNever(overlay, `Unknown overlay type ${JSON.stringify(overlay)}`);
121
129
  }
@@ -271,6 +279,16 @@ export class EventReferenceClick extends Event {
271
279
  }
272
280
  }
273
281
 
282
+ /**
283
+ * Dispatched when a comment pin overlay on a flame chart entry is clicked.
284
+ */
285
+ export class CommentPinClick extends Event {
286
+ static readonly eventName = 'commentpinclick';
287
+ constructor(public overlay: Trace.Types.Overlays.CommentPin) {
288
+ super(CommentPinClick.eventName, {composed: true, bubbles: true});
289
+ }
290
+ }
291
+
274
292
  /**
275
293
  * This class manages all the overlays that get drawn onto the performance
276
294
  * timeline. Overlays are DOM and are drawn above the network and main flame
@@ -572,7 +590,7 @@ export class Overlays extends EventTarget {
572
590
 
573
591
  /**
574
592
  * Update the dimensions of a chart.
575
- * IMPORTANT: this does not trigger a re-draw. You must call the render() method manually.
593
+ * IMPORTANT: this does not trigger a re-draw. You must call the update() method manually.
576
594
  */
577
595
  updateChartDimensions(chart: EntryChartLocation, dimensions: FlameChartDimensions): void {
578
596
  this.#dimensions.charts[chart] = dimensions;
@@ -580,7 +598,7 @@ export class Overlays extends EventTarget {
580
598
 
581
599
  /**
582
600
  * Update the visible window of the UI.
583
- * IMPORTANT: this does not trigger a re-draw. You must call the render() method manually.
601
+ * IMPORTANT: this does not trigger a re-draw. You must call the update() method manually.
584
602
  */
585
603
  updateVisibleWindow(visibleWindow: Trace.Types.Timing.TraceWindowMicro): void {
586
604
  this.#dimensions.trace.visibleWindow = visibleWindow;
@@ -819,6 +837,15 @@ export class Overlays extends EventTarget {
819
837
  break;
820
838
  }
821
839
 
840
+ case 'COMMENT_PIN': {
841
+ const isVisible = this.entryIsVisibleOnChart(overlay.entry);
842
+ this.#setOverlayElementVisibility(element, isVisible);
843
+ if (isVisible) {
844
+ this.#positionEntryBorderOutlineType(overlay.entry, element);
845
+ }
846
+ break;
847
+ }
848
+
822
849
  default: {
823
850
  Platform.TypeScriptUtilities.assertNever(overlay, `Unknown overlay: ${JSON.stringify(overlay)}`);
824
851
  }
@@ -1588,6 +1615,33 @@ export class Overlays extends EventTarget {
1588
1615
  overlayElement.style.setProperty('--marker-color', color);
1589
1616
  return overlayElement;
1590
1617
  }
1618
+ case 'COMMENT_PIN': {
1619
+ const pin = document.createElement('div');
1620
+ pin.classList.add('comment-pin');
1621
+ pin.setAttribute('role', 'button');
1622
+ pin.setAttribute('tabindex', '0');
1623
+ UI.ARIAUtils.setLabel(pin, i18nString(UIStrings.commentPin));
1624
+ if (overlay.commentThreadId) {
1625
+ pin.setAttribute('data-comment-id', overlay.commentThreadId);
1626
+ }
1627
+ const cursor = document.createElement('div');
1628
+ cursor.classList.add('comment-cursor');
1629
+ pin.appendChild(cursor);
1630
+
1631
+ const handleActivation = (event: Event): void => {
1632
+ event.preventDefault();
1633
+ event.stopPropagation();
1634
+ this.dispatchEvent(new CommentPinClick(overlay));
1635
+ };
1636
+ pin.addEventListener('click', handleActivation);
1637
+ pin.addEventListener('keydown', (event: KeyboardEvent) => {
1638
+ if (event.key === 'Enter' || event.key === ' ') {
1639
+ handleActivation(event);
1640
+ }
1641
+ });
1642
+ overlayElement.appendChild(pin);
1643
+ return overlayElement;
1644
+ }
1591
1645
  default: {
1592
1646
  return overlayElement;
1593
1647
  }
@@ -1735,9 +1789,10 @@ export class Overlays extends EventTarget {
1735
1789
  // before appending the infobar, just in case.
1736
1790
  element.innerHTML = '';
1737
1791
  element.appendChild(overlay.infobar.element);
1792
+ break;
1738
1793
  }
1739
-
1740
- break;
1794
+ case 'COMMENT_PIN':
1795
+ break;
1741
1796
  default:
1742
1797
  Platform.TypeScriptUtilities.assertNever(overlay, `Unexpected overlay ${overlay}`);
1743
1798
  }
@@ -1782,6 +1837,8 @@ export class Overlays extends EventTarget {
1782
1837
  break;
1783
1838
  case 'BOTTOM_INFO_BAR':
1784
1839
  break;
1840
+ case 'COMMENT_PIN':
1841
+ break;
1785
1842
  default:
1786
1843
  Platform.TypeScriptUtilities.assertNever(overlay, `Unexpected overlay ${overlay}`);
1787
1844
  }
@@ -2113,6 +2170,9 @@ export function jsLogContext(overlay: Trace.Types.Overlays.Overlay): string|null
2113
2170
  }
2114
2171
  case 'BOTTOM_INFO_BAR':
2115
2172
  return 'timeline.overlays.info-bar';
2173
+ case 'COMMENT_PIN': {
2174
+ return 'timeline.overlays.comment-pin';
2175
+ }
2116
2176
  default:
2117
2177
  Platform.assertNever(overlay, 'Unknown overlay type');
2118
2178
  }