chrome-devtools-frontend 1.0.1597624 → 1.0.1599001

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 (140) hide show
  1. package/.agents/README.md +13 -0
  2. package/{agents/prompts/creating-a-model.md → .agents/skills/creating-a-model/SKILL.md} +7 -1
  3. package/{agents/prompts/devtools-imports.md → .agents/skills/devtools-imports/SKILL.md} +10 -5
  4. package/{agents/prompts/merging-devtools-module.md → .agents/skills/merging-devtools-module/SKILL.md} +5 -0
  5. package/{agents/prompts/ui-widgets.md → .agents/skills/ui-widgets/SKILL.md} +5 -0
  6. package/{agents/prompts/verification.md → .agents/skills/verification/SKILL.md} +5 -0
  7. package/docs/ui_engineering.md +6 -6
  8. package/front_end/core/host/AidaClient.ts +2 -0
  9. package/front_end/core/host/GcaTypes.ts +518 -0
  10. package/front_end/core/host/UserMetrics.ts +0 -1
  11. package/front_end/core/host/host.ts +2 -0
  12. package/front_end/core/root/ExperimentNames.ts +0 -1
  13. package/front_end/entrypoints/main/MainImpl.ts +0 -2
  14. package/front_end/generated/InspectorBackendCommands.ts +1 -1
  15. package/front_end/generated/protocol.ts +2 -1
  16. package/front_end/models/ai_assistance/AiConversation.ts +28 -15
  17. package/front_end/models/ai_assistance/AiHistoryStorage.snapshot.txt +1 -1
  18. package/front_end/models/ai_assistance/AiHistoryStorage.ts +1 -0
  19. package/front_end/models/ai_assistance/ConversationHandler.ts +8 -2
  20. package/front_end/models/ai_assistance/agents/AccessibilityAgent.ts +3 -18
  21. package/front_end/models/ai_assistance/agents/AiAgent.ts +39 -5
  22. package/front_end/models/ai_assistance/agents/BreakpointDebuggerAgent.ts +0 -1
  23. package/front_end/models/ai_assistance/agents/ContextSelectionAgent.ts +1 -0
  24. package/front_end/models/ai_assistance/agents/ConversationSummaryAgent.ts +108 -0
  25. package/front_end/models/ai_assistance/agents/FileAgent.ts +0 -15
  26. package/front_end/models/ai_assistance/agents/NetworkAgent.ts +0 -5
  27. package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +76 -13
  28. package/front_end/models/ai_assistance/agents/PerformanceAnnotationsAgent.ts +0 -10
  29. package/front_end/models/ai_assistance/agents/StylingAgent.snapshot.txt +0 -6
  30. package/front_end/models/ai_assistance/agents/StylingAgent.ts +0 -5
  31. package/front_end/models/ai_assistance/ai_assistance.ts +2 -0
  32. package/front_end/models/emulation/DeviceModeModel.ts +5 -1
  33. package/front_end/models/emulation/EmulatedDevices.ts +3 -2
  34. package/front_end/models/issues_manager/SharedDictionaryIssue.ts +15 -5
  35. package/front_end/models/issues_manager/descriptions/sharedDictionaryUseErrorNoCorpCrossOriginNoCorsRequest.md +3 -0
  36. package/front_end/models/issues_manager/descriptions/sharedDictionaryWriteErrorNoCorpCossOriginNoCorsRequest.md +3 -0
  37. package/front_end/models/javascript_metadata/NativeFunctions.js +8 -0
  38. package/front_end/models/lighthouse/RunTypes.ts +41 -0
  39. package/front_end/models/lighthouse/lighthouse.ts +2 -0
  40. package/front_end/models/trace/ModelImpl.ts +4 -0
  41. package/front_end/models/trace/helpers/SamplesIntegrator.ts +1 -8
  42. package/front_end/models/trace/types/Configuration.ts +0 -5
  43. package/front_end/panels/ai_assistance/AiAssistancePanel.ts +90 -14
  44. package/front_end/panels/ai_assistance/PatchWidget.ts +1 -1
  45. package/front_end/panels/ai_assistance/components/ChatInput.ts +2 -0
  46. package/front_end/panels/ai_assistance/components/ChatMessage.ts +153 -42
  47. package/front_end/panels/ai_assistance/components/ChatView.ts +1 -1
  48. package/front_end/panels/ai_assistance/components/chatMessage.css +61 -0
  49. package/front_end/panels/application/AppManifestView.ts +2 -2
  50. package/front_end/panels/application/CookieItemsView.ts +9 -15
  51. package/front_end/panels/application/DeviceBoundSessionsView.ts +3 -5
  52. package/front_end/panels/application/FrameDetailsView.ts +2 -2
  53. package/front_end/panels/application/ReportingApiView.ts +2 -2
  54. package/front_end/panels/application/preloading/PreloadingView.ts +20 -7
  55. package/front_end/panels/application/preloading/components/PreloadingDetailsReportView.ts +6 -3
  56. package/front_end/panels/application/preloading/components/PreloadingString.ts +15 -2
  57. package/front_end/panels/application/preloading/helper/PreloadingForward.ts +31 -2
  58. package/front_end/panels/changes/ChangesView.ts +7 -11
  59. package/front_end/panels/coverage/CoverageView.ts +4 -4
  60. package/front_end/panels/css_overview/CSSOverviewCompletedView.ts +3 -3
  61. package/front_end/panels/elements/ElementsTreeOutline.ts +34 -8
  62. package/front_end/panels/elements/StylePropertiesSection.ts +129 -1
  63. package/front_end/panels/elements/StylePropertyHighlighter.ts +3 -0
  64. package/front_end/panels/elements/stylesSidebarPane.css +34 -0
  65. package/front_end/panels/issues/AffectedSelectivePermissionsInterventionView.ts +3 -5
  66. package/front_end/panels/layer_viewer/LayerDetailsView.ts +2 -1
  67. package/front_end/panels/lighthouse/LighthouseController.ts +148 -162
  68. package/front_end/panels/lighthouse/LighthousePanel.ts +2 -7
  69. package/front_end/panels/lighthouse/LighthouseStartView.ts +7 -6
  70. package/front_end/panels/lighthouse/LighthouseStatusView.ts +3 -3
  71. package/front_end/panels/linear_memory_inspector/components/LinearMemoryInspector.ts +7 -3
  72. package/front_end/panels/network/RequestConditionsDrawer.ts +4 -4
  73. package/front_end/panels/network/RequestCookiesView.ts +2 -2
  74. package/front_end/panels/network/RequestHeadersView.ts +4 -4
  75. package/front_end/panels/network/RequestResponseView.ts +2 -2
  76. package/front_end/panels/performance_monitor/PerformanceMonitor.ts +2 -2
  77. package/front_end/panels/protocol_monitor/ProtocolMonitor.ts +3 -3
  78. package/front_end/panels/recorder/components/StepView.ts +2 -1
  79. package/front_end/panels/search/SearchView.ts +2 -2
  80. package/front_end/panels/sensors/SensorsView.ts +32 -22
  81. package/front_end/panels/settings/emulation/DevicesSettingsTab.ts +18 -4
  82. package/front_end/panels/timeline/StatusDialog.ts +159 -83
  83. package/front_end/panels/timeline/TimelineController.ts +0 -4
  84. package/front_end/panels/timeline/TimelineDetailsView.ts +8 -6
  85. package/front_end/panels/timeline/TimelinePanel.ts +29 -2
  86. package/front_end/panels/timeline/components/LiveMetricsView.ts +2 -2
  87. package/front_end/panels/timeline/components/Sidebar.ts +1 -1
  88. package/front_end/panels/timeline/components/SidebarInsightsTab.ts +1 -1
  89. package/front_end/panels/timeline/components/SidebarSingleInsightSet.ts +62 -34
  90. package/front_end/panels/timeline/components/insights/BaseInsightComponent.ts +53 -28
  91. package/front_end/panels/timeline/components/insights/CharacterSet.ts +2 -6
  92. package/front_end/panels/timeline/components/insights/EventRef.ts +2 -2
  93. package/front_end/panels/timeline/components/insights/baseInsightComponent.css +7 -0
  94. package/front_end/panels/timeline/components/insights/insights.ts +0 -2
  95. package/front_end/panels/timeline/timeline-meta.ts +11 -0
  96. package/front_end/panels/webauthn/WebauthnPane.ts +2 -2
  97. package/front_end/third_party/chromium/README.chromium +1 -1
  98. package/front_end/third_party/puppeteer/README.chromium +2 -2
  99. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Realm.js +1 -1
  100. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Realm.js.map +1 -1
  101. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/util.d.ts +4 -0
  102. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/util.d.ts.map +1 -1
  103. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/util.js +13 -0
  104. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/util.js.map +1 -1
  105. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/injected/injected.d.ts +1 -1
  106. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.d.ts +3 -3
  107. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.js +3 -3
  108. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.js.map +1 -1
  109. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/Mutex.d.ts +2 -2
  110. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/version.d.ts +1 -1
  111. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/version.js +1 -1
  112. package/front_end/third_party/puppeteer/package/lib/cjs/third_party/mitt/mitt.js +2 -2
  113. package/front_end/third_party/puppeteer/package/lib/cjs/third_party/parsel-js/parsel-js.js +1 -1
  114. package/front_end/third_party/puppeteer/package/lib/cjs/third_party/rxjs/rxjs.js +446 -446
  115. package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.js +166 -167
  116. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Realm.js +2 -2
  117. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Realm.js.map +1 -1
  118. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/util.d.ts +4 -0
  119. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/util.d.ts.map +1 -1
  120. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/util.js +12 -0
  121. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/util.js.map +1 -1
  122. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.d.ts +3 -3
  123. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.js +3 -3
  124. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.js.map +1 -1
  125. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/version.d.ts +1 -1
  126. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/version.js +1 -1
  127. package/front_end/third_party/puppeteer/package/lib/esm/third_party/mitt/mitt.js +1 -1
  128. package/front_end/third_party/puppeteer/package/lib/esm/third_party/parsel-js/parsel-js.js +1 -1
  129. package/front_end/third_party/puppeteer/package/lib/esm/third_party/rxjs/rxjs.js +97 -97
  130. package/front_end/third_party/puppeteer/package/package.json +1 -1
  131. package/front_end/third_party/puppeteer/package/src/bidi/Realm.ts +2 -2
  132. package/front_end/third_party/puppeteer/package/src/bidi/util.ts +17 -0
  133. package/front_end/third_party/puppeteer/package/src/revisions.ts +3 -3
  134. package/front_end/third_party/puppeteer/package/src/util/version.ts +1 -1
  135. package/front_end/ui/legacy/Widget.ts +47 -9
  136. package/front_end/ui/visual_logging/KnownContextValues.ts +1 -1
  137. package/package.json +1 -1
  138. package/agents/prompts/README.md +0 -18
  139. package/front_end/models/issues_manager/descriptions/sharedDictionaryUseErrorCrossOriginNoCorsRequest.md +0 -1
  140. package/front_end/panels/timeline/components/insights/InsightRenderer.ts +0 -93
