chrome-devtools-frontend 1.0.1603822 → 1.0.1605219

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 (89) hide show
  1. package/AUTHORS +1 -0
  2. package/front_end/Tests.js +23 -7
  3. package/front_end/core/host/AidaClient.ts +153 -525
  4. package/front_end/core/host/AidaClientTypes.ts +470 -0
  5. package/front_end/core/host/AidaGcaTranslation.ts +231 -122
  6. package/front_end/core/host/GcaClient.ts +112 -0
  7. package/front_end/core/host/GcaTypes.ts +107 -155
  8. package/front_end/core/host/UserMetrics.ts +0 -1
  9. package/front_end/core/host/host.ts +2 -0
  10. package/front_end/core/protocol_client/DevToolsCDPConnection.ts +1 -1
  11. package/front_end/core/root/ExperimentNames.ts +0 -1
  12. package/front_end/core/root/Runtime.ts +5 -0
  13. package/front_end/core/sdk/AutofillModel.ts +3 -2
  14. package/front_end/core/sdk/CSSModel.ts +3 -4
  15. package/front_end/core/sdk/CSSProperty.ts +1 -1
  16. package/front_end/core/sdk/ConsoleModel.ts +15 -13
  17. package/front_end/core/sdk/CookieModel.ts +5 -4
  18. package/front_end/core/sdk/DOMDebuggerModel.ts +20 -14
  19. package/front_end/core/sdk/DOMModel.ts +24 -22
  20. package/front_end/core/sdk/DebuggerModel.ts +21 -36
  21. package/front_end/core/sdk/EmulationModel.ts +21 -23
  22. package/front_end/core/sdk/EventBreakpointsModel.ts +16 -6
  23. package/front_end/core/sdk/HeapProfilerModel.ts +4 -7
  24. package/front_end/core/sdk/IsolateManager.ts +12 -7
  25. package/front_end/core/sdk/NetworkManager.ts +35 -28
  26. package/front_end/core/sdk/OverlayModel.ts +10 -10
  27. package/front_end/core/sdk/PreloadingModel.ts +3 -4
  28. package/front_end/core/sdk/ServiceWorkerManager.ts +2 -3
  29. package/front_end/core/sdk/SourceMapScopesInfo.ts +93 -63
  30. package/front_end/entrypoints/formatter_worker/FormatterWorker.ts +1 -3
  31. package/front_end/entrypoints/heap_snapshot_worker/AllocationProfile.ts +22 -48
  32. package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshot.ts +1 -1
  33. package/front_end/entrypoints/main/MainImpl.ts +0 -4
  34. package/front_end/generated/InspectorBackendCommands.ts +4 -0
  35. package/front_end/generated/SupportedCSSProperties.js +68 -2
  36. package/front_end/generated/protocol-mapping.d.ts +7 -0
  37. package/front_end/generated/protocol-proxy-api.d.ts +14 -0
  38. package/front_end/generated/protocol.ts +22 -0
  39. package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +31 -17
  40. package/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.snapshot.txt +1 -1
  41. package/front_end/models/bindings/TempFile.ts +1 -4
  42. package/front_end/models/emulation/DeviceModeModel.ts +21 -26
  43. package/front_end/models/extensions/ExtensionAPI.ts +1 -1
  44. package/front_end/models/heap_snapshot_model/HeapSnapshotModel.ts +34 -47
  45. package/front_end/models/javascript_metadata/NativeFunctions.js +6 -6
  46. package/front_end/models/trace/insights/LCPDiscovery.ts +14 -6
  47. package/front_end/panels/ai_assistance/AiAssistancePanel.ts +85 -31
  48. package/front_end/panels/ai_assistance/components/ChatMessage.ts +50 -40
  49. package/front_end/panels/ai_assistance/components/ChatView.ts +3 -2
  50. package/front_end/panels/ai_assistance/components/WalkthroughView.ts +35 -7
  51. package/front_end/panels/ai_assistance/components/chatMessage.css +5 -1
  52. package/front_end/panels/application/ApplicationPanelSidebar.ts +6 -0
  53. package/front_end/panels/application/IndexedDBViews.ts +0 -9
  54. package/front_end/panels/application/WebMCPTreeElement.ts +35 -0
  55. package/front_end/panels/application/WebMCPView.ts +118 -0
  56. package/front_end/panels/application/application.ts +4 -0
  57. package/front_end/panels/application/webMCPView.css +65 -0
  58. package/front_end/panels/common/aiCodeCompletionSummaryToolbar.css +1 -1
  59. package/front_end/panels/console/consoleView.css +4 -0
  60. package/front_end/panels/elements/ElementsTreeElement.ts +91 -13
  61. package/front_end/panels/elements/StylesAiCodeCompletionProvider.ts +23 -2
  62. package/front_end/panels/elements/StylesSidebarPane.ts +85 -20
  63. package/front_end/panels/elements/elementsPanel.css +14 -0
  64. package/front_end/panels/elements/elementsTreeOutline.css +18 -0
  65. package/front_end/panels/network/NetworkLogViewColumns.ts +3 -3
  66. package/front_end/panels/profiler/HeapSnapshotDataGrids.ts +15 -19
  67. package/front_end/panels/profiler/HeapSnapshotGridNodes.ts +4 -2
  68. package/front_end/panels/profiler/HeapSnapshotProxy.ts +12 -16
  69. package/front_end/panels/profiler/HeapSnapshotView.ts +3 -10
  70. package/front_end/panels/profiler/ProfilesPanel.ts +5 -7
  71. package/front_end/panels/recorder/components/recordingView.css +0 -6
  72. package/front_end/panels/sensors/SensorsView.ts +28 -61
  73. package/front_end/panels/timeline/EventsTimelineTreeView.ts +2 -2
  74. package/front_end/panels/timeline/ThirdPartyTreeView.ts +35 -36
  75. package/front_end/panels/timeline/TimelineDetailsView.ts +47 -41
  76. package/front_end/panels/timeline/TimelinePanel.ts +1 -3
  77. package/front_end/panels/timeline/TimelineTreeView.ts +13 -13
  78. package/front_end/panels/timeline/components/LiveMetricsView.ts +852 -824
  79. package/front_end/panels/timeline/components/liveMetricsView.css +4 -0
  80. package/front_end/panels/timeline/thirdPartyTreeView.css +2 -2
  81. package/front_end/third_party/chromium/README.chromium +1 -1
  82. package/front_end/ui/components/buttons/button.css +2 -2
  83. package/front_end/ui/components/text_editor/AiCodeCompletionProvider.ts +0 -11
  84. package/front_end/ui/legacy/InspectorDrawerView.ts +206 -0
  85. package/front_end/ui/legacy/InspectorView.ts +41 -91
  86. package/front_end/ui/legacy/ViewManager.ts +14 -5
  87. package/front_end/ui/legacy/inspectorDrawerTabbedPane.css +5 -0
  88. package/front_end/ui/visual_logging/KnownContextValues.ts +2 -1
  89. package/package.json +1 -1
