chrome-devtools-frontend 1.0.1537268 → 1.0.1538310

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 (98) hide show
  1. package/.env.template +10 -0
  2. package/docs/get_the_code.md +27 -0
  3. package/eslint.config.mjs +151 -149
  4. package/front_end/core/common/SettingRegistration.ts +10 -7
  5. package/front_end/core/common/Settings.ts +3 -0
  6. package/front_end/core/host/AidaClient.ts +1 -0
  7. package/front_end/core/host/UserMetrics.ts +3 -1
  8. package/front_end/core/root/Runtime.ts +8 -0
  9. package/front_end/core/sdk/sdk-meta.ts +8 -2
  10. package/front_end/entrypoints/inspector_main/RenderingOptions.ts +4 -3
  11. package/front_end/generated/SupportedCSSProperties.js +1 -0
  12. package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +23 -7
  13. package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.snapshot.txt +110 -5
  14. package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.ts +50 -45
  15. package/front_end/models/ai_code_generation/AiCodeGeneration.ts +151 -0
  16. package/front_end/models/ai_code_generation/ai_code_generation.ts +6 -0
  17. package/front_end/models/ai_code_generation/debug.ts +30 -0
  18. package/front_end/models/cpu_profile/ProfileTreeModel.ts +7 -7
  19. package/front_end/models/trace_source_maps_resolver/SourceMapsResolver.ts +1 -1
  20. package/front_end/panels/application/PreloadingTreeElement.ts +10 -2
  21. package/front_end/panels/application/StorageView.ts +3 -2
  22. package/front_end/panels/application/components/BackForwardCacheView.ts +34 -51
  23. package/front_end/panels/application/components/OriginTrialTreeView.ts +141 -170
  24. package/front_end/panels/application/components/backForwardCacheView.css +4 -0
  25. package/front_end/panels/application/components/originTrialTreeView.css +37 -7
  26. package/front_end/panels/application/preloading/components/PreloadingGrid.ts +2 -2
  27. package/front_end/panels/application/preloading/components/PreloadingString.ts +30 -1
  28. package/front_end/panels/autofill/AutofillView.ts +1 -1
  29. package/front_end/panels/console/ConsoleView.ts +11 -9
  30. package/front_end/panels/coverage/CoverageView.ts +1 -2
  31. package/front_end/panels/css_overview/CSSOverviewSidebarPanel.ts +1 -1
  32. package/front_end/panels/developer_resources/DeveloperResourcesView.ts +1 -1
  33. package/front_end/panels/elements/ElementStatePaneWidget.ts +1 -1
  34. package/front_end/panels/elements/EventListenersWidget.ts +1 -2
  35. package/front_end/panels/elements/PropertiesWidget.ts +1 -1
  36. package/front_end/panels/emulation/components/DeviceSizeInputElement.ts +1 -0
  37. package/front_end/panels/network/NetworkConfigView.ts +2 -1
  38. package/front_end/panels/network/NetworkItemView.ts +1 -1
  39. package/front_end/panels/network/NetworkPanel.ts +5 -4
  40. package/front_end/panels/network/NetworkWaterfallColumn.ts +5 -6
  41. package/front_end/panels/network/RequestCookiesView.ts +2 -1
  42. package/front_end/panels/network/RequestTimingView.ts +404 -348
  43. package/front_end/panels/network/networkTimingTable.css +22 -2
  44. package/front_end/panels/profiler/HeapSnapshotView.ts +3 -2
  45. package/front_end/panels/sensors/SensorsView.ts +4 -3
  46. package/front_end/panels/settings/FrameworkIgnoreListSettingsTab.ts +8 -6
  47. package/front_end/panels/settings/KeybindsSettingsTab.ts +3 -2
  48. package/front_end/panels/settings/SettingsScreen.ts +2 -1
  49. package/front_end/panels/settings/WorkspaceSettingsTab.ts +1 -1
  50. package/front_end/panels/sources/AiCodeCompletionPlugin.ts +2 -1
  51. package/front_end/panels/sources/SourcesPanel.ts +2 -1
  52. package/front_end/panels/sources/sources-meta.ts +8 -1
  53. package/front_end/panels/timeline/TimelinePanel.ts +4 -3
  54. package/front_end/panels/timeline/TimelineUIUtils.ts +4 -20
  55. package/front_end/panels/timeline/components/LiveMetricsView.ts +1 -0
  56. package/front_end/panels/timeline/components/NetworkRequestTooltip.ts +42 -3
  57. package/front_end/panels/timeline/components/SidebarAnnotationsTab.ts +2 -0
  58. package/front_end/panels/timeline/components/networkRequestTooltip.css +19 -0
  59. package/front_end/third_party/chromium/README.chromium +1 -1
  60. package/front_end/ui/components/adorners/Adorner.ts +3 -1
  61. package/front_end/ui/components/buttons/Button.docs.ts +195 -0
  62. package/front_end/ui/components/icon_button/IconButton.ts +1 -0
  63. package/front_end/ui/components/settings/SettingCheckbox.ts +50 -14
  64. package/front_end/ui/components/settings/settingCheckbox.css +6 -1
  65. package/front_end/ui/components/spinners/Spinners.docs.ts +13 -0
  66. package/front_end/ui/components/tooltips/Tooltip.docs.ts +76 -0
  67. package/front_end/ui/legacy/FilterBar.ts +1 -2
  68. package/front_end/ui/legacy/RadioButton.docs.ts +41 -0
  69. package/front_end/ui/legacy/SelectMenu.docs.ts +98 -0
  70. package/front_end/ui/legacy/Toolbar.ts +4 -6
  71. package/front_end/ui/legacy/Treeoutline.ts +15 -0
  72. package/front_end/ui/legacy/UIUtils.ts +117 -1
  73. package/front_end/ui/legacy/Widget.ts +68 -38
  74. package/front_end/ui/legacy/XLink.ts +1 -0
  75. package/front_end/ui/legacy/components/inline_editor/Swatches.ts +1 -0
  76. package/front_end/ui/legacy/components/perf_ui/BrickBreaker.ts +1 -0
  77. package/front_end/ui/legacy/components/settings_ui/SettingsUI.ts +125 -0
  78. package/front_end/ui/legacy/components/settings_ui/settings_ui.ts +8 -0
  79. package/front_end/ui/legacy/legacy.ts +0 -2
  80. package/front_end/ui/legacy/popover.css +12 -11
  81. package/front_end/ui/visual_logging/KnownContextValues.ts +3 -0
  82. package/package.json +1 -1
  83. package/front_end/models/trace/lantern/testing/MetricTestUtils.ts +0 -62
  84. package/front_end/models/trace/lantern/testing/testing.ts +0 -5
  85. package/front_end/panels/application/components/badge.css +0 -25
  86. package/front_end/ui/components/docs/button/basic.html +0 -44
  87. package/front_end/ui/components/docs/button/basic.ts +0 -175
  88. package/front_end/ui/components/docs/radio_button/basic.html +0 -23
  89. package/front_end/ui/components/docs/radio_button/basic.ts +0 -50
  90. package/front_end/ui/components/docs/select_menu/basic.html +0 -19
  91. package/front_end/ui/components/docs/select_menu/basic.ts +0 -95
  92. package/front_end/ui/components/docs/select_menu/wide-option.html +0 -38
  93. package/front_end/ui/components/docs/select_menu/wide-option.ts +0 -43
  94. package/front_end/ui/components/docs/spinners/basic.html +0 -17
  95. package/front_end/ui/components/docs/spinners/basic.ts +0 -22
  96. package/front_end/ui/components/docs/tooltip/basic.html +0 -20
  97. package/front_end/ui/components/docs/tooltip/basic.ts +0 -82
  98. package/front_end/ui/legacy/SettingsUI.ts +0 -240
