chrome-devtools-frontend 1.0.1724140 → 1.0.1726686

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 (95) hide show
  1. package/.agents/skills/review-ui-widgets/SKILL.md +7 -7
  2. package/.agents/skills/ui-eng-vision-local-lit-renderer/SKILL.md +12 -0
  3. package/.agents/skills/ui-eng-vision-widget-promoter/SKILL.md +3 -3
  4. package/.agents/skills/ui-widgets/SKILL.md +2 -1
  5. package/docs/cookbook/dependencies.md +6 -4
  6. package/front_end/core/i18n/i18nImpl.ts +1 -1
  7. package/front_end/core/root/Runtime.ts +1 -1
  8. package/front_end/core/sdk/ResourceTreeModel.ts +16 -0
  9. package/front_end/entrypoints/js_app/js_app.ts +2 -5
  10. package/front_end/entrypoints/node_app/node_app.ts +2 -3
  11. package/front_end/generated/InspectorBackendCommands.ts +1 -1
  12. package/front_end/generated/protocol.ts +1 -0
  13. package/front_end/models/ai_assistance/skills/lighthouse.md +2 -1
  14. package/front_end/models/ai_assistance/skills/network.md +1 -0
  15. package/front_end/models/ai_assistance/tools/ExecuteJavaScript.ts +26 -2
  16. package/front_end/models/ai_assistance/tools/GetLighthouseAudits.ts +1 -1
  17. package/front_end/models/ai_assistance/tools/ListNetworkRequests.ts +2 -7
  18. package/front_end/models/ai_assistance/tools/RunLighthouse.ts +2 -2
  19. package/front_end/models/comment_manager/CommentManager.ts +0 -6
  20. package/front_end/models/comment_manager/CommentThread.ts +23 -19
  21. package/front_end/models/elements/StyleChanges.ts +66 -0
  22. package/front_end/models/trace/EventsSerializer.ts +2 -7
  23. package/front_end/models/trace/ModelImpl.ts +0 -2
  24. package/front_end/models/trace/handlers/FlowsHandler.ts +37 -29
  25. package/front_end/models/trace/helpers/SyntheticEvents.ts +10 -37
  26. package/front_end/models/trace/insights/RenderBlocking.ts +3 -1
  27. package/front_end/models/trace/lantern/simulation/Simulator.ts +4 -0
  28. package/front_end/models/trace/lantern/types/Lantern.ts +1 -0
  29. package/front_end/panels/accessibility/SourceOrderView.ts +1 -1
  30. package/front_end/panels/application/ApplicationPanelSidebar.ts +90 -0
  31. package/front_end/panels/application/StorageView.ts +196 -174
  32. package/front_end/panels/application/SubAppsView.ts +2 -2
  33. package/front_end/panels/application/preloading/PreloadingView.ts +360 -336
  34. package/front_end/panels/application/preloading/components/PreloadingDisabledInfobar.ts +2 -2
  35. package/front_end/panels/application/preloading/components/PreloadingGrid.ts +6 -3
  36. package/front_end/panels/application/preloading/components/RuleSetGrid.ts +17 -17
  37. package/front_end/panels/application/preloading/components/UsedPreloadingView.ts +2 -2
  38. package/front_end/panels/application/preloading/preloadingView.css +12 -4
  39. package/front_end/panels/application/preloading/preloadingViewDropDown.css +1 -1
  40. package/front_end/panels/application/storageView.css +16 -21
  41. package/front_end/panels/browser_debugger/CategorizedBreakpointsSidebarPane.ts +2 -2
  42. package/front_end/panels/browser_debugger/browser_debugger-meta.ts +6 -8
  43. package/front_end/panels/comments/CommentsPane.ts +26 -9
  44. package/front_end/panels/comments/commentsPane.css +25 -6
  45. package/front_end/panels/common/CommentThreadWidget.ts +2 -2
  46. package/front_end/panels/common/CommentsOverlayWidget.ts +94 -35
  47. package/front_end/panels/common/commentThreadWidget.css +17 -0
  48. package/front_end/panels/common/commentsOverlay.css +5 -10
  49. package/front_end/panels/common/common-meta.ts +11 -1
  50. package/front_end/panels/elements/ClassesPaneWidget.ts +130 -88
  51. package/front_end/panels/elements/ColorSwatchPopoverIcon.ts +7 -33
  52. package/front_end/panels/elements/DOMTreeWidget.ts +7 -3
  53. package/front_end/panels/elements/ElementStatePaneWidget.ts +11 -1
  54. package/front_end/panels/elements/PropertyRenderer.ts +3 -2
  55. package/front_end/panels/elements/StyleEditorWidget.ts +60 -41
  56. package/front_end/panels/elements/StylePropertiesSection.ts +32 -5
  57. package/front_end/panels/elements/StylePropertyTreeElement.ts +227 -162
  58. package/front_end/panels/event_listeners/EventListenersView.ts +11 -8
  59. package/front_end/panels/linear_memory_inspector/components/ValueInterpreterSettings.ts +1 -1
  60. package/front_end/panels/network/NetworkDataGridNode.ts +3 -1
  61. package/front_end/panels/network/RequestConditionsDrawer.ts +1 -1
  62. package/front_end/panels/network/RequestPayloadView.ts +12 -5
  63. package/front_end/panels/profiler/HeapProfileView.ts +28 -6
  64. package/front_end/panels/profiler/HeapSnapshotDataGrids.ts +7 -3
  65. package/front_end/panels/protocol_monitor/JSONEditor.ts +0 -1
  66. package/front_end/panels/recorder/RecorderPanel.ts +2 -2
  67. package/front_end/panels/settings/SettingsScreen.ts +1 -1
  68. package/front_end/panels/sources/NavigatorView.ts +105 -45
  69. package/front_end/panels/sources/ScopeChainSidebarPane.ts +8 -5
  70. package/front_end/panels/sources/SourcesNavigator.ts +421 -213
  71. package/front_end/panels/sources/SourcesPanel.ts +6 -4
  72. package/front_end/panels/sources/WatchExpressionsSidebarPane.ts +10 -5
  73. package/front_end/panels/sources/sources-meta.ts +4 -15
  74. package/front_end/panels/sources/sourcesNavigator.css +5 -0
  75. package/front_end/panels/timeline/ModificationsManager.ts +0 -2
  76. package/front_end/panels/timeline/README.md +2 -0
  77. package/front_end/panels/timeline/TimelineCommentController.ts +132 -30
  78. package/front_end/panels/timeline/TimelinePanel.ts +4 -0
  79. package/front_end/panels/timeline/components/IgnoreListSetting.ts +1 -1
  80. package/front_end/panels/timeline/utils/Treemap.ts +8 -0
  81. package/front_end/third_party/chromium/README.chromium +1 -1
  82. package/front_end/ui/comments/CommentAnchorResolver.ts +3 -0
  83. package/front_end/ui/comments/CommentOverlayManager.ts +2 -4
  84. package/front_end/ui/components/lists/List.ts +14 -1
  85. package/front_end/ui/components/panel_feedback/PreviewToggle.ts +1 -1
  86. package/front_end/ui/components/text_editor/AiCodeCompletionProvider.ts +23 -14
  87. package/front_end/ui/components/text_editor/AiCodeGenerationProvider.ts +3 -0
  88. package/front_end/ui/legacy/Toolbar.ts +0 -1
  89. package/front_end/ui/legacy/Treeoutline.ts +7 -2
  90. package/front_end/ui/legacy/UIUtils.ts +4 -1
  91. package/front_end/ui/legacy/components/inline_editor/Swatches.ts +19 -6
  92. package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +20 -11
  93. package/front_end/ui/legacy/components/source_frame/XMLView.ts +27 -7
  94. package/front_end/ui/visual_logging/KnownContextValues.ts +1 -0
  95. package/package.json +1 -1