@@ -132,13 +132,13 @@ class HeapSnapshotSortableDataGridBase extends DataGrid.DataGrid.DataGridImpl<He
132
132
  export class HeapSnapshotSortableDataGrid extends Common.ObjectWrapper
133
133
  .eventMixin<EventTypes, typeof HeapSnapshotSortableDataGridBase>(
134
134
  HeapSnapshotSortableDataGridBase) {
135
- snapshot: HeapSnapshotProxy|null;
136
- override selectedNode: HeapSnapshotGridNode|null;
135
+ snapshot: HeapSnapshotProxy|null = null;
136
+ override selectedNode: HeapSnapshotGridNode|null = null;
137
137
  readonly heapProfilerModelInternal: SDK.HeapProfilerModel.HeapProfilerModel|null;
138
138
  readonly dataDisplayDelegateInternal: DataDisplayDelegate;
139
- recursiveSortingDepth: number;
140
- populatedAndSorted: boolean;
141
- nameFilter: UI.Toolbar.ToolbarInput|null;
139
+ recursiveSortingDepth = 0;
140
+ populatedAndSorted = false;
141
+ nameFilter: UI.Toolbar.ToolbarInput|null = null;
142
142
  nodeFilterInternal: HeapSnapshotModel.HeapSnapshotModel.NodeFilter|undefined;
143
143
  lastSortColumnId?: string|null;
144
144
  lastSortAscending?: boolean;
@@ -147,8 +147,6 @@ export class HeapSnapshotSortableDataGrid extends Common.ObjectWrapper
147
147
  dataGridParameters: DataGrid.DataGrid.Parameters) {
148
148
  // TODO(allada) This entire class needs to be converted to use the templates in DataGridNode.
149
149
  super(dataGridParameters);
150
- this.snapshot = null;
151
- this.selectedNode = null;
152
150
  this.heapProfilerModelInternal = heapProfilerModel;
153
151
  this.dataDisplayDelegateInternal = dataDisplayDelegate;
154
152
  const tooltips = [
@@ -743,9 +741,9 @@ export enum HeapSnapshotRetainmentDataGridEvents {
743
741
  }
744
742
 
745
743
  export class HeapSnapshotConstructorsDataGrid extends HeapSnapshotViewportDataGrid {
746
- profileIndex: number;
747
- objectIdToSelect: string|null;
748
- nextRequestedFilter: HeapSnapshotModel.HeapSnapshotModel.NodeFilter|null;
744
+ profileIndex = -1;
745
+ objectIdToSelect: string|null = null;
746
+ nextRequestedFilter: HeapSnapshotModel.HeapSnapshotModel.NodeFilter|null = null;
749
747
  lastFilter?: HeapSnapshotModel.HeapSnapshotModel.NodeFilter|null;
750
748
  filterInProgress?: HeapSnapshotModel.HeapSnapshotModel.NodeFilter|null;
751
749
 
@@ -773,14 +771,13 @@ export class HeapSnapshotConstructorsDataGrid extends HeapSnapshotViewportDataGr
773
771
  },
774
772
  ];
775
773
  super(
776
- heapProfilerModel, dataDisplayDelegate,
777
- ({displayName: i18nString(UIStrings.heapSnapshotConstructors).toString(), columns} as
778
- DataGrid.DataGrid.Parameters));
779
- // clang-format on
780
- this.profileIndex = -1;
781
- this.objectIdToSelect = null;
782
-
783
- this.nextRequestedFilter = null;
774
+ heapProfilerModel,
775
+ dataDisplayDelegate,
776
+ {
777
+ displayName: i18nString(UIStrings.heapSnapshotConstructors).toString(),
778
+ columns,
779
+ },
780
+ );
784
781
  }