@@ -0,0 +1,30 @@
1
+ // Copyright 2025 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
+ /**
6
+ * @file Local debugging utilities.
7
+ */
8
+
9
+ export function isDebugMode(): boolean {
10
+ return Boolean(localStorage.getItem('debugAiCodeGenerationEnabled'));
11
+ }
12
+
13
+ export function debugLog(...log: unknown[]): void {
14
+ if (!isDebugMode()) {
15
+ return;
16
+ }
17
+
18
+ // eslint-disable-next-line no-console
19
+ console.log(...log);
20
+ }
21
+
22
+ function setDebugAiCodeGenerationEnabled(enabled: boolean): void {
23
+ if (enabled) {
24
+ localStorage.setItem('debugAiCodeGenerationEnabled', 'true');
25
+ } else {
26
+ localStorage.removeItem('debugAiCodeGenerationEnabled');
27
+ }
28
+ }
29
+ // @ts-expect-error
30
+ globalThis.setDebugAiCodeGenerationEnabled = setDebugAiCodeGenerationEnabled;
@@ -13,7 +13,7 @@ export class ProfileNode {
13
13
  id: number;
14
14
  parent: ProfileNode|null;
15
15
  children: this[];
16
- functionName: string;
16
+ originalFunctionName: string|null = null;
17
17
  depth!: number;
18
18
  deoptReason!: string|null;
19
19
  constructor(callFrame: Protocol.Runtime.CallFrame) {
@@ -22,7 +22,6 @@ export class ProfileNode {
22
22
  this.self = 0;
23
23
  this.total = 0;
24
24
  this.id = 0;
25
- this.functionName = callFrame.functionName;
26
25
  this.parent = null;
27
26
  this.children = [];
28
27
  }
@@ -43,11 +42,12 @@ export class ProfileNode {
43
42
  return this.callFrame.columnNumber;
44
43
  }
45
44
 
46
- setFunctionName(name: string|null): void {
47
- if (name === null) {
48
- return;
49
- }
50
- this.functionName = name;
45
+ get functionName(): string {
46
+ return this.originalFunctionName ?? this.callFrame.functionName;
47
+ }
48
+
49
+ setOriginalFunctionName(name: string|null): void {
50
+ this.originalFunctionName = name;
51
51
  }
52
52
  }
53
53
 
@@ -173,7 +173,7 @@ export class SourceMapsResolver extends EventTarget {
173
173
  const resolvedFunctionName =
174
174
  await SourceMapScopes.NamesResolver.resolveProfileFrameFunctionName(node.callFrame, target);
175
175
  updatedMappings ||= Boolean(resolvedFunctionName);
176
- node.setFunctionName(resolvedFunctionName);
176
+ node.setOriginalFunctionName(resolvedFunctionName);
177
177
 
178
178
  const debuggerModel = target.model(SDK.DebuggerModel.DebuggerModel);
179
179
  const script = debuggerModel?.scriptForId(node.scriptId) || null;
@@ -8,7 +8,7 @@ import type * as SDK from '../../core/sdk/sdk.js';
8
8
  import * as IconButton from '../../ui/components/icon_button/icon_button.js';
9
9
 
10
10
  import {ApplicationPanelTreeElement, ExpandableApplicationPanelTreeElement} from './ApplicationPanelTreeElement.js';
11
- import type * as PreloadingHelper from './preloading/helper/helper.js';
11
+ import * as PreloadingHelper from './preloading/helper/helper.js';
12
12
  import {PreloadingAttemptView, PreloadingRuleSetView, PreloadingSummaryView} from './preloading/PreloadingView.js';
13
13
  import type {ResourcesPanel} from './ResourcesPanel.js';
14
14
 
@@ -125,7 +125,15 @@ export class PreloadingSummaryTreeElement extends ExpandableApplicationPanelTree
125
125
  this.#attempt.initialize(model);
126
126
 
127
127
  // Show the view if the model was initialized after selection.
128
- if (this.#selected && !this.#view) {
128
+ // However, if the user last viewed this page and clicked into Rules or
129
+ // Speculations, we ensure that we instead show those pages.
130
+ if (this.#attempt.selected) {
131
+ const filter = new PreloadingHelper.PreloadingForward.AttemptViewWithFilter(null);
132
+ this.expandAndRevealAttempts(filter);
133
+ } else if (this.#ruleSet.selected) {
134
+ const filter = new PreloadingHelper.PreloadingForward.RuleSetView(null);
135
+ this.expandAndRevealRuleSet(filter);
136
+ } else if (this.#selected && !this.#view) {
129
137
  this.onselect(false);
130
138
  }
131
139
  }
@@ -12,6 +12,7 @@ import type * as Buttons from '../../ui/components/buttons/buttons.js';
12
12
  import * as IconButton from '../../ui/components/icon_button/icon_button.js';
13
13
  import * as uiI18n from '../../ui/i18n/i18n.js';
14
14
  import * as PerfUI from '../../ui/legacy/components/perf_ui/perf_ui.js';
15
+ import * as SettingsUI from '../../ui/legacy/components/settings_ui/settings_ui.js';
15
16
  import * as UI from '../../ui/legacy/legacy.js';
16
17
  import * as VisualLogging from '../../ui/visual_logging/visual_logging.js';
17
18
 
@@ -207,7 +208,7 @@ export class StorageView extends UI.Widget.VBox {
207
208
  this.clearButton.id = 'storage-view-clear-button';
208
209
  clearButtonSection.appendChild(this.clearButton);
209
210
 
210
- const includeThirdPartyCookiesCheckbox = UI.SettingsUI.createSettingCheckbox(
211
+ const includeThirdPartyCookiesCheckbox = SettingsUI.SettingsUI.createSettingCheckbox(
211
212
  i18nString(UIStrings.includingThirdPartyCookies), this.includeThirdPartyCookiesSetting);
212
213
  includeThirdPartyCookiesCheckbox.classList.add('include-third-party-cookies');
213
214
  clearButtonSection.appendChild(includeThirdPartyCookiesCheckbox);
@@ -280,7 +281,7 @@ export class StorageView extends UI.Widget.VBox {
280
281
  const row = section.appendRow();
281
282
  const setting = this.settings.get(settingName);
282
283
  if (setting) {
283
- row.appendChild(UI.SettingsUI.createSettingCheckbox(title, setting));
284
+ row.appendChild(SettingsUI.SettingsUI.createSettingCheckbox(title, setting));
284
285
  }
285
286
  }
286
287
 
@@ -5,7 +5,7 @@
5
5
  import '../../../ui/components/chrome_link/chrome_link.js';
6
6
  import '../../../ui/components/expandable_list/expandable_list.js';
7
7
  import '../../../ui/components/report_view/report_view.js';
8
- import '../../../ui/components/tree_outline/tree_outline.js';
8
+ import '../../../ui/legacy/legacy.js';
9
9
 
10
10
  import * as Common from '../../../core/common/common.js';
11
11
  import * as i18n from '../../../core/i18n/i18n.js';
@@ -15,7 +15,6 @@ import * as Protocol from '../../../generated/protocol.js';
15
15
  import * as Buttons from '../../../ui/components/buttons/buttons.js';
16
16
  import type * as ExpandableList from '../../../ui/components/expandable_list/expandable_list.js';
17
17
  import type * as ReportView from '../../../ui/components/report_view/report_view.js';
18
- import type * as TreeOutline from '../../../ui/components/tree_outline/tree_outline.js';
19
18
  import * as Components from '../../../ui/legacy/components/utils/utils.js';
20
19
  import * as UI from '../../../ui/legacy/legacy.js';
21
20
  import {html, type LitTemplate, nothing, render, type TemplateResult} from '../../../ui/lit/lit.js';
@@ -213,22 +212,23 @@ function maybeRenderFrameTree(
213
212
  return nothing;
214
213
  }
215
214
 
216
- function treeNodeRenderer(node: TreeOutline.TreeOutlineUtils.TreeNode<FrameTreeNodeData>): TemplateResult {
215
+ function renderFrameTreeNode(node: FrameTreeNodeData): TemplateResult {
217
216
  // clang-format off
218
217
  return html`
219
- <div class="text-ellipsis">
220
- ${node.treeNodeData.iconName ? html`
221
- <devtools-icon class="inline-icon extra-large" .name=${node.treeNodeData.iconName} style="margin-bottom: -3px;">
218
+ <li role="treeitem" class="text-ellipsis">
219
+ ${node.iconName ? html`
220
+ <devtools-icon class="inline-icon extra-large" .name=${node.iconName} style="margin-bottom: -3px;">
222
221
  </devtools-icon>
223
222
  ` : nothing}
224
- ${node.treeNodeData.text}
225
- </div>`;
223
+ ${node.text}
224
+ ${node.children?.length ? html`
225
+ <ul role="group" hidden>
226
+ ${node.children.map(child => renderFrameTreeNode(child))}
227
+ </ul>` : nothing}
228
+ </li>`;
226
229
  // clang-format on
227
230
  }
228
231
 
229
- const frameTreeNode = buildFrameTree(frameTreeData.node);
230
- // Override the icon for the outermost frame.
231
- frameTreeNode.treeNodeData.iconName = 'frame';
232
232
  let title = '';
233
233
  // The translation pipeline does not support nested plurals. We avoid this
234
234
  // here by pulling out the logic for one of the plurals into code instead.
@@ -237,49 +237,31 @@ function maybeRenderFrameTree(
237
237
  } else {
238
238
  title = i18nString(UIStrings.issuesInMultipleFrames, {n: frameTreeData.issueCount, m: frameTreeData.frameCount});
239
239
  }
240
- const root: TreeOutline.TreeOutlineUtils.TreeNode<FrameTreeNodeData> = {
241
- treeNodeData: {
242
- text: title,
243
- },
244
- id: 'root',
245
- children: () => Promise.resolve([frameTreeNode]),
246
- };
247
-
248
240
  // clang-format off
249
241
  return html`
250
242
  <devtools-report-key jslog=${VisualLogging.section('frames')}>${i18nString(UIStrings.framesTitle)}</devtools-report-key>
251
243
  <devtools-report-value>
252
- <devtools-tree-outline .data=${{
253
- tree: [root],
254
- defaultRenderer: treeNodeRenderer,
255
- compact: true,
256
- } as TreeOutline.TreeOutline.TreeOutlineData<FrameTreeNodeData>}>
257
- </devtools-tree-outline>
244
+ <devtools-tree .template=${html`
245
+ <ul role="tree">
246
+ <li role="treeitem" class="text-ellipsis">
247
+ ${title}
248
+ <ul role="group">
249
+ ${renderFrameTreeNode(frameTreeData.node)}
250
+ </ul>
251
+ </li>
252
+ </ul>
253
+ `}>
254
+ </devtools-tree>
258
255
  </devtools-report-value>`;
259
256
  // clang-format on
260
257
  }
261
258
 
262
- let nextNodeId = 0;
263
-
264
- function buildFrameTree(data: FrameTreeNodeData): TreeOutline.TreeOutlineUtils.TreeNode<FrameTreeNodeData> {
265
- const children = data.children;
266
- const node = {
267
- treeNodeData: {
268
- text: data.text,
269
- ...(data.iconName ? {iconName: data.iconName} : {}),
270
- },
271
- ...(children?.length ? {children: () => Promise.resolve(children.map(child => buildFrameTree(child)))} : {}),
272
- id: String(nextNodeId++),
273
- };
274
- return node;
275
- }
276
-
277
259
  function renderBackForwardCacheStatus(status: boolean|undefined): TemplateResult {
278
260
  switch (status) {
279
261
  case true:
280
262
  // clang-format off
281
263
  return html`
282
- <devtools-report-section class="cache-status-section" tabindex="-1">
264
+ <devtools-report-section autofocus tabindex="-1">
283
265
  <div class="status extra-large">
284
266
  <devtools-icon class="inline-icon extra-large" name="check-circle" style="color: var(--icon-checkmark-green);">
285
267
  </devtools-icon>
@@ -290,7 +272,7 @@ function renderBackForwardCacheStatus(status: boolean|undefined): TemplateResult
290
272
  case false:
291
273
  // clang-format off
292
274
  return html`
293
- <devtools-report-section class="cache-status-section" tabindex="-1">
275
+ <devtools-report-section autofocus tabindex="-1">
294
276
  <div class="status">
295
277
  <devtools-icon class="inline-icon extra-large" name="clear">
296
278
  </devtools-icon>
@@ -301,7 +283,7 @@ function renderBackForwardCacheStatus(status: boolean|undefined): TemplateResult
301
283
  }
302
284
  // clang-format off
303
285
  return html`
304
- <devtools-report-section class="cache-status-section" tabindex="-1">
286
+ <devtools-report-section autofocus tabindex="-1">
305
287
  ${i18nString(UIStrings.unknown)}
306
288
  </devtools-report-section>`;
307
289
  // clang-format on
@@ -477,7 +459,7 @@ export class BackForwardCacheView extends UI.Widget.Widget {
477
459
  #view: View;
478
460
 
479
461
  constructor(view = DEFAULT_VIEW) {
480
- super({useShadowDom: true});
462
+ super({useShadowDom: true, delegatesFocus: true});
481
463
  this.#view = view;
482
464
  this.#getMainResourceTreeModel()?.addEventListener(
483
465
  SDK.ResourceTreeModel.Events.PrimaryPageChanged, this.requestUpdate, this);
@@ -497,13 +479,17 @@ export class BackForwardCacheView extends UI.Widget.Widget {
497
479
 
498
480
  override async performUpdate(): Promise<void> {
499
481
  const reasonToFramesMap = new Map<Protocol.Page.BackForwardCacheNotRestoredReason, string[]>();
500
- const explanationTree = this.#getMainFrame()?.backForwardCacheDetails?.explanationsTree;
482
+ const frame = this.#getMainFrame();
483
+ const explanationTree = frame?.backForwardCacheDetails?.explanationsTree;
501
484
  if (explanationTree) {
502
485
  this.#buildReasonToFramesMap(explanationTree, {blankCount: 1}, reasonToFramesMap);
503
486
  }
487
+ const frameTreeData = this.#buildFrameTreeDataRecursive(explanationTree, {blankCount: 1});
488
+ // Override the icon for the outermost frame.
489
+ frameTreeData.node.iconName = 'frame';
504
490
  const viewInput: ViewInput = {
505
- frame: this.#getMainFrame(),
506
- frameTreeData: this.#buildFrameTreeDataRecursive(explanationTree, {blankCount: 1}),
491
+ frame,
492
+ frameTreeData,
507
493
  reasonToFramesMap,
508
494
  screenStatus: this.#screenStatus,
509
495
  navigateAwayAndBack: this.#navigateAwayAndBack.bind(this),
@@ -519,10 +505,7 @@ export class BackForwardCacheView extends UI.Widget.Widget {
519
505
  this.requestUpdate();
520
506
  void this.updateComplete.then(() => {
521
507
  UI.ARIAUtils.LiveAnnouncer.alert(i18nString(UIStrings.testCompleted));
522
- const resultsSection = this.contentElement?.querySelector('.cache-status-section') as HTMLElement;
523
- if (resultsSection) {
524
- resultsSection.focus();
525
- }
508
+ this.contentElement.focus();
526
509
  });
527
510
  }
528
511