@@ -22,7 +22,7 @@ import {Events as JSONEditorEvents, JSONEditor, type Parameter} from './JSONEdit
22
22
  import protocolMonitorStyles from './protocolMonitor.css.js';
23
23
 
24
24
  const {styleMap} = Directives;
25
- const {widget, widgetConfig, widgetRef} = UI.Widget;
25
+ const {widget, widgetRef} = UI.Widget;
26
26
  const UIStrings = {
27
27
  /**
28
28
  * @description Text for one or a group of functions
@@ -303,7 +303,7 @@ export const DEFAULT_VIEW: View = (input, output, target) => {
303
303
  </tr>`)}
304
304
  </table>
305
305
  </devtools-data-grid>
306
- <devtools-widget .widgetConfig=${widgetConfig(InfoWidget, {
306
+ <devtools-widget ${widget(InfoWidget, {
307
307
  request: input.selectedMessage?.params,
308
308
  response: input.selectedMessage?.result || input.selectedMessage?.error,
309
309
  type: !input.selectedMessage ? undefined :
@@ -349,7 +349,7 @@ export const DEFAULT_VIEW: View = (input, output, target) => {
349
349
  </devtools-toolbar>
350
350
  </div>
351
351
  <devtools-widget slot="sidebar"
352
- .widgetConfig=${widgetConfig(JSONEditor, { metadataByCommand, typesByName, enumsByName})}
352
+ ${widget(JSONEditor, { metadataByCommand, typesByName, enumsByName})}
353
353
  ${widgetRef(JSONEditor, e => {output.editorWidget = e;})}>
354
354
  </devtools-widget>
355
355
  </devtools-split-view>`,
@@ -19,6 +19,7 @@ import stepViewStyles from './stepView.css.js';
19
19
  import {TimelineSection} from './TimelineSection.js';
20
20
 
21
21
  const {html} = Lit;
22
+ const {widget} = UI.Widget;
22
23
 
23
24
  const UIStrings = {
24
25
  /**
@@ -396,7 +397,7 @@ export const DEFAULT_VIEW = (input: ViewInput, _output: ViewOutput, target: HTML
396
397
  html`
397
398
  <style>${stepViewStyles}</style>
398
399
  <div>
399
- <devtools-widget .widgetConfig=${UI.Widget.widgetConfig(TimelineSection, {
400
+ <devtools-widget ${widget(TimelineSection, {
400
401
  isFirstSection: input.isFirstSection,
401
402
  isLastSection: input.isLastSection,
402
403
  isStartOfGroup: input.isStartOfGroup,
@@ -107,7 +107,7 @@ const UIStrings = {
107
107
  const str_ = i18n.i18n.registerUIStrings('panels/search/SearchView.ts', UIStrings);
108
108
  const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
109
109
  const {ref, live} = Directives;
110
- const {widgetConfig, widget, widgetRef} = UI.Widget;
110
+ const {widget, widgetRef} = UI.Widget;
111
111
 
112
112
  export interface SearchViewInput {
113
113
  query: string;
@@ -246,7 +246,7 @@ export const DEFAULT_VIEW: View = (input, output, target) => {
246
246
  </div>
247
247
  <div class="search-results" @keydown=${onPanelKeyDown}>
248
248
  ${searchResults.length
249
- ? html`<devtools-widget .widgetConfig=${widgetConfig(SearchResultsPane, {searchResults, searchConfig})}
249
+ ? html`<devtools-widget ${widget(SearchResultsPane, {searchResults, searchConfig})}
250
250
  ${widgetRef(SearchResultsPane, w => {
251
251
  output.showAllMatches = () => void w.showAllMatches();
252
252
  output.collapseAllResults = () => void w.collapseAllResults(); })}>
@@ -13,6 +13,7 @@ import * as UI from '../../ui/legacy/legacy.js';
13
13
  import * as VisualLogging from '../../ui/visual_logging/visual_logging.js';
14
14
  import * as MobileThrottling from '../mobile_throttling/mobile_throttling.js';
15
15
 
16
+ import type {LocationDescription} from './LocationsSettingsTab.js';
16
17
  import sensorsStyles from './sensors.css.js';
17
18
 
18
19
  const UIStrings = {
@@ -179,6 +180,7 @@ export class SensorsView extends UI.Widget.VBox {
179
180
  readonly #locationSetting: Common.Settings.Setting<string>;
180
181
  #location: SDK.EmulationModel.Location;
181
182
  #locationOverrideEnabled: boolean;
183
+ readonly #locationSectionElement: HTMLElement;
182
184
  private fieldsetElement!: HTMLFieldSetElement;
183
185
  private timezoneError!: HTMLElement;
184
186
  private locationSelectElement!: HTMLSelectElement;
@@ -225,7 +227,11 @@ export class SensorsView extends UI.Widget.VBox {
225
227
  this.#location = SDK.EmulationModel.Location.parseSetting(this.#locationSetting.get());
226
228
  this.#locationOverrideEnabled = false;
227
229
 
228
- this.createLocationSection(this.#location);
230
+ this.#locationSectionElement = this.contentElement.createChild('section', 'sensors-group');
231
+ const customLocationsSetting =
232
+ Common.Settings.Settings.instance().moduleSetting<LocationDescription[]>('emulation.locations');
233
+ this.renderLocationSection(this.#location, customLocationsSetting);
234
+ customLocationsSetting.addChangeListener(() => this.renderLocationSection(this.#location, customLocationsSetting));
229
235
 
230
236
  this.createPanelSeparator();
231
237
 
@@ -259,12 +265,15 @@ export class SensorsView extends UI.Widget.VBox {
259
265
  this.contentElement.createChild('div').classList.add('panel-section-separator');
260
266
  }
261
267
 
262
- private createLocationSection(location: SDK.EmulationModel.Location): void {
263
- const geogroup = this.contentElement.createChild('section', 'sensors-group');
264
- geogroup.setAttribute('jslog', `${VisualLogging.section('location')}`);
268
+ private renderLocationSection(
269
+ location: SDK.EmulationModel.Location,
270
+ customLocationsSetting: Common.Settings.Setting<LocationDescription[]>): void {
271
+ const customLocations = customLocationsSetting.get();
272
+ this.#locationSectionElement.removeChildren();
273
+ this.#locationSectionElement.setAttribute('jslog', `${VisualLogging.section('location')}`);
265
274
  const geogroupTitle = UI.UIUtils.createLabel(i18nString(UIStrings.location), 'sensors-group-title');
266
- geogroup.appendChild(geogroupTitle);
267
- const fields = geogroup.createChild('div', 'geo-fields');
275
+ this.#locationSectionElement.appendChild(geogroupTitle);
276
+ const fields = this.#locationSectionElement.createChild('div', 'geo-fields');
268
277
  let selectedIndex = 0;
269
278
 
270
279
  const noOverrideOption = {title: i18nString(UIStrings.noOverride), location: NonPresetOptions.NoOverride};
@@ -277,28 +286,29 @@ export class SensorsView extends UI.Widget.VBox {
277
286
  UI.UIUtils.createOption(noOverrideOption.title, noOverrideOption.location, 'no-override'));
278
287
  this.customLocationsGroup = this.locationSelectElement.createChild('optgroup');
279
288
  this.customLocationsGroup.label = i18nString(UIStrings.overrides);
280
- const customLocations = Common.Settings.Settings.instance().moduleSetting('emulation.locations');
281
289
  const manageButton = UI.UIUtils.createTextButton(
282
- i18nString(UIStrings.manage), () => Common.Revealer.reveal(customLocations),
290
+ i18nString(UIStrings.manage), () => Common.Revealer.reveal(customLocationsSetting),
283
291
  {className: 'manage-locations', jslogContext: 'sensors.manage-locations'});
284
292
  UI.ARIAUtils.setLabel(manageButton, i18nString(UIStrings.manageTheListOfLocations));
285
293
  fields.appendChild(manageButton);
286
- const fillCustomSettings = (): void => {
287
- if (!this.customLocationsGroup) {
288
- return;
289
- }
290
- this.customLocationsGroup.removeChildren();
291
- for (const [i, customLocation] of customLocations.get().entries()) {
292
- this.customLocationsGroup.appendChild(
293
- UI.UIUtils.createOption(customLocation.title, JSON.stringify(customLocation), 'custom'));
294
- if (location.latitude === customLocation.lat && location.longitude === customLocation.long) {
295
- // If the location coming from settings matches the custom location, use its index to select the option
296
- selectedIndex = i + 1;
294
+ if (this.#locationOverrideEnabled) {
295
+ if (location.unavailable) {
296
+ selectedIndex = customLocations.length + 2;
297
+ } else {
298
+ selectedIndex = customLocations.length + 1;
299
+ for (const [i, customLocation] of customLocations.entries()) {
300
+ if (location.latitude === customLocation.lat && location.longitude === customLocation.long &&
301
+ location.timezoneId === customLocation.timezoneId && location.locale === customLocation.locale) {
302
+ selectedIndex = i + 1;
303
+ break;
304
+ }
297
305
  }
298
306
  }
299
- };
300
- customLocations.addChangeListener(fillCustomSettings);
301
- fillCustomSettings();
307
+ }
308
+ for (const customLocation of customLocations) {
309
+ this.customLocationsGroup.appendChild(
310
+ UI.UIUtils.createOption(customLocation.title, JSON.stringify(customLocation), 'custom'));
311
+ }
302
312
 
303
313
  // Other location
304
314
  const customLocationOption = {title: i18nString(UIStrings.other), location: NonPresetOptions.Custom};
@@ -70,6 +70,10 @@ const UIStrings = {
70
70
  * @example {TestDevice} PH1
71
71
  */
72
72
  deviceAddedOrUpdated: 'Device {PH1} successfully added/updated.',
73
+ /**
74
+ * @description Error message in the Devices settings pane shown when the user agent string is empty.
75
+ */
76
+ userAgentStringCannotBeEmpty: 'User agent string cannot be empty.',
73
77
  } as const;
