chrome-devtools-frontend 1.0.1697595 → 1.0.1698733

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 (124) hide show
  1. package/.agents/skills/version-control/SKILL.md +21 -9
  2. package/.stylelintignore +2 -0
  3. package/front_end/core/common/VersionController.ts +5 -1
  4. package/front_end/core/platform/HostRuntime.ts +12 -0
  5. package/front_end/core/platform/api/HostRuntime.ts +13 -0
  6. package/front_end/core/platform/browser/HostRuntime.ts +34 -0
  7. package/front_end/core/platform/node/HostRuntime.ts +40 -0
  8. package/front_end/core/sdk/AnimationModel.ts +21 -99
  9. package/front_end/core/sdk/CSSModel.ts +4 -2
  10. package/front_end/core/sdk/CSSPropertyParser.ts +4 -4
  11. package/front_end/core/sdk/CSSPropertyParserMatchers.ts +4 -44
  12. package/front_end/core/sdk/Connections.ts +6 -1
  13. package/front_end/core/sdk/ConsoleModel.ts +1 -12
  14. package/front_end/core/sdk/DOMModel.ts +3 -51
  15. package/front_end/core/sdk/DebuggerModel.ts +9 -8
  16. package/front_end/core/sdk/NetworkRequest.ts +1 -1
  17. package/front_end/core/sdk/PageFunctions.ts +187 -0
  18. package/front_end/core/sdk/Resource.ts +1 -1
  19. package/front_end/core/sdk/RuntimeModel.ts +1 -20
  20. package/front_end/core/sdk/Script.ts +21 -0
  21. package/front_end/core/sdk/SourceMap.ts +15 -2
  22. package/front_end/core/sdk/SourceMapCache.ts +13 -10
  23. package/front_end/core/sdk/SourceMapManager.ts +11 -9
  24. package/front_end/core/sdk/SourceMapScopeChainEntry.ts +59 -17
  25. package/front_end/core/sdk/SourceMapScopesInfo.ts +8 -2
  26. package/front_end/entrypoints/heap_snapshot_worker/ContextAnalyzer.ts +635 -0
  27. package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshot.ts +26 -12
  28. package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshotLoader.ts +16 -2
  29. package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshotWorkerDispatcher.ts +4 -4
  30. package/front_end/entrypoints/heap_snapshot_worker/heap_snapshot_worker.ts +2 -0
  31. package/front_end/entrypoints/shell/shell.ts +1 -1
  32. package/front_end/generated/InspectorBackendCommands.ts +1 -1
  33. package/front_end/generated/protocol.ts +8 -2
  34. package/front_end/models/ai_assistance/DOMHelpers.ts +95 -0
  35. package/front_end/models/ai_assistance/EvaluateAction.ts +5 -42
  36. package/front_end/models/ai_assistance/ExtensionScope.ts +2 -31
  37. package/front_end/models/ai_assistance/agents/AiAgent.ts +2 -1
  38. package/front_end/models/ai_assistance/agents/ContextSelectionAgent.ts +27 -2
  39. package/front_end/models/ai_assistance/ai_assistance.ts +6 -4
  40. package/front_end/models/ai_assistance/contexts/DOMNodeContext.ts +10 -7
  41. package/front_end/models/ai_assistance/contexts/FileContext.ts +2 -10
  42. package/front_end/models/ai_assistance/skills/performance.md +4 -3
  43. package/front_end/models/ai_assistance/tools/GetSourceContent.ts +3 -2
  44. package/front_end/models/ai_assistance/tools/{GetFunctionCode.ts → GetTraceFunctionCode.ts} +26 -13
  45. package/front_end/models/ai_assistance/tools/{GetResourceContent.ts → GetTraceResourceContent.ts} +31 -11
  46. package/front_end/models/ai_assistance/tools/ListSources.ts +21 -14
  47. package/front_end/models/ai_assistance/tools/Tool.ts +2 -2
  48. package/front_end/models/ai_assistance/tools/ToolRegistry.ts +6 -6
  49. package/front_end/models/bindings/CompilerScriptMapping.ts +3 -10
  50. package/front_end/models/bindings/DebuggerLanguagePlugins.ts +48 -17
  51. package/front_end/models/bindings/ResourceScriptMapping.ts +2 -2
  52. package/front_end/models/bindings/StylesSourceMapping.ts +1 -1
  53. package/front_end/models/comment_manager/CD4ABridge.ts +55 -12
  54. package/front_end/models/comment_manager/CommentManager.ts +46 -91
  55. package/front_end/models/comment_manager/CommentThread.ts +145 -0
  56. package/front_end/models/comment_manager/comment_manager.ts +2 -0
  57. package/front_end/models/elements/DOMChanges.ts +238 -0
  58. package/front_end/models/elements/elements.ts +2 -0
  59. package/front_end/models/emulation/DeviceModeModel.ts +53 -0
  60. package/front_end/models/extensions/ExtensionAPI.ts +8 -6
  61. package/front_end/models/extensions/ExtensionEndpoint.ts +11 -8
  62. package/front_end/models/extensions/HostUrlPattern.ts +4 -3
  63. package/front_end/models/extensions/LanguageExtensionEndpoint.ts +3 -2
  64. package/front_end/models/extensions/RecorderExtensionEndpoint.ts +2 -1
  65. package/front_end/models/formatter/FormatterWorkerPool.ts +4 -6
  66. package/front_end/models/heap_snapshot/HeapSnapshotModel.ts +55 -0
  67. package/front_end/models/heap_snapshot/HeapSnapshotProxy.ts +18 -14
  68. package/front_end/models/issues_manager/IssuesManager.ts +5 -0
  69. package/front_end/models/issues_manager/WebInstallIssue.ts +63 -0
  70. package/front_end/models/issues_manager/descriptions/webInstallManifestMissingId.md +3 -0
  71. package/front_end/models/issues_manager/descriptions/webInstallManifestMissingNameOrShortName.md +3 -0
  72. package/front_end/models/issues_manager/descriptions/webInstallManifestParsingOrNetworkError.md +3 -0
  73. package/front_end/models/issues_manager/descriptions/webInstallNoManifest.md +3 -0
  74. package/front_end/models/issues_manager/descriptions/webInstallStartUrlInvalid.md +3 -0
  75. package/front_end/models/issues_manager/issues_manager.ts +2 -0
  76. package/front_end/models/workspace/UISourceCode.ts +20 -0
  77. package/front_end/panels/ai_assistance/AiAssistancePanel.ts +7 -7
  78. package/front_end/panels/ai_assistance/components/AIv2MarkdownRenderer.ts +4 -10
  79. package/front_end/panels/ai_assistance/components/MarkdownRendererWithCodeBlock.ts +25 -5
  80. package/front_end/panels/browser_debugger/ObjectEventListenersSidebarPane.ts +2 -3
  81. package/front_end/panels/common/CommentThreadWidget.ts +221 -0
  82. package/front_end/{ui/comments → panels/common}/CommentsOverlayWidget.ts +117 -28
  83. package/front_end/{ui/comments → panels/common}/CommentsStatusBarPill.ts +5 -5
  84. package/front_end/panels/common/ExtensionServer.ts +2 -1
  85. package/front_end/panels/common/commentThreadWidget.css +173 -0
  86. package/front_end/{ui/comments → panels/common}/commentsOverlay.css +8 -1
  87. package/front_end/{ui/comments/comments-meta.ts → panels/common/common-meta.ts} +11 -11
  88. package/front_end/panels/common/common.ts +3 -0
  89. package/front_end/panels/elements/AdoptedStyleSheetTreeElement.ts +3 -3
  90. package/front_end/panels/elements/ElementsPanel.ts +5 -1
  91. package/front_end/panels/elements/ElementsTreeElement.ts +102 -21
  92. package/front_end/panels/elements/ElementsTreeOutline.ts +326 -91
  93. package/front_end/panels/elements/EventListenersWidget.ts +0 -1
  94. package/front_end/panels/elements/PropertiesWidget.ts +11 -10
  95. package/front_end/panels/elements/PropertyRenderer.ts +29 -25
  96. package/front_end/panels/elements/StylePropertyTreeElement.ts +6 -6
  97. package/front_end/panels/elements/elementsTreeOutline.css +7 -1
  98. package/front_end/panels/emulation/DeviceModeToolbar.ts +2 -3
  99. package/front_end/panels/event_listeners/EventListenersView.ts +235 -302
  100. package/front_end/panels/linear_memory_inspector/LinearMemoryInspectorController.ts +6 -7
  101. package/front_end/panels/linear_memory_inspector/components/linearMemoryInspector.css +5 -1
  102. package/front_end/panels/linear_memory_inspector/linear_memory_inspector-meta.ts +1 -1
  103. package/front_end/panels/mobile_throttling/ThrottlingSettingsTab.ts +10 -2
  104. package/front_end/panels/network/NetworkConfigView.ts +141 -116
  105. package/front_end/panels/network/NetworkPanel.ts +7 -4
  106. package/front_end/panels/network/RequestHeadersView.ts +1 -1
  107. package/front_end/panels/network/forward/BackendLinking.ts +5 -2
  108. package/front_end/panels/recorder/stepView.css +1 -0
  109. package/front_end/panels/security/SecurityPanel.ts +5 -5
  110. package/front_end/panels/security/SecurityPanelSidebar.ts +2 -11
  111. package/front_end/panels/settings/BackendLinkingSettingsTab.ts +7 -2
  112. package/front_end/panels/sources/DebuggerPlugin.ts +1 -1
  113. package/front_end/panels/sources/WatchExpressionsSidebarPane.ts +11 -16
  114. package/front_end/panels/sources/sources-meta.ts +1 -1
  115. package/front_end/panels/timeline/TimelineTreeView.ts +11 -1
  116. package/front_end/panels/timeline/overlays/OverlaysImpl.ts +0 -3
  117. package/front_end/third_party/chromium/README.chromium +1 -1
  118. package/front_end/ui/comments/CommentOverlayManager.ts +89 -42
  119. package/front_end/ui/comments/comments.ts +0 -4
  120. package/front_end/ui/legacy/Treeoutline.ts +4 -0
  121. package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +15 -8
  122. package/front_end/ui/legacy/components/perf_ui/FlameChart.ts +4 -0
  123. package/front_end/ui/visual_logging/KnownContextValues.ts +1 -0
  124. package/package.json +5 -5
