chrome-devtools-frontend 1.0.1672557 → 1.0.1675430

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 (177) hide show
  1. package/.agents/skills/devtools-ux-writing-refactor/SKILL.md +26 -9
  2. package/front_end/core/common/ParsedURL.ts +5 -1
  3. package/front_end/core/common/SettingRegistration.ts +30 -34
  4. package/front_end/core/common/Settings.ts +4 -64
  5. package/front_end/core/host/UserMetrics.ts +127 -117
  6. package/front_end/core/protocol_client/PuppeteerDevToolsConnection.ts +42 -9
  7. package/front_end/core/root/Runtime.ts +14 -0
  8. package/front_end/core/sdk/NetworkManager.ts +0 -35
  9. package/front_end/core/sdk/SourceMap.ts +1 -19
  10. package/front_end/core/sdk/SourceMapManager.ts +75 -48
  11. package/front_end/core/sdk/SourceMapScopesInfo.ts +0 -62
  12. package/front_end/core/sdk/TargetManager.ts +18 -0
  13. package/front_end/devtools_compatibility.js +1 -1
  14. package/front_end/entrypoints/main/MainImpl.ts +1 -0
  15. package/front_end/foundation/Universe.ts +44 -29
  16. package/front_end/generated/InspectorBackendCommands.ts +4 -3
  17. package/front_end/generated/SupportedCSSProperties.ts +16 -1
  18. package/front_end/generated/protocol-mapping.d.ts +8 -0
  19. package/front_end/generated/protocol-proxy-api.d.ts +6 -0
  20. package/front_end/generated/protocol.ts +16 -2
  21. package/front_end/models/ai_assistance/AiSetting.ts +66 -3
  22. package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +15 -5
  23. package/front_end/models/bindings/CompilerScriptMapping.ts +1 -1
  24. package/front_end/models/emulation/DeviceModeModel.ts +82 -102
  25. package/front_end/models/emulation/EmulatedDevices.ts +18 -66
  26. package/front_end/models/javascript_metadata/NativeFunctions.js +4 -4
  27. package/front_end/models/persistence/AutomaticFileSystemManager.ts +2 -2
  28. package/front_end/models/persistence/IsolatedFileSystemManager.ts +20 -29
  29. package/front_end/models/trace/ModelImpl.ts +5 -0
  30. package/front_end/models/trace/Processor.ts +5 -0
  31. package/front_end/models/trace/handlers/LayoutShiftsHandler.ts +7 -1
  32. package/front_end/models/trace/handlers/MetaHandler.ts +8 -4
  33. package/front_end/models/trace/handlers/PageLoadMetricsHandler.ts +11 -0
  34. package/front_end/models/workspace/FileManager.ts +13 -6
  35. package/front_end/panels/ai_assistance/AiAssistancePanel.ts +11 -10
  36. package/front_end/panels/ai_assistance/ai_assistance-meta.ts +3 -45
  37. package/front_end/panels/application/BackgroundServiceView.ts +42 -40
  38. package/front_end/panels/application/KeyValueStorageItemsView.ts +1 -0
  39. package/front_end/panels/application/WebMCPView.ts +13 -5
  40. package/front_end/panels/application/components/AdsView.ts +24 -1
  41. package/front_end/panels/application/components/adsView.css +27 -21
  42. package/front_end/panels/autofill/AutofillView.ts +12 -12
  43. package/front_end/panels/autofill/autofill-meta.ts +2 -2
  44. package/front_end/panels/common/ExtensionServer.ts +7 -1
  45. package/front_end/panels/common/common.ts +0 -1
  46. package/front_end/panels/console/ConsoleInsightTeaser.ts +7 -6
  47. package/front_end/panels/console/ConsoleViewMessage.ts +1 -1
  48. package/front_end/panels/elements/ClassesPaneWidget.ts +2 -2
  49. package/front_end/panels/elements/ElementsTreeElement.ts +602 -327
  50. package/front_end/panels/elements/ElementsTreeOutline.ts +1 -1
  51. package/front_end/panels/elements/StylesSidebarPane.ts +1 -1
  52. package/front_end/panels/elements/components/AdornerManager.ts +1 -0
  53. package/front_end/panels/emulation/AdvancedApp.ts +3 -3
  54. package/front_end/panels/emulation/DeviceModeToolbar.ts +2 -11
  55. package/front_end/panels/emulation/DeviceModeView.ts +234 -75
  56. package/front_end/panels/emulation/InspectedPagePlaceholder.ts +1 -1
  57. package/front_end/panels/emulation/deviceModeView.css +4 -21
  58. package/front_end/panels/emulation/emulation-meta.ts +4 -30
  59. package/front_end/panels/emulation/emulation.ts +0 -3
  60. package/front_end/panels/explain/components/ConsoleInsight.ts +11 -7
  61. package/front_end/panels/js_timeline/js_timeline-meta.ts +8 -8
  62. package/front_end/panels/layer_viewer/LayerDetailsView.ts +30 -30
  63. package/front_end/panels/layer_viewer/LayerTreeOutline.ts +6 -6
  64. package/front_end/panels/layer_viewer/LayerViewHost.ts +1 -1
  65. package/front_end/panels/layer_viewer/Layers3DView.ts +11 -11
  66. package/front_end/panels/layer_viewer/PaintProfilerView.ts +8 -8
  67. package/front_end/panels/layer_viewer/TransformController.ts +3 -3
  68. package/front_end/panels/layer_viewer/layer_viewer-meta.ts +11 -11
  69. package/front_end/panels/layers/LayersPanel.ts +2 -2
  70. package/front_end/panels/layers/layers-meta.ts +2 -2
  71. package/front_end/panels/lighthouse/LighthouseController.ts +3 -7
  72. package/front_end/panels/mobile_throttling/CPUThrottlingSelector.ts +313 -0
  73. package/front_end/panels/mobile_throttling/NetworkPanelIndicator.ts +0 -10
  74. package/front_end/panels/mobile_throttling/NetworkThrottlingSelector.ts +21 -10
  75. package/front_end/panels/mobile_throttling/ThrottlingManager.ts +1 -58
  76. package/front_end/panels/mobile_throttling/mobile_throttling.ts +2 -9
  77. package/front_end/panels/network/NetworkConfigView.ts +1 -71
  78. package/front_end/panels/network/networkConfigView.css +1 -2
  79. package/front_end/panels/profiler/HeapDetachedElementsDataGrid.ts +3 -3
  80. package/front_end/panels/profiler/HeapDetachedElementsView.ts +5 -5
  81. package/front_end/panels/profiler/HeapProfileView.ts +32 -32
  82. package/front_end/panels/profiler/HeapProfilerPanel.ts +2 -2
  83. package/front_end/panels/profiler/HeapSnapshotDataGrids.ts +33 -37
  84. package/front_end/panels/profiler/HeapSnapshotGridNodes.ts +26 -27
  85. package/front_end/panels/profiler/HeapSnapshotView.ts +48 -48
  86. package/front_end/panels/profiler/IsolateSelector.ts +10 -10
  87. package/front_end/panels/profiler/ModuleUIStrings.ts +25 -25
  88. package/front_end/panels/profiler/ProfileLauncherView.ts +6 -6
  89. package/front_end/panels/profiler/ProfilesPanel.ts +6 -6
  90. package/front_end/panels/profiler/WritableProfileHeader.ts +6 -6
  91. package/front_end/panels/profiler/profiler-meta.ts +7 -7
  92. package/front_end/panels/protocol_monitor/ProtocolMonitor.ts +7 -0
  93. package/front_end/panels/recorder/RecorderPanel.ts +1 -1
  94. package/front_end/panels/settings/AISettingsTab.ts +27 -23
  95. package/front_end/panels/settings/emulation/DevicesSettingsTab.ts +1 -2
  96. package/front_end/panels/timeline/TimelineFlameChartNetworkDataProvider.ts +12 -17
  97. package/front_end/panels/timeline/TimelinePanel.ts +20 -35
  98. package/front_end/panels/timeline/components/LiveMetricsView.ts +27 -6
  99. package/front_end/panels/timeline/components/NetworkTrackWidget.ts +1 -1
  100. package/front_end/panels/timeline/components/components.ts +0 -4
  101. package/front_end/panels/timeline/components/liveMetricsView.css +7 -0
  102. package/front_end/third_party/chromium/README.chromium +1 -1
  103. package/front_end/third_party/source-map-scopes-codec/package/CONTRIBUTING.md +0 -0
  104. package/front_end/third_party/source-map-scopes-codec/package/LICENSE +0 -0
  105. package/front_end/third_party/source-map-scopes-codec/package/README.md +0 -0
  106. package/front_end/third_party/source-map-scopes-codec/package/_dist/src/builder/builder.d.ts +0 -0
  107. package/front_end/third_party/source-map-scopes-codec/package/_dist/src/builder/builder.d.ts.map +1 -1
  108. package/front_end/third_party/source-map-scopes-codec/package/_dist/src/builder/safe_builder.d.ts +0 -0
  109. package/front_end/third_party/source-map-scopes-codec/package/_dist/src/builder/safe_builder.d.ts.map +0 -0
  110. package/front_end/third_party/source-map-scopes-codec/package/_dist/src/decode/decode.d.ts +0 -0
  111. package/front_end/third_party/source-map-scopes-codec/package/_dist/src/decode/decode.d.ts.map +0 -0
  112. package/front_end/third_party/source-map-scopes-codec/package/_dist/src/encode/encode.d.ts +0 -0
  113. package/front_end/third_party/source-map-scopes-codec/package/_dist/src/encode/encode.d.ts.map +0 -0
  114. package/front_end/third_party/source-map-scopes-codec/package/_dist/src/mod.d.ts +0 -0
  115. package/front_end/third_party/source-map-scopes-codec/package/_dist/src/mod.d.ts.map +0 -0
  116. package/front_end/third_party/source-map-scopes-codec/package/_dist/src/scopes.d.ts +0 -0
  117. package/front_end/third_party/source-map-scopes-codec/package/_dist/src/scopes.d.ts.map +0 -0
  118. package/front_end/third_party/source-map-scopes-codec/package/deno.json +1 -1
  119. package/front_end/third_party/source-map-scopes-codec/package/package.json +1 -1
  120. package/front_end/third_party/source-map-scopes-codec/package/src/builder/builder.js +2 -0
  121. package/front_end/third_party/source-map-scopes-codec/package/src/builder/builder.js.map +1 -1
  122. package/front_end/third_party/source-map-scopes-codec/package/src/builder/builder.ts +2 -0
  123. package/front_end/third_party/source-map-scopes-codec/package/src/builder/safe_builder.js +0 -0
  124. package/front_end/third_party/source-map-scopes-codec/package/src/builder/safe_builder.js.map +0 -0
  125. package/front_end/third_party/source-map-scopes-codec/package/src/builder/safe_builder.ts +0 -0
  126. package/front_end/third_party/source-map-scopes-codec/package/src/codec.js +0 -0
  127. package/front_end/third_party/source-map-scopes-codec/package/src/codec.js.map +0 -0
  128. package/front_end/third_party/source-map-scopes-codec/package/src/codec.ts +0 -0
  129. package/front_end/third_party/source-map-scopes-codec/package/src/decode/decode.js +0 -0
  130. package/front_end/third_party/source-map-scopes-codec/package/src/decode/decode.js.map +0 -0
  131. package/front_end/third_party/source-map-scopes-codec/package/src/decode/decode.ts +0 -0
  132. package/front_end/third_party/source-map-scopes-codec/package/src/encode/encode.js +0 -0
  133. package/front_end/third_party/source-map-scopes-codec/package/src/encode/encode.js.map +0 -0
  134. package/front_end/third_party/source-map-scopes-codec/package/src/encode/encode.ts +0 -0
  135. package/front_end/third_party/source-map-scopes-codec/package/src/encode/encoder.js +0 -0
  136. package/front_end/third_party/source-map-scopes-codec/package/src/encode/encoder.js.map +0 -0
  137. package/front_end/third_party/source-map-scopes-codec/package/src/encode/encoder.ts +0 -0
  138. package/front_end/third_party/source-map-scopes-codec/package/src/mod.js +0 -0
  139. package/front_end/third_party/source-map-scopes-codec/package/src/mod.js.map +0 -0
  140. package/front_end/third_party/source-map-scopes-codec/package/src/mod.ts +0 -0
  141. package/front_end/third_party/source-map-scopes-codec/package/src/scopes.js +0 -0
  142. package/front_end/third_party/source-map-scopes-codec/package/src/scopes.js.map +0 -0
  143. package/front_end/third_party/source-map-scopes-codec/package/src/scopes.ts +0 -0
  144. package/front_end/third_party/source-map-scopes-codec/package/src/util.js +0 -0
  145. package/front_end/third_party/source-map-scopes-codec/package/src/util.js.map +0 -0
  146. package/front_end/third_party/source-map-scopes-codec/package/src/util.ts +0 -0
  147. package/front_end/third_party/source-map-scopes-codec/package/src/vlq.js +0 -0
  148. package/front_end/third_party/source-map-scopes-codec/package/src/vlq.js.map +0 -0
  149. package/front_end/third_party/source-map-scopes-codec/package/src/vlq.ts +0 -0
  150. package/front_end/ui/comments/CommentAnchorResolver.ts +132 -0
  151. package/front_end/ui/comments/comments.ts +9 -0
  152. package/front_end/ui/components/dialogs/ShortcutDialog.ts +2 -0
  153. package/front_end/ui/components/settings/SettingCheckbox.ts +4 -12
  154. package/front_end/ui/components/settings/settingCheckbox.css +0 -7
  155. package/front_end/ui/legacy/Treeoutline.ts +14 -14
  156. package/front_end/ui/legacy/UIUtils.ts +2 -47
  157. package/front_end/ui/legacy/Widget.ts +10 -2
  158. package/front_end/ui/legacy/components/data_grid/DataGridElement.ts +40 -0
  159. package/front_end/ui/legacy/components/settings_ui/SettingsUI.ts +1 -1
  160. package/front_end/ui/legacy/components/utils/Linkifier.ts +1 -0
  161. package/front_end/ui/lit/Directives.ts +80 -0
  162. package/front_end/ui/lit/lit.ts +1 -0
  163. package/front_end/ui/lit/render.ts +8 -0
  164. package/front_end/ui/settings/SettingUIRegistration.ts +4 -0
  165. package/front_end/ui/visual_logging/Debugging.ts +1 -5
  166. package/front_end/ui/visual_logging/KnownContextValues.ts +3 -0
  167. package/front_end/ui/visual_logging/LoggingConfig.ts +21 -0
  168. package/front_end/ui/visual_logging/visual_logging.ts +9 -0
  169. package/mcp/mcp.ts +1 -0
  170. package/package.json +1 -1
  171. package/front_end/panels/common/ThrottlingUtils.ts +0 -51
  172. package/front_end/panels/emulation/DeviceModeWrapper.ts +0 -248
  173. package/front_end/panels/mobile_throttling/MobileThrottlingSelector.ts +0 -92
  174. package/front_end/panels/timeline/components/CPUThrottlingSelector.ts +0 -235
  175. package/front_end/panels/timeline/components/NetworkThrottlingSelector.ts +0 -245
  176. package/front_end/panels/timeline/components/cpuThrottlingSelector.css +0 -30
  177. package/front_end/panels/timeline/components/networkThrottlingSelector.css +0 -24
