chrome-devtools-frontend 1.0.1625079 → 1.0.1626437

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 (190) hide show
  1. package/front_end/core/common/VersionController.ts +9 -7
  2. package/front_end/core/common/common.ts +0 -4
  3. package/front_end/core/host/AidaClient.ts +1 -1
  4. package/front_end/core/host/AidaClientTypes.ts +2 -0
  5. package/front_end/core/host/AidaGcaTranslation.ts +2 -2
  6. package/front_end/core/host/Platform.ts +0 -9
  7. package/front_end/core/host/UserMetrics.ts +0 -55
  8. package/front_end/core/root/ExperimentNames.ts +0 -1
  9. package/front_end/core/sdk/CPUThrottlingManager.ts +1 -1
  10. package/front_end/core/sdk/CSSMetadata.ts +60 -63
  11. package/front_end/core/sdk/CSSProperty.ts +1 -5
  12. package/front_end/core/sdk/CSSPropertyParserMatchers.ts +11 -32
  13. package/front_end/{panels/application → core/sdk}/DOMStorageModel.ts +12 -10
  14. package/front_end/core/sdk/sdk.ts +2 -0
  15. package/front_end/entrypoints/main/MainImpl.ts +12 -8
  16. package/front_end/entrypoints/main/SimpleApp.ts +3 -4
  17. package/front_end/entrypoints/main/main-meta.ts +1 -1
  18. package/front_end/generated/InspectorBackendCommands.ts +3 -3
  19. package/front_end/generated/SupportedCSSProperties.js +21 -21
  20. package/front_end/generated/protocol.ts +4 -1
  21. package/front_end/models/ai_assistance/StorageItem.ts +16 -0
  22. package/front_end/models/ai_assistance/agents/StorageAgent.ts +82 -0
  23. package/front_end/models/ai_assistance/ai_assistance.ts +4 -0
  24. package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.snapshot.txt +9 -37
  25. package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.ts +26 -3
  26. package/front_end/models/ai_code_completion/AiCodeCompletion.ts +10 -2
  27. package/front_end/models/ai_code_generation/AiCodeGeneration.ts +5 -1
  28. package/front_end/models/issues_manager/CookieIssue.ts +0 -4
  29. package/front_end/models/issues_manager/RelatedIssue.ts +0 -14
  30. package/front_end/models/javascript_metadata/NativeFunctions.js +0 -4
  31. package/front_end/models/web_mcp/WebMCPModel.ts +11 -2
  32. package/front_end/models/workspace/IgnoreListManager.ts +1 -1
  33. package/front_end/models/workspace/UISourceCode.ts +10 -5
  34. package/front_end/panels/ai_assistance/ai_assistance-meta.ts +6 -1
  35. package/front_end/panels/ai_assistance/components/ChatMessage.ts +26 -9
  36. package/front_end/panels/application/ApplicationPanelSidebar.ts +32 -42
  37. package/front_end/panels/application/BackForwardCacheTreeElement.ts +2 -2
  38. package/front_end/panels/application/BounceTrackingMitigationsTreeElement.ts +2 -2
  39. package/front_end/panels/application/DOMStorageItemsView.ts +18 -13
  40. package/front_end/panels/application/InterestGroupTreeElement.ts +2 -2
  41. package/front_end/panels/application/ReportingApiTreeElement.ts +3 -3
  42. package/front_end/panels/application/ResourcesPanel.ts +1 -2
  43. package/front_end/panels/application/ServiceWorkerCacheTreeElement.ts +1 -2
  44. package/front_end/panels/application/StorageView.ts +1 -2
  45. package/front_end/panels/application/TrustTokensTreeElement.ts +2 -2
  46. package/front_end/panels/application/WebMCPTreeElement.ts +2 -2
  47. package/front_end/panels/application/WebMCPView.ts +74 -16
  48. package/front_end/panels/application/application.ts +0 -2
  49. package/front_end/panels/application/webMCPView.css +13 -2
  50. package/front_end/panels/console/ConsolePrompt.ts +1 -1
  51. package/front_end/panels/console/ConsoleView.ts +3 -4
  52. package/front_end/panels/elements/ColorSwatchPopoverIcon.ts +0 -152
  53. package/front_end/panels/elements/ElementsTreeElement.ts +4 -9
  54. package/front_end/panels/elements/StandaloneStylesContainer.ts +3 -0
  55. package/front_end/panels/elements/StylePropertiesSection.ts +0 -61
  56. package/front_end/panels/elements/StylePropertyTreeElement.ts +36 -23
  57. package/front_end/panels/elements/StylesAiCodeCompletionProvider.ts +6 -4
  58. package/front_end/panels/elements/StylesContainer.ts +1 -0
  59. package/front_end/panels/elements/StylesSidebarPane.ts +12 -7
  60. package/front_end/panels/elements/stylesSidebarPane.css +0 -8
  61. package/front_end/panels/emulation/AdvancedApp.ts +3 -3
  62. package/front_end/panels/emulation/DeviceModeToolbar.ts +207 -377
  63. package/front_end/panels/emulation/emulation-meta.ts +1 -1
  64. package/front_end/panels/network/NetworkPanel.ts +1 -1
  65. package/front_end/panels/profiler/HeapProfilerPanel.ts +1 -2
  66. package/front_end/panels/screencast/ScreencastApp.ts +3 -3
  67. package/front_end/panels/screencast/screencast-meta.ts +1 -2
  68. package/front_end/panels/settings/SettingsScreen.ts +2 -2
  69. package/front_end/panels/sources/AiCodeCompletionPlugin.ts +2 -4
  70. package/front_end/panels/sources/ScopeChainSidebarPane.ts +5 -1
  71. package/front_end/panels/sources/SourcesNavigator.ts +1 -1
  72. package/front_end/panels/sources/UISourceCodeFrame.ts +1 -3
  73. package/front_end/panels/sources/WatchExpressionsSidebarPane.ts +179 -145
  74. package/front_end/panels/timeline/TimelinePanel.ts +2 -2
  75. package/front_end/panels/timeline/timelineTreeView.css +2 -2
  76. package/front_end/third_party/chromium/README.chromium +1 -1
  77. package/front_end/third_party/puppeteer/README.chromium +2 -2
  78. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Page.d.ts +2 -2
  79. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/locators/locators.d.ts +3 -2
  80. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/locators/locators.d.ts.map +1 -1
  81. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/locators/locators.js +53 -23
  82. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/locators/locators.js.map +1 -1
  83. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Browser.d.ts +3 -2
  84. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Browser.d.ts.map +1 -1
  85. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Browser.js +18 -8
  86. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Browser.js.map +1 -1
  87. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/BrowserConnector.d.ts.map +1 -1
  88. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/BrowserConnector.js +2 -2
  89. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/BrowserConnector.js.map +1 -1
  90. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Page.d.ts.map +1 -1
  91. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Page.js +4 -0
  92. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Page.js.map +1 -1
  93. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/TargetManager.d.ts +1 -1
  94. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/TargetManager.d.ts.map +1 -1
  95. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/TargetManager.js +54 -19
  96. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/TargetManager.js.map +1 -1
  97. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/WebMCP.d.ts +5 -0
  98. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/WebMCP.d.ts.map +1 -1
  99. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/WebMCP.js +2 -9
  100. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/WebMCP.js.map +1 -1
  101. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/BrowserConnector.d.ts.map +1 -1
  102. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/BrowserConnector.js +3 -0
  103. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/BrowserConnector.js.map +1 -1
  104. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConnectOptions.d.ts +37 -1
  105. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConnectOptions.d.ts.map +1 -1
  106. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/injected/injected.d.ts +1 -1
  107. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/BrowserLauncher.d.ts.map +1 -1
  108. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/BrowserLauncher.js +5 -2
  109. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/BrowserLauncher.js.map +1 -1
  110. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/ChromeLauncher.d.ts.map +1 -1
  111. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/ChromeLauncher.js +1 -0
  112. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/ChromeLauncher.js.map +1 -1
  113. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.d.ts +3 -3
  114. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.js +3 -3
  115. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/Mutex.d.ts +2 -2
  116. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/version.d.ts +1 -1
  117. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/version.js +1 -1
  118. package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.d.ts +47 -65
  119. package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.js +143 -55
  120. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Page.d.ts +2 -2
  121. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/locators/locators.d.ts +3 -2
  122. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/locators/locators.d.ts.map +1 -1
  123. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/locators/locators.js +53 -23
  124. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/locators/locators.js.map +1 -1
  125. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Browser.d.ts +3 -2
  126. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Browser.d.ts.map +1 -1
  127. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Browser.js +18 -8
  128. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Browser.js.map +1 -1
  129. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/BrowserConnector.d.ts.map +1 -1
  130. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/BrowserConnector.js +2 -2
  131. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/BrowserConnector.js.map +1 -1
  132. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Page.d.ts.map +1 -1
  133. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Page.js +4 -0
  134. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Page.js.map +1 -1
  135. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/TargetManager.d.ts +1 -1
  136. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/TargetManager.d.ts.map +1 -1
  137. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/TargetManager.js +54 -19
  138. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/TargetManager.js.map +1 -1
  139. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/WebMCP.d.ts +5 -0
  140. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/WebMCP.d.ts.map +1 -1
  141. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/WebMCP.js +2 -9
  142. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/WebMCP.js.map +1 -1
  143. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/BrowserConnector.d.ts.map +1 -1
  144. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/BrowserConnector.js +3 -0
  145. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/BrowserConnector.js.map +1 -1
  146. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/ConnectOptions.d.ts +37 -1
  147. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/ConnectOptions.d.ts.map +1 -1
  148. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/BrowserLauncher.d.ts.map +1 -1
  149. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/BrowserLauncher.js +5 -2
  150. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/BrowserLauncher.js.map +1 -1
  151. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/ChromeLauncher.d.ts.map +1 -1
  152. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/ChromeLauncher.js +1 -0
  153. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/ChromeLauncher.js.map +1 -1
  154. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.d.ts +3 -3
  155. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.js +3 -3
  156. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/version.d.ts +1 -1
  157. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/version.js +1 -1
  158. package/front_end/third_party/puppeteer/package/lib/types.d.ts +47 -65
  159. package/front_end/third_party/puppeteer/package/package.json +6 -6
  160. package/front_end/third_party/puppeteer/package/src/api/Page.ts +2 -2
  161. package/front_end/third_party/puppeteer/package/src/api/locators/locators.ts +69 -27
  162. package/front_end/third_party/puppeteer/package/src/cdp/Browser.ts +27 -8
  163. package/front_end/third_party/puppeteer/package/src/cdp/BrowserConnector.ts +4 -2
  164. package/front_end/third_party/puppeteer/package/src/cdp/Page.ts +6 -0
  165. package/front_end/third_party/puppeteer/package/src/cdp/TargetManager.ts +60 -18
  166. package/front_end/third_party/puppeteer/package/src/cdp/WebMCP.ts +7 -9
  167. package/front_end/third_party/puppeteer/package/src/common/BrowserConnector.ts +3 -0
  168. package/front_end/third_party/puppeteer/package/src/common/ConnectOptions.ts +37 -1
  169. package/front_end/third_party/puppeteer/package/src/node/BrowserLauncher.ts +7 -2
  170. package/front_end/third_party/puppeteer/package/src/node/ChromeLauncher.ts +1 -0
  171. package/front_end/third_party/puppeteer/package/src/revisions.ts +3 -3
  172. package/front_end/third_party/puppeteer/package/src/util/version.ts +1 -1
  173. package/front_end/ui/components/text_editor/AiCodeCompletionProvider.ts +19 -14
  174. package/front_end/ui/components/text_editor/AiCodeGenerationProvider.ts +8 -7
  175. package/front_end/ui/components/tooltips/Tooltip.ts +3 -3
  176. package/front_end/{core/common → ui/legacy}/AppProvider.ts +1 -1
  177. package/front_end/ui/legacy/InspectorView.ts +4 -3
  178. package/front_end/ui/legacy/TabbedPane.ts +1 -1
  179. package/front_end/ui/legacy/UIUserMetrics.ts +70 -0
  180. package/front_end/ui/legacy/components/cookie_table/CookiesTable.ts +1 -8
  181. package/front_end/ui/legacy/components/inline_editor/inline_editor.ts +0 -6
  182. package/front_end/ui/legacy/legacy.ts +6 -0
  183. package/front_end/ui/visual_logging/KnownContextValues.ts +2 -0
  184. package/package.json +1 -1
  185. package/front_end/Images/src/custom-typography.svg +0 -3
  186. package/front_end/ui/legacy/components/inline_editor/FontEditor.ts +0 -798
  187. package/front_end/ui/legacy/components/inline_editor/FontEditorUnitConverter.ts +0 -250
  188. package/front_end/ui/legacy/components/inline_editor/FontEditorUtils.ts +0 -204
  189. package/front_end/ui/legacy/components/inline_editor/fontEditor.css +0 -185
  190. /package/front_end/{core/common → ui/legacy}/App.ts +0 -0