74
78
  const str_ = i18n.i18n.registerUIStrings('panels/settings/emulation/DevicesSettingsTab.ts', UIStrings);
75
79
  const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
@@ -243,7 +247,9 @@ export class DevicesSettingsTab extends UI.Widget.VBox implements
243
247
  (editor.control('ua-metadata') as
244
248
  UI.ListWidget.CustomEditorControl<EmulationComponents.UserAgentClientHintsForm.UserAgentClientHintsFormData>)
245
249
  .value.metaData;
246
- if (userAgentControlValue) {
250
+ const hasUserAgentOverride = device.userAgent.trim().length > 0;
251
+ device.userAgentMetadata = null;
252
+ if (hasUserAgentOverride && userAgentControlValue) {
247
253
  device.userAgentMetadata = {
248
254
  ...userAgentControlValue,
249
255
  mobile:
@@ -310,9 +316,7 @@ export class DevicesSettingsTab extends UI.Widget.VBox implements
310
316
  UI.UIUtils.createTextChild(uaStringFields.createChild('b'), i18nString(UIStrings.userAgentString));
311
317
 
312
318
  const ua = uaStringFields.createChild('div', 'hbox');
313
- ua.appendChild(editor.createInput('user-agent', 'text', i18nString(UIStrings.userAgentString), () => {
314
- return {valid: true};
315
- }));
319
+ ua.appendChild(editor.createInput('user-agent', 'text', i18nString(UIStrings.userAgentString), userAgentValidator));
316
320
  const uaTypeOptions = [
317
321
  EmulationModel.DeviceModeModel.UA.MOBILE,
318
322
  EmulationModel.DeviceModeModel.UA.MOBILE_NO_TOUCH,
@@ -338,6 +342,16 @@ export class DevicesSettingsTab extends UI.Widget.VBox implements
338
342
  return uaMetadata.validate();
339
343
  }
340
344
 
345
+ function userAgentValidator(
346
+ _item: EmulationModel.EmulatedDevices.EmulatedDevice, _index: number,
347
+ input: UI.ListWidget.EditorControl): UI.ListWidget.ValidatorResult {
348
+ if (input.value.trim().length > 0) {
349
+ return {valid: true};
350
+ }
351
+
352
+ return {valid: false, errorMessage: i18nString(UIStrings.userAgentStringCannotBeEmpty)};
353
+ }
354
+
341
355
  function titleValidator(
342
356
  _item: EmulationModel.EmulatedDevices.EmulatedDevice, _index: number,
343
357
  input: UI.ListWidget.EditorControl): UI.ListWidget.ValidatorResult {
@@ -2,8 +2,6 @@
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
4
 
5
- /* eslint-disable @devtools/no-imperative-dom-api */
6
-
7
5
  import '../../ui/legacy/legacy.js';
8
6
 
9
7
  import * as i18n from '../../core/i18n/i18n.js';
@@ -11,8 +9,9 @@ import * as Platform from '../../core/platform/platform.js';
11
9
  import * as TextUtils from '../../models/text_utils/text_utils.js';
12
10
  import type * as Trace from '../../models/trace/trace.js';
13
11
  import * as Workspace from '../../models/workspace/workspace.js';
14
- import type * as Buttons from '../../ui/components/buttons/buttons.js';
12
+ import * as Buttons from '../../ui/components/buttons/buttons.js';
15
13
  import * as UI from '../../ui/legacy/legacy.js';
14
+ import {html, nothing, render} from '../../ui/lit/lit.js';
16
15
  import * as VisualLogging from '../../ui/visual_logging/visual_logging.js';
17
16
 
18
17
  import {traceJsonGenerator} from './SaveFileFormatter.js';
@@ -44,19 +43,105 @@ const UIStrings = {
44
43
  const str_ = i18n.i18n.registerUIStrings('panels/timeline/StatusDialog.ts', UIStrings);
45
44
  const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
46
45
 
46
+ export interface ViewInput {
47
+ statusText: string;
48
+ showTimer: boolean;
49
+ timeText: string;
50
+ showProgress: boolean;
51
+ progressActivity: string;
52
+ progressPercent: number;
53
+ descriptionText: string|undefined;
54
+ buttonText: string;
55
+ hideStopButton: boolean;
56
+ focusStopButton: boolean;
57
+ showDownloadButton: boolean;
58
+ downloadButtonDisabled: boolean;
59
+ onStopClick: () => void;
60
+ onDownloadClick: () => void;
61
+ }
62
+
63
+ export type ViewOutput = Record<string, never>;
64
+
65
+ export type View = (input: ViewInput, output: ViewOutput, target: HTMLElement) => void;
66
+
67
+ // clang-format off
68
+ export const DEFAULT_VIEW: View = (input, output, target) => {
69
+ render(html`
70
+ <style>${timelineStatusDialogStyles}</style>
71
+ <div class="timeline-status-dialog">
72
+ <div class="status-dialog-line status">
73
+ <div class="label">${i18nString(UIStrings.status)}</div>
74
+ <div class="content" role="status">${input.statusText}</div>
75
+ </div>
76
+ ${input.showTimer ? html`
77
+ <div class="status-dialog-line time">
78
+ <div class="label">${i18nString(UIStrings.time)}</div>
79
+ <div class="content">${input.timeText}</div>
80
+ </div>
81
+ ` : nothing}
82
+ ${input.showProgress ? html`
83
+ <div class="status-dialog-line progress">
84
+ <div class="label">${input.progressActivity}</div>
85
+ <div class="indicator-container">
86
+ <div class="indicator"
87
+ style="width: ${input.progressPercent.toFixed(1)}%"
88
+ role="progressbar"
89
+ aria-valuemin="0"
90
+ aria-valuemax="100"
91
+ aria-valuenow=${input.progressPercent}>
92
+ </div>
93
+ </div>
94
+ </div>
95
+ ` : nothing}
96
+ ${input.descriptionText !== undefined ? html`
97
+ <div class="status-dialog-line description">
98
+ <div class="label">${i18nString(UIStrings.description)}</div>
99
+ <div class="content">${input.descriptionText}</div>
100
+ </div>
101
+ ` : nothing}
102
+ <div class="stop-button">
103
+ ${input.showDownloadButton ? html`
104
+ <devtools-button
105
+ .variant=${Buttons.Button.Variant.OUTLINED}
106
+ .disabled=${input.downloadButtonDisabled}
107
+ @click=${input.onDownloadClick}
108
+ .jslogContext=${'timeline.download-after-error'}
109
+ >${i18nString(UIStrings.downloadAfterError)}</devtools-button>
110
+ ` : nothing}
111
+ ${!input.hideStopButton ? html`
112
+ <devtools-button
113
+ .variant=${Buttons.Button.Variant.PRIMARY}
114
+ @click=${input.onStopClick}
115
+ .jslogContext=${'timeline.stop-recording'}
116
+ ?autofocus=${input.focusStopButton}
117
+ >${input.buttonText}</devtools-button>
118
+ ` : nothing}
119
+ </div>
120
+ </div>
121
+ `, target);
122
+ };
123
+ // clang-format on
124
+
47
125
  /**
48
126
  * This is the dialog shown whilst a trace is being recorded/imported.
49
127
  */
50
128
  export class StatusDialog extends UI.Widget.VBox {
51
- private status: HTMLElement;
52
- private time: Element|undefined;
53
- private progressLabel?: HTMLElement;
54
- private progressBar?: HTMLElement;
55
- private readonly description: HTMLElement|undefined;
56
- private button: Buttons.Button.Button;
57
- private downloadTraceButton: Buttons.Button.Button;
58
- private startTime!: number;
59
- private timeUpdateTimer?: number;
129
+ readonly #view: View;
130
+ #statusText = '';
131
+ readonly #showTimer: boolean;
132
+ #timeText = '';
133
+ readonly #showProgress: boolean;
134
+ #progressActivity = '';
135
+ #progressPercent = 0;
136
+ readonly #descriptionText: string|undefined;
137
+ readonly #buttonText: string;
138
+ #hideStopButton: boolean;
139
+ #focusStopButton = false;
140
+ #showDownloadButton = false;
141
+ #downloadButtonDisabled = true;
142
+ readonly #onButtonClickCallback: () => (Promise<void>| void);
143
+ #startTime!: number;
144
+ #timeUpdateTimer?: number;
60
145
  #rawEvents?: Trace.Types.Events.Event[];
61
146
 
62
147
  constructor(
@@ -67,61 +152,25 @@ export class StatusDialog extends UI.Widget.VBox {
67
152
  description?: string,
68
153
  buttonText?: string,
69
154
  },
70
- onButtonClickCallback: () => (Promise<void>| void)) {
155
+ onButtonClickCallback: () => (Promise<void>| void), view: View = DEFAULT_VIEW) {
71
156
  super({
72
157
  jslog: `${VisualLogging.dialog('timeline-status').track({resize: true})}`,
73
158
  useShadowDom: true,
74
159
  });
75
160
 
76
- this.contentElement.classList.add('timeline-status-dialog');
77
-
78
- const statusLine = this.contentElement.createChild('div', 'status-dialog-line status');
79
- statusLine.createChild('div', 'label').textContent = i18nString(UIStrings.status);
80
- this.status = statusLine.createChild('div', 'content');
81
- UI.ARIAUtils.markAsStatus(this.status);
82
-
83
- if (options.showTimer) {
84
- const timeLine = this.contentElement.createChild('div', 'status-dialog-line time');
85
- timeLine.createChild('div', 'label').textContent = i18nString(UIStrings.time);
86
- this.time = timeLine.createChild('div', 'content');
87
- }
88
-
89
- if (options.showProgress) {
90
- const progressBarContainer = this.contentElement.createChild('div', 'status-dialog-line progress');
91
- this.progressLabel = progressBarContainer.createChild('div', 'label');
92
- this.progressBar = progressBarContainer.createChild('div', 'indicator-container').createChild('div', 'indicator');
93
- UI.ARIAUtils.markAsProgressBar(this.progressBar);
94
- }
95
-
96
- if (typeof options.description === 'string') {
97
- const descriptionLine = this.contentElement.createChild('div', 'status-dialog-line description');
98
- descriptionLine.createChild('div', 'label').textContent = i18nString(UIStrings.description);
99
- this.description = descriptionLine.createChild('div', 'content');
100
- this.description.innerText = options.description;
101
- }
102
-
103
- const buttonContainer = this.contentElement.createChild('div', 'stop-button');
104
- this.downloadTraceButton = UI.UIUtils.createTextButton(i18nString(UIStrings.downloadAfterError), () => {
105
- void this.#downloadRawTraceAfterError();
106
- }, {jslogContext: 'timeline.download-after-error'});
107
-
108
- this.downloadTraceButton.disabled = true;
109
- this.downloadTraceButton.classList.add('hidden');
110
-
111
- const buttonText = options.buttonText || i18nString(UIStrings.stop);
112
- this.button = UI.UIUtils.createTextButton(buttonText, onButtonClickCallback, {
113
- jslogContext: 'timeline.stop-recording',
114
- });
115
- // Profiling can't be stopped during initialization.
116
- this.button.classList.toggle('hidden', options.hideStopButton);
117
-
118
- buttonContainer.append(this.downloadTraceButton);
119
- buttonContainer.append(this.button);
161
+ this.#view = view;
162
+ this.#showTimer = Boolean(options.showTimer);
163
+ this.#showProgress = Boolean(options.showProgress);
164
+ this.#descriptionText = options.description;
165
+ this.#buttonText = options.buttonText || i18nString(UIStrings.stop);
166
+ this.#hideStopButton = options.hideStopButton;
167
+ this.#onButtonClickCallback = onButtonClickCallback;
120
168
  }
121
169
 
122
170
  finish(): void {
123
171
  this.stopTimer();
124
- this.button.classList.add('hidden');
172
+ this.#hideStopButton = true;
173
+ this.requestUpdate();
125
174
  }
126
175
 
127
176
  async #downloadRawTraceAfterError(): Promise<void> {
@@ -140,8 +189,9 @@ export class StatusDialog extends UI.Widget.VBox {
140
189
 
141
190
  enableDownloadOfEvents(rawEvents: Trace.Types.Events.Event[]): void {
142
191
  this.#rawEvents = rawEvents;
143
- this.downloadTraceButton.disabled = false;
144
- this.downloadTraceButton.classList.remove('hidden');
192
+ this.#showDownloadButton = true;
193
+ this.#downloadButtonDisabled = false;
194
+ this.requestUpdate();
145
195
  }
146
196
 
147
197
  remove(): void {
@@ -157,51 +207,77 @@ export class StatusDialog extends UI.Widget.VBox {
157
207
  }
158
208
 
159
209
  enableAndFocusButton(): void {
160
- this.button.classList.remove('hidden');
161
- this.button.focus();
210
+ this.#hideStopButton = false;
211
+ this.#focusStopButton = true;
212
+ this.requestUpdate();
162
213
  }
163
214
 
164
215
  updateStatus(text: string): void {
165
- this.status.textContent = text;
216
+ this.#statusText = text;
217
+ this.requestUpdate();
166
218
  }
167
219
 
168
220
  updateProgressBar(activity: string, percent: number): void {
169
- if (this.progressLabel) {
170
- this.progressLabel.textContent = activity;
171
- }
172
- if (this.progressBar) {
173
- this.progressBar.style.width = percent.toFixed(1) + '%';
174
- UI.ARIAUtils.setValueNow(this.progressBar, percent);
175
- }
176
- this.updateTimer();
221
+ this.#progressActivity = activity;
222
+ this.#progressPercent = percent;
223
+ this.#updateTimerTick();
224
+ this.requestUpdate();
177
225
  }
178
226
 
179
227
  startTimer(): void {
180
- this.startTime = Date.now();
181
- this.timeUpdateTimer = window.setInterval(this.updateTimer.bind(this), 100);
182
- this.updateTimer();
228
+ this.#startTime = Date.now();
229
+ this.#timeUpdateTimer = window.setInterval(this.#updateTimerTick.bind(this), 100);
230
+ this.#updateTimerTick();
183
231
  }
184
232
 
185
233
  private stopTimer(): void {
186
- if (!this.timeUpdateTimer) {
234
+ if (!this.#timeUpdateTimer) {
187
235
  return;
188
236
  }
189
- clearInterval(this.timeUpdateTimer);
190
- this.updateTimer();
191
- delete this.timeUpdateTimer;
237
+ clearInterval(this.#timeUpdateTimer);
238
+ this.#updateTimerTick();
239
+ this.#timeUpdateTimer = undefined;
192
240
  }
193
241
 
194
- private updateTimer(): void {
195
- if (!this.timeUpdateTimer || !this.time) {
242
+ #updateTimerTick(): void {
243
+ if (!this.#timeUpdateTimer || !this.#showTimer) {
196
244
  return;
197
245
  }
246
+ const seconds = (Date.now() - this.#startTime) / 1000;
247
+ this.#timeText = i18n.TimeUtilities.preciseSecondsToString(seconds, 1);
248
+ this.requestUpdate();
249
+ }
198
250
 
199
- const seconds = (Date.now() - this.startTime) / 1000;
200
- this.time.textContent = i18n.TimeUtilities.preciseSecondsToString(seconds, 1);
251
+ override performUpdate(): void {
252
+ this.#view(
253
+ {
254
+ statusText: this.#statusText,
255
+ showTimer: this.#showTimer,
256
+ timeText: this.#timeText,
257
+ showProgress: this.#showProgress,
258
+ progressActivity: this.#progressActivity,
259
+ progressPercent: this.#progressPercent,
260
+ descriptionText: this.#descriptionText,
261
+ buttonText: this.#buttonText,
262
+ hideStopButton: this.#hideStopButton,
263
+ focusStopButton: this.#focusStopButton,
264
+ showDownloadButton: this.#showDownloadButton,
265
+ downloadButtonDisabled: this.#downloadButtonDisabled,
266
+ onStopClick: () => {
267
+ void this.#onButtonClickCallback();
268
+ },
269
+ onDownloadClick: () => {
270
+ void this.#downloadRawTraceAfterError();
271
+ },
272
+ },
273
+ {},
274
+ this.contentElement,
275
+ );
276
+ this.#focusStopButton = false;
201
277
  }
202
278
 
203
279
  override wasShown(): void {
204
280
  super.wasShown();
205
- this.registerRequiredCSS(timelineStatusDialogStyles);
281
+ this.requestUpdate();
206
282
  }
207
283
  }
@@ -251,10 +251,6 @@ export class TimelineController implements Tracing.TracingManager.TracingManager
251
251
  'navigation,rail',
252
252
  ];
253
253
 
254
- if (Root.Runtime.experiments.isEnabled(Root.ExperimentNames.ExperimentName.TIMELINE_V8_RUNTIME_CALL_STATS) &&
255
- options.enableJSSampling) {
256
- categoriesArray.push(disabledByDefault('v8.runtime_stats_sampling'));
257
- }
258
254
  if (options.enableJSSampling) {
259
255
  categoriesArray.push(disabledByDefault('v8.cpu_profiler'));
260
256
  }
@@ -72,6 +72,8 @@ const UIStrings = {
72
72
  } as const;
73
73
  const str_ = i18n.i18n.registerUIStrings('panels/timeline/TimelineDetailsView.ts', UIStrings);
74
74
  const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
75
+ const {widget} = UI.Widget;
76
+
75
77
  export class TimelineDetailsPane extends
76
78
  Common.ObjectWrapper.eventMixin<TimelineTreeView.EventTypes, typeof UI.Widget.VBox>(UI.Widget.VBox) {
77
79
  private readonly detailsLinkifier: Components.Linkifier.Linkifier;
@@ -612,8 +614,8 @@ const SUMMARY_DEFAULT_VIEW: View = (input, _output, target) => {
612
614
  <style>${detailsViewStyles}</style>
613
615
  ${Directives.until(renderSelectedEventDetails(input))}
614
616
  ${input.selectedRange ? generateRangeSummaryDetails(input) : nothing}
615
- <devtools-widget data-related-insight-chips .widgetConfig=${
616
- UI.Widget.widgetConfig(TimelineComponents.RelatedInsightChips.RelatedInsightChips, {
617
+ <devtools-widget data-related-insight-chips ${widget(
618
+ TimelineComponents.RelatedInsightChips.RelatedInsightChips, {
617
619
  activeEvent: input.selectedEvent,
618
620
  eventToInsightsMap: input.eventToRelatedInsightsMap,
619
621
  })}></devtools-widget>
@@ -685,8 +687,8 @@ async function renderSelectedEventDetails(
685
687
  Trace.Types.Events.isSyntheticLayoutShiftCluster(selectedEvent)) {
686
688
  // clang-format off
687
689
  return html`
688
- <devtools-widget data-layout-shift-details .widgetConfig=${
689
- UI.Widget.widgetConfig(TimelineComponents.LayoutShiftDetails.LayoutShiftDetails, {
690
+ <devtools-widget data-layout-shift-details ${widget(
691
+ TimelineComponents.LayoutShiftDetails.LayoutShiftDetails, {
690
692
  event: selectedEvent,
691
693
  parsedTrace: input.parsedTrace,
692
694
  isFreshRecording: traceRecordingIsFresh,
@@ -698,8 +700,8 @@ async function renderSelectedEventDetails(
698
700
  if (Trace.Types.Events.isSyntheticNetworkRequest(selectedEvent)) {
699
701
  // clang-format off
700
702
  return html`
701
- <devtools-widget data-network-request-details .widgetConfig=${
702
- UI.Widget.widgetConfig(TimelineComponents.NetworkRequestDetails.NetworkRequestDetails, {
703
+ <devtools-widget data-network-request-details ${widget(
704
+ TimelineComponents.NetworkRequestDetails.NetworkRequestDetails, {
703
705
  request: selectedEvent,
704
706
  entityMapper: input.entityMapper,
705
707
  target: input.target,
@@ -747,8 +747,6 @@ export class TimelinePanel extends Common.ObjectWrapper.eventMixin<EventTypes, t
747
747
  const config = Trace.Types.Configuration.defaults();
748
748
  config.showAllEvents =
749
749
  Root.Runtime.experiments.isEnabled(Root.ExperimentNames.ExperimentName.TIMELINE_SHOW_ALL_EVENTS);
750
- config.includeRuntimeCallStats =
751
- Root.Runtime.experiments.isEnabled(Root.ExperimentNames.ExperimentName.TIMELINE_V8_RUNTIME_CALL_STATS);
752
750
  config.debugMode = Root.Runtime.experiments.isEnabled(Root.ExperimentNames.ExperimentName.TIMELINE_DEBUG_MODE);
753
751
 
754
752
  const traceEngineModel = Trace.TraceModel.Model.createWithAllHandlers(config);
@@ -1678,6 +1676,23 @@ export class TimelinePanel extends Common.ObjectWrapper.eventMixin<EventTypes, t
1678
1676
  }
1679
1677
  }
1680
1678
 
1679
+ revealParsedTrace(revealable: ParsedTraceRevealable): void {
1680
+ const index = this.model.indexForTrace(revealable.parsedTrace);
1681
+ if (index === -1) {
1682
+ return;
1683
+ }
1684
+
1685
+ if (this.#activeTraceIndex() === index) {
1686
+ // Already viewing this trace.
1687
+ return;
1688
+ }
1689
+
1690
+ this.#changeView({
1691
+ mode: 'VIEWING_TRACE',
1692
+ traceIndex: index,
1693
+ });
1694
+ }
1695
+
1681
1696
  navigateHistory(direction: number): boolean {
1682
1697
  const recordingData = this.#historyManager.navigate(direction);
1683
1698
  // When navigating programmatically, you cannot navigate to the landing page
@@ -3235,6 +3250,18 @@ export class TraceRevealer implements Common.Revealer.Revealer<SDK.TraceObject.T
3235
3250
  }
3236
3251
  }
3237
3252
 
3253
+ export class ParsedTraceRevealer implements Common.Revealer.Revealer<ParsedTraceRevealable> {
3254
+ async reveal(traceRevealer: ParsedTraceRevealable): Promise<void> {
3255
+ await UI.ViewManager.ViewManager.instance().showView('timeline');
3256
+ TimelinePanel.instance().revealParsedTrace(traceRevealer);
3257
+ }
3258
+ }
3259
+
3260
+ export class ParsedTraceRevealable {
3261
+ constructor(public parsedTrace: Trace.TraceModel.ParsedTrace) {
3262
+ }
3263
+ }
3264
+
3238
3265
  export class EventRevealer implements Common.Revealer.Revealer<SDK.TraceObject.RevealableEvent> {
3239
3266
  async reveal(rEvent: SDK.TraceObject.RevealableEvent): Promise<void> {
3240
3267
  await UI.ViewManager.ViewManager.instance().showView('timeline');
@@ -31,7 +31,7 @@ import * as UI from '../../../ui/legacy/legacy.js';
31
31
  import * as Lit from '../../../ui/lit/lit.js';
32
32
  import * as VisualLogging from '../../../ui/visual_logging/visual_logging.js';
33
33
  import * as PanelsCommon from '../../common/common.js';
34
- import {getThrottlingRecommendations} from '../utils/Helpers.js';
34
+ import * as Utils from '../utils/utils.js';
35
35
 
36
36
  import {CPUThrottlingSelector} from './CPUThrottlingSelector.js';
37
37
  import {md} from './insights/Helpers.js';
@@ -636,7 +636,7 @@ export class LiveMetricsView extends LegacyWrapper.LegacyWrapper.WrappableCompon
636
636
  networkRecEl.classList.add('environment-rec');
637
637
  networkRecEl.textContent = this.#getNetworkRecTitle() || i18nString(UIStrings.notEnoughData);
638
638
 
639
- const recs = getThrottlingRecommendations();
639
+ const recs = Utils.Helpers.getThrottlingRecommendations();
640
640
 
641
641
  // clang-format off
642
642
  return html`
@@ -217,7 +217,7 @@ class InsightsView extends UI.Widget.VBox {
217
217
  // might highlight the wrong insight. The UI needs to be fully
218
218
  // re-rendered before we can highlight the newly-expanded insight.
219
219
  void widget.updateComplete.then(() => {
220
- widget.highlightActiveInsight();
220
+ void widget.highlightActiveInsight();
221
221
  });
222
222
  }
223
223
  }