@@ -0,0 +1,313 @@
1
+ // Copyright 2026 The Chromium Authors
2
+ // Use of this source code is governed by a BSD-style license that can be
3
+ // found in the LICENSE file.
4
+
5
+ import * as Common from '../../core/common/common.js';
6
+ import * as i18n from '../../core/i18n/i18n.js';
7
+ import * as SDK from '../../core/sdk/sdk.js';
8
+ import * as CrUXManager from '../../models/crux-manager/crux-manager.js';
9
+ import * as UI from '../../ui/legacy/legacy.js';
10
+ import * as Lit from '../../ui/lit/lit.js';
11
+ import * as VisualLogging from '../../ui/visual_logging/visual_logging.js';
12
+ import * as PanelsCommon from '../common/common.js';
13
+
14
+ import {throttlingManager} from './ThrottlingManager.js';
15
+ import {ThrottlingPresets} from './ThrottlingPresets.js';
16
+
17
+ const {render, html, Directives} = Lit;
18
+
19
+ const UIStrings = {
20
+ /**
21
+ * @description Text label for a selection box showing which CPU throttling option is applied.
22
+ * @example {No throttling} PH1
23
+ */
24
+ cpuThrottling: 'CPU throttling: {PH1}',
25
+ /**
26
+ * @description Text label for a selection box showing that a specific option is recommended.
27
+ * @example {4x slowdown} PH1
28
+ */
29
+ recommendedThrottling: '{PH1} – recommended',
30
+ /**
31
+ * @description Text to prompt the user to run the CPU calibration process.
32
+ */
33
+ calibrate: 'Calibrate…',
34
+ /**
35
+ * @description Text to prompt the user to re-run the CPU calibration process.
36
+ */
37
+ recalibrate: 'Recalibrate…',
38
+ /**
39
+ * @description CPU preset option with no throttling.
40
+ */
41
+ disabledThrottlingPreset: 'Disabled',
42
+ /**
43
+ * @description Default presets category title.
44
+ */
45
+ defaultPresets: 'Presets',
46
+ /**
47
+ * @description Label shown above a list of CPU calibration preset options.
48
+ */
49
+ labelCalibratedPresets: 'Calibrated presets',
50
+ } as const;
51
+
52
+ const str_ = i18n.i18n.registerUIStrings(
53
+ 'panels/mobile_throttling/CPUThrottlingSelector.ts',
54
+ UIStrings,
55
+ );
56
+ const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
57
+
58
+ interface CPUThrottlingGroup {
59
+ name: string;
60
+ items: PanelsCommon.CPUThrottlingOption.CPUThrottlingOption[];
61
+ }
62
+
63
+ interface ViewInput {
64
+ recommendedOption: PanelsCommon.CPUThrottlingOption.CPUThrottlingOption|null;
65
+ currentOption: PanelsCommon.CPUThrottlingOption.CPUThrottlingOption;
66
+ groups: CPUThrottlingGroup[];
67
+ throttling: PanelsCommon.CPUThrottlingOption.CalibratedCPUThrottling;
68
+ onSelect: (
69
+ option: PanelsCommon.CPUThrottlingOption.CPUThrottlingOption,
70
+ ) => void;
71
+ onCalibrateClick: () => void;
72
+ }
73
+
74
+ const optionsMap = new WeakMap<HTMLOptionElement, PanelsCommon.CPUThrottlingOption.CPUThrottlingOption>();
75
+
76
+ export const DEFAULT_VIEW = (
77
+ input: ViewInput,
78
+ _output: undefined,
79
+ target: HTMLElement,
80
+ ): void => {
81
+ const selectionTitle = input.currentOption.title();
82
+ const hasCalibratedOnce = input.throttling.low || input.throttling.mid;
83
+ const calibrationLabel = hasCalibratedOnce ? i18nString(UIStrings.recalibrate) : i18nString(UIStrings.calibrate);
84
+
85
+ function onSelect(event: Event): void {
86
+ const element = event.target as HTMLSelectElement | null;
87
+ if (!element) {
88
+ return;
89
+ }
90
+ const option = element.selectedOptions[0];
91
+ if (!option) {
92
+ return;
93
+ }
94
+ const condition = optionsMap.get(option);
95
+ if (condition) {
96
+ input.onSelect(condition);
97
+ } else {
98
+ input.onCalibrateClick();
99
+ event.consume(true);
100
+ element.value = String(
101
+ input.currentOption.calibratedDeviceType ?? input.currentOption.rate(),
102
+ );
103
+ }
104
+ }
105
+
106
+ // clang-format off
107
+ render(
108
+ html`${input.groups.map(group => {
109
+ return html` <optgroup
110
+ label=${group.name}
111
+ title=${group.name}
112
+ >
113
+ ${group.items.map(option => {
114
+ const title =
115
+ option === input.recommendedOption
116
+ ? i18nString(UIStrings.recommendedThrottling, {
117
+ PH1: option.title(),
118
+ })
119
+ : option.title();
120
+ const rate = option.rate();
121
+ return html`
122
+ <option
123
+ ${Directives.ref(
124
+ optionEl =>
125
+ optionEl &&
126
+ optionsMap.set(optionEl as HTMLOptionElement, option),
127
+ )}
128
+ .value=${String(option.calibratedDeviceType ?? rate)}
129
+ ?selected=${input.currentOption === option}
130
+ ?disabled=${rate === 0}
131
+ title=${title}
132
+ aria-label=${title}
133
+ jslog=${VisualLogging.item(option.jslogContext).track({
134
+ click: true,
135
+ })}
136
+ >
137
+ ${title}
138
+ </option>
139
+ `;
140
+ })}
141
+ ${group.name === i18nString(UIStrings.labelCalibratedPresets)
142
+ ? html`<option
143
+ .value=${
144
+ '-1' /* This won't be displayed unless it has some value. */
145
+ }
146
+ title=${calibrationLabel}
147
+ aria-label=${calibrationLabel}
148
+ jslog=${VisualLogging.action(
149
+ 'cpu-throttling-selector-calibrate',
150
+ ).track({click: true})}
151
+ >
152
+ ${calibrationLabel}
153
+ </option>`
154
+ : Lit.nothing}
155
+ </optgroup>`;
156
+ })}`,
157
+ target,
158
+ {
159
+ container: {
160
+ listeners: {change: onSelect},
161
+ attributes: {
162
+ title: i18nString(UIStrings.cpuThrottling, {PH1: selectionTitle}),
163
+ 'aria-label': i18nString(UIStrings.cpuThrottling, {PH1: selectionTitle}),
164
+ jslog: `${VisualLogging.dropDown('cpu-throttling').track({change: true})}`,
165
+ },
166
+ },
167
+ },
168
+ );
169
+ // clang-format on
170
+ };
171
+
172
+ type View = typeof DEFAULT_VIEW;
173
+
174
+ export class CPUThrottlingSelector extends UI.Widget.Widget {
175
+ #currentOption: PanelsCommon.CPUThrottlingOption.CPUThrottlingOption;
176
+ #recommendedOption: PanelsCommon.CPUThrottlingOption.CPUThrottlingOption|null = null;
177
+ #groups: CPUThrottlingGroup[] = [];
178
+ #calibratedThrottlingSetting: Common.Settings.Setting<PanelsCommon.CPUThrottlingOption.CalibratedCPUThrottling>;
179
+ readonly #view: View;
180
+ readonly #cpuThrottlingManager = SDK.CPUThrottlingManager.CPUThrottlingManager.instance();
181
+
182
+ static createForGlobalConditions(
183
+ element: HTMLElement,
184
+ ): CPUThrottlingSelector {
185
+ const selectElement = element.createChild('select');
186
+ const select = new CPUThrottlingSelector(selectElement);
187
+ select.show(element, undefined, /* suppressOrphanWidgetError= */ true);
188
+ select.performUpdate();
189
+ return select;
190
+ }
191
+
192
+ constructor(element?: HTMLElement, view: View = DEFAULT_VIEW) {
193
+ super(element);
194
+ this.#currentOption = throttlingManager().cpuThrottlingOption();
195
+ this.#calibratedThrottlingSetting =
196
+ Common.Settings.Settings.instance().createSetting<PanelsCommon.CPUThrottlingOption.CalibratedCPUThrottling>(
197
+ 'calibrated-cpu-throttling',
198
+ {},
199
+ Common.Settings.SettingStorageType.GLOBAL,
200
+ );
201
+ this.#resetGroups();
202
+ this.#view = view;
203
+ this.performUpdate();
204
+ }
205
+
206
+ set recommendedOption(
207
+ recommendedOption: PanelsCommon.CPUThrottlingOption.CPUThrottlingOption|null,
208
+ ) {
209
+ this.#recommendedOption = recommendedOption;
210
+ this.requestUpdate();
211
+ }
212
+
213
+ #updateRecommendation = (): void => {
214
+ let cpuOption: PanelsCommon.CPUThrottlingOption.CPUThrottlingOption =
215
+ PanelsCommon.CPUThrottlingOption.CalibratedMidTierMobileThrottlingOption;
216
+ if (cpuOption.rate() === 0) {
217
+ cpuOption = PanelsCommon.CPUThrottlingOption.MidTierThrottlingOption;
218
+ }
219
+ this.recommendedOption = cpuOption;
220
+ };
221
+
222
+ override wasShown(): void {
223
+ super.wasShown();
224
+ this.#cpuThrottlingManager.addEventListener(
225
+ SDK.CPUThrottlingManager.Events.RATE_CHANGED,
226
+ this.#onOptionChange,
227
+ this,
228
+ );
229
+ this.#calibratedThrottlingSetting.addChangeListener(
230
+ this.#onCalibratedSettingChanged,
231
+ this,
232
+ );
233
+ CrUXManager.CrUXManager.instance().addEventListener(
234
+ CrUXManager.Events.FIELD_DATA_CHANGED,
235
+ this.#updateRecommendation,
236
+ );
237
+ this.#updateRecommendation();
238
+ this.#onOptionChange();
239
+ }
240
+
241
+ override willHide(): void {
242
+ super.willHide();
243
+ this.#calibratedThrottlingSetting.removeChangeListener(
244
+ this.#onCalibratedSettingChanged,
245
+ this,
246
+ );
247
+ this.#cpuThrottlingManager.removeEventListener(
248
+ SDK.CPUThrottlingManager.Events.RATE_CHANGED,
249
+ this.#onOptionChange,
250
+ this,
251
+ );
252
+ CrUXManager.CrUXManager.instance().removeEventListener(
253
+ CrUXManager.Events.FIELD_DATA_CHANGED,
254
+ this.#updateRecommendation,
255
+ );
256
+ }
257
+
258
+ #onOptionChange(): void {
259
+ this.#currentOption = throttlingManager().cpuThrottlingOption();
260
+ this.requestUpdate();
261
+ }
262
+
263
+ #onCalibratedSettingChanged(): void {
264
+ this.#resetGroups();
265
+ this.requestUpdate();
266
+ }
267
+
268
+ #onSelect(
269
+ option: PanelsCommon.CPUThrottlingOption.CPUThrottlingOption,
270
+ ): void {
271
+ throttlingManager().setCPUThrottlingOption(option);
272
+ }
273
+
274
+ #onCalibrateClick(): void {
275
+ void Common.Revealer.reveal(this.#calibratedThrottlingSetting);
276
+ this.requestUpdate();
277
+ }
278
+
279
+ #resetGroups(): void {
280
+ this.#groups = [
281
+ {
282
+ name: i18nString(UIStrings.disabledThrottlingPreset),
283
+ items: ThrottlingPresets.cpuThrottlingPresets.filter(
284
+ option => option.rate() === 1 && !option.calibratedDeviceType,
285
+ ),
286
+ },
287
+ {
288
+ name: i18nString(UIStrings.defaultPresets),
289
+ items: ThrottlingPresets.cpuThrottlingPresets.filter(
290
+ option => !option.calibratedDeviceType && option.rate() > 1,
291
+ ),
292
+ },
293
+ {
294
+ name: i18nString(UIStrings.labelCalibratedPresets),
295
+ items: ThrottlingPresets.cpuThrottlingPresets.filter(
296
+ option => option.calibratedDeviceType,
297
+ ),
298
+ },
299
+ ];
300
+ }
301
+
302
+ override performUpdate(): void {
303
+ const input: ViewInput = {
304
+ recommendedOption: this.#recommendedOption,
305
+ currentOption: this.#currentOption,
306
+ groups: this.#groups,
307
+ throttling: this.#calibratedThrottlingSetting.get(),
308
+ onSelect: this.#onSelect.bind(this),
309
+ onCalibrateClick: this.#onCalibrateClick.bind(this),
310
+ };
311
+ this.#view(input, undefined, this.contentElement as HTMLSelectElement);
312
+ }
313
+ }
@@ -20,11 +20,6 @@ const UIStrings = {
20
20
  * @description Icon title for warning indicator in the Network panel title.
21
21
  */
22
22
  requestsMayBeBlocked: 'Requests may be blocked. See the Network request blocking panel',
23
- /**
24
- * @description Title of an icon in the Network panel that indicates that accepted content encodings have been overridden.
25
- */
26
- acceptedEncodingOverrideSet:
27
- 'The set of accepted `Content-Encoding` headers has been changed by DevTools. See the Network conditions panel',
28
23
  } as const;