@@ -190,7 +190,7 @@ UI.Toolbar.registerToolbarItem({
190
190
  order: 1,
191
191
  });
192
192
 
193
- Common.AppProvider.registerAppProvider({
193
+ UI.AppProvider.registerAppProvider({
194
194
  async loadAppProvider() {
195
195
  const Emulation = await loadEmulationModule();
196
196
  return Emulation.AdvancedApp.AdvancedAppProvider.instance();
@@ -660,7 +660,7 @@ export class NetworkPanel extends UI.Panel.Panel implements
660
660
  UI.Context.Context.instance().setFlavor(NetworkPanel, this);
661
661
 
662
662
  // Record the network tool load time after the panel has loaded.
663
- Host.userMetrics.panelLoaded('network', 'DevTools.Launch.Network');
663
+ UI.UIUserMetrics.UIUserMetrics.instance().panelLoaded('network', 'DevTools.Launch.Network');
664
664
 
665
665
  if (Annotations.AnnotationRepository.annotationsEnabled()) {
666
666
  void PanelCommon.AnnotationManager.instance().resolveAnnotationsOfType(
@@ -2,7 +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
- import * as Host from '../../core/host/host.js';
6
5
  import * as i18n from '../../core/i18n/i18n.js';
7
6
  import type * as SDK from '../../core/sdk/sdk.js';
8
7
  import * as UI from '../../ui/legacy/legacy.js';
@@ -80,7 +79,7 @@ export class HeapProfilerPanel extends ProfilesPanel implements UI.ContextMenu.P
80
79
  super.wasShown();
81
80
  UI.Context.Context.instance().setFlavor(HeapProfilerPanel, this);
82
81
  // Record the memory tool load time.
83
- Host.userMetrics.panelLoaded('heap-profiler', 'DevTools.Launch.HeapProfiler');
82
+ UI.UIUserMetrics.UIUserMetrics.instance().panelLoaded('heap-profiler', 'DevTools.Launch.HeapProfiler');
84
83
  }
85
84
 
86
85
  override willHide(): void {
@@ -20,7 +20,7 @@ const str_ = i18n.i18n.registerUIStrings('panels/screencast/ScreencastApp.ts', U
20
20
  const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
21
21
  let appInstance: ScreencastApp;
22
22
 
23
- export class ScreencastApp implements Common.App.App,
23
+ export class ScreencastApp implements UI.App.App,
24
24
  SDK.TargetManager.SDKModelObserver<SDK.ScreenCaptureModel.ScreenCaptureModel> {
25
25
  private readonly enabledSetting: Common.Settings.Setting<boolean>;
26
26
  toggleButton: UI.Toolbar.ToolbarToggle;
@@ -127,7 +127,7 @@ export class ToolbarButtonProvider implements UI.Toolbar.Provider {
127
127
 
128
128
  let screencastAppProviderInstance: ScreencastAppProvider;
129
129
 
130
- export class ScreencastAppProvider implements Common.AppProvider.AppProvider {
130
+ export class ScreencastAppProvider implements UI.AppProvider.AppProvider {
131
131
  static instance(opts: {forceNew: boolean} = {forceNew: false}): ScreencastAppProvider {
132
132
  const {forceNew} = opts;
133
133
  if (!screencastAppProviderInstance || forceNew) {
@@ -137,7 +137,7 @@ export class ScreencastAppProvider implements Common.AppProvider.AppProvider {
137
137
  return screencastAppProviderInstance;
138
138
  }
139
139
 
140
- createApp(): Common.App.App {
140
+ createApp(): UI.App.App {
141
141
  return ScreencastApp.instance();
142
142
  }
143
143
  }
@@ -2,7 +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
- import * as Common from '../../core/common/common.js';
6
5
  import * as UI from '../../ui/legacy/legacy.js';
7
6
 
8
7
  import type * as Screencast from './screencast.js';
@@ -25,7 +24,7 @@ UI.Toolbar.registerToolbarItem({
25
24
  location: UI.Toolbar.ToolbarItemLocation.MAIN_TOOLBAR_LEFT,
26
25
  });
27
26
 
28
- Common.AppProvider.registerAppProvider({
27
+ UI.AppProvider.registerAppProvider({
29
28
  async loadAppProvider() {
30
29
  const Screencast = await loadScreencastModule();
31
30
  return Screencast.ScreencastApp.ScreencastAppProvider.instance();
@@ -206,11 +206,11 @@ export class SettingsScreen extends UI.Widget.VBox implements UI.View.ViewLocati
206
206
 
207
207
  private reportSettingsPanelShown(tabId: string): void {
208
208
  if (tabId === i18nString(UIStrings.shortcuts)) {
209
- Host.userMetrics.settingsPanelShown('shortcuts');
209
+ UI.UIUserMetrics.UIUserMetrics.instance().settingsPanelShown('shortcuts');
210
210
  return;
211
211
  }
212
212
 
213
- Host.userMetrics.settingsPanelShown(tabId);
213
+ UI.UIUserMetrics.UIUserMetrics.instance().settingsPanelShown(tabId);
214
214
  }
215
215
 
216
216
  private onEscapeKeyPressed(event: KeyboardEvent): void {
@@ -3,7 +3,6 @@
3
3
  // found in the LICENSE file.
4
4
 
5
5
  import * as Host from '../../core/host/host.js';
6
- import * as i18n from '../../core/i18n/i18n.js';
7
6
  import * as AiCodeCompletion from '../../models/ai_code_completion/ai_code_completion.js';
8
7
  import * as AiCodeGeneration from '../../models/ai_code_generation/ai_code_generation.js';
9
8
  import type * as Workspace from '../../models/workspace/workspace.js';
@@ -32,9 +31,8 @@ export class AiCodeCompletionPlugin extends Plugin {
32
31
 
33
32
  constructor(uiSourceCode: Workspace.UISourceCode.UISourceCode) {
34
33
  super(uiSourceCode);
35
- const devtoolsLocale = i18n.DevToolsLocale.DevToolsLocale.instance();
36
- if (!AiCodeCompletion.AiCodeCompletion.AiCodeCompletion.isAiCodeCompletionEnabled(devtoolsLocale.locale)) {
37
- throw new Error('AI code completion feature is not enabled.');
34
+ if (!AiCodeCompletion.AiCodeCompletion.AiCodeCompletion.isAiCodeCompletionAvailable()) {
35
+ throw new Error('AI code completion feature is not available.');
38
36
  }
39
37
 
40
38
  this.aiCodeCompletionConfig = {
@@ -104,6 +104,10 @@ export class ScopeChainSidebarPane extends UI.Widget.VBox implements UI.ContextF
104
104
  return scopeChainSidebarPaneInstance;
105
105
  }
106
106
 
107
+ treeOutlineForTest(): ObjectUI.ObjectPropertiesSection.ObjectPropertiesSectionsTreeOutline {
108
+ return this.treeOutline;
109
+ }
110
+
107
111
  flavorChanged(callFrame: StackTrace.StackTrace.DebuggableFrameFlavor|null): void {
108
112
  this.#scopeChainModel?.dispose();
109
113
  this.#scopeChainModel = null;
@@ -210,6 +214,6 @@ export class ScopeChainSidebarPane extends UI.Widget.VBox implements UI.ContextF
210
214
  return section;
211
215
  }
212
216
 
213
- private sidebarPaneUpdatedForTest(): void {
217
+ sidebarPaneUpdatedForTest(): void {
214
218
  }
215
219
  }
@@ -117,7 +117,7 @@ export class NetworkNavigatorView extends NavigatorView {
117
117
  SDK.TargetManager.Events.INSPECTED_URL_CHANGED, this.inspectedURLChanged, this);
118
118
 
119
119
  // Record the sources tool load time after the file navigator has loaded.
120
- Host.userMetrics.panelLoaded('sources', 'DevTools.Launch.Sources');
120
+ UI.UIUserMetrics.UIUserMetrics.instance().panelLoaded('sources', 'DevTools.Launch.Sources');
121
121
  SDK.TargetManager.TargetManager.instance().addScopeChangeListener(this.onScopeChange.bind(this));
122
122
  }
123
123
 
@@ -6,7 +6,6 @@
6
6
 
7
7
  import * as Common from '../../core/common/common.js';
8
8
  import * as Host from '../../core/host/host.js';
9
- import * as i18n from '../../core/i18n/i18n.js';
10
9
  import * as FormatterActions from '../../entrypoints/formatter_worker/FormatterActions.js'; // eslint-disable-line @devtools/es-modules-import
11
10
  import * as AiCodeCompletion from '../../models/ai_code_completion/ai_code_completion.js';
12
11
  import * as IssuesManager from '../../models/issues_manager/issues_manager.js';
@@ -327,8 +326,7 @@ export class UISourceCodeFrame extends Common.ObjectWrapper
327
326
  AiWarningInfobarPlugin,
328
327
  ];
329
328
 
330
- const devtoolsLocale = i18n.DevToolsLocale.DevToolsLocale.instance();
331
- if (AiCodeCompletion.AiCodeCompletion.AiCodeCompletion.isAiCodeCompletionEnabled(devtoolsLocale.locale)) {
329
+ if (AiCodeCompletion.AiCodeCompletion.AiCodeCompletion.isAiCodeCompletionAvailable()) {
332
330
  sourceFramePluginsList.push(AiCodeCompletionPlugin);
333
331
  }
334
332
  return sourceFramePluginsList;
@@ -49,6 +49,7 @@ import * as ObjectUI from '../../ui/legacy/components/object_ui/object_ui.js';
49
49
  import objectValueStyles from '../../ui/legacy/components/object_ui/objectValue.css.js';
50
50
  import * as Components from '../../ui/legacy/components/utils/utils.js';
51
51
  import * as UI from '../../ui/legacy/legacy.js';
52
+ import {Directives, html, render} from '../../ui/lit/lit.js';
52
53
  import * as VisualLogging from '../../ui/visual_logging/visual_logging.js';
53
54
 
54
55
  import {UISourceCodeFrame} from './UISourceCodeFrame.js';
@@ -95,25 +96,98 @@ const UIStrings = {
95
96
  const str_ = i18n.i18n.registerUIStrings('panels/sources/WatchExpressionsSidebarPane.ts', UIStrings);
96
97
  const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
97
98
  let watchExpressionsSidebarPaneInstance: WatchExpressionsSidebarPane;
99
+ const {repeat} = Directives;
100
+ interface ViewInput {
101
+ onCopyWatchExpression(watchExpression: WatchExpression): void;
102
+ onDeleteAll(): unknown;
103
+ onAddExpression(): unknown;
104
+ watchExpressions: WatchExpression[];
105
+ }
106
+ type View = (input: ViewInput, output: object, target: HTMLElement) => void;
107
+ export const DEFAULT_VIEW: View = (input, output, target) => {
108
+ const onContextMenu = (watchExpression: WatchExpression|undefined, event: Event): void => {
109
+ const contextMenu = new UI.ContextMenu.ContextMenu(event);
110
+ const isEditing = input.watchExpressions.some(e => e.isEditing());
111
+
112
+ if (!isEditing) {
113
+ contextMenu.debugSection().appendItem(
114
+ i18nString(UIStrings.addWatchExpression), input.onAddExpression, {jslogContext: 'add-watch-expression'});
115
+ }
116
+
117
+ if (input.watchExpressions.length > 1) {
118
+ contextMenu.debugSection().appendItem(
119
+ i18nString(UIStrings.deleteAllWatchExpressions), input.onDeleteAll,
120
+ {jslogContext: 'delete-all-watch-expressions'});
121
+ }
122
+
123
+ if (watchExpression) {
124
+ if (!watchExpression.isEditing()) {
125
+ contextMenu.editSection().appendItem(
126
+ i18nString(UIStrings.deleteWatchExpression), watchExpression.updateExpression.bind(watchExpression, null),
127
+ {jslogContext: 'delete-watch-expression'});
128
+ }
129
+
130
+ if (!watchExpression.isEditing() && watchExpression.result &&
131
+ (watchExpression.result.type === 'number' || watchExpression.result.type === 'string')) {
132
+ contextMenu.clipboardSection().appendItem(
133
+ i18nString(UIStrings.copyValue), () => input.onCopyWatchExpression(watchExpression),
134
+ {jslogContext: 'copy-watch-expression-value'});
135
+ }
98
136
 
99
- export class WatchExpressionsSidebarPane extends UI.Widget.VBox implements
100
- UI.ActionRegistration.ActionDelegate, UI.Toolbar.ItemsProvider,
101
- UI.ContextMenu.Provider<ObjectUI.ObjectPropertiesSection.ObjectPropertyTreeElement|UISourceCodeFrame> {
137
+ contextMenu.appendApplicableItems(watchExpression.result);
138
+ }
139
+ void contextMenu.show();
140
+ event.consume();
141
+ };
142
+
143
+ for (const watchExpression of input.watchExpressions) {
144
+ watchExpression.treeElement().listItemElement.oncontextmenu = onContextMenu.bind(undefined, watchExpression);
145
+ watchExpression.treeElement().childrenListElement.oncontextmenu = onContextMenu.bind(undefined, watchExpression);
146
+ }
147
+
148
+ render(
149
+ // clang-format off
150
+ html`
151
+ ${input.watchExpressions.length === 0
152
+ ? html`<div class=gray-info-message tabindex=-1 >
153
+ ${i18nString(UIStrings.noWatchExpressions)}
154
+ </div>`
155
+ : html`<devtools-tree hide-overflow show-selection-on-keyboard-focus .template=${html`
156
+ <ul role=tree class="source-code object-properties-section">
157
+ <style>${ObjectUI.ObjectPropertiesSection.objectValueStyles}</style>
158
+ <style>${ObjectUI.ObjectPropertiesSection.objectPropertiesSectionStyles}</style>
159
+ <style>${watchExpressionsSidebarPaneStyles}</style>
160
+ ${repeat(input.watchExpressions,
161
+ e => html`<devtools-tree-wrapper .treeElement=${e.treeElement()}></devtools-tree-wrapper>`)}
162
+ </ul>`}>
163
+ </devtools-tree>`
164
+ }`,
165
+ // clang-format on
166
+ target, {
167
+ container: {
168
+ classes: ['watch-expressions'],
169
+ attributes: {
170
+ jslog: `${VisualLogging.section('sources.watch')}`,
171
+ 'aria-label': i18nString(UIStrings.addWatchExpression)
172
+ },
173
+ listeners: {contextmenu: onContextMenu.bind(undefined, undefined)}
174
+ }
175
+ });
176
+ };
177
+
178
+ export class WatchExpressionsSidebarPane extends UI.Widget.VBox implements UI.ActionRegistration.ActionDelegate,
179
+ UI.Toolbar.ItemsProvider {
102
180
  #watchExpressions: WatchExpression[];
103
- private emptyElement!: HTMLElement;
104
181
  #watchExpressionsSetting: Common.Settings.Setting<string[]>;
105
182
  private readonly addButton: UI.Toolbar.ToolbarButton;
106
183
  private readonly refreshButton: UI.Toolbar.ToolbarButton;
107
- private readonly treeOutline: ObjectUI.ObjectPropertiesSection.ObjectPropertiesSectionsTreeOutline;
108
- private readonly expandController: ObjectUI.ObjectPropertiesSection.ObjectPropertiesSectionsTreeExpandController;
109
184
  private readonly linkifier: Components.Linkifier.Linkifier;
185
+ #view: View;
186
+ #expandControllers = new Map<string, ObjectUI.ObjectPropertiesSection.ObjectTreeExpansionTracker>();
110
187
  constructor() {
111
188
  super({useShadowDom: true});
112
189
  this.registerRequiredCSS(watchExpressionsSidebarPaneStyles, objectValueStyles);
113
190
 
114
- // TODO(szuend): Replace with a Set once the web test
115
- // panels/sources/debugger-ui/watch-expressions-preserve-expansion.js is either converted
116
- // to an e2e test or no longer accesses this variable directly.
117
191
  this.#watchExpressions = [];
118
192
  this.#watchExpressionsSetting =
119
193
  Common.Settings.Settings.instance().createLocalSetting<string[]>('watch-expressions', []);
@@ -127,24 +201,15 @@ export class WatchExpressionsSidebarPane extends UI.Widget.VBox implements
127
201
  this.refreshButton = new UI.Toolbar.ToolbarButton(
128
202
  i18nString(UIStrings.refreshWatchExpressions), 'refresh', undefined, 'refresh-watch-expressions');
129
203
  this.refreshButton.setSize(Buttons.Button.Size.SMALL);
130
- this.refreshButton.addEventListener(UI.Toolbar.ToolbarButton.Events.CLICK, this.requestUpdate, this);
131
-
132
- this.contentElement.classList.add('watch-expressions');
133
- this.contentElement.setAttribute('jslog', `${VisualLogging.section('sources.watch')}`);
134
- this.contentElement.addEventListener('contextmenu', this.contextMenu.bind(this), false);
135
- this.treeOutline = new ObjectUI.ObjectPropertiesSection.ObjectPropertiesSectionsTreeOutline();
136
- this.treeOutline.registerRequiredCSS(watchExpressionsSidebarPaneStyles);
137
- this.treeOutline.setHideOverflow(true);
138
-
139
- this.treeOutline.setShowSelectionOnKeyboardFocus(/* show */ true);
140
- this.expandController =
141
- new ObjectUI.ObjectPropertiesSection.ObjectPropertiesSectionsTreeExpandController(this.treeOutline);
204
+ this.refreshButton.addEventListener(UI.Toolbar.ToolbarButton.Events.CLICK, this.#refreshExpressions, this);
142
205
 
143
- UI.Context.Context.instance().addFlavorChangeListener(SDK.RuntimeModel.ExecutionContext, this.requestUpdate, this);
144
206
  UI.Context.Context.instance().addFlavorChangeListener(
145
- StackTrace.StackTrace.DebuggableFrameFlavor, this.requestUpdate, this);
207
+ SDK.RuntimeModel.ExecutionContext, this.#refreshExpressions, this);
208
+ UI.Context.Context.instance().addFlavorChangeListener(
209
+ StackTrace.StackTrace.DebuggableFrameFlavor, this.#refreshExpressions, this);
146
210
  this.linkifier = new Components.Linkifier.Linkifier();
147
- this.requestUpdate();
211
+ this.#view = DEFAULT_VIEW;
212
+ this.#refreshExpressions();
148
213
  }
149
214
 
150
215
  static instance(): WatchExpressionsSidebarPane {
@@ -162,15 +227,6 @@ export class WatchExpressionsSidebarPane extends UI.Widget.VBox implements
162
227
  return [this.addButton, this.refreshButton];
163
228
  }
164
229
 
165
- override focus(): void {
166
- if (this.hasFocus()) {
167
- return;
168
- }
169
- if (this.#watchExpressions.length > 0) {
170
- this.treeOutline.forceSelect();
171
- }
172
- }
173
-
174
230
  private saveExpressions(): void {
175
231
  const toSave = [];
176
232
  for (let i = 0; i < this.#watchExpressions.length; i++) {
@@ -185,102 +241,99 @@ export class WatchExpressionsSidebarPane extends UI.Widget.VBox implements
185
241
 
186
242
  private async addButtonClicked(): Promise<void> {
187
243
  await UI.ViewManager.ViewManager.instance().showView('sources.watch');
188
- this.emptyElement.classList.add('hidden');
189
- this.createWatchExpression(null).startEditing();
244
+ const watchExpression = this.createWatchExpression(null);
245
+ this.requestUpdate();
246
+ // This synchronization is only needed because startEditing is imperative and
247
+ // requires the tree element to be in the DOM. This can be removed once the
248
+ // prompt is migrated to Lit.
249
+ await this.updateComplete;
250
+ watchExpression.startEditing();
190
251
  }
191
252
 
192
- override async performUpdate(): Promise<void> {
253
+ #refreshExpressions(): void {
193
254
  this.linkifier.reset();
194
- this.contentElement.removeChildren();
195
- this.treeOutline.removeChildren();
255
+ for (const expression of this.#watchExpressions) {
256
+ expression.removeEventListener(Events.EXPRESSION_UPDATED, this.watchExpressionUpdated, this);
257
+ }
196
258
  this.#watchExpressions = [];
197
- this.emptyElement = this.contentElement.createChild('div', 'gray-info-message');
198
- this.emptyElement.textContent = i18nString(UIStrings.noWatchExpressions);
199
- this.emptyElement.tabIndex = -1;
200
259
  const watchExpressionStrings = this.#watchExpressionsSetting.get();
201
- if (watchExpressionStrings.length) {
202
- this.emptyElement.classList.add('hidden');
203
- }
260
+
261
+ const oldExpandControllers = this.#expandControllers;
262
+ this.#expandControllers = new Map();
263
+
204
264
  for (let i = 0; i < watchExpressionStrings.length; ++i) {
205
265
  const expression = watchExpressionStrings[i];
206
266
  if (!expression) {
207
267
  continue;
208
268
  }
209
269
 
270
+ const controller = oldExpandControllers.get(expression);
271
+ if (controller) {
272
+ this.#expandControllers.set(expression, controller);
273
+ }
274
+
210
275
  this.createWatchExpression(expression);
211
276
  }
277
+ this.requestUpdate();
278
+ }
279
+
280
+ override async performUpdate(): Promise<void> {
212
281
  await Promise.all(this.#watchExpressions.map(we => we.updateComplete));
282
+ this.#view(
283
+ {
284
+ watchExpressions: this.watchExpressions,
285
+ onDeleteAll: this.deleteAllButtonClicked.bind(this),
286
+ onAddExpression: this.addButtonClicked.bind(this),
287
+ onCopyWatchExpression: watchExpression => {
288
+ if (watchExpression.result?.description) {
289
+ Host.InspectorFrontendHost.InspectorFrontendHostInstance.copyText(watchExpression.result.description);
290
+ }
291
+ }
292
+ },
293
+ {}, this.contentElement);
294
+ }
295
+
296
+ #getExpandController(expression: string|null): ObjectUI.ObjectPropertiesSection.ObjectTreeExpansionTracker {
297
+ if (expression === null) {
298
+ return new ObjectUI.ObjectPropertiesSection.ObjectTreeExpansionTracker();
299
+ }
300
+ let expandController = this.#expandControllers.get(expression);
301
+ if (!expandController) {
302
+ expandController = new ObjectUI.ObjectPropertiesSection.ObjectTreeExpansionTracker();
303
+ this.#expandControllers.set(expression, expandController);
304
+ }
305
+ return expandController;
213
306
  }
214
307
 
215
308
  private createWatchExpression(expression: string|null): WatchExpression {
216
- this.contentElement.appendChild(this.treeOutline.element);
217
- const watchExpression = new WatchExpression(expression, this.expandController, this.linkifier);
218
- UI.ARIAUtils.setLabel(this.contentElement, i18nString(UIStrings.addWatchExpression));
309
+ const expandController = this.#getExpandController(expression);
310
+ const watchExpression = new WatchExpression(expression, expandController, this.linkifier);
219
311
  watchExpression.addEventListener(Events.EXPRESSION_UPDATED, this.watchExpressionUpdated, this);
220
- this.treeOutline.appendChild(watchExpression.treeElement());
221
312
  this.#watchExpressions.push(watchExpression);
222
313
  return watchExpression;
223
314
  }
224
315
 
225
316
  private watchExpressionUpdated({data: watchExpression}: Common.EventTarget.EventTargetEvent<WatchExpression>): void {
226
- if (!watchExpression.expression()) {
317
+ const expression = watchExpression.expression();
318
+ if (!expression) {
227
319
  Platform.ArrayUtilities.removeElement(this.#watchExpressions, watchExpression);
228
- this.treeOutline.removeChild(watchExpression.treeElement());
229
- this.emptyElement.classList.toggle('hidden', Boolean(this.#watchExpressions.length));
230
- if (this.#watchExpressions.length === 0) {
231
- this.treeOutline.element.remove();
232
- }
233
320
  }
234
321
 
235
322
  this.saveExpressions();
236
- }
237
-
238
- private contextMenu(event: MouseEvent): void {
239
- const contextMenu = new UI.ContextMenu.ContextMenu(event);
240
- this.populateContextMenu(contextMenu, event);
241
- void contextMenu.show();
242
- }
243
-
244
- private populateContextMenu(contextMenu: UI.ContextMenu.ContextMenu, event: MouseEvent): void {
245
- let isEditing = false;
246
- for (const watchExpression of this.#watchExpressions) {
247
- isEditing = isEditing || watchExpression.isEditing();
248
- }
249
-
250
- if (!isEditing) {
251
- contextMenu.debugSection().appendItem(
252
- i18nString(UIStrings.addWatchExpression), this.addButtonClicked.bind(this),
253
- {jslogContext: 'add-watch-expression'});
254
- }
255
-
256
- if (this.#watchExpressions.length > 1) {
257
- contextMenu.debugSection().appendItem(
258
- i18nString(UIStrings.deleteAllWatchExpressions), this.deleteAllButtonClicked.bind(this),
259
- {jslogContext: 'delete-all-watch-expressions'});
260
- }
261
-
262
- const treeElement = this.treeOutline.treeElementFromEvent(event);
263
- if (!treeElement) {
264
- return;
265
- }
266
- const currentWatchExpression =
267
- this.#watchExpressions.find(watchExpression => treeElement.hasAncestorOrSelf(watchExpression.treeElement()));
268
- if (currentWatchExpression) {
269
- currentWatchExpression.populateContextMenu(contextMenu, event);
270
- }
323
+ this.requestUpdate();
271
324
  }
272
325
 
273
326
  private deleteAllButtonClicked(): void {
274
327
  this.#watchExpressions = [];
275
328
  this.saveExpressions();
276
- this.requestUpdate();
329
+ this.#refreshExpressions();
277
330
  }
278
331
 
279
332
  private async focusAndAddExpressionToWatch(expression: string): Promise<void> {
280
333
  await UI.ViewManager.ViewManager.instance().showView('sources.watch');
281
334
  this.createWatchExpression(expression);
282
335
  this.saveExpressions();
283
- this.requestUpdate();
336
+ this.#refreshExpressions();
284
337
  }
285
338
 
286
339
  handleAction(_context: UI.Context.Context, _actionId: string): boolean {
@@ -326,32 +379,35 @@ export class WatchExpression extends Common.ObjectWrapper.ObjectWrapper<EventTyp
326
379
  private nameElement!: Element;
327
380
  private valueElement!: Element;
328
381
  #expression: string|null;
329
- private readonly expandController: ObjectUI.ObjectPropertiesSection.ObjectPropertiesSectionsTreeExpandController;
382
+ readonly #expandController: ObjectUI.ObjectPropertiesSection.ObjectTreeExpansionTracker;
330
383
  private element: HTMLDivElement;
331
384
  private editing: boolean;
332
385
  private linkifier: Components.Linkifier.Linkifier;
333
386
  private textPrompt?: ObjectPropertyPrompt;
334
- private result?: SDK.RemoteObject.RemoteObject|null;
387
+ #result?: SDK.RemoteObject.RemoteObject|null;
335
388
  private preventClickTimeout?: number;
336
389
  #updateComplete: Promise<void> = Promise.resolve();
337
390
  constructor(
338
- expression: string|null,
339
- expandController: ObjectUI.ObjectPropertiesSection.ObjectPropertiesSectionsTreeExpandController,
391
+ expression: string|null, expandController: ObjectUI.ObjectPropertiesSection.ObjectTreeExpansionTracker,
340
392
  linkifier: Components.Linkifier.Linkifier) {
341
393
  super();
342
394
 
343
395
  this.#expression = expression;
344
- this.expandController = expandController;
396
+ this.#expandController = expandController;
345
397
  this.element = document.createElement('div');
346
398
  this.element.classList.add('watch-expression');
347
399
  this.element.classList.add('monospace');
348
400
  this.editing = false;
349
401
  this.linkifier = linkifier;
350
402
 
351
- this.createWatchExpression();
403
+ void this.createWatchExpression();
352
404
  this.update();
353
405
  }
354
406
 
407
+ get result(): SDK.RemoteObject.RemoteObject|null {
408
+ return this.#result ?? null;
409
+ }
410
+
355
411
  get updateComplete(): Promise<void> {
356
412
  return this.#updateComplete;
357
413
  }
@@ -392,16 +448,17 @@ export class WatchExpression extends Common.ObjectWrapper.ObjectWrapper<EventTyp
392
448
  update(): void {
393
449
  const currentExecutionContext = UI.Context.Context.instance().flavor(SDK.RuntimeModel.ExecutionContext);
394
450
  if (currentExecutionContext && this.#expression) {
395
- this.#updateComplete = this.#evaluateExpression(currentExecutionContext, this.#expression).then(result => {
396
- if ('object' in result) {
397
- this.createWatchExpression(result.object, result.exceptionDetails);
398
- } else {
399
- this.createWatchExpression();
400
- }
401
- });
451
+ this.#updateComplete = this.#evaluateExpression(currentExecutionContext, this.#expression)
452
+ .then(async result => {
453
+ if ('object' in result) {
454
+ await this.createWatchExpression(result.object, result.exceptionDetails);
455
+ } else {
456
+ await this.createWatchExpression();
457
+ }
458
+ })
459
+ .catch(() => {});
402
460
  } else {
403
- this.createWatchExpression();
404
- this.#updateComplete = Promise.resolve();
461
+ this.#updateComplete = this.createWatchExpression();
405
462
  }
406
463
  }
407
464
 
@@ -454,8 +511,8 @@ export class WatchExpression extends Common.ObjectWrapper.ObjectWrapper<EventTyp
454
511
  }
455
512
 
456
513
  updateExpression(newExpression: string|null): void {
457
- if (this.#expression) {
458
- this.expandController.stopWatchSectionsWithId(this.#expression);
514
+ if (this.#expression !== newExpression && newExpression) {
515
+ this.#expandController.clear();
459
516
  }
460
517
  this.#expression = newExpression;
461
518
  this.update();
@@ -468,13 +525,13 @@ export class WatchExpression extends Common.ObjectWrapper.ObjectWrapper<EventTyp
468
525
  this.updateExpression(null);
469
526
  }
470
527
 
471
- createWatchExpression(result?: SDK.RemoteObject.RemoteObject, exceptionDetails?: Protocol.Runtime.ExceptionDetails):
472
- void {
473
- this.result = result || null;
528
+ async createWatchExpression(
529
+ result?: SDK.RemoteObject.RemoteObject, exceptionDetails?: Protocol.Runtime.ExceptionDetails): Promise<void> {
530
+ this.#result = result || null;
474
531
 
475
532
  this.element.removeChildren();
476
533
  const oldTreeElement = this.#treeElement;
477
- this.createWatchExpressionTreeElement(result, exceptionDetails);
534
+ await this.#createWatchExpressionTreeElement(result, exceptionDetails);
478
535
  if (oldTreeElement?.parent) {
479
536
  const root = oldTreeElement.parent;
480
537
  const index = root.indexOfChild(oldTreeElement);
@@ -530,20 +587,20 @@ export class WatchExpression extends Common.ObjectWrapper.ObjectWrapper<EventTyp
530
587
  return headerElement;
531
588
  }
532
589
 
533
- private createWatchExpressionTreeElement(
534
- expressionValue?: SDK.RemoteObject.RemoteObject, exceptionDetails?: Protocol.Runtime.ExceptionDetails): void {
590
+ async #createWatchExpressionTreeElement(
591
+ expressionValue?: SDK.RemoteObject.RemoteObject,
592
+ exceptionDetails?: Protocol.Runtime.ExceptionDetails): Promise<void> {
535
593
  const headerElement = this.createWatchExpressionHeader(expressionValue, exceptionDetails);
536
594
 
537
595
  if (!exceptionDetails && expressionValue && expressionValue.hasChildren && !expressionValue.customPreview()) {
538
596
  headerElement.classList.add('watch-expression-object-header');
539
- this.#treeElement = new ObjectUI.ObjectPropertiesSection.RootElement(
540
- new ObjectUI.ObjectPropertiesSection.ObjectTree(expressionValue, {
541
- readOnly: true,
542
- propertiesMode: ObjectUI.ObjectPropertiesSection.ObjectPropertiesMode.OWN_AND_INTERNAL_AND_INHERITED,
543
- }),
544
- this.linkifier);
545
- this.expandController.watchSection(
546
- (this.#expression as string), (this.#treeElement as ObjectUI.ObjectPropertiesSection.RootElement));
597
+ const objectTree = new ObjectUI.ObjectPropertiesSection.ObjectTree(expressionValue, {
598
+ readOnly: true,
599
+ propertiesMode: ObjectUI.ObjectPropertiesSection.ObjectPropertiesMode.OWN_AND_INTERNAL_AND_INHERITED,
600
+ expansionTracker: this.#expandController,
601
+ });
602
+ await this.#expandController.apply(objectTree);
603
+ this.#treeElement = new ObjectUI.ObjectPropertiesSection.RootElement(objectTree, this.linkifier);
547
604
  this.#treeElement.toggleOnClick = false;
548
605
  this.#treeElement.listItemElement.addEventListener('click', this.onSectionClick.bind(this), false);
549
606
  this.#treeElement.listItemElement.addEventListener('dblclick', this.dblClickOnWatchExpression.bind(this));
@@ -593,29 +650,6 @@ export class WatchExpression extends Common.ObjectWrapper.ObjectWrapper<EventTyp
593
650
  }
594
651
  }
595
652
 
596
- populateContextMenu(contextMenu: UI.ContextMenu.ContextMenu, event: Event): void {
597
- if (!this.isEditing()) {
598
- contextMenu.editSection().appendItem(
599
- i18nString(UIStrings.deleteWatchExpression), this.updateExpression.bind(this, null),
600
- {jslogContext: 'delete-watch-expression'});
601
- }
602
-
603
- if (!this.isEditing() && this.result && (this.result.type === 'number' || this.result.type === 'string')) {
604
- contextMenu.clipboardSection().appendItem(
605
- i18nString(UIStrings.copyValue), this.copyValueButtonClicked.bind(this),
606
- {jslogContext: 'copy-watch-expression-value'});
607
- }
608
-
609
- const target = UI.UIUtils.deepElementFromEvent(event);
610
- if (target && this.valueElement.isSelfOrAncestor(target) && this.result) {
611
- contextMenu.appendApplicableItems(this.result);
612
- }
613
- }
614
-
615
- private copyValueButtonClicked(): void {
616
- Host.InspectorFrontendHost.InspectorFrontendHostInstance.copyText(this.valueElement.textContent);
617
- }
618
-
619
653
  private static readonly watchObjectGroupId = 'watch-group';
620
654
  }
621
655
 
@@ -776,7 +776,7 @@ export class TimelinePanel extends Common.ObjectWrapper.eventMixin<EventTypes, t
776
776
  super.wasShown();
777
777
  UI.Context.Context.instance().setFlavor(TimelinePanel, this);
778
778
  // Record the performance tool load time.
779
- Host.userMetrics.panelLoaded('timeline', 'DevTools.Launch.Timeline');
779
+ UI.UIUserMetrics.UIUserMetrics.instance().panelLoaded('timeline', 'DevTools.Launch.Timeline');
780
780
 
781
781
  const cruxManager = CrUXManager.CrUXManager.instance();
782
782
  cruxManager.addEventListener(CrUXManager.Events.FIELD_DATA_CHANGED, this.#onFieldDataChanged, this);
@@ -2575,7 +2575,7 @@ export class TimelinePanel extends Common.ObjectWrapper.eventMixin<EventTypes, t
2575
2575
  const measure = performance.measure('TraceLoad', {start, end});
2576
2576
  const duration = Trace.Types.Timing.Milli(measure.duration);
2577
2577
  this.element.dispatchEvent(new TraceLoadEvent(duration));
2578
- Host.userMetrics.performanceTraceLoad(measure);
2578
+ UI.UIUserMetrics.UIUserMetrics.instance().performanceTraceLoad(measure);
2579
2579
  }, 0);
2580
2580
  });
2581
2581
  }