785
782
 
786
783
  override sortFields(sortColumn: string, sortAscending: boolean):
@@ -1015,7 +1012,6 @@ export class AllocationDataGrid extends HeapSnapshotViewportDataGrid {
1015
1012
  super(
1016
1013
  heapProfilerModel, dataDisplayDelegate,
1017
1014
  ({displayName: i18nString(UIStrings.allocation).toString(), columns} as DataGrid.DataGrid.Parameters));
1018
- // clang-format on
1019
1015
  this.linkifierInternal = new Components.Linkifier.Linkifier();
1020
1016
  }
1021
1017
 
@@ -1290,8 +1290,10 @@ export class HeapSnapshotDiffNode extends HeapSnapshotGridNode {
1290
1290
  readonly classKey: string;
1291
1291
 
1292
1292
  constructor(
1293
- dataGrid: HeapSnapshotDiffDataGrid, classKey: string,
1294
- diffForClass: HeapSnapshotModel.HeapSnapshotModel.DiffForClass) {
1293
+ dataGrid: HeapSnapshotDiffDataGrid,
1294
+ classKey: string,
1295
+ diffForClass: HeapSnapshotModel.HeapSnapshotModel.Diff,
1296
+ ) {
1295
1297
  super(dataGrid, true);
1296
1298
  this.nameInternal = diffForClass.name;
1297
1299
  this.addedCount = diffForClass.addedCount;
@@ -20,26 +20,19 @@ const UIStrings = {
20
20
  const str_ = i18n.i18n.registerUIStrings('panels/profiler/HeapSnapshotProxy.ts', UIStrings);
21
21
  const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
22
22
  export class HeapSnapshotWorkerProxy extends Common.ObjectWrapper.ObjectWrapper<HeapSnapshotWorkerProxy.EventTypes> {
23
+ readonly eventHandler: (arg0: string, arg1: string) => void;
24
+ nextObjectId = 1;
25
+ nextCallId = 1;
23
26
  // TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration)
24
27
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
25
- readonly eventHandler: (arg0: string, arg1: any) => void;
26
- nextObjectId: number;
27
- nextCallId: number;
28
- // TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration)
29
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
30
- callbacks: Map<number, (arg0: any) => void>;
31
- readonly previousCallbacks: Set<number>;
28
+ callbacks = new Map<number, (arg0: any) => void>();
29
+ readonly previousCallbacks = new Set<number>();
32
30
  readonly worker: PlatformApi.HostRuntime.Worker;
33
31
  interval?: number;
34
- // TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration)
35
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
36
- constructor(eventHandler: (arg0: string, arg1: any) => void) {
32
+
33
+ constructor(eventHandler: (arg0: string, arg1: string) => void) {
37
34
  super();
38
35
  this.eventHandler = eventHandler;
39
- this.nextObjectId = 1;
40
- this.nextCallId = 1;
41
- this.callbacks = new Map();
42
- this.previousCallbacks = new Set();
43
36
  this.worker = Platform.HostRuntime.HOST_RUNTIME.createWorker(
44
37
  new URL('../../entrypoints/heap_snapshot_worker/heap_snapshot_worker-entrypoint.js', import.meta.url)
45
38
  .toString());
@@ -243,8 +236,11 @@ export class HeapSnapshotLoaderProxy extends HeapSnapshotProxyObject implements
243
236
  readonly profileUid: number;
244
237
  readonly snapshotReceivedCallback: (arg0: HeapSnapshotProxy) => void;
245
238
  constructor(
246
- worker: HeapSnapshotWorkerProxy, objectId: number, profileUid: number,
247
- snapshotReceivedCallback: (arg0: HeapSnapshotProxy) => void) {
239
+ worker: HeapSnapshotWorkerProxy,
240
+ objectId: number,
241
+ profileUid: number,
242
+ snapshotReceivedCallback: (arg0: HeapSnapshotProxy) => void,
243
+ ) {
248
244
  super(worker, objectId);
249
245
  this.profileUid = profileUid;
250
246
  this.snapshotReceivedCallback = snapshotReceivedCallback;
@@ -1557,9 +1557,6 @@ export class TrackingHeapSnapshotProfileType extends
1557
1557
  }
1558
1558
  this.setProfileBeingRecorded(new HeapProfileHeader(heapProfilerModel, this, undefined));
1559
1559
  this.profileSamples = new Samples();
1560
- // TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration)
1561
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1562
- (this.profileBeingRecorded() as any)._profileSamples = this.profileSamples;
1563
1560
  this.recording = true;
1564
1561
  this.addProfile((this.profileBeingRecorded() as ProfileHeader));
1565
1562
  (this.profileBeingRecorded() as HeapProfileHeader).updateStatus(i18nString(UIStrings.recording));
@@ -1733,20 +1730,16 @@ export class HeapProfileHeader extends ProfileHeader {
1733
1730
  this.receiver = this.workerProxy.createLoader(this.uid, this.snapshotReceived.bind(this));
1734
1731
  }
1735
1732
 
1736
- // TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration)
1737
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1738
- handleWorkerEvent(eventName: string, data: any): void {
1733
+ handleWorkerEvent(eventName: string, data: string): void {
1739
1734
  if (HeapSnapshotModel.HeapSnapshotModel.HeapSnapshotProgressEvent.BrokenSnapshot === eventName) {
1740
- const error = (data as string);
1741
- Common.Console.Console.instance().error(error);
1735
+ Common.Console.Console.instance().error(data);
1742
1736
  return;
1743
1737
  }
1744
1738
 
1745
1739
  if (HeapSnapshotModel.HeapSnapshotModel.HeapSnapshotProgressEvent.Update !== eventName) {
1746
1740
  return;
1747
1741
  }
1748
- const serializedMessage = (data as string);
1749
- const messageObject = i18n.i18n.deserializeUIString(serializedMessage);
1742
+ const messageObject = i18n.i18n.deserializeUIString(data);
1750
1743
  // We know all strings from the worker are declared inside a single file so we can
1751
1744
  // use a custom function.
1752
1745
  this.updateStatus(moduleI18nString(messageObject.string, messageObject.values));
@@ -499,7 +499,10 @@ export class ProfileTypeSidebarSection extends UI.TreeOutline.TreeElement {
499
499
  const profileTitle = profile.title;
500
500
  let group: ProfileGroup = this.profileGroups[profileTitle];
501
501
  if (!group) {
502
- group = new ProfileGroup();
502
+ group = {
503
+ profileSidebarTreeElements: [],
504
+ sidebarTreeElement: null,
505
+ };
503
506
  this.profileGroups[profileTitle] = group;
504
507
  }
505
508
  group.profileSidebarTreeElements.push(profileTreeElement);
@@ -604,19 +607,14 @@ export class ProfileTypeSidebarSection extends UI.TreeOutline.TreeElement {
604
607
  }
605
608
  }
606
609
 
607
- export class ProfileGroup {
610
+ export interface ProfileGroup {
608
611
  profileSidebarTreeElements: ProfileSidebarTreeElement[];
609
612
  sidebarTreeElement: ProfileGroupSidebarTreeElement|null;
610
- constructor() {
611
- this.profileSidebarTreeElements = [];
612
- this.sidebarTreeElement = null;
613
- }
614
613
  }
615
614
 
616
615
  export class ProfileGroupSidebarTreeElement extends UI.TreeOutline.TreeElement {
617
616
  readonly dataDisplayDelegate: DataDisplayDelegate;
618
617
  profileTitle: string;
619
- override toggleOnClick: boolean;
620
618
 
621
619
  constructor(dataDisplayDelegate: DataDisplayDelegate, title: string) {
622
620
  super('', true);
@@ -27,7 +27,6 @@
27
27
 
28
28
  .sections {
29
29
  min-height: 0;
30
- overflow: hidden;
31
30
  background-color: var(--sys-color-cdt-base-container);
32
31
  z-index: 0;
33
32
  position: relative;
@@ -357,11 +356,6 @@
357
356
  border-bottom: 1px solid var(--sys-color-divider);
358
357
  }
359
358
 
360
- .show-code {
361
- margin-right: 14px;
362
- margin-top: 8px;
363
- }
364
-
365
359
  devtools-recorder-extension-view {
366
360
  flex: 1;
367
361
  }
@@ -203,7 +203,6 @@ export class SensorsView extends UI.Widget.VBox {
203
203
  private betaElement!: HTMLInputElement;
204
204
  private gammaElement!: HTMLInputElement;
205
205
  private orientationLayer!: HTMLDivElement;
206
- private boxElement?: HTMLElement;
207
206
  private boxMatrix?: DOMMatrix;
208
207
  private mouseDownVector?: Geometry.Vector|null;
209
208
  private originalBoxMatrix?: DOMMatrix;
@@ -334,13 +333,15 @@ export class SensorsView extends UI.Widget.VBox {
334
333
  <input
335
334
  id="latitude-input"
336
335
  type="number"
336
+ min="-90"
337
+ max="90"
337
338
  step="any"
339
+ required
338
340
  .value=${String(location.latitude)}
339
341
  name="latitude"
340
342
  title=${modifierKeyMessage}
341
343
  jslog=${VisualLogging.textField('latitude').track({change: true})}
342
344
  ${Directives.ref((el: Element | undefined) => { if (el) { this.latitudeInput = el as HTMLInputElement; } })}
343
- @input=${this.#onLocationInput.bind(this)}
344
345
  @change=${this.#onLocationChange.bind(this)}
345
346
  @keydown=${this.#onLocationKeyDown.bind(this)}
346
347
  @focus=${this.#onLocationFocus.bind(this)}
@@ -352,13 +353,15 @@ export class SensorsView extends UI.Widget.VBox {
352
353
  <input
353
354
  id="longitude-input"
354
355
  type="number"
356
+ min="-180"
357
+ max="180"
355
358
  step="any"
359
+ required
356
360
  .value=${String(location.longitude)}
357
361
  name="longitude"
358
362
  title=${modifierKeyMessage}
359
363
  jslog=${VisualLogging.textField('longitude').track({change: true})}
360
364
  ${Directives.ref((el: Element | undefined) => { if (el) { this.longitudeInput = el as HTMLInputElement; } })}
361
- @input=${this.#onLocationInput.bind(this)}
362
365
  @change=${this.#onLocationChange.bind(this)}
363
366
  @keydown=${this.#onLocationKeyDown.bind(this)}
364
367
  @focus=${this.#onLocationFocus.bind(this)}
@@ -369,11 +372,11 @@ export class SensorsView extends UI.Widget.VBox {
369
372
  <input
370
373
  id="timezone-input"
371
374
  type="text"
375
+ pattern=".*[a-zA-Z].*"
372
376
  .value=${location.timezoneId}
373
377
  name="timezone"
374
378
  jslog=${VisualLogging.textField('timezone').track({change: true})}
375
379
  ${Directives.ref((el: Element | undefined) => { if (el) { this.timezoneInput = el as HTMLInputElement; } })}
376
- @input=${this.#onLocationInput.bind(this)}
377
380
  @change=${this.#onLocationChange.bind(this)}
378
381
  @keydown=${this.#onLocationKeyDown.bind(this)}
379
382
  @focus=${this.#onLocationFocus.bind(this)}
@@ -385,11 +388,11 @@ export class SensorsView extends UI.Widget.VBox {
385
388
  <input
386
389
  id="locale-input"
387
390
  type="text"
391
+ pattern=".*[a-zA-Z]{2}.*"
388
392
  .value=${location.locale}
389
393
  name="locale"
390
394
  jslog=${VisualLogging.textField('locale').track({change: true})}
391
395
  ${Directives.ref((el: Element | undefined) => { if (el) { this.localeInput = el as HTMLInputElement; } })}
392
- @input=${this.#onLocationInput.bind(this)}
393
396
  @change=${this.#onLocationChange.bind(this)}
394
397
  @keydown=${this.#onLocationKeyDown.bind(this)}
395
398
  @focus=${this.#onLocationFocus.bind(this)}
@@ -402,12 +405,12 @@ export class SensorsView extends UI.Widget.VBox {
402
405
  <input
403
406
  id="accuracy-input"
404
407
  type="number"
408
+ min="0"
405
409
  step="any"
406
410
  .value=${String(location.accuracy || SDK.EmulationModel.Location.DEFAULT_ACCURACY)}
407
411
  name="accuracy"
408
412
  jslog=${VisualLogging.textField('accuracy').track({change: true})}
409
413
  ${Directives.ref((el: Element | undefined) => { if (el) { this.accuracyInput = el as HTMLInputElement; } })}
410
- @input=${this.#onLocationInput.bind(this)}
411
414
  @change=${this.#onLocationChange.bind(this)}
412
415
  @keydown=${this.#onLocationKeyDown.bind(this)}
413
416
  @focus=${this.#onLocationFocus.bind(this)}
@@ -449,12 +452,11 @@ export class SensorsView extends UI.Widget.VBox {
449
452
  this.#location = new SDK.EmulationModel.Location(
450
453
  coordinates.lat, coordinates.long, coordinates.timezoneId, coordinates.locale,
451
454
  coordinates.accuracy || SDK.EmulationModel.Location.DEFAULT_ACCURACY, false);
452
- this.#setInputValue(this.latitudeInput, coordinates.lat);
453
- this.#setInputValue(this.longitudeInput, coordinates.long);
454
- this.#setInputValue(this.timezoneInput, coordinates.timezoneId);
455
- this.#setInputValue(this.localeInput, coordinates.locale);
456
- this.#setInputValue(
457
- this.accuracyInput, String(coordinates.accuracy || SDK.EmulationModel.Location.DEFAULT_ACCURACY));
455
+ this.latitudeInput.value = coordinates.lat;
456
+ this.longitudeInput.value = coordinates.long;
457
+ this.timezoneInput.value = coordinates.timezoneId;
458
+ this.localeInput.value = coordinates.locale;
459
+ this.accuracyInput.value = String(coordinates.accuracy || SDK.EmulationModel.Location.DEFAULT_ACCURACY);
458
460
  }
459
461
 
460
462
  this.applyLocation();
@@ -463,17 +465,9 @@ export class SensorsView extends UI.Widget.VBox {
463
465
  }
464
466
  }
465
467
 
466
- #onLocationInput(event: Event): void {
467
- const input = event.currentTarget as HTMLInputElement;
468
- const valid = this.#validateInput(input, input.value);
469
- input.classList.toggle('error-input', !valid);
470
- }
471
-
472
468
  #onLocationChange(event: Event): void {
473
469
  const input = event.currentTarget as HTMLInputElement;
474
- const valid = this.#validateInput(input, input.value);
475
- input.classList.toggle('error-input', !valid);
476
- if (valid) {
470
+ if (input.checkValidity()) {
477
471
  this.applyLocationUserInput();
478
472
  }
479
473
  }
@@ -481,8 +475,7 @@ export class SensorsView extends UI.Widget.VBox {
481
475
  #onLocationKeyDown(event: KeyboardEvent): void {
482
476
  const input = event.currentTarget as HTMLInputElement;
483
477
  if (event.key === 'Enter') {
484
- const valid = this.#validateInput(input, input.value);
485
- if (valid) {
478
+ if (input.checkValidity()) {
486
479
  this.applyLocationUserInput();
487
480
  }
488
481
  event.preventDefault();
@@ -499,10 +492,13 @@ export class SensorsView extends UI.Widget.VBox {
499
492
  if (value === null) {
500
493
  return;
501
494
  }
502
- const stringValue = String(value);
503
- const valid = this.#validateInput(input, stringValue);
504
- if (valid) {
505
- this.#setInputValue(input, stringValue);
495
+ const prevValue = input.value;
496
+ input.value = String(value);
497
+ if (input.checkValidity()) {
498
+ this.applyLocationUserInput();
499
+ } else {
500
+ // If ArrowUp/ArrowDown adjusts the value out of bounds, we reset it.
501
+ input.value = prevValue;
506
502
  }
507
503
  event.preventDefault();
508
504
  }
@@ -512,34 +508,6 @@ export class SensorsView extends UI.Widget.VBox {
512
508
  input.select();
513
509
  }
514
510
 
515
- #validateInput(input: HTMLInputElement, value: string): boolean {
516
- if (input === this.latitudeInput) {
517
- return SDK.EmulationModel.Location.latitudeValidator(value);
518
- }
519
- if (input === this.longitudeInput) {
520
- return SDK.EmulationModel.Location.longitudeValidator(value);
521
- }
522
- if (input === this.timezoneInput) {
523
- return SDK.EmulationModel.Location.timezoneIdValidator(value);
524
- }
525
- if (input === this.localeInput) {
526
- return SDK.EmulationModel.Location.localeValidator(value);
527
- }
528
- if (input === this.accuracyInput) {
529
- return SDK.EmulationModel.Location.accuracyValidator(value).valid;
530
- }
531
- return false;
532
- }
533
-
534
- #setInputValue(input: HTMLInputElement, value: string): void {
535
- if (value === input.value) {
536
- return;
537
- }
538
- const valid = this.#validateInput(input, value);
539
- input.classList.toggle('error-input', !valid);
540
- input.value = value;
541
- }
542
-
543
511
  private applyLocationUserInput(): void {
544
512
  const location = SDK.EmulationModel.Location.parseUserInput(
545
513
  this.latitudeInput.value.trim(), this.longitudeInput.value.trim(), this.timezoneInput.value.trim(),
@@ -583,11 +551,11 @@ export class SensorsView extends UI.Widget.VBox {
583
551
  }
584
552
 
585
553
  private clearFieldsetElementInputs(): void {
586
- this.#setInputValue(this.latitudeInput, '0');
587
- this.#setInputValue(this.longitudeInput, '0');
588
- this.#setInputValue(this.timezoneInput, '');
589
- this.#setInputValue(this.localeInput, '');
590
- this.#setInputValue(this.accuracyInput, SDK.EmulationModel.Location.DEFAULT_ACCURACY.toString());
554
+ this.latitudeInput.value = '0';
555
+ this.longitudeInput.value = '0';
556
+ this.timezoneInput.value = '';
557
+ this.localeInput.value = '';
558
+ this.accuracyInput.value = SDK.EmulationModel.Location.DEFAULT_ACCURACY.toString();
591
559
  }
592
560
 
593
561
  private createDeviceOrientationSection(): void {
@@ -731,7 +699,6 @@ export class SensorsView extends UI.Widget.VBox {
731
699
  <div class="orientation-layer" ${Directives.ref((el: Element | undefined) => { if (el) { this.orientationLayer = el as HTMLDivElement; } })}>
732
700
  <section
733
701
  class="orientation-box orientation-element"
734
- ${Directives.ref((el: Element | undefined) => { if (el) { this.boxElement = el as HTMLElement; } })}
735
702
  >
736
703
  <section class="orientation-front orientation-element"></section>
737
704
  <section class="orientation-top orientation-element"></section>
@@ -51,8 +51,8 @@ export class EventsTimelineTreeView extends TimelineTreeView {
51
51
  return [...super.filters(), ...this.filtersControl.filters()];
52
52
  }
53
53
 
54
- override updateContents(selection: TimelineSelection): void {
55
- super.updateContents(selection);
54
+ override set activeSelection(selection: TimelineSelection) {
55
+ super.activeSelection = selection;
56
56
  if (selectionIsEvent(selection)) {
57
57
  this.selectEvent(selection.event, true);
58
58
  }
@@ -6,7 +6,6 @@
6
6
  import * as i18n from '../../core/i18n/i18n.js';
7
7
  import * as Trace from '../../models/trace/trace.js';
8
8
  import * as DataGrid from '../../ui/legacy/components/data_grid/data_grid.js';
9
- import * as UI from '../../ui/legacy/legacy.js';
10
9
  import * as VisualLogging from '../../ui/visual_logging/visual_logging.js';
11
10
 
12
11
  import thirdPartyTreeViewStyles from './thirdPartyTreeView.css.js';
@@ -39,8 +38,12 @@ export class ThirdPartyTreeViewWidget extends TimelineTreeView.TimelineTreeView
39
38
  // want to do this when the user hovers.
40
39
  protected override autoSelectFirstChildOnRefresh = false;
41
40
 
42
- constructor() {
43
- super();
41
+ #onRowHovered?: (node: Trace.Extras.TraceTree.Node|null, events?: Trace.Types.Events.Event[]) => void;
42
+ #onBottomUpButtonClicked?: (node: Trace.Extras.TraceTree.Node|null) => void;
43
+ #onRowClicked?: (node: Trace.Extras.TraceTree.Node|null, events?: Trace.Types.Events.Event[]) => void;
44
+
45
+ constructor(element?: HTMLElement) {
46
+ super(element);
44
47
  this.element.setAttribute('jslog', `${VisualLogging.pane('third-party-tree').track({hover: true})}`);
45
48
  this.init();
46
49
  this.dataGrid.markColumnAsSortedBy('self', DataGrid.DataGrid.Order.Descending);
@@ -61,12 +64,14 @@ export class ThirdPartyTreeViewWidget extends TimelineTreeView.TimelineTreeView
61
64
  this.registerRequiredCSS(thirdPartyTreeViewStyles);
62
65
  }
63
66
 
64
- override setModelWithEvents(
65
- selectedEvents: Trace.Types.Events.Event[]|null, parsedTrace?: Trace.TraceModel.ParsedTrace|null,
66
- entityMappings?: Trace.EntityMapper.EntityMapper|null): void {
67
- super.setModelWithEvents(selectedEvents, parsedTrace, entityMappings);
67
+ override set model(model: {
68
+ selectedEvents: Trace.Types.Events.Event[]|null,
69
+ parsedTrace: Trace.TraceModel.ParsedTrace|null,
70
+ entityMapper: Trace.EntityMapper.EntityMapper|null,
71
+ }) {
72
+ super.model = model;
68
73
 
69
- const hasEvents = Boolean(selectedEvents && selectedEvents.length > 0);
74
+ const hasEvents = Boolean(model.selectedEvents && model.selectedEvents.length > 0);
70
75
  this.element.classList.toggle('empty-table', !hasEvents);
71
76
  }
72
77
 
@@ -252,42 +257,36 @@ export class ThirdPartyTreeViewWidget extends TimelineTreeView.TimelineTreeView
252
257
  const entity = mapper.entityForEvent(node.event);
253
258
  return Boolean(entity) && entity?.category === 'Chrome Extension';
254
259
  }
255
- }
256
-
257
- export class ThirdPartyTreeElement extends UI.Widget.WidgetElement<UI.Widget.Widget> {
258
- #treeView?: ThirdPartyTreeViewWidget;
259
-
260
- static readonly observedAttributes = ['max-rows'];
261
-
262
- set treeView(treeView: ThirdPartyTreeViewWidget) {
263
- this.#treeView = treeView;
264
- }
265
260
 
266
- constructor() {
267
- super();
268
- this.style.display = 'contents';
261
+ set maxRows(maxRows: number) {
262
+ this.element.style.setProperty('--max-rows', String(maxRows));
263
+ this.element.classList.toggle('has-max-rows', Boolean(maxRows));
269
264
  }
270
265
 
271
- attributeChangedCallback(name: string, _oldValue: string|null, newValue: string|null): void {
272
- if (name === 'max-rows' && newValue) {
273
- this.style.setProperty('--max-rows', newValue);
266
+ set onRowHovered(callback: (node: Trace.Extras.TraceTree.Node|null, events?: Trace.Types.Events.Event[]) => void) {
267
+ if (!this.#onRowHovered) {
268
+ this.addEventListener(TimelineTreeView.TimelineTreeView.Events.TREE_ROW_HOVERED, ({data}) => {
269
+ this.#onRowHovered?.(data.node, data.events);
270
+ });
274
271
  }
272
+ this.#onRowHovered = callback;
275
273
  }
276
274
 
277
- override createWidget(): UI.Widget.Widget {
278
- const containerWidget = new UI.Widget.Widget(this);
279
- containerWidget.contentElement.style.display = 'contents';
280
- if (this.#treeView) {
281
- this.#treeView.show(containerWidget.contentElement);
275
+ set onBottomUpButtonClicked(callback: (node: Trace.Extras.TraceTree.Node|null) => void) {
276
+ if (!this.#onBottomUpButtonClicked) {
277
+ this.addEventListener(TimelineTreeView.TimelineTreeView.Events.BOTTOM_UP_BUTTON_CLICKED, ({data}) => {
278
+ this.#onBottomUpButtonClicked?.(data);
279
+ });
282
280
  }
283
- return containerWidget;
281
+ this.#onBottomUpButtonClicked = callback;
284
282
  }
285
- }
286
283
 
287
- customElements.define('devtools-performance-third-party-tree-view', ThirdPartyTreeElement);
288
-
289
- declare global {
290
- interface HTMLElementTagNameMap {
291
- 'devtools-performance-third-party-tree-view': ThirdPartyTreeElement;
284
+ set onRowClicked(callback: (node: Trace.Extras.TraceTree.Node|null, events?: Trace.Types.Events.Event[]) => void) {
285
+ if (!this.#onRowClicked) {
286
+ this.addEventListener(TimelineTreeView.TimelineTreeView.Events.TREE_ROW_CLICKED, ({data}) => {
287
+ this.#onRowClicked?.(data.node, data.events);
288
+ });
289
+ }
290
+ this.#onRowClicked = callback;
292
291
  }
293
292
  }