29
24
  const str_ = i18n.i18n.registerUIStrings('panels/mobile_throttling/NetworkPanelIndicator.ts', UIStrings);
30
25
  const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
@@ -41,8 +36,6 @@ export class NetworkPanelIndicator {
41
36
  SDK.NetworkManager.MultitargetNetworkManager.Events.BLOCKED_PATTERNS_CHANGED, updateVisibility);
42
37
  manager.addEventListener(
43
38
  SDK.NetworkManager.MultitargetNetworkManager.Events.INTERCEPTORS_CHANGED, updateVisibility);
44
- manager.addEventListener(
45
- SDK.NetworkManager.MultitargetNetworkManager.Events.ACCEPTED_ENCODINGS_CHANGED, updateVisibility);
46
39
  Common.Settings.Settings.instance().moduleSetting('cache-disabled').addChangeListener(updateVisibility, this);
47
40
 
48
41
  updateVisibility();
@@ -58,9 +51,6 @@ export class NetworkPanelIndicator {
58
51
  if (manager.isBlocking()) {
59
52
  warnings.push(i18nString(UIStrings.requestsMayBeBlocked));
60
53
  }
61
- if (manager.isAcceptedEncodingOverrideSet()) {
62
- warnings.push(i18nString(UIStrings.acceptedEncodingOverrideSet));
63
- }
64
54
  UI.InspectorView.InspectorView.instance().setPanelWarnings('network', warnings);
65
55
  }