@@ -65,6 +65,19 @@ const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
65
65
  let networkConfigViewInstance: NetworkConfigView;
66
66
 
67
67
  export class NetworkConfigView extends UI.Widget.VBox {
68
+ readonly #cacheDisabledSetting =
69
+ Common.Settings.Settings.instance().resolve(SDK.SDKSettings.cacheDisabledSettingDescriptor);
70
+ readonly #customUserAgentSetting = Common.Settings.Settings.instance().createSetting('custom-user-agent', '');
71
+ readonly #customUserAgentMetadataSetting =
72
+ Common.Settings.Settings.instance().createSetting<Protocol.Emulation.UserAgentMetadata|null>(
73
+ 'custom-user-agent-metadata', null);
74
+
75
+ #autoCheckbox?: UI.UIUtils.CheckboxLabel;
76
+ #customUserAgentSelectBox?: HTMLElement;
77
+ #customSelectAndInput?: {select: HTMLSelectElement, input: HTMLInputElement, error: HTMLElement};
78
+ #clientHints?: EmulationComponents.UserAgentClientHintsForm.UserAgentClientHintsForm;
79
+ #userAgentUpdateButtonStatusText?: HTMLElement;
80
+
68
81
  constructor() {
69
82
  super({
70
83
  jslog: `${VisualLogging.panel('network-conditions').track({resize: true})}`,
@@ -91,18 +104,14 @@ export class NetworkConfigView extends UI.Widget.VBox {
91
104
  return networkConfigViewInstance;
92
105
  }
93
106
 
94
- static createUserAgentSelectAndInput(title: string): {
107
+ private createUserAgentSelectAndInput(title: string): {
95
108
  select: HTMLSelectElement,
96
109
  input: HTMLInputElement,
97
110
  error: HTMLElement,
98
111
  } {
99
- const userAgentSetting = Common.Settings.Settings.instance().createSetting('custom-user-agent', '');
100
- const userAgentMetadataSetting =
101
- Common.Settings.Settings.instance().createSetting<Protocol.Emulation.UserAgentMetadata|null>(
102
- 'custom-user-agent-metadata', null);
103
112
  const userAgentSelectElement = document.createElement('select');
104
113
  userAgentSelectElement.setAttribute(
105
- 'jslog', `${VisualLogging.dropDown().track({change: true}).context(userAgentSetting.name)}`);
114
+ 'jslog', `${VisualLogging.dropDown().track({change: true}).context(this.#customUserAgentSetting.name)}`);
106
115
  UI.ARIAUtils.setLabel(userAgentSelectElement, title);
107
116
 
108
117
  const customOverride = {title: i18nString(UIStrings.custom), value: 'custom'};
@@ -132,9 +141,9 @@ export class NetworkConfigView extends UI.Widget.VBox {
132
141
 
133
142
  const otherUserAgentElement = UI.UIUtils.createInput('', 'text');
134
143
  otherUserAgentElement.setAttribute(
135
- 'jslog', `${VisualLogging.textField().track({change: true}).context(userAgentSetting.name)}`);
136
- otherUserAgentElement.value = userAgentSetting.get();
137
- UI.Tooltip.Tooltip.install(otherUserAgentElement, userAgentSetting.get());
144
+ 'jslog', `${VisualLogging.textField().track({change: true}).context(this.#customUserAgentSetting.name)}`);
145
+ otherUserAgentElement.value = this.#customUserAgentSetting.get();
146
+ UI.Tooltip.Tooltip.install(otherUserAgentElement, this.#customUserAgentSetting.get());
138
147
  otherUserAgentElement.placeholder = i18nString(UIStrings.enterACustomUserAgent);
139
148
  otherUserAgentElement.required = true;
140
149
  UI.ARIAUtils.setLabel(otherUserAgentElement, otherUserAgentElement.placeholder);
@@ -146,57 +155,11 @@ export class NetworkConfigView extends UI.Widget.VBox {
146
155
  errorElement.textContent = i18nString(UIStrings.customUserAgentFieldIsRequired);
147
156
  }
148
157
 
149
- settingChanged();
150
- userAgentSelectElement.addEventListener('change', userAgentSelected, false);
151
- otherUserAgentElement.addEventListener('input', applyOtherUserAgent, false);
152
-
153
- function userAgentSelected(): void {
154
- const value = userAgentSelectElement.options[userAgentSelectElement.selectedIndex].value;
155
- if (value !== customOverride.value) {
156
- userAgentSetting.set(value);
157
- otherUserAgentElement.value = value;
158
- UI.Tooltip.Tooltip.install(otherUserAgentElement, value);
159
- const userAgentMetadata = getUserAgentMetadata(value);
160
- userAgentMetadataSetting.set(userAgentMetadata);
161
- SDK.NetworkManager.MultitargetNetworkManager.instance().setCustomUserAgentOverride(value, userAgentMetadata);
162
- } else {
163
- userAgentMetadataSetting.set(null);
164
- otherUserAgentElement.select();
165
- }
166
- errorElement.textContent = '';
167
- const userAgentChangeEvent = new CustomEvent('user-agent-change', {detail: {value}});
168
- userAgentSelectElement.dispatchEvent(userAgentChangeEvent);
169
- }
170
-
171
- function settingChanged(): void {
172
- const value = userAgentSetting.get();
173
- const options = userAgentSelectElement.options;
174
- let selectionRestored = false;
175
- for (let i = 0; i < options.length; ++i) {
176
- if (options[i].value === value) {
177
- userAgentSelectElement.selectedIndex = i;
178
- selectionRestored = true;
179
- break;
180
- }
181
- }
182
-
183
- if (!selectionRestored) {
184
- userAgentSelectElement.selectedIndex = 0;
185
- }
186
- }
187
-
188
- function applyOtherUserAgent(): void {
189
- if (userAgentSetting.get() !== otherUserAgentElement.value) {
190
- if (!otherUserAgentElement.value) {
191
- errorElement.textContent = i18nString(UIStrings.customUserAgentFieldIsRequired);
192
- } else {
193
- errorElement.textContent = '';
194
- }
195
- userAgentSetting.set(otherUserAgentElement.value);
196
- UI.Tooltip.Tooltip.install(otherUserAgentElement, otherUserAgentElement.value);
197
- settingChanged();
198
- }
199
- }
158
+ this.#settingChanged(userAgentSelectElement);
159
+ userAgentSelectElement.addEventListener('change', () => this.#onUserAgentSelect(userAgentSelectElement.value),
160
+ false);
161
+ otherUserAgentElement.addEventListener('input', () => this.#onCustomUserAgentInput(otherUserAgentElement.value),
162
+ false);
200
163
 
201
164
  return {select: userAgentSelectElement, input: otherUserAgentElement, error: errorElement};
202
165
  }
@@ -212,9 +175,8 @@ export class NetworkConfigView extends UI.Widget.VBox {
212
175
 
213
176
  private createCacheSection(): void {
214
177
  const section = this.createSection(i18nString(UIStrings.caching), 'network-config-disable-cache');
215
- section.appendChild(SettingsUI.SettingsUI.createSettingCheckbox(
216
- i18nString(UIStrings.disableCache),
217
- Common.Settings.Settings.instance().resolve(SDK.SDKSettings.cacheDisabledSettingDescriptor)));
178
+ section.appendChild(
179
+ SettingsUI.SettingsUI.createSettingCheckbox(i18nString(UIStrings.disableCache), this.#cacheDisabledSetting));
218
180
  }
219
181
 
220
182
  private createNetworkThrottlingSection(): void {
@@ -227,82 +189,145 @@ export class NetworkConfigView extends UI.Widget.VBox {
227
189
  }
228
190
 
229
191
  private createUserAgentSection(): void {
230
- const userAgentMetadataSetting =
231
- Common.Settings.Settings.instance().createSetting<Protocol.Emulation.UserAgentMetadata|null>(
232
- 'custom-user-agent-metadata', null);
233
- const customUserAgentSetting = Common.Settings.Settings.instance().createSetting('custom-user-agent', '');
234
-
235
192
  const title = i18nString(UIStrings.userAgent);
236
193
  const section = this.createSection(title, 'network-config-ua');
237
- const autoCheckbox = UI.UIUtils.CheckboxLabel.create(
238
- i18nString(UIStrings.selectAutomatically), true, undefined, customUserAgentSetting.name);
239
- section.appendChild(autoCheckbox);
194
+ this.#autoCheckbox = UI.UIUtils.CheckboxLabel.create(i18nString(UIStrings.selectAutomatically), true, undefined,
195
+ this.#customUserAgentSetting.name);
196
+ section.appendChild(this.#autoCheckbox);
240
197
 
241
- customUserAgentSetting.addChangeListener(() => {
242
- if (autoCheckbox.checked) {
198
+ this.#customUserAgentSetting.addChangeListener(() => {
199
+ if (this.#autoCheckbox?.checked) {
243
200
  return;
244
201
  }
245
- const customUA = customUserAgentSetting.get();
202
+ const customUA = this.#customUserAgentSetting.get();
246
203
  const userAgentMetadata = getUserAgentMetadata(customUA);
247
204
  SDK.NetworkManager.MultitargetNetworkManager.instance().setCustomUserAgentOverride(customUA, userAgentMetadata);
248
205
  });
249
- const customUserAgentSelectBox = section.createChild('div', 'network-config-ua-custom');
250
- autoCheckbox.addEventListener('change', userAgentSelectBoxChanged);
251
- const customSelectAndInput = NetworkConfigView.createUserAgentSelectAndInput(title);
252
- customUserAgentSelectBox.appendChild(customSelectAndInput.select);
253
- customUserAgentSelectBox.appendChild(customSelectAndInput.input);
254
- customUserAgentSelectBox.appendChild(customSelectAndInput.error);
255
-
256
- const clientHints = new EmulationComponents.UserAgentClientHintsForm.UserAgentClientHintsForm();
257
- const userAgentMetaDataSetting = userAgentMetadataSetting.get();
258
- const initialUserAgentMetaData = getUserAgentMetadata(customSelectAndInput.select.value);
259
- clientHints.value = {
206
+ this.#customUserAgentSelectBox = section.createChild('div', 'network-config-ua-custom');
207
+ this.#autoCheckbox.addEventListener('change',
208
+ () => this.#onAutoCheckboxChange(this.#autoCheckbox?.checked ?? false));
209
+ this.#customSelectAndInput = this.createUserAgentSelectAndInput(title);
210
+ this.#customUserAgentSelectBox.appendChild(this.#customSelectAndInput.select);
211
+ this.#customUserAgentSelectBox.appendChild(this.#customSelectAndInput.input);
212
+ this.#customUserAgentSelectBox.appendChild(this.#customSelectAndInput.error);
213
+
214
+ this.#clientHints = new EmulationComponents.UserAgentClientHintsForm.UserAgentClientHintsForm();
215
+ const userAgentMetaDataSetting = this.#customUserAgentMetadataSetting.get();
216
+ const initialUserAgentMetaData = getUserAgentMetadata(this.#customSelectAndInput.select.value);
217
+ this.#clientHints.value = {
260
218
  showMobileCheckbox: true,
261
219
  showSubmitButton: true,
262
220
  metaData: userAgentMetaDataSetting || initialUserAgentMetaData || undefined,
263
221
  };
264
- customUserAgentSelectBox.appendChild(clientHints);
222
+ this.#customUserAgentSelectBox.appendChild(this.#clientHints);
223
+
224
+ this.#clientHints.addEventListener('clienthintschange', () => this.#onClientHintsChange());
225
+ this.#clientHints.addEventListener('clienthintssubmit',
226
+ event => this.#onClientHintsSubmit((event as CustomEvent).detail.value as
227
+ Protocol.Emulation.UserAgentMetadata));
228
+
229
+ this.#userAgentUpdateButtonStatusText = section.createChild('span', 'status-text');
230
+ this.#userAgentUpdateButtonStatusText.textContent = '';
231
+
232
+ this.#onAutoCheckboxChange(this.#autoCheckbox.checked);
233
+ }
234
+
235
+ #onAutoCheckboxChange(checked: boolean): void {
236
+ const useCustomUA = !checked;
237
+ if (this.#customUserAgentSelectBox && this.#customSelectAndInput && this.#clientHints) {
238
+ this.#customUserAgentSelectBox.classList.toggle('checked', useCustomUA);
239
+ this.#customSelectAndInput.select.disabled = !useCustomUA;
240
+ this.#customSelectAndInput.input.disabled = !useCustomUA;
241
+ this.#customSelectAndInput.error.hidden = !useCustomUA;
242
+ this.#clientHints.disabled = !useCustomUA;
243
+ }
244
+ const customUA = useCustomUA ? this.#customUserAgentSetting.get() : '';
245
+ const userAgentMetadata = useCustomUA ? getUserAgentMetadata(customUA) : null;
246
+ SDK.NetworkManager.MultitargetNetworkManager.instance().setCustomUserAgentOverride(customUA, userAgentMetadata);
247
+ }
265
248
 
266
- customSelectAndInput.select.addEventListener('user-agent-change', (event: Event) => {
267
- const userStringValue = (event as CustomEvent).detail.value;
268
- const userAgentMetadata = userStringValue ? getUserAgentMetadata(userStringValue) : null;
269
- clientHints.value = {
249
+ #onUserAgentSelect(value: string): void {
250
+ if (!this.#customSelectAndInput || !this.#clientHints || !this.#userAgentUpdateButtonStatusText) {
251
+ return;
252
+ }
253
+ const customOverride = 'custom';
254
+ if (value !== customOverride) {
255
+ this.#customUserAgentSetting.set(value);
256
+ this.#customSelectAndInput.input.value = value;
257
+ UI.Tooltip.Tooltip.install(this.#customSelectAndInput.input, value);
258
+ const userAgentMetadata = getUserAgentMetadata(value);
259
+ this.#customUserAgentMetadataSetting.set(userAgentMetadata);
260
+ SDK.NetworkManager.MultitargetNetworkManager.instance().setCustomUserAgentOverride(value, userAgentMetadata);
261
+ this.#clientHints.value = {
270
262
  metaData: userAgentMetadata || undefined,
271
263
  showMobileCheckbox: true,
272
264
  showSubmitButton: true,
273
265
  };
274
- userAgentUpdateButtonStatusText.textContent = '';
275
- });
266
+ } else {
267
+ this.#customUserAgentMetadataSetting.set(null);
268
+ this.#clientHints.value = {
269
+ showMobileCheckbox: true,
270
+ showSubmitButton: true,
271
+ };
272
+ this.#customSelectAndInput.input.select();
273
+ }
274
+ this.#customSelectAndInput.error.textContent = '';
275
+ this.#userAgentUpdateButtonStatusText.textContent = '';
276
+ }
276
277
 
277
- clientHints.addEventListener('clienthintschange', () => {
278
- customSelectAndInput.select.value = 'custom';
279
- userAgentUpdateButtonStatusText.textContent = '';
280
- });
278
+ #onCustomUserAgentInput(value: string): void {
279
+ if (!this.#customSelectAndInput) {
280
+ return;
281
+ }
282
+ if (this.#customUserAgentSetting.get() !== value) {
283
+ if (!value) {
284
+ this.#customSelectAndInput.error.textContent = i18nString(UIStrings.customUserAgentFieldIsRequired);
285
+ } else {
286
+ this.#customSelectAndInput.error.textContent = '';
287
+ }
288
+ this.#customUserAgentSetting.set(value);
289
+ UI.Tooltip.Tooltip.install(this.#customSelectAndInput.input, value);
290
+ this.#settingChanged(this.#customSelectAndInput.select);
291
+ }
292
+ }
281
293
 
282
- clientHints.addEventListener('clienthintssubmit', event => {
283
- const metaData: Protocol.Emulation.UserAgentMetadata = (event as CustomEvent).detail.value;
284
- const customUA = customUserAgentSetting.get();
285
- userAgentMetadataSetting.set(metaData);
286
- SDK.NetworkManager.MultitargetNetworkManager.instance().setCustomUserAgentOverride(customUA, metaData);
287
- userAgentUpdateButtonStatusText.textContent = i18nString(UIStrings.clientHintsStatusText);
288
- });
294
+ #settingChanged(selectElement?: HTMLSelectElement): void {
295
+ const select = selectElement ?? this.#customSelectAndInput?.select;
296
+ if (!select) {
297
+ return;
298
+ }
299
+ const value = this.#customUserAgentSetting.get();
300
+ const options = select.options;
301
+ let selectionRestored = false;
302
+ for (let i = 0; i < options.length; ++i) {
303
+ if (options[i].value === value) {
304
+ select.selectedIndex = i;
305
+ selectionRestored = true;
306
+ break;
307
+ }
308
+ }
289
309
 
290
- const userAgentUpdateButtonStatusText = section.createChild('span', 'status-text');
291
- userAgentUpdateButtonStatusText.textContent = '';
310
+ if (!selectionRestored) {
311
+ select.selectedIndex = 0;
312
+ }
313
+ }
292
314
 
293
- userAgentSelectBoxChanged();
315
+ #onClientHintsChange(): void {
316
+ if (!this.#customSelectAndInput || !this.#userAgentUpdateButtonStatusText) {
317
+ return;
318
+ }
319
+ this.#customSelectAndInput.select.value = 'custom';
320
+ this.#userAgentUpdateButtonStatusText.textContent = '';
321
+ }
294
322
 
295
- function userAgentSelectBoxChanged(): void {
296
- const useCustomUA = !autoCheckbox.checked;
297
- customUserAgentSelectBox.classList.toggle('checked', useCustomUA);
298
- customSelectAndInput.select.disabled = !useCustomUA;
299
- customSelectAndInput.input.disabled = !useCustomUA;
300
- customSelectAndInput.error.hidden = !useCustomUA;
301
- clientHints.disabled = !useCustomUA;
302
- const customUA = useCustomUA ? customUserAgentSetting.get() : '';
303
- const userAgentMetadata = useCustomUA ? getUserAgentMetadata(customUA) : null;
304
- SDK.NetworkManager.MultitargetNetworkManager.instance().setCustomUserAgentOverride(customUA, userAgentMetadata);
323
+ #onClientHintsSubmit(metaData: Protocol.Emulation.UserAgentMetadata): void {
324
+ if (!this.#userAgentUpdateButtonStatusText) {
325
+ return;
305
326
  }
327
+ const customUA = this.#customUserAgentSetting.get();
328
+ this.#customUserAgentMetadataSetting.set(metaData);
329
+ SDK.NetworkManager.MultitargetNetworkManager.instance().setCustomUserAgentOverride(customUA, metaData);
330
+ this.#userAgentUpdateButtonStatusText.textContent = i18nString(UIStrings.clientHintsStatusText);
306
331
  }
307
332
 
308
333
  override wasShown(): void {
@@ -266,7 +266,8 @@ export class BackendLinking {
266
266
  }
267
267
  let backendLink = rule.template;
268
268
  for (const placeholder of rule.placeholders) {
269
- backendLink = backendLink.replaceAll(placeholder, placeholderValues[placeholder] as string);
269
+ backendLink =
270
+ backendLink.replaceAll(placeholder, () => encodeURIComponent(placeholderValues[placeholder] as string));
270
271
  }
271
272
  try {
272
273
  return {label: rule.label, url: new URL(backendLink)};
@@ -311,14 +312,16 @@ export class NetworkPanel extends UI.Panel.Panel implements
311
312
  recordLogSetting: Common.Settings.Setting<boolean>;
312
313
  private readonly throttlingSelect: UI.Toolbar.ToolbarItem;
313
314
  private readonly displayScreenshotDelay: number;
314
- readonly backendLinkingRulesSetting: Common.Settings.Setting<BackendLinkingRule[]> =
315
- Common.Settings.Settings.instance().resolve(backendLinkingRulesSettingDescriptor);
316
- readonly backendLinking: BackendLinking = new BackendLinking(this.backendLinkingRulesSetting);
315
+ readonly backendLinking: BackendLinking|null;
317
316
 
318
317
  constructor(displayScreenshotDelay: number) {
319
318
  super('network');
320
319
  this.registerRequiredCSS(networkPanelStyles);
321
320
 
321
+ const backendLinkingSetting =
322
+ Common.Settings.Settings.instance().maybeResolve(backendLinkingRulesSettingDescriptor);
323
+ this.backendLinking = 'setting' in backendLinkingSetting ? new BackendLinking(backendLinkingSetting.setting) : null;
324
+
322
325
  this.displayScreenshotDelay = displayScreenshotDelay;
323
326
  this.networkLogShowOverviewSetting =
324
327
  Common.Settings.Settings.instance().createSetting('network-log-show-overview', true);
@@ -391,7 +391,7 @@ export class RequestHeadersView extends UI.Widget.Widget {
391
391
  showResponseHeadersText: this.#showResponseHeadersText,
392
392
  showRequestHeadersText: this.#showRequestHeadersText,
393
393
  backendLink: Root.Runtime.hostConfig.devToolsNetworkBackendLinking?.enabled ?
394
- NetworkPanel.instance().backendLinking.getLink(this.#request) :
394
+ NetworkPanel.instance().backendLinking?.getLink(this.#request) ?? null :
395
395
  null,
396
396
  };
397
397
 
@@ -41,9 +41,12 @@ export const BACKEND_LINKING_PLACEHOLDERS = [
41
41
 
42
42
  export type BackendLinkingPlaceholder = typeof BACKEND_LINKING_PLACEHOLDERS[number];
43
43
 
44
- export const backendLinkingRulesSettingDescriptor: Common.Settings.SettingDescriptor<BackendLinkingRule[]> = {
44
+ export const backendLinkingRulesSettingDescriptor:
45
+ Common.Settings.ConditionalSettingDescriptor<BackendLinkingRule[], void> = {
45
46
  name: 'network.backend-linking-rules',
46
47
  type: Common.Settings.SettingType.ARRAY,
47
48
  defaultValue: [],
48
- storageType: Common.Settings.SettingStorageType.SYNCED,
49
+ isAvailable: config => config.devToolsNetworkBackendLinking?.enabled ?
50
+ {status: Common.Settings.SettingAvailability.AVAILABLE} :
51
+ {status: Common.Settings.SettingAvailability.UNAVAILABLE, reason: undefined},
49
52
  };
@@ -215,6 +215,7 @@ devtools-recorder-step-editor.is-selected {
215
215
  .step-actions {
216
216
  border: none;
217
217
  border-radius: 0;
218
+ flex-shrink: 0;
218
219
  height: var(--sys-size-11);
219
220
 
220
221
  --override-select-menu-show-button-border-radius: 0;
@@ -608,7 +608,7 @@ export class SecurityPanel extends UI.Panel.Panel implements SDK.TargetManager.S
608
608
  SDK.ResourceTreeModel.ResourceTreeModel, SDK.ResourceTreeModel.Events.PrimaryPageChanged,
609
609
  this.onPrimaryPageChanged, this);
610
610
 
611
- this.sidebar.showLastSelectedElement();
611
+ this.sidebar.showOverview();
612
612
  }
613
613
 
614
614
  static instance(opts: {forceNew: boolean|null} = {forceNew: null}): SecurityPanel {
@@ -657,7 +657,7 @@ export class SecurityPanel extends UI.Panel.Panel implements SDK.TargetManager.S
657
657
  override wasShown(): void {
658
658
  super.wasShown();
659
659
  if (!this.visibleView) {
660
- this.sidebar.showLastSelectedElement();
660
+ this.sidebar.showOverview();
661
661
  }
662
662
  }
663
663
 
@@ -808,7 +808,7 @@ export class SecurityPanel extends UI.Panel.Panel implements SDK.TargetManager.S
808
808
  const {frame} = event.data;
809
809
  const request = this.lastResponseReceivedForLoaderId.get(frame.loaderId);
810
810
 
811
- this.sidebar.showLastSelectedElement();
811
+ this.sidebar.showOverview();
812
812
  this.sidebar.clearOrigins();
813
813
  this.origins.clear();
814
814
  this.lastResponseReceivedForLoaderId.clear();
@@ -831,8 +831,8 @@ export class SecurityPanel extends UI.Panel.Panel implements SDK.TargetManager.S
831
831
  private onInterstitialShown(): void {
832
832
  // The panel might have been displaying the origin view on the
833
833
  // previously loaded page. When showing an interstitial, switch
834
- // back to the sidebar's last shown view.
835
- this.sidebar.showLastSelectedElement();
834
+ // back to the overview view.
835
+ this.sidebar.showOverview();
836
836
  this.sidebar.toggleOriginsList(true /* hidden */);
837
837
  }
838
838
 
@@ -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 i18n from '../../core/i18n/i18n.js';
7
6
  import type * as Platform from '../../core/platform/platform.js';
8
7
  import * as Protocol from '../../generated/protocol.js';
@@ -208,7 +207,6 @@ export const DEFAULT_VIEW: View = (input, output, target) => {
208
207
  };
209
208
 
210
209
  export class SecurityPanelSidebar extends UI.Widget.VBox {
211
- readonly #securitySidebarLastItemSetting: Common.Settings.Setting<string>;
212
210
  #mainOrigin: string|null = null;
213
211
  #origins = new Map<Platform.DevToolsPath.UrlString, Protocol.Security.SecurityState>();
214
212
  #originsHidden = false;
@@ -222,9 +220,6 @@ export class SecurityPanelSidebar extends UI.Widget.VBox {
222
220
  super(element);
223
221
  this.#view = view;
224
222
  this.registerRequiredCSS(lockIconStyles, sidebarStyles);
225
-
226
- this.#securitySidebarLastItemSetting =
227
- Common.Settings.Settings.instance().createSetting('security-last-selected-element-path', '');
228
223
  }
229
224
 
230
225
  set onShowOrigin(callback: (origin: Platform.DevToolsPath.UrlString|null) => void) {
@@ -233,12 +228,11 @@ export class SecurityPanelSidebar extends UI.Widget.VBox {
233
228
 
234
229
  override wasShown(): void {
235
230
  super.wasShown();
236
- this.showLastSelectedElement();
231
+ this.requestUpdate();
237
232
  }
238
233
 
239
- showLastSelectedElement(): void {
234
+ showOverview(): void {
240
235
  this.#selectedElementId = 'overview';
241
- this.#securitySidebarLastItemSetting.set('overview');
242
236
  this.requestUpdate();
243
237
  this.#onShowOrigin?.(null);
244
238
  }
@@ -295,7 +289,6 @@ export class SecurityPanelSidebar extends UI.Widget.VBox {
295
289
  const element = {
296
290
  select: () => {
297
291
  this.#selectedElementId = origin;
298
- this.#securitySidebarLastItemSetting.set(origin);
299
292
  this.requestUpdate();
300
293
  this.#onShowOrigin?.(origin);
301
294
  },
@@ -312,7 +305,6 @@ export class SecurityPanelSidebar extends UI.Widget.VBox {
312
305
 
313
306
  set selectedOrigin(origin: Platform.DevToolsPath.UrlString|null) {
314
307
  this.#selectedElementId = origin ?? 'overview';
315
- this.#securitySidebarLastItemSetting.set(this.#selectedElementId);
316
308
  this.requestUpdate();
317
309
  this.#onShowOrigin?.(origin);
318
310
  }
@@ -333,7 +325,6 @@ export class SecurityPanelSidebar extends UI.Widget.VBox {
333
325
  const output: ViewOutput = {
334
326
  onElementSelected: (id: string) => {
335
327
  this.#selectedElementId = id;
336
- this.#securitySidebarLastItemSetting.set(id);
337
328
  this.requestUpdate();
338
329
  },
339
330
  onShowOrigin: (origin: Platform.DevToolsPath.UrlString|null) => {
@@ -250,12 +250,17 @@ export const DEFAULT_VIEW: View = (input, output, target) => {
250
250
 
251
251
  export class BackendLinkingSettingsTab extends UI.Widget.VBox {
252
252
  readonly #view: View;
253
- readonly #rulesSetting: Common.Settings.Setting<NetworkForward.BackendLinking.BackendLinkingRule[]> =
254
- Common.Settings.Settings.instance().resolve(NetworkForward.BackendLinking.backendLinkingRulesSettingDescriptor);
253
+ readonly #rulesSetting: Common.Settings.Setting<NetworkForward.BackendLinking.BackendLinkingRule[]>;
255
254
 
256
255
  constructor(target?: HTMLElement, view: View = DEFAULT_VIEW) {
257
256
  super(target);
258
257
  this.#view = view;
258
+ const res = Common.Settings.Settings.instance().maybeResolve(
259
+ NetworkForward.BackendLinking.backendLinkingRulesSettingDescriptor);
260
+ if (!('setting' in res)) {
261
+ throw new Error('Backend linking setting is not available');
262
+ }
263
+ this.#rulesSetting = res.setting;
259
264
  }
260
265
 
261
266
  override wasShown(): void {
@@ -540,7 +540,7 @@ export class DebuggerPlugin extends Plugin {
540
540
  if (!url) {
541
541
  return;
542
542
  }
543
- scriptFile.addSourceMapURL(url);
543
+ scriptFile.addSourceMapURL(url, SDK.SourceMap.SourceMapProvenance.USER);
544
544
  }
545
545
 
546
546
  function addDebugInfoURL(
@@ -350,6 +350,7 @@ export const DEFAULT_VIEW: View = (input, output, target) => {
350
350
  // clang-format off
351
351
  return html`<li
352
352
  class=${classMap({'watch-expression-tree-item': true, 'watch-expression-editing': e.editing })}
353
+ ?open=${Boolean(e.result?.expanded)}
353
354
  @keydown=${onExpressionKeydown.bind(undefined, e)}
354
355
  @expand=${(event: UI.TreeOutline.TreeViewElement.ExpandEvent) => input.onExpand(e, event.detail.expanded)}
355
356
  role=treeitem>
@@ -364,12 +365,8 @@ export const DEFAULT_VIEW: View = (input, output, target) => {
364
365
  onContextMenu: (event: Event) => onContextMenu(e, event),
365
366
  })}></devtools-widget>
366
367
  ${e.editing || !e.result || e.exceptionDetails ||
367
- !e.result.hasChildren || e.result.object.customPreview() ? nothing : html`
368
- <ul role=group>
369
- ${ObjectUI.ObjectPropertiesSection.ObjectPropertyTreeElement.createPropertyNodes(
370
- e.result.children ?? {}, false /* skipProto */, false /* skipGettersAndSetters */, input.linkifier).map(
371
- node => html`<devtools-tree-wrapper .treeElement=${node}></devtools-tree-wrapper>`)}
372
- </ul>`}
368
+ !e.result.hasChildren || e.result.object.customPreview() ? nothing :
369
+ ObjectUI.ObjectPropertiesSection.renderObjectTree(e.result, input.linkifier)}
373
370
  </li>`;
374
371
  // clang-format on
375
372
  };
@@ -552,10 +549,9 @@ export class WatchExpressionsSidebarPane extends UI.Widget.VBox implements UI.Ac
552
549
  this.saveExpressions();
553
550
  this.requestUpdate();
554
551
  },
555
- onExpand: async(e: WatchExpression, expanded: boolean): Promise<void> => {
556
- if (expanded) {
557
- await e.result?.populateChildrenIfNeeded();
558
- this.requestUpdate();
552
+ onExpand: (e: WatchExpression, expanded: boolean): void => {
553
+ if (e.result) {
554
+ e.result.expanded = expanded;
559
555
  }
560
556
  },
561
557
  },
@@ -600,13 +596,12 @@ export class WatchExpressionsSidebarPane extends UI.Widget.VBox implements UI.Ac
600
596
  return true;
601
597
  }
602
598
 
603
- appendApplicableItems(
604
- _event: Event, contextMenu: UI.ContextMenu.ContextMenu,
605
- target: ObjectUI.ObjectPropertiesSection.ObjectPropertyTreeElement|UISourceCodeFrame): void {
606
- if (target instanceof ObjectUI.ObjectPropertiesSection.ObjectPropertyTreeElement) {
607
- if (!target.property.property.synthetic) {
599
+ appendApplicableItems(_event: Event, contextMenu: UI.ContextMenu.ContextMenu,
600
+ target: ObjectUI.ObjectPropertiesSection.ObjectTreeNode|UISourceCodeFrame): void {
601
+ if (target instanceof ObjectUI.ObjectPropertiesSection.ObjectTreeNode) {
602
+ if (!target.property.synthetic) {
608
603
  contextMenu.debugSection().appendItem(i18nString(UIStrings.addPropertyPathToWatch),
609
- () => this.#focusAndAddExpressionToWatch(target.path()),
604
+ () => this.#focusAndAddExpressionToWatch(target.path),
610
605
  {jslogContext: 'add-property-path-to-watch'});
611
606
  }
612
607
  return;
@@ -2035,7 +2035,7 @@ UI.ContextMenu.registerProvider({
2035
2035
  },
2036
2036
  contextTypes() {
2037
2037
  return [
2038
- ObjectUI.ObjectPropertiesSection.ObjectPropertyTreeElement,
2038
+ ObjectUI.ObjectPropertiesSection.ObjectTreeNode,
2039
2039
  ...maybeRetrieveContextTypes(Sources => [Sources.UISourceCodeFrame.UISourceCodeFrame]),
2040
2040
  ];
2041
2041
  },
@@ -200,6 +200,9 @@ export class TimelineTreeView extends TimelineTreeViewBase implements UI.Searcha
200
200
  #compactMode = false;
201
201
  #maxLinkLength: number|undefined = undefined;
202
202
  #maxRows: number|undefined = undefined;
203
+ // Tracks whether a tree refresh was deferred while detached from the DOM,
204
+ // so it can be performed when the widget becomes visible again.
205
+ #dirty = false;
203
206
 
204
207
  /**
205
208
  * Determines if the first child in the data grid will be selected
@@ -392,7 +395,11 @@ export class TimelineTreeView extends TimelineTreeViewBase implements UI.Searcha
392
395
 
393
396
  override wasShown(): void {
394
397
  super.wasShown();
395
- this.refreshTree();
398
+ // Only refresh if data or configuration changed while detached,
399
+ // avoiding rebuilding the DataGrid which resets expanded nodes and selection.
400
+ if (this.#dirty) {
401
+ this.refreshTree();
402
+ }
396
403
  this.dataGrid.addEventListener(DataGrid.DataGrid.Events.SELECTED_NODE, this.#onDataGridSelectionChange, this);
397
404
  this.dataGrid.addEventListener(DataGrid.DataGrid.Events.DESELECTED_NODE, this.#onDataGridDeselection, this);
398
405
  }
@@ -510,8 +517,11 @@ export class TimelineTreeView extends TimelineTreeViewBase implements UI.Searcha
510
517
  // dropdown changes value. Thus, we bail out whenever the view is
511
518
  // not visible, which we know if the related element is detached
512
519
  // from the document.
520
+ // Mark dirty so that the refresh is deferred until shown.
521
+ this.#dirty = true;
513
522
  return;
514
523
  }
524
+ this.#dirty = false;
515
525
  this.linkifier.reset();
516
526
  this.dataGrid.rootNode().removeChildren();
517
527
  if (!this.#parsedTrace) {
@@ -1621,9 +1621,6 @@ export class Overlays extends EventTarget {
1621
1621
  pin.setAttribute('role', 'button');
1622
1622
  pin.setAttribute('tabindex', '0');
1623
1623
  UI.ARIAUtils.setLabel(pin, i18nString(UIStrings.commentPin));
1624
- if (overlay.commentThreadId) {
1625
- pin.setAttribute('data-comment-id', overlay.commentThreadId);
1626
- }
1627
1624
  const cursor = document.createElement('div');
1628
1625
  cursor.classList.add('comment-cursor');
1629
1626
  pin.appendChild(cursor);
@@ -1,7 +1,7 @@
1
1
  Name: Dependencies sourced from the upstream `chromium` repository
2
2
  URL: Internal
3
3
  Version: N/A
4
- Revision: 199ac2cd7ab289e11c2236bd2cede848781213da
4
+ Revision: 87625275b7c30150efc10c7dbf7c86982459704f
5
5
  Update Mechanism: Manual (https://crbug.com/428069060)
6
6
  License: BSD-3-Clause
7
7
  License File: LICENSE