@@ -55,7 +55,7 @@ import * as Snippets from '../snippets/snippets.js';
55
55
 
56
56
  import {CallStackSidebarPane} from './CallStackSidebarPane.js';
57
57
  import {DebuggerPausedMessage} from './DebuggerPausedMessage.js';
58
- import {NavigatorView} from './NavigatorView.js';
58
+ import {SourcesNavigatorView} from './SourcesNavigator.js';
59
59
  import sourcesPanelStyles from './sourcesPanel.css.js';
60
60
  import {type EditorClosedEvent, Events, SourcesView} from './SourcesView.js';
61
61
  import {ThreadsSidebarPane} from './ThreadsSidebarPane.js';
@@ -781,12 +781,14 @@ export class SourcesPanel extends UI.Panel.Panel implements
781
781
  const viewManager = UI.ViewManager.ViewManager.instance();
782
782
  for (const view of viewManager.viewsForLocation(UI.ViewManager.ViewLocationValues.NAVIGATOR_VIEW)) {
783
783
  const navigatorView = await view.widget();
784
- if (navigatorView instanceof NavigatorView && navigatorView.acceptProject(uiSourceCode.project())) {
785
- navigatorView.revealUISourceCode(uiSourceCode, true);
784
+ if (navigatorView instanceof SourcesNavigatorView && navigatorView.acceptProject(uiSourceCode.project())) {
786
785
  this.navigatorTabbedLocation.tabbedPane().selectTab(view.viewId(), true);
787
786
  if (!skipReveal) {
788
787
  this.#setNavigatorSidebarOpen(true);
789
- await navigatorView.updateComplete;
788
+ }
789
+ await navigatorView.updateComplete;
790
+ navigatorView.revealUISourceCode(uiSourceCode, true);
791
+ if (!skipReveal) {
790
792
  navigatorView.focus();
791
793
  }
792
794
  break;
@@ -101,7 +101,7 @@ interface ViewInput {
101
101
  onCopyWatchExpression(watchExpression: WatchExpression): void;
102
102
  onDeleteAll(): unknown;
103
103
  onAddExpression(): unknown;
104
- onExpand(e: WatchExpression, expanded: boolean): unknown;
104
+ onExpand(e: WatchExpression, expanded: boolean, recursively?: boolean): unknown;
105
105
  watchExpressions: WatchExpression[];
106
106
  }
107
107
  export interface WatchExpressionPromptViewInput {
@@ -352,7 +352,7 @@ export const DEFAULT_VIEW: View = (input, output, target) => {
352
352
  class=${classMap({'watch-expression-tree-item': true, 'watch-expression-editing': e.editing })}
353
353
  ?open=${Boolean(e.result?.expanded)}
354
354
  @keydown=${onExpressionKeydown.bind(undefined, e)}
355
- @expand=${(event: UI.TreeOutline.TreeViewElement.ExpandEvent) => input.onExpand(e, event.detail.expanded)}
355
+ @expand=${(event: UI.TreeOutline.TreeViewElement.ExpandEvent) => input.onExpand(e, event.detail.expanded, event.detail.recursively)}
356
356
  role=treeitem>
357
357
  <devtools-widget ${widget(WatchExpressionPromptWidget, {
358
358
  expression: e,
@@ -549,10 +549,15 @@ export class WatchExpressionsSidebarPane extends UI.Widget.VBox implements UI.Ac
549
549
  this.saveExpressions();
550
550
  this.requestUpdate();
551
551
  },
552
- onExpand: (e: WatchExpression, expanded: boolean): void => {
553
- if (e.result) {
554
- e.result.expanded = expanded;
552
+ onExpand: (e: WatchExpression, expanded: boolean, recursively = false): void => {
553
+ if (!e.result) {
554
+ return;
555
+ }
556
+ if (expanded && recursively) {
557
+ void e.result.expandRecursively().then(() => this.requestUpdate());
558
+ return;
555
559
  }
560
+ e.result.expanded = expanded;
556
561
  },
557
562
  },
558
563
  {}, this.contentElement);
@@ -227,11 +227,6 @@ const UIStrings = {
227
227
  * @description Title of an action in the sources tool to create a snippet.
228
228
  */
229
229
  createNewSnippet: 'Create new snippet',
230
- /**
231
- * @description Button in the Workspace tab of the Sources panel, used to
232
- * (manually) add a folder to the workspace.
233
- */
234
- addFolderManually: 'Add folder manually',
235
230
  /**
236
231
  * @description Title of an action in the Sources panel command menu to (manually)
237
232
  * add a folder to the workspace.
@@ -564,9 +559,9 @@ UI.ViewManager.registerViewExtension({
564
559
  order: 3,
565
560
  persistence: UI.ViewManager.ViewPersistence.PERMANENT,
566
561
  condition: () => !Root.Runtime.Runtime.isTraceApp(),
567
- async loadView(universe) {
562
+ async loadView() {
568
563
  const Sources = await loadSourcesModule();
569
- return new Sources.SourcesNavigator.FilesNavigatorView(universe.networkProjectManager);
564
+ return new Sources.SourcesNavigator.FilesNavigatorView();
570
565
  },
571
566
  });
572
567
 
@@ -578,9 +573,9 @@ UI.ViewManager.registerViewExtension({
578
573
  order: 6,
579
574
  persistence: UI.ViewManager.ViewPersistence.PERMANENT,
580
575
  condition: () => !Root.Runtime.Runtime.isTraceApp(),
581
- async loadView(universe) {
576
+ async loadView() {
582
577
  const Sources = await loadSourcesModule();
583
- return new Sources.SourcesNavigator.SnippetsNavigatorView(universe.networkProjectManager);
578
+ return new Sources.SourcesNavigator.SnippetsNavigatorView();
584
579
  },
585
580
  });
586
581
 
@@ -2055,12 +2050,6 @@ Common.Revealer.registerRevealer({
2055
2050
  },
2056
2051
  });
2057
2052
 
2058
- UI.Toolbar.registerToolbarItem({
2059
- actionId: 'sources.add-folder-to-workspace',
2060
- location: UI.Toolbar.ToolbarItemLocation.FILES_NAVIGATION_TOOLBAR,
2061
- label: i18nLazyString(UIStrings.addFolderManually),
2062
- });
2063
-
2064
2053
  UI.Context.registerListener({
2065
2054
  contextTypes() {
2066
2055
  return [SDK.DebuggerModel.DebuggerPausedDetails];
@@ -9,6 +9,11 @@
9
9
  flex-shrink: 0;
10
10
  }
11
11
 
12
+ .navigator-toolbar {
13
+ border-bottom: var(--sys-size-1) solid var(--sys-color-divider);
14
+ padding-left: var(--sys-size-5);
15
+ }
16
+
12
17
  .automatic-workspace-infobar {
13
18
  border-top: var(--sys-size-1) solid var(--sys-color-divider);
14
19
  }
@@ -35,7 +35,6 @@ interface ModificationsManagerData {
35
35
  parsedTrace: Trace.TraceModel.ParsedTrace;
36
36
  traceBounds: Trace.Types.Timing.TraceWindowMicro;
37
37
  rawTraceEvents: readonly Trace.Types.Events.Event[];
38
- syntheticEvents: Trace.Types.Events.SyntheticBased[];
39
38
  modifications?: Trace.Types.File.Modifications;
40
39
  }
41
40
 
@@ -90,7 +89,6 @@ export class ModificationsManager extends EventTarget {
90
89
  traceBounds,
91
90
  rawTraceEvents: parsedTrace.traceEvents,
92
91
  modifications: parsedTrace.metadata.modifications,
93
- syntheticEvents: parsedTrace.syntheticEventsManager.getSyntheticTraces(),
94
92
  });
95
93
  modificationsManagerByTraceIndex[traceIndex] = newModificationsManager;
96
94
  activeManager = newModificationsManager;
@@ -185,6 +185,8 @@ Comments on flame chart entries use the shared comments UI from `ui/comments` an
185
185
 
186
186
  The pin and the `COMMENT_PIN` element are separate elements in separate layers, and moving the element fires no DOM scroll or resize event, so step 2 is what keeps the pin on its entry. See the `CustomAnchorResolver` documentation in `ui/comments/CommentAnchorResolver.ts` for the contract.
187
187
 
188
+ Entries without an `EventsSerializer` key, such as JS samples, use a synthetic key and are found again by start time, duration and title.
189
+
188
190
  ## Timeline tree views
189
191
 
190
192
  The `TimelineTreeView` base class provides the foundation for creating various tree-based views within the Performance panel (e.g., Summary, Bottom-Up, Call Tree, Event Log). It handles core functionality like:
@@ -10,9 +10,33 @@ import * as VisualLogging from '../../ui/visual_logging/visual_logging.js';
10
10
 
11
11
  import * as Overlays from './overlays/overlays.js';
12
12
  import {agentContextForEntry} from './TimelineCommentContext.js';
13
- import type {TimelineFlameChartDataProvider} from './TimelineFlameChartDataProvider.js';
13
+ import {
14
+ Events as TimelineFlameChartDataProviderEvents,
15
+ type TimelineFlameChartDataProvider,
16
+ } from './TimelineFlameChartDataProvider.js';
14
17
  import type {TimelineFlameChartNetworkDataProvider} from './TimelineFlameChartNetworkDataProvider.js';
15
18
 
19
+ /**
20
+ * Prefix for keys of entries that EventsSerializer cannot key. The full key is
21
+ * `fc-<chartLocation>-<entryIndex>`.
22
+ */
23
+ const SYNTHETIC_KEY_PREFIX = 'fc-';
24
+
25
+ function entryStartTimeMicro(timelineData: PerfUI.FlameChart.FlameChartTimelineData, entryIndex: number): number {
26
+ return Trace.Helpers.Timing.milliToMicro(Trace.Types.Timing.Milli(timelineData.entryStartTimes[entryIndex]));
27
+ }
28
+
29
+ /**
30
+ * Returns the entry's duration, or undefined for instant entries.
31
+ */
32
+ function entryDurationMicro(timelineData: PerfUI.FlameChart.FlameChartTimelineData, entryIndex: number): number|
33
+ undefined {
34
+ const totalTime = timelineData.entryTotalTimes[entryIndex];
35
+ return !Number.isNaN(totalTime) && totalTime > 0 ?
36
+ Trace.Helpers.Timing.milliToMicro(Trace.Types.Timing.Milli(totalTime)) :
37
+ undefined;
38
+ }
39
+
16
40
  /**
17
41
  * Supplies the flame charts, data providers, overlays and events serializer
18
42
  * that the controller needs to resolve and pin comments.
@@ -45,10 +69,10 @@ interface ResolvedEntry {
45
69
  * flame chart canvas:
46
70
  * - It registers a CustomAnchorResolver that maps a pointer position on a
47
71
  * flame chart canvas to a timeline anchor.
48
- * - It keeps one COMMENT_PIN overlay per thread on the current trace. Overlays
49
- * positions each COMMENT_PIN element over its entry, and the resolver
50
- * returns that element from getAnchorElement() so the shared overlay can
51
- * draw the pin on it.
72
+ * - It keeps one COMMENT_PIN overlay for each thread on the current trace
73
+ * whose entry it finds. Overlays positions each COMMENT_PIN element over its
74
+ * entry, and the resolver returns that element from getAnchorElement() so
75
+ * the shared overlay can draw the pin on it.
52
76
  * - It requests repositioning after every Overlays update, because panning or
53
77
  * zooming the flame chart moves the COMMENT_PIN elements without any DOM
54
78
  * scroll or resize.
@@ -69,6 +93,15 @@ export class TimelineCommentController {
69
93
  this.#syncCommentOverlays();
70
94
  };
71
95
 
96
+ /**
97
+ * The main flame chart rebuilds its entries when entries are hidden or
98
+ * shown from the context menu, or the ignore list changes. Threads with a
99
+ * synthetic key whose entry was missing can then be pinned.
100
+ */
101
+ readonly #onMainDataChanged = (): void => {
102
+ this.#syncCommentOverlays();
103
+ };
104
+
72
105
  // Overlays updates on every pan and zoom, so the notification is skipped
73
106
  // while there are no COMMENT_PIN overlays.
74
107
  readonly #onOverlaysUpdated = (): void => {
@@ -113,13 +146,15 @@ export class TimelineCommentController {
113
146
  }
114
147
 
115
148
  /**
116
- * Starts listening for thread and overlay changes, registers the anchor
117
- * resolver and shows pins for existing threads.
149
+ * Starts listening for thread, overlay and flame chart data changes,
150
+ * registers the anchor resolver and shows pins for existing threads.
118
151
  */
119
152
  wasShown(): void {
120
153
  this.#commentManager.addEventListener(CommentManager.CommentManager.Events.COMMENT_THREADS_CHANGED,
121
154
  this.#onCommentThreadsChanged);
122
155
  this.#delegate.overlays.addEventListener(Overlays.Overlays.OverlaysUpdated.eventName, this.#onOverlaysUpdated);
156
+ this.#delegate.mainDataProvider.addEventListener(TimelineFlameChartDataProviderEvents.DATA_CHANGED,
157
+ this.#onMainDataChanged);
123
158
  Comments.CommentAnchorResolver.registerCustomAnchorResolver(this.#customAnchorResolver);
124
159
  this.#syncCommentOverlays();
125
160
  // COMMENT_PIN overlays that survived while the view was hidden need their
@@ -130,14 +165,16 @@ export class TimelineCommentController {
130
165
  }
131
166
 
132
167
  /**
133
- * Stops listening for thread and overlay changes and unregisters the anchor
134
- * resolver. The final notification removes the shared pins, because the
135
- * resolver no longer supplies their anchor elements.
168
+ * Stops listening for thread, overlay and flame chart data changes and
169
+ * unregisters the anchor resolver. The final notification removes the shared
170
+ * pins, because the resolver no longer supplies their anchor elements.
136
171
  */
137
172
  willHide(): void {
138
173
  this.#commentManager.removeEventListener(CommentManager.CommentManager.Events.COMMENT_THREADS_CHANGED,
139
174
  this.#onCommentThreadsChanged);
140
175
  this.#delegate.overlays.removeEventListener(Overlays.Overlays.OverlaysUpdated.eventName, this.#onOverlaysUpdated);
176
+ this.#delegate.mainDataProvider.removeEventListener(TimelineFlameChartDataProviderEvents.DATA_CHANGED,
177
+ this.#onMainDataChanged);
141
178
  Comments.CommentAnchorResolver.unregisterCustomAnchorResolver(this.#customAnchorResolver);
142
179
  Comments.CommentAnchorResolver.notifyCustomAnchorsMoved();
143
180
  this.#notifiedWithCommentPins = false;
@@ -177,6 +214,67 @@ export class TimelineCommentController {
177
214
  return `trace-${min}-${max}`;
178
215
  }
179
216
 
217
+ #dataProviderFor(chartLocation: 'main'|'network'): TimelineFlameChartDataProvider
218
+ |TimelineFlameChartNetworkDataProvider {
219
+ return chartLocation === 'network' ? this.#delegate.networkDataProvider : this.#delegate.mainDataProvider;
220
+ }
221
+
222
+ /**
223
+ * Returns the event for a thread's timeline anchor, or null if the anchor
224
+ * has a synthetic key and no flame chart entry matches it.
225
+ */
226
+ #eventForTimelineAnchor(anchor: CommentManager.CommentManager.TimelineAnchorSignature,
227
+ parsedTrace: Trace.TraceModel.ParsedTrace): Trace.Types.Events.Event|null {
228
+ if (!anchor.traceEventKey.startsWith(SYNTHETIC_KEY_PREFIX)) {
229
+ // The key was created by EventsSerializer for this trace, because the
230
+ // thread's traceId matches.
231
+ return this.#delegate.eventsSerializer.eventForKey(anchor.traceEventKey as Trace.Types.File.SerializableKey,
232
+ parsedTrace);
233
+ }
234
+ const entryIndex = this.#findEntryIndexForSyntheticKey(anchor);
235
+ if (entryIndex === -1) {
236
+ return null;
237
+ }
238
+ return this.#dataProviderFor(anchor.chartLocation).eventByIndex(entryIndex);
239
+ }
240
+
241
+ /**
242
+ * Returns the index of the flame chart entry with the anchor's start time,
243
+ * duration and title, or -1 if there is none. Duration separates nested
244
+ * entries that share a start time and title, such as recursive calls.
245
+ *
246
+ * Entry indexes change when the flame chart rebuilds its entries, for
247
+ * example after entries are hidden from the context menu. The index encoded
248
+ * in the synthetic key is therefore checked first and used only if that
249
+ * entry still matches. Otherwise every entry is scanned, because
250
+ * `entryStartTimes` concatenates all tracks and is not sorted.
251
+ */
252
+ #findEntryIndexForSyntheticKey(anchor: CommentManager.CommentManager.TimelineAnchorSignature): number {
253
+ const dataProvider = this.#dataProviderFor(anchor.chartLocation);
254
+ const timelineData = dataProvider.timelineData();
255
+ const entryCount = timelineData.entryStartTimes.length;
256
+ const matchesAnchor = (index: number): boolean => {
257
+ // The anchor's times were computed by entryStartTimeMicro() and
258
+ // entryDurationMicro() from the same trace, so exact comparisons are
259
+ // safe.
260
+ return entryStartTimeMicro(timelineData, index) === anchor.startTimeMicro &&
261
+ entryDurationMicro(timelineData, index) === anchor.durationMicro &&
262
+ (dataProvider.entryTitle(index) ?? '') === anchor.entryName;
263
+ };
264
+
265
+ const encodedIndex = Number(anchor.traceEventKey.slice(`${SYNTHETIC_KEY_PREFIX}${anchor.chartLocation}-`.length));
266
+ if (Number.isInteger(encodedIndex) && encodedIndex >= 0 && encodedIndex < entryCount &&
267
+ matchesAnchor(encodedIndex)) {
268
+ return encodedIndex;
269
+ }
270
+ for (let index = 0; index < entryCount; index++) {
271
+ if (matchesAnchor(index)) {
272
+ return index;
273
+ }
274
+ }
275
+ return -1;
276
+ }
277
+
180
278
  #syncCommentOverlays(): void {
181
279
  const existingOverlays = this.#delegate.overlays.overlaysOfType<Trace.Types.Overlays.CommentPin>('COMMENT_PIN');
182
280
  const currentTraceId = this.#traceId();
@@ -203,10 +301,13 @@ export class TimelineCommentController {
203
301
  if (existingOverlays.some(overlay => overlay.commentThreadId === thread.id)) {
204
302
  continue;
205
303
  }
206
- // The key was created by EventsSerializer for this trace, because the
207
- // thread's traceId matches.
208
- const event = this.#delegate.eventsSerializer.eventForKey(
209
- thread.anchor.timeline.traceEventKey as Trace.Types.File.SerializableKey, parsedTrace);
304
+ const event = this.#eventForTimelineAnchor(thread.anchor.timeline, parsedTrace);
305
+ // The entry of a synthetic key can be missing from the flame chart, for
306
+ // example after it is hidden from the context menu. The thread then has
307
+ // no pin until #onMainDataChanged() syncs again and finds the entry.
308
+ if (!event) {
309
+ continue;
310
+ }
210
311
  this.#delegate.overlays.add({
211
312
  type: 'COMMENT_PIN',
212
313
  entry: event,
@@ -224,6 +325,11 @@ export class TimelineCommentController {
224
325
 
225
326
  if (mutationsMade) {
226
327
  void this.#delegate.overlays.update();
328
+ } else {
329
+ // Overlays#reset() clears previous overlays before setParsedTrace() runs.
330
+ // Run #onOverlaysUpdated() so notifyCustomAnchorsMoved() still fires when
331
+ // the new trace adds no comment pins of its own.
332
+ this.#onOverlaysUpdated();
227
333
  }
228
334
  }
229
335
 
@@ -305,27 +411,23 @@ export class TimelineCommentController {
305
411
  if (!traceId) {
306
412
  return null;
307
413
  }
308
- // Events that EventsSerializer cannot key, such as JS samples, cannot be
309
- // found again when the thread is pinned, so they are not commentable.
310
- const traceEventKey = this.#delegate.eventsSerializer.keyForEvent(entry.event);
311
- if (!traceEventKey) {
312
- return null;
313
- }
314
-
315
- const {flameChart, dataProvider, chartLocation, canvas, entryIndex, highlightRect} = entry;
414
+ const {flameChart, dataProvider, chartLocation, canvas, entryIndex, event, highlightRect} = entry;
415
+ // Events that EventsSerializer cannot key, such as JS samples, get a
416
+ // synthetic key that encodes the chart and the entry index.
417
+ // #findEntryIndexForSyntheticKey() uses the stored start time, duration
418
+ // and title to find the entry again if the index has changed.
419
+ const traceEventKey =
420
+ this.#delegate.eventsSerializer.keyForEvent(event) ?? `${SYNTHETIC_KEY_PREFIX}${chartLocation}-${entryIndex}`;
316
421
  const timelineData = flameChart.timelineData();
317
422
  if (!timelineData) {
318
423
  throw new Error('Flame chart resolved an entry index without timeline data.');
319
424
  }
320
- // Store the raw title, even when it is empty. The UI applies its own
321
- // display fallback for untitled entries.
425
+ // Store the raw title, even when it is empty. #findEntryIndexForSyntheticKey()
426
+ // compares against it, and the UI applies its own display fallback for
427
+ // untitled entries.
322
428
  const entryName = dataProvider.entryTitle(entryIndex) ?? '';
323
- const startTimeMicro =
324
- Trace.Helpers.Timing.milliToMicro(Trace.Types.Timing.Milli(timelineData.entryStartTimes[entryIndex]));
325
- const totalTime = timelineData.entryTotalTimes[entryIndex];
326
- const durationMicro = !Number.isNaN(totalTime) && totalTime > 0 ?
327
- Trace.Helpers.Timing.milliToMicro(Trace.Types.Timing.Milli(totalTime)) :
328
- undefined;
429
+ const startTimeMicro = entryStartTimeMicro(timelineData, entryIndex);
430
+ const durationMicro = entryDurationMicro(timelineData, entryIndex);
329
431
 
330
432
  return {
331
433
  anchor: {
@@ -962,6 +962,10 @@ export class TimelinePanel extends TimelinePanelBase implements Client, Timeline
962
962
  // We also hide the sidebar - else if the user is viewing a trace and
963
963
  // then load/record another, the sidebar remains visible.
964
964
  this.#hideSidebar();
965
+ // Hide the SearchableView so Ctrl/Cmd-F cannot search a hidden trace
966
+ // and flame chart overlays (such as comment pins rendered on
967
+ // document.body) do not remain visible above the StatusDialog.
968
+ this.#searchableView.hideWidget();
965
969
  return;
966
970
  }
967
971
  default:
@@ -89,7 +89,7 @@ export const DEFAULT_VIEW: View = (input, output, target) => {
89
89
  // clang-format off
90
90
  return html`
91
91
  <div class='regex-row'>
92
- <devtools-checkbox title=${helpText} aria-label=${helpText} ?checked=${!regex.disabled}
92
+ <devtools-checkbox title=${helpText} aria-label=${helpText} .checked=${!regex.disabled}
93
93
  @change=${(event: Event) => onExistingRegexEnableToggle(regex, (event.currentTarget as UI.UIUtils.CheckboxLabel).checked)}
94
94
  .jslogContext=${'timeline.ignore-list-pattern'}>${regex.pattern}</devtools-checkbox>
95
95
  <devtools-button
@@ -197,12 +197,20 @@ export function createTreemapData(
197
197
  duplication: Trace.Extras.ScriptDuplication.ScriptDuplication): TreemapData {
198
198
  const nodes: TreemapNode[] = [];
199
199
  const htmlNodesByFrameId = new Map<string, TreemapNode>();
200
+ const seenRequests = new Set<Trace.Types.Events.SyntheticNetworkRequest>();
200
201
 
201
202
  for (const script of scripts.scripts) {
202
203
  if (!script.url) {
203
204
  continue;
204
205
  }
205
206
 
207
+ if (!script.inline && script.request) {
208
+ if (seenRequests.has(script.request)) {
209
+ continue;
210
+ }
211
+ seenRequests.add(script.request);
212
+ }
213
+
206
214
  const name = script.url;
207
215
  const sizes = Trace.Handlers.ModelHandlers.Scripts.getScriptGeneratedSizes(script);
208
216
 
@@ -1,7 +1,7 @@
1
1
  Name: Dependencies sourced from the upstream `chromium` repository
2
2
  URL: Internal
3
3
  Version: N/A
4
- Revision: 4f991ca53d23a716fc5bb9f0b7626a258e4d7b40
4
+ Revision: d4d613355ad137685e4f35deed6a3697cd9d5202
5
5
  Update Mechanism: Manual (https://crbug.com/428069060)
6
6
  License: BSD-3-Clause
7
7
  License File: LICENSE
@@ -277,6 +277,9 @@ function getElementLoggingConfig(element: Element): VisualLogging.LoggingConfig|
277
277
  export function hasDisallowedCommentAncestor(element: Element): boolean {
278
278
  let current: Element|null = element;
279
279
  while (current) {
280
+ if (current.classList.contains('comments-overlay-container')) {
281
+ return true;
282
+ }
280
283
  const config = getElementLoggingConfig(current);
281
284
  if (config && (DISALLOWED_COMMENT_ANCESTORS.has(config.ve) || config.context === 'comments')) {
282
285
  return true;
@@ -37,7 +37,6 @@ export interface PinPositionData {
37
37
  top: number;
38
38
  left: number;
39
39
  visible: boolean;
40
- index: number;
41
40
  }
42
41
 
43
42
  export interface HighlightRectData {
@@ -238,8 +237,8 @@ export class CommentOverlayManager extends Common.ObjectWrapper.ObjectWrapper<Ev
238
237
  return this.#pinPositions;
239
238
  }
240
239
 
241
- getHighlightRects(): HighlightRectData[] {
242
- return this.#highlightRects;
240
+ getHighlight(threadId: string): HighlightRectData|undefined {
241
+ return this.#highlightRects.find(h => h.id === threadId);
243
242
  }
244
243
 
245
244
  getAnchorElement(thread: CommentThread): Element|undefined {
@@ -490,7 +489,6 @@ export class CommentOverlayManager extends Common.ObjectWrapper.ObjectWrapper<Ev
490
489
  top: scrollY + visibleRect.top - 12 + offsetY,
491
490
  left: scrollX + visibleRect.right - 12,
492
491
  visible: true,
493
- index: thread.index,
494
492
  });
495
493
 
496
494
  newHighlights.push({
@@ -107,7 +107,10 @@ export class List extends HTMLElement {
107
107
 
108
108
  createSlottedListItem(index: number): TemplateResult {
109
109
  return html`
110
- <li role='listitem' tabindex=${this.#disableListItemFocus ? '-1' : '0'}>
110
+ <li
111
+ role='listitem'
112
+ tabindex=${this.#disableListItemFocus ? '-1' : '0'}
113
+ @keydown=${this.#deletable ? this.#dispatchRemoveOnDelete.bind(this, index) : nothing}>
111
114
  <slot name='slot-${index}'></slot>
112
115
  <div class='controls-container'>
113
116
  <div class='controls-gradient'></div>
@@ -166,6 +169,16 @@ export class List extends HTMLElement {
166
169
  this.dispatchEvent(new ItemRemoveEvent({index}));
167
170
  }
168
171
 
172
+ #dispatchRemoveOnDelete(index: number, event: KeyboardEvent): void {
173
+ if (!this.#deletable || event.target !== event.currentTarget ||
174
+ (event.key !== 'Delete' && event.key !== 'Backspace')) {
175
+ return;
176
+ }
177
+
178
+ event.preventDefault();
179
+ this.#dispatchRemove(index);
180
+ }
181
+
169
182
  #dispatchEdit(index: number): void {
170
183
  this.dispatchEvent(new ItemEditEvent({index}));
171
184
  }
@@ -68,7 +68,7 @@ export class PreviewToggle extends HTMLElement {
68
68
  <style>${previewToggleStyles}</style>
69
69
  <div class="container">
70
70
  <devtools-checkbox
71
- ?checked=${checked}
71
+ .checked=${Boolean(checked)}
72
72
  @change=${this.#checkboxChanged}
73
73
  aria-label=${this.#name} >
74
74
  <devtools-icon name="experiment" class="medium">
@@ -246,24 +246,33 @@ export class AiCodeCompletionProvider {
246
246
  },
247
247
  {
248
248
  key: 'Tab',
249
- run: (): boolean => {
250
- if (!this.#aiCodeCompletion || !this.#editor || !hasActiveAiSuggestion(this.#editor.state)) {
251
- return false;
252
- }
253
- const {accepted, suggestion} = acceptAiAutoCompleteSuggestion(this.#editor.editor);
254
- if (!accepted) {
255
- return false;
256
- }
257
- if (suggestion?.rpcGlobalId) {
258
- this.#aiCodeCompletion?.registerUserAcceptance(suggestion.rpcGlobalId, suggestion.sampleId);
259
- }
260
- this.#aiCodeCompletionConfig?.onSuggestionAccepted(this.#aiCodeCompletionCitations);
261
- return true;
262
- },
249
+ run: this.#acceptAiSuggestion.bind(this),
250
+ },
251
+ {
252
+ key: 'Enter',
253
+ run: this.#acceptAiSuggestion.bind(this),
263
254
  },
264
255
  ];
265
256
  }
266
257
 
258
+ #acceptAiSuggestion(): boolean {
259
+ if (!this.#aiCodeCompletion || !this.#editor || !hasActiveAiSuggestion(this.#editor.state)) {
260
+ return false;
261
+ }
262
+ if (this.#editor.state.field(aiAutoCompleteSuggestionState)?.source !== AiSuggestionSource.COMPLETION) {
263
+ return false;
264
+ }
265
+ const {accepted, suggestion} = acceptAiAutoCompleteSuggestion(this.#editor.editor);
266
+ if (!accepted) {
267
+ return false;
268
+ }
269
+ if (suggestion?.rpcGlobalId) {
270
+ this.#aiCodeCompletion?.registerUserAcceptance(suggestion.rpcGlobalId, suggestion.sampleId);
271
+ }
272
+ this.#aiCodeCompletionConfig?.onSuggestionAccepted(this.#aiCodeCompletionCitations);
273
+ return true;
274
+ }
275
+
267
276
  #detachTeaser(): void {
268
277
  if (!this.#teaser) {
269
278
  return;
@@ -270,6 +270,9 @@ export class AiCodeGenerationProvider {
270
270
  if (!this.#aiCodeGeneration || !this.#editor || !hasActiveAiSuggestion(this.#editor.state)) {
271
271
  return false;
272
272
  }
273
+ if (this.#editor.state.field(aiAutoCompleteSuggestionState)?.source !== AiSuggestionSource.GENERATION) {
274
+ return false;
275
+ }
273
276
  const {accepted, suggestion} = acceptAiAutoCompleteSuggestion(this.#editor.editor);
274
277
  if (!accepted) {
275
278
  return false;
@@ -1381,7 +1381,6 @@ export interface ToolbarItemRegistration {
1381
1381
  }
1382
1382
 
1383
1383
  export const enum ToolbarItemLocation {
1384
- FILES_NAVIGATION_TOOLBAR = 'files-navigator-toolbar',
1385
1384
  MAIN_TOOLBAR_RIGHT = 'main-toolbar-right',
1386
1385
  MAIN_TOOLBAR_LEFT = 'main-toolbar-left',
1387
1386
  STYLES_SIDEBARPANE_TOOLBAR = 'styles-sidebarpane-toolbar',
@@ -1730,6 +1730,11 @@ class TreeViewTreeElement extends TreeElement {
1730
1730
  return super.onselect(selectedByUser);
1731
1731
  }
1732
1732
 
1733
+ override async expandRecursively(maxDepth?: number): Promise<void> {
1734
+ await super.expandRecursively(maxDepth);
1735
+ this.listItemElement.dispatchEvent(new TreeViewElement.ExpandEvent({expanded: true, recursively: true}));
1736
+ }
1737
+
1733
1738
  override onenter(): boolean {
1734
1739
  const enterEvent = new TreeViewElement.EnterEvent();
1735
1740
  const shouldExpand = this.listItemElement.dispatchEvent(enterEvent);
@@ -2129,8 +2134,8 @@ export namespace TreeViewElement {
2129
2134
  }
2130
2135
  }
2131
2136
 
2132
- export class ExpandEvent extends CustomEvent<{expanded: boolean}> {
2133
- constructor(detail: {expanded: boolean}) {
2137
+ export class ExpandEvent extends CustomEvent<{expanded: boolean, recursively?: boolean}> {
2138
+ constructor(detail: {expanded: boolean, recursively?: boolean}) {
2134
2139
  super('expand', {detail});
2135
2140
  }
2136
2141
  }
@@ -1244,7 +1244,10 @@ export class CheckboxLabel extends HTMLElement {
1244
1244
  }
1245
1245
 
1246
1246
  set checked(checked: boolean) {
1247
- this.toggleAttribute('checked', checked);
1247
+ // Coerce explicitly: `toggleAttribute(name, undefined)` toggles the
1248
+ // attribute instead of removing it, which would flip the state when a
1249
+ // Lit `.checked=${...}` binding receives `undefined`.
1250
+ this.toggleAttribute('checked', Boolean(checked));
1248
1251
  }
1249
1252
 
1250
1253
  get small(): boolean {