66
56
  }
@@ -10,7 +10,6 @@ import * as CrUXManager from '../../models/crux-manager/crux-manager.js';
10
10
  import * as UI from '../../ui/legacy/legacy.js';
11
11
  import * as Lit from '../../ui/lit/lit.js';
12
12
  import * as VisualLogging from '../../ui/visual_logging/visual_logging.js';
13
- import * as PanelsCommon from '../common/common.js';
14
13
 
15
14
  import {ThrottlingManager} from './ThrottlingManager.js';
16
15
  import type {NetworkThrottlingConditionsGroup} from './ThrottlingPresets.js';
@@ -84,7 +83,6 @@ export const DEFAULT_VIEW: ViewFunction = (input, output, target) => {
84
83
  .item(Platform.StringUtilities.toKebabCase(
85
84
  ('i18nTitleKey' in condition && condition.i18nTitleKey) || title(condition)))
86
85
  .track({click: true})}`;
87
-
88
86
  let selectedConditions = input.selectedConditions;
89
87
  function onSelect(event: Event): void {
90
88
  const element = (event.target as HTMLSelectElement | null);
@@ -95,18 +93,16 @@ export const DEFAULT_VIEW: ViewFunction = (input, output, target) => {
95
93
  if (!option) {
96
94
  return;
97
95
  }
98
- if (option === element.options[element.options.length - 1]) {
96
+ const conditions = optionsMap.get(option);
97
+ if (conditions) {
98
+ selectedConditions = conditions;
99
+ input.onSelect(conditions);
100
+ } else {
99
101
  input.onAddCustomConditions();
100
102
  event.consume(true);
101
103
  if (selectedConditions) {
102
104
  element.value = title(selectedConditions);
103
105
  }
104
- } else {
105
- const conditions = optionsMap.get(option);
106
- if (conditions) {
107
- selectedConditions = conditions;
108
- input.onSelect(conditions);
109
- }
110
106
  }
111
107
  }
112
108
 
@@ -167,6 +163,19 @@ export interface EventTypes {
167
163
  [Events.CONDITIONS_CHANGED]: SDK.NetworkManager.ThrottlingConditions;
168
164
  }
169
165
 
166
+ /**
167
+ * Computes the recommended network throttling preset based on CrUX RTT field
168
+ * metric data. Returns null if no RTT data is available or no preset matches.
169
+ */
170
+ export function getRecommendedNetworkConditions(roundTripTimeMetricData?: CrUXManager.MetricResponse):
171
+ SDK.NetworkManager.Conditions|null {
172
+ if (roundTripTimeMetricData?.percentiles) {
173
+ const rtt = Number(roundTripTimeMetricData.percentiles.p75);
174
+ return SDK.NetworkManager.getRecommendedNetworkPreset(rtt);
175
+ }
176
+ return null;
177
+ }
178
+
170
179
  export class NetworkThrottlingSelect extends Common.ObjectWrapper.eventMixin<EventTypes, typeof UI.Widget.Widget>(
171
180
  UI.Widget.Widget) {
172
181
  readonly #settings: Common.Settings.Settings;
@@ -253,7 +262,9 @@ export class NetworkThrottlingSelect extends Common.ObjectWrapper.eventMixin<Eve
253
262
  #updateRecommendation = (): void => {
254
263
  const cruxManager = CrUXManager.CrUXManager.instance();
255
264
  const roundTripTimeMetricData = cruxManager.getSelectedFieldMetricData('round_trip_time');
256
- this.recommendedConditions = PanelsCommon.ThrottlingUtils.getRecommendedNetworkConditions(roundTripTimeMetricData);
265
+ this.recommendedConditions = getRecommendedNetworkConditions(
266
+ roundTripTimeMetricData,
267
+ );
257
268
  };
258
269
 
259
270
  set bindToGlobalConditions(bind: boolean) {
@@ -13,13 +13,7 @@ import {html, render} from '../../ui/lit/lit.js';
13
13
  import * as VisualLogging from '../../ui/visual_logging/visual_logging.js';
14
14
  import * as PanelsCommon from '../common/common.js';
15
15
 
16
- import {MobileThrottlingSelector} from './MobileThrottlingSelector.js';
17
- import {
18
- type Conditions,
19
- type ConditionsList,
20
- type MobileThrottlingConditionsGroup,
21
- ThrottlingPresets,
22
- } from './ThrottlingPresets.js';
16
+ import {ThrottlingPresets} from './ThrottlingPresets.js';
23
17
 
24
18
  export interface CPUThrottlingSelectorWrapper {
25
19
  control: UI.Toolbar.ToolbarComboBox;
@@ -35,10 +29,6 @@ const UIStrings = {
35
29
  * @description Text in throttling manager of the Network panel.
36
30
  */
37
31
  forceDisconnectedFromNetwork: 'Force disconnected from network',
38
- /**
39
- * @description Text for throttling the network.
40
- */
41
- throttling: 'Throttling',
42
32
  /**
43
33
  * @description Icon title in throttling manager of the Network panel.
44
34
  */
@@ -206,53 +196,6 @@ export class ThrottlingManager extends Common.ObjectWrapper.ObjectWrapper<Thrott
206
196
  return checkbox;
207
197
  }
208
198
 
209
- createMobileThrottlingButton(): UI.Toolbar.ToolbarMenuButton {
210
- const button = new UI.Toolbar.ToolbarMenuButton(appendItems, undefined, undefined, 'mobile-throttling');
211
- button.setTitle(i18nString(UIStrings.throttling));
212
- button.setDarkText();
213
-
214
- let options: ConditionsList = [];
215
- let selectedIndex = -1;
216
- const selector = new MobileThrottlingSelector(populate, select);
217
- return button;
218
-
219
- function appendItems(contextMenu: UI.ContextMenu.ContextMenu): void {
220
- for (let index = 0; index < options.length; ++index) {
221
- const conditions = options[index];
222
- if (!conditions) {
223
- continue;
224
- }
225
- if (conditions.title === ThrottlingPresets.getCustomConditions().title &&
226
- conditions.description === ThrottlingPresets.getCustomConditions().description) {
227
- continue;
228
- }
229
- contextMenu.defaultSection().appendCheckboxItem(
230
- conditions.title, selector.optionSelected.bind(selector, conditions as Conditions),
231
- {checked: selectedIndex === index, jslogContext: conditions.jslogContext});
232
- }
233
- }
234
-
235
- function populate(groups: MobileThrottlingConditionsGroup[]): ConditionsList {
236
- options = [];
237
- for (const group of groups) {
238
- for (const conditions of group.items) {
239
- options.push(conditions);
240
- }
241
- options.push(null);
242
- }
243
- return options;
244
- }
245
-
246
- function select(index: number): void {
247
- selectedIndex = index;
248
- const option = options[index];
249
- if (option) {
250
- button.setText(option.title);
251
- button.setTitle(`${option.title}: ${option.description}`);
252
- }
253
- }
254
- }
255
-
256
199
  private updatePanelIcon(): void {
257
200
  const warnings = [];
258
201
  if (this.cpuThrottlingManager.cpuThrottlingRate() !==
@@ -2,14 +2,7 @@
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 './ThrottlingPresets.js';
6
- import './MobileThrottlingSelector.js';
7
- import './NetworkPanelIndicator.js';
8
- import './NetworkThrottlingSelector.js';
9
- import './ThrottlingSettingsTab.js';
10
- import './ThrottlingManager.js';
11
-
12
- import * as MobileThrottlingSelector from './MobileThrottlingSelector.js';
5
+ import * as CPUThrottlingSelector from './CPUThrottlingSelector.js';
13
6
  import * as NetworkPanelIndicator from './NetworkPanelIndicator.js';
14
7
  import * as NetworkThrottlingSelector from './NetworkThrottlingSelector.js';
15
8
  import * as ThrottlingManager from './ThrottlingManager.js';
@@ -17,7 +10,7 @@ import * as ThrottlingPresets from './ThrottlingPresets.js';
17
10
  import * as ThrottlingSettingsTab from './ThrottlingSettingsTab.js';
18
11
 
19
12
  export {
20
- MobileThrottlingSelector,
13
+ CPUThrottlingSelector,
21
14
  NetworkPanelIndicator,
22
15
  NetworkThrottlingSelector,
23
16
  ThrottlingManager,
@@ -7,7 +7,7 @@ import * as Common from '../../core/common/common.js';
7
7
  import * as i18n from '../../core/i18n/i18n.js';
8
8
  import * as Platform from '../../core/platform/platform.js';
9
9
  import * as SDK from '../../core/sdk/sdk.js';
10
- import * as Protocol from '../../generated/protocol.js';
10
+ import type * as Protocol from '../../generated/protocol.js';
11
11
  import * as SettingsUI from '../../ui/legacy/components/settings_ui/settings_ui.js';
12
12
  import * as UI from '../../ui/legacy/legacy.js';
13
13
  import * as VisualLogging from '../../ui/visual_logging/visual_logging.js';
@@ -49,11 +49,6 @@ const UIStrings = {
49
49
  * @description User agent setting in the network conditions panel to use the browser's default value.
50
50
  */
51
51
  selectAutomatically: 'Use browser default',
52
- /**
53
- * @description Title of a section in the Network conditions panel that includes
54
- * a set of checkboxes to override the content encodings supported by the browser.
55
- */
56
- acceptedEncoding: 'Accepted `Content-Encoding`s',
57
52
  /**
58
53
  * @description Status text displayed after updating user agent client hints.
59
54
  */
@@ -83,8 +78,6 @@ export class NetworkConfigView extends UI.Widget.VBox {
83
78
  this.createNetworkThrottlingSection();
84
79
  this.contentElement.createChild('div').classList.add('panel-section-separator');
85
80
  this.createUserAgentSection();
86
- this.contentElement.createChild('div').classList.add('panel-section-separator');
87
- this.createAcceptedEncodingSection();
88
81
  }
89
82
 
90
83
  static instance(opts: {
@@ -301,69 +294,6 @@ export class NetworkConfigView extends UI.Widget.VBox {
301
294
  }
302
295
  }
303
296
 
304
- private createAcceptedEncodingSection(): void {
305
- const useCustomAcceptedEncodingSetting =
306
- Common.Settings.Settings.instance().createSetting('use-custom-accepted-encodings', false);
307
- const customAcceptedEncodingSetting = Common.Settings.Settings.instance().createSetting(
308
- 'custom-accepted-encodings',
309
- `${Protocol.Network.ContentEncoding.Gzip},${Protocol.Network.ContentEncoding.Br},${
310
- Protocol.Network.ContentEncoding.Deflate}`);
311
-
312
- const title = i18nString(UIStrings.acceptedEncoding);
313
- const section = this.createSection(title, 'network-config-accepted-encoding');
314
- const autoCheckbox = UI.UIUtils.CheckboxLabel.create(
315
- i18nString(UIStrings.selectAutomatically), true, undefined, useCustomAcceptedEncodingSetting.name);
316
- section.appendChild(autoCheckbox);
317
-
318
- function onSettingChange(): void {
319
- if (!useCustomAcceptedEncodingSetting.get()) {
320
- SDK.NetworkManager.MultitargetNetworkManager.instance().clearCustomAcceptedEncodingsOverride();
321
- } else {
322
- SDK.NetworkManager.MultitargetNetworkManager.instance().setCustomAcceptedEncodingsOverride(
323
- customAcceptedEncodingSetting.get() === '' ?
324
- [] :
325
- customAcceptedEncodingSetting.get().split(',') as Protocol.Network.ContentEncoding[]);
326
- }
327
- }
328
-
329
- customAcceptedEncodingSetting.addChangeListener(onSettingChange);
330
- useCustomAcceptedEncodingSetting.addChangeListener(onSettingChange);
331
-
332
- const encodingsSection = section.createChild('div', 'network-config-accepted-encoding-custom');
333
- encodingsSection.setAttribute('jslog', `${VisualLogging.section().context(customAcceptedEncodingSetting.name)}`);
334
- autoCheckbox.checked = !useCustomAcceptedEncodingSetting.get();
335
- autoCheckbox.addEventListener('change', acceptedEncodingsChanged);
336
- const checkboxes = new Map<Protocol.Network.ContentEncoding, UI.UIUtils.CheckboxLabel>();
337
- const contentEncodings: Protocol.EnumerableEnum<typeof Protocol.Network.ContentEncoding> = {
338
- Deflate: Protocol.Network.ContentEncoding.Deflate,
339
- Gzip: Protocol.Network.ContentEncoding.Gzip,
340
- Br: Protocol.Network.ContentEncoding.Br,
341
- Zstd: Protocol.Network.ContentEncoding.Zstd,
342
- };
343
- for (const encoding of Object.values(contentEncodings)) {
344
- const checkbox = UI.UIUtils.CheckboxLabel.createWithStringLiteral(encoding, true, encoding);
345
- encodingsSection.appendChild(checkbox);
346
- checkboxes.set(encoding, checkbox);
347
- }
348
- for (const [encoding, checkbox] of checkboxes) {
349
- checkbox.checked = customAcceptedEncodingSetting.get().includes(encoding);
350
- checkbox.addEventListener('change', acceptedEncodingsChanged);
351
- }
352
-
353
- acceptedEncodingsChanged();
354
-
355
- function acceptedEncodingsChanged(): void {
356
- useCustomAcceptedEncodingSetting.set(!autoCheckbox.checked);
357
- const encodings = [];
358
- for (const [encoding, checkbox] of checkboxes) {
359
- checkbox.disabled = autoCheckbox.checked;
360
- if (checkbox.checked) {
361
- encodings.push(encoding);
362
- }
363
- }
364
- customAcceptedEncodingSetting.set(encodings.join(','));
365
- }
366
- }
367
297
  override wasShown(): void {
368
298
  super.wasShown();
369
299
  UI.ARIAUtils.LiveAnnouncer.alert(i18nString(UIStrings.networkConditionsPanelShown));
@@ -26,8 +26,7 @@
26
26
  flex: 2 0 200px;
27
27
  }
28
28
 
29
- .network-config-fields span:first-of-type,
30
- .network-config-fields .network-config-accepted-encoding-custom {
29
+ .network-config-fields span:first-of-type {
31
30
  padding: 3px 0;
32
31
  }
33
32
 
@@ -14,15 +14,15 @@ const {widget} = UI.Widget;
14
14
 
15
15
  const UIStrings = {
16
16
  /**
17
- * @description Text in Heap Snapshot View of a profiler tool
17
+ * @description Column header in detached elements table displaying detached DOM nodes.
18
18
  */
19
19
  detachedNodes: 'Detached nodes',
20
20
  /**
21
- * @description Text in Heap Snapshot View of a profiler tool
21
+ * @description Column header in detached elements table displaying the number of detached DOM nodes.
22
22
  */
23
23
  nodeSize: 'Node count',
24
24
  /**
25
- * @description Label for the detached elements table
25
+ * @description Label for the detached elements table.
26
26
  */
27
27
  detachedElementsList: 'Detached elements list',
28
28
  } as const;
@@ -21,19 +21,19 @@ import {WritableProfileHeader} from './WritableProfileHeader.js';
21
21
 
22
22
  const UIStrings = {
23
23
  /**
24
- * @description Button text to obtain the detached elements retained by JS
24
+ * @description Button text to get the detached elements retained by JavaScript.
25
25
  */
26
- startDetachedElements: 'Obtain detached elements',
26
+ startDetachedElements: 'Get detached elements',
27
27
  /**
28
28
  * @description The title for the collection of profiles that are gathered from various snapshots of the heap, using a sampling (e.g. every 1/100) technique.
29
29
  */
30
30
  detachedElementsTitle: 'Detached elements',
31
31
  /**
32
- * @description Description in Heap Profile View of a profiler tool
32
+ * @description Description for the detached elements profiling option in the Memory panel.
33
33
  */
34
- detachedElementsDescription: 'Detached elements shows objects that are retained by a JS reference.',
34
+ detachedElementsDescription: 'Detached elements show objects retained by a JS reference.',
35
35
  /**
36
- * @description Name of a profile
36
+ * @description Name of a profile.
37
37
  * @example {2} PH1
38
38
  */
39
39
  detachedElementProfile: 'Detached elements {PH1}',