chrome-devtools-frontend 1.0.1613465 → 1.0.1614363

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 (65) hide show
  1. package/.agents/skills/verification/SKILL.md +5 -1
  2. package/AUTHORS +1 -0
  3. package/front_end/core/common/VersionController.ts +17 -1
  4. package/front_end/core/host/UserMetrics.ts +0 -1
  5. package/front_end/core/root/ExperimentNames.ts +0 -1
  6. package/front_end/core/sdk/OverlayModel.ts +2 -4
  7. package/front_end/core/sdk/sdk-meta.ts +13 -0
  8. package/front_end/entrypoints/device_mode_emulation_frame/device_mode_emulation_frame.ts +4 -0
  9. package/front_end/entrypoints/greendev_floaty/FloatyEntrypoint.ts +0 -1
  10. package/front_end/entrypoints/greendev_floaty/greendev_floaty.ts +0 -1
  11. package/front_end/entrypoints/main/MainImpl.ts +0 -6
  12. package/front_end/entrypoints/shell/shell.ts +4 -0
  13. package/front_end/entrypoints/trace_app/trace_app.ts +4 -0
  14. package/front_end/generated/InspectorBackendCommands.ts +2 -2
  15. package/front_end/generated/protocol.ts +5 -3
  16. package/front_end/models/ai_assistance/agents/ContextSelectionAgent.snapshot.txt +10 -2
  17. package/front_end/models/ai_assistance/agents/ContextSelectionAgent.ts +23 -7
  18. package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +161 -36
  19. package/front_end/models/ai_assistance/agents/README.md +77 -0
  20. package/front_end/models/heap_snapshot/HeapSnapshotProxy.ts +6 -4
  21. package/front_end/models/javascript_metadata/NativeFunctions.js +673 -639
  22. package/front_end/models/stack_trace/DetailedErrorStackParser.ts +142 -0
  23. package/front_end/models/stack_trace/StackTrace.ts +18 -0
  24. package/front_end/models/stack_trace/StackTraceImpl.ts +96 -4
  25. package/front_end/models/stack_trace/Trie.ts +21 -0
  26. package/front_end/models/stack_trace/stack_trace_impl.ts +2 -0
  27. package/front_end/panels/ai_assistance/components/ChatMessage.ts +13 -3
  28. package/front_end/panels/ai_assistance/components/ChatView.ts +4 -3
  29. package/front_end/panels/ai_assistance/components/ExportForAgentsDialog.ts +6 -2
  30. package/front_end/panels/ai_assistance/components/WalkthroughView.ts +4 -3
  31. package/front_end/panels/ai_assistance/components/optInChangeDialog.css +1 -2
  32. package/front_end/panels/application/WebMCPView.ts +249 -17
  33. package/front_end/panels/application/components/ProtocolHandlersView.ts +2 -2
  34. package/front_end/panels/common/AiCodeCompletionDisclaimer.ts +7 -0
  35. package/front_end/panels/console/ConsoleContextSelector.ts +1 -1
  36. package/front_end/panels/css_overview/CSSOverviewCompletedView.ts +2 -3
  37. package/front_end/panels/css_overview/CSSOverviewModel.ts +1 -2
  38. package/front_end/panels/elements/StylesSidebarPane.ts +3 -1
  39. package/front_end/panels/emulation/DeviceModeToolbar.ts +13 -4
  40. package/front_end/panels/network/RequestConditionsDrawer.ts +4 -2
  41. package/front_end/panels/network/RequestPayloadView.ts +8 -3
  42. package/front_end/panels/network/RequestTimingView.ts +6 -7
  43. package/front_end/panels/performance_monitor/PerformanceMonitor.ts +7 -5
  44. package/front_end/panels/profiler/HeapSnapshotDataGrids.ts +1 -1
  45. package/front_end/panels/profiler/HeapSnapshotGridNodes.ts +9 -17
  46. package/front_end/panels/protocol_monitor/JSONEditor.ts +29 -3
  47. package/front_end/panels/settings/AISettingsTab.ts +14 -3
  48. package/front_end/third_party/chromium/README.chromium +1 -1
  49. package/front_end/third_party/codemirror/codemirror-tsconfig.json +4 -4
  50. package/front_end/third_party/lighthouse/lighthouse-tsconfig.json +1 -1
  51. package/front_end/tsconfig.json +2 -1
  52. package/front_end/ui/legacy/EmptyWidget.ts +2 -2
  53. package/front_end/ui/legacy/TextPrompt.ts +1 -1
  54. package/front_end/ui/legacy/components/color_picker/ContrastDetails.ts +1 -2
  55. package/front_end/ui/legacy/components/color_picker/ContrastOverlay.ts +4 -5
  56. package/front_end/ui/legacy/components/source_frame/XMLView.ts +12 -7
  57. package/front_end/ui/lit/lit.ts +4 -1
  58. package/front_end/ui/lit/render.ts +81 -0
  59. package/front_end/ui/visual_logging/KnownContextValues.ts +8 -1
  60. package/package.json +1 -1
  61. /package/front_end/third_party/codemirror/package/addon/runmode/{runmode-standalone.mjs.d.ts → runmode-standalone.d.mts} +0 -0
  62. /package/front_end/third_party/codemirror/package/mode/css/{css.mjs.d.ts → css.d.mts} +0 -0
  63. /package/front_end/third_party/codemirror/package/mode/javascript/{javascript.mjs.d.ts → javascript.d.mts} +0 -0
  64. /package/front_end/third_party/codemirror/package/mode/xml/{xml.mjs.d.ts → xml.d.mts} +0 -0
  65. /package/front_end/third_party/lighthouse/report-assets/{report-generator.mjs.d.ts → report-generator.d.mts} +0 -0
@@ -8,6 +8,8 @@ import '../../ui/components/node_text/node_text.js';
8
8
  import '../../ui/legacy/components/data_grid/data_grid.js';
9
9
  import '../../ui/legacy/legacy.js';
10
10
 
11
+ import type {JSONSchema7, JSONSchema7Definition} from 'json-schema';
12
+
11
13
  import * as Common from '../../core/common/common.js';
12
14
  import * as i18n from '../../core/i18n/i18n.js';
13
15
  import * as Platform from '../../core/platform/platform.js';
@@ -30,6 +32,7 @@ import {
30
32
  type TemplateResult,
31
33
  } from '../../ui/lit/lit.js';
32
34
  import * as VisualLogging from '../../ui/visual_logging/visual_logging.js';
35
+ import * as ProtocolMonitor from '../protocol_monitor/protocol_monitor.js';
33
36
 
34
37
  import webMCPViewStyles from './webMCPView.css.js';
35
38
 
@@ -130,7 +133,7 @@ const UIStrings = {
130
133
  /**
131
134
  * @description Text for the status of a tool call that succeeded
132
135
  */
133
- success: 'Success',
136
+ completed: 'Completed',
134
137
  /**
135
138
  * @description Text for the status of a tool call that has failed
136
139
  */
@@ -167,7 +170,7 @@ export interface FilterState {
167
170
  declarative?: boolean,
168
171
  };
169
172
  statusTypes?: {
170
- success?: boolean,
173
+ completed?: boolean,
171
174
  error?: boolean,
172
175
  pending?: boolean,
173
176
  };
@@ -202,8 +205,8 @@ export function filterToolCalls(
202
205
  const statusTypes = filterState.statusTypes;
203
206
  if (statusTypes) {
204
207
  filtered = filtered.filter(call => {
205
- const {success, error, pending} = statusTypes;
206
- if (success && call.result?.status === Protocol.WebMCP.InvocationStatus.Success) {
208
+ const {completed, error, pending} = statusTypes;
209
+ if (completed && call.result?.status === Protocol.WebMCP.InvocationStatus.Completed) {
207
210
  return true;
208
211
  }
209
212
  if (error && call.result?.status === Protocol.WebMCP.InvocationStatus.Error) {
@@ -243,33 +246,33 @@ export function filterToolCalls(
243
246
  }
244
247
  export type View = (input: ViewInput, output: object, target: HTMLElement) => void;
245
248
  function calculateToolStats(calls: WebMCP.WebMCPModel.Call[]):
246
- {total: number, success: number, failed: number, canceled: number, inProgress: number} {
247
- let total = 0, success = 0, failed = 0, canceled = 0, inProgress = 0;
249
+ {total: number, completed: number, failed: number, canceled: number, inProgress: number} {
250
+ let total = 0, completed = 0, failed = 0, canceled = 0, inProgress = 0;
248
251
  for (const call of calls) {
249
252
  total++;
250
253
  if (call.result?.status === Protocol.WebMCP.InvocationStatus.Error) {
251
254
  failed++;
252
255
  } else if (call.result?.status === Protocol.WebMCP.InvocationStatus.Canceled) {
253
256
  canceled++;
254
- } else if (call.result?.status === Protocol.WebMCP.InvocationStatus.Success) {
255
- success++;
257
+ } else if (call.result?.status === Protocol.WebMCP.InvocationStatus.Completed) {
258
+ completed++;
256
259
  } else if (call.result === undefined) {
257
260
  inProgress++;
258
261
  }
259
262
  }
260
- return {total, success, failed, canceled, inProgress};
263
+ return {total, completed, failed, canceled, inProgress};
261
264
  }
262
265
 
263
266
  function getIconGroupsFromStats(toolStats: ReturnType<typeof calculateToolStats>):
264
267
  IconButton.IconButton.IconWithTextData[] {
265
268
  const groups = [];
266
- if (toolStats.success > 0) {
269
+ if (toolStats.completed > 0) {
267
270
  groups.push({
268
271
  iconName: 'check-circle',
269
272
  iconColor: 'var(--sys-color-green)',
270
273
  iconWidth: '16px',
271
274
  iconHeight: '16px',
272
- text: String(toolStats.success),
275
+ text: String(toolStats.completed),
273
276
  });
274
277
  }
275
278
  if (toolStats.failed > 0) {
@@ -341,8 +344,8 @@ export const DEFAULT_VIEW: View = (input, output, target) => {
341
344
  return i18nString(UIStrings.error);
342
345
  case Protocol.WebMCP.InvocationStatus.Canceled:
343
346
  return i18nString(UIStrings.canceled);
344
- case Protocol.WebMCP.InvocationStatus.Success:
345
- return i18nString(UIStrings.success);
347
+ case Protocol.WebMCP.InvocationStatus.Completed:
348
+ return i18nString(UIStrings.completed);
346
349
  default:
347
350
  return i18nString(UIStrings.inProgress);
348
351
  }
@@ -600,19 +603,19 @@ export class WebMCPView extends UI.Widget.VBox {
600
603
  }
601
604
 
602
605
  #showStatusTypesContextMenu(contextMenu: UI.ContextMenu.ContextMenu): void {
603
- const toggle = (key: 'success'|'error'|'pending'): void => {
606
+ const toggle = (key: 'completed'|'error'|'pending'): void => {
604
607
  const current = this.#filterState.statusTypes ?? {};
605
608
  const next = {...current, [key]: !current[key]};
606
609
  let statusTypesToPass: FilterState['statusTypes'] = next;
607
- if (!next.success && !next.error && !next.pending) {
610
+ if (!next.completed && !next.error && !next.pending) {
608
611
  statusTypesToPass = undefined;
609
612
  }
610
613
  this.#handleFilterChange({...this.#filterState, statusTypes: statusTypesToPass});
611
614
  };
612
615
 
613
616
  contextMenu.defaultSection().appendCheckboxItem(
614
- i18nString(UIStrings.success), () => toggle('success'),
615
- {checked: this.#filterState.statusTypes?.['success'] ?? false, jslogContext: 'webmcp.success'});
617
+ i18nString(UIStrings.completed), () => toggle('completed'),
618
+ {checked: this.#filterState.statusTypes?.['completed'] ?? false, jslogContext: 'webmcp.completed'});
616
619
  contextMenu.defaultSection().appendCheckboxItem(
617
620
  i18nString(UIStrings.error), () => toggle('error'),
618
621
  {checked: this.#filterState.statusTypes?.['error'] ?? false, jslogContext: 'webmcp.error'});
@@ -990,3 +993,232 @@ export class ToolDetailsWidget extends UI.Widget.Widget {
990
993
  this.requestUpdate();
991
994
  }
992
995
  }
996
+
997
+ export interface ParsedToolSchema {
998
+ parameters: ProtocolMonitor.JSONEditor.Parameter[];
999
+ typesByName: Map<string, ProtocolMonitor.JSONEditor.Parameter[]>;
1000
+ enumsByName: Map<string, Record<string, string>>;
1001
+ }
1002
+
1003
+ const parsedSchemaCache = new WeakMap<object, ParsedToolSchema>();
1004
+
1005
+ export function parseToolSchema(schema: JSONSchema7): ParsedToolSchema {
1006
+ if (typeof schema === 'object' && schema !== null) {
1007
+ const cached = parsedSchemaCache.get(schema);
1008
+ if (cached) {
1009
+ return cached;
1010
+ }
1011
+ }
1012
+
1013
+ const typesByName = new Map<string, ProtocolMonitor.JSONEditor.Parameter[]>();
1014
+ const enumsByName = new Map<string, Record<string, string>>();
1015
+ const simpleTypesByName = new Map<string, ProtocolMonitor.JSONEditor.ParameterType>();
1016
+ let typeCount = 0;
1017
+
1018
+ function createEnumRecord(values: unknown[]): Record<string, string> {
1019
+ const enumRecord: Record<string, string> = {};
1020
+ for (const val of values) {
1021
+ enumRecord[String(val)] = String(val);
1022
+ }
1023
+ return enumRecord;
1024
+ }
1025
+
1026
+ function preScanDefinition(name: string, def: JSONSchema7Definition): void {
1027
+ if (typeof def === 'boolean') {
1028
+ return;
1029
+ }
1030
+ if (def.type === 'string' && def.enum) {
1031
+ enumsByName.set(name, createEnumRecord(def.enum));
1032
+ } else if (def.type && typeof def.type === 'string' && def.type !== 'object' && def.type !== 'array') {
1033
+ let paramType = ProtocolMonitor.JSONEditor.ParameterType.STRING;
1034
+ switch (def.type) {
1035
+ case 'number':
1036
+ case 'integer':
1037
+ paramType = ProtocolMonitor.JSONEditor.ParameterType.NUMBER;
1038
+ break;
1039
+ case 'boolean':
1040
+ paramType = ProtocolMonitor.JSONEditor.ParameterType.BOOLEAN;
1041
+ break;
1042
+ }
1043
+ simpleTypesByName.set(name, paramType);
1044
+ }
1045
+ }
1046
+
1047
+ function parseDefinition(name: string, def: JSONSchema7Definition): void {
1048
+ if (typeof def === 'boolean') {
1049
+ return;
1050
+ }
1051
+ if (def.type === 'object' && def.properties) {
1052
+ const nestedParams: ProtocolMonitor.JSONEditor.Parameter[] = [];
1053
+ for (const [key, value] of Object.entries(def.properties)) {
1054
+ const isOpt = !(def.required || []).includes(key);
1055
+ nestedParams.push(parseProperty(key, value, isOpt));
1056
+ }
1057
+ typesByName.set(name, nestedParams);
1058
+ }
1059
+ }
1060
+
1061
+ // First pass: populate enums and simple types
1062
+ if (schema.definitions) {
1063
+ for (const [name, def] of Object.entries(schema.definitions)) {
1064
+ preScanDefinition(name, def);
1065
+ }
1066
+ }
1067
+ if (schema.$defs) {
1068
+ for (const [name, def] of Object.entries(schema.$defs)) {
1069
+ preScanDefinition(name, def);
1070
+ }
1071
+ }
1072
+
1073
+ // Second pass: parse objects
1074
+ if (schema.definitions) {
1075
+ for (const [name, def] of Object.entries(schema.definitions)) {
1076
+ parseDefinition(name, def);
1077
+ }
1078
+ }
1079
+ if (schema.$defs) {
1080
+ for (const [name, def] of Object.entries(schema.$defs)) {
1081
+ parseDefinition(name, def);
1082
+ }
1083
+ }
1084
+
1085
+ function parseProperty(
1086
+ name: string, propDef: JSONSchema7Definition, optional: boolean): ProtocolMonitor.JSONEditor.Parameter {
1087
+ if (typeof propDef === 'boolean') {
1088
+ return {
1089
+ name,
1090
+ optional,
1091
+ description: '',
1092
+ type: ProtocolMonitor.JSONEditor.ParameterType.STRING,
1093
+ isCorrectType: true,
1094
+ };
1095
+ }
1096
+ const prop = propDef;
1097
+ if (prop.$ref) {
1098
+ const typeRef = prop.$ref.split('/').pop() || '';
1099
+ let paramType = ProtocolMonitor.JSONEditor.ParameterType.OBJECT;
1100
+ if (enumsByName.has(typeRef)) {
1101
+ paramType = ProtocolMonitor.JSONEditor.ParameterType.STRING;
1102
+ } else {
1103
+ const simpleType = simpleTypesByName.get(typeRef);
1104
+ if (simpleType !== undefined) {
1105
+ paramType = simpleType;
1106
+ }
1107
+ }
1108
+ return {
1109
+ name,
1110
+ optional,
1111
+ description: prop.description || '',
1112
+ type: paramType,
1113
+ typeRef,
1114
+ isCorrectType: true,
1115
+ };
1116
+ }
1117
+
1118
+ const typeStr = Array.isArray(prop.type) ? prop.type[0] : prop.type;
1119
+ let type: string|undefined = typeStr === 'integer' ? 'number' : typeStr;
1120
+ if (!typeStr) {
1121
+ if (prop.properties) {
1122
+ type = 'object';
1123
+ } else if (prop.items) {
1124
+ type = 'array';
1125
+ } else {
1126
+ type = 'unknown';
1127
+ }
1128
+ }
1129
+ const description = prop.description || '';
1130
+
1131
+ let paramType = ProtocolMonitor.JSONEditor.ParameterType.UNKNOWN;
1132
+ switch (type) {
1133
+ case 'string':
1134
+ paramType = ProtocolMonitor.JSONEditor.ParameterType.STRING;
1135
+ break;
1136
+ case 'number':
1137
+ paramType = ProtocolMonitor.JSONEditor.ParameterType.NUMBER;
1138
+ break;
1139
+ case 'boolean':
1140
+ paramType = ProtocolMonitor.JSONEditor.ParameterType.BOOLEAN;
1141
+ break;
1142
+ case 'object':
1143
+ paramType = ProtocolMonitor.JSONEditor.ParameterType.OBJECT;
1144
+ break;
1145
+ case 'array':
1146
+ paramType = ProtocolMonitor.JSONEditor.ParameterType.ARRAY;
1147
+ break;
1148
+ }
1149
+
1150
+ const base: ProtocolMonitor.JSONEditor.Parameter = {
1151
+ name,
1152
+ optional,
1153
+ description,
1154
+ type: paramType,
1155
+ isCorrectType: true,
1156
+ };
1157
+
1158
+ if (type === 'object') {
1159
+ if (prop.properties) {
1160
+ const typeRef = `Object_${++typeCount}`;
1161
+ const nestedParams: ProtocolMonitor.JSONEditor.Parameter[] = [];
1162
+ for (const [key, value] of Object.entries(prop.properties)) {
1163
+ const isOpt = !(prop.required || []).includes(key);
1164
+ nestedParams.push(parseProperty(key, value, isOpt));
1165
+ }
1166
+ typesByName.set(typeRef, nestedParams);
1167
+ base.typeRef = typeRef;
1168
+ } else {
1169
+ base.isKeyEditable = true;
1170
+ }
1171
+ } else if (type === 'array') {
1172
+ const items =
1173
+ prop.items && !Array.isArray(prop.items) && typeof prop.items !== 'boolean' ? prop.items : undefined;
1174
+ if (items) {
1175
+ const itemTypeStr = Array.isArray(items.type) ? items.type[0] : items.type;
1176
+ if (items.$ref) {
1177
+ base.typeRef = items.$ref.split('/').pop() || '';
1178
+ } else if (itemTypeStr === 'object' && items.properties) {
1179
+ const typeRef = `Object_${++typeCount}`;
1180
+ const nestedParams: ProtocolMonitor.JSONEditor.Parameter[] = [];
1181
+ for (const [key, value] of Object.entries(items.properties)) {
1182
+ const isOpt = !(items.required || []).includes(key);
1183
+ nestedParams.push(parseProperty(key, value, isOpt));
1184
+ }
1185
+ typesByName.set(typeRef, nestedParams);
1186
+ base.typeRef = typeRef;
1187
+ } else if (itemTypeStr) {
1188
+ const itemType = itemTypeStr === 'integer' ? 'number' : itemTypeStr;
1189
+ if (itemType === 'string' && items.enum) {
1190
+ const typeRef = `Enum_${++typeCount}`;
1191
+ enumsByName.set(typeRef, createEnumRecord(items.enum));
1192
+ base.typeRef = typeRef;
1193
+ } else {
1194
+ base.typeRef = itemType as string;
1195
+ }
1196
+ } else {
1197
+ base.typeRef = 'string';
1198
+ }
1199
+ } else {
1200
+ base.typeRef = 'string';
1201
+ }
1202
+ } else if (type === 'string' && prop.enum) {
1203
+ const typeRef = `Enum_${++typeCount}`;
1204
+ enumsByName.set(typeRef, createEnumRecord(prop.enum));
1205
+ base.typeRef = typeRef;
1206
+ }
1207
+
1208
+ return base;
1209
+ }
1210
+
1211
+ const parameters: ProtocolMonitor.JSONEditor.Parameter[] = [];
1212
+ if ((schema.type === 'object' || !schema.type) && schema.properties) {
1213
+ for (const [key, value] of Object.entries(schema.properties)) {
1214
+ const isOpt = !(schema.required || []).includes(key);
1215
+ parameters.push(parseProperty(key, value, isOpt));
1216
+ }
1217
+ }
1218
+
1219
+ const result = {parameters, typesByName, enumsByName};
1220
+ if (typeof schema === 'object' && schema !== null) {
1221
+ parsedSchemaCache.set(schema, result);
1222
+ }
1223
+ return result;
1224
+ }
@@ -150,7 +150,7 @@ const DEFAULT_VIEW: View = (input, _output, target) => {
150
150
  </div>
151
151
  ${renderProtocolTest(input.protocolHandler, input.queryInputState, input.protocolSelectHandler,
152
152
  input.queryInputChangeHandler, input.testProtocolClickHandler)}
153
- `, target);
153
+ `, target, {container: {classes: ['vbox']}});
154
154
  // clang-format on
155
155
  };
156
156
 
@@ -172,7 +172,7 @@ export class ProtocolHandlersView extends UI.Widget.Widget {
172
172
  #view: View;
173
173
 
174
174
  constructor(element?: HTMLElement, view: View = DEFAULT_VIEW) {
175
- super(element, {useShadowDom: false, classes: ['vbox']});
175
+ super(element, {useShadowDom: false});
176
176
  this.#view = view;
177
177
  }
178
178
 
@@ -166,8 +166,15 @@ export const DEFAULT_SUMMARY_TOOLBAR_VIEW: View =
166
166
  role="link"
167
167
  jslog=${VisualLogging.link('open-ai-settings').track({
168
168
  click: true,
169
+ keydown: 'Enter',
169
170
  })}
170
171
  @click=${input.onManageInSettingsTooltipClick}
172
+ @keydown=${(e: KeyboardEvent) => {
173
+ if (e.key === 'Enter') {
174
+ e.consume(true);
175
+ input.onManageInSettingsTooltipClick();
176
+ }
177
+ }}
171
178
  >${lockedString(UIStringsNotTranslate.manageInSettings)}</span></div></devtools-tooltip>
172
179
  </div>
173
180
  `, target);
@@ -303,7 +303,7 @@ interface ViewInput {
303
303
  type View = (input: ViewInput, output: undefined, target: HTMLElement) => void;
304
304
 
305
305
  const DEFAULT_VIEW: View = (input, _output, target): void => {
306
- if (!input.title || !input.subtitle) {
306
+ if (!input.title) {
307
307
  render(nothing, target);
308
308
  return;
309
309
  }
@@ -8,7 +8,6 @@ import '../../ui/kit/kit.js';
8
8
  import * as Common from '../../core/common/common.js';
9
9
  import * as i18n from '../../core/i18n/i18n.js';
10
10
  import * as Platform from '../../core/platform/platform.js';
11
- import * as Root from '../../core/root/root.js';
12
11
  import * as SDK from '../../core/sdk/sdk.js';
13
12
  import type * as Protocol from '../../generated/protocol.js';
14
13
  import * as Geometry from '../../models/geometry/geometry.js';
@@ -483,7 +482,7 @@ function renderContrastIssue(key: string, issues: ContrastIssue[]): TemplateResu
483
482
  const color = (minContrastIssue.textColor.asString(Common.Color.Format.HEXA));
484
483
  const backgroundColor = (minContrastIssue.backgroundColor.asString(Common.Color.Format.HEXA));
485
484
 
486
- const showAPCA = Root.Runtime.experiments.isEnabled(Root.ExperimentNames.ExperimentName.APCA);
485
+ const showAPCA = Common.Settings.Settings.instance().moduleSetting('apca').get();
487
486
 
488
487
  const title = i18nString(UIStrings.textColorSOverSBackgroundResults, {
489
488
  PH1: color,
@@ -1041,7 +1040,7 @@ function renderContrastRatio(data: PopulateNodesEventNodeTypes): TemplateResult
1041
1040
  if (!('contrastRatio' in data)) {
1042
1041
  throw new Error('Contrast ratio entry is missing a contrast ratio.');
1043
1042
  }
1044
- const showAPCA = Root.Runtime.experiments.isEnabled(Root.ExperimentNames.ExperimentName.APCA);
1043
+ const showAPCA = Common.Settings.Settings.instance().moduleSetting('apca').get();
1045
1044
  const contrastRatio = Platform.NumberUtilities.floor(data.contrastRatio, 2);
1046
1045
  const contrastRatioString = showAPCA ? contrastRatio + '%' : contrastRatio;
1047
1046
  const border = getBorderString(data.backgroundColor);
@@ -3,7 +3,6 @@
3
3
  // found in the LICENSE file.
4
4
 
5
5
  import * as Common from '../../core/common/common.js';
6
- import * as Root from '../../core/root/root.js';
7
6
  import * as SDK from '../../core/sdk/sdk.js';
8
7
  import type * as ProtocolProxyApi from '../../generated/protocol-proxy-api.js';
9
8
  import type * as Protocol from '../../generated/protocol.js';
@@ -267,7 +266,7 @@ export class CSSOverviewModel extends SDK.SDKModel.SDKModel<void> {
267
266
  const formattedTextColor = formatColor(blendedTextColor);
268
267
  const formattedBackgroundColor = formatColor(blendedBackgroundColor.asLegacyColor());
269
268
  const key = `${formattedTextColor}_${formattedBackgroundColor}`;
270
- if (Root.Runtime.experiments.isEnabled(Root.ExperimentNames.ExperimentName.APCA)) {
269
+ if (Common.Settings.Settings.instance().moduleSetting('apca').get()) {
271
270
  const contrastRatio = contrastInfo.contrastRatioAPCA();
272
271
  const threshold = contrastInfo.contrastRatioAPCAThreshold();
273
272
  const passes = contrastRatio && threshold ? Math.abs(contrastRatio) >= threshold : false;
@@ -2290,7 +2290,7 @@ export class CSSPropertyPrompt extends UI.TextPrompt.TextPrompt {
2290
2290
  do {
2291
2291
  if (cursor.name === ':') {
2292
2292
  name = suggestionText.slice(node.from, cursor.from);
2293
- value = suggestionText.slice(cursor.to + 1, node.to);
2293
+ value = suggestionText.slice(cursor.to, node.to);
2294
2294
  }
2295
2295
  } while (cursor.nextSibling());
2296
2296
  }
@@ -2350,6 +2350,8 @@ export class CSSPropertyPrompt extends UI.TextPrompt.TextPrompt {
2350
2350
  }
2351
2351
 
2352
2352
  if (suggestionForCurrentPrompt !== textAfterAccept) {
2353
+ // Explicitly set the query range as it is cleared during `acceptAutoComplete`
2354
+ this.queryRange = new TextUtils.TextRange.TextRange(0, 0, 0, textAfterAccept.length);
2353
2355
  // Re-apply the ghost text for the remainder
2354
2356
  this.applySuggestion({text: suggestionForCurrentPrompt}, true);
2355
2357
  }
@@ -217,6 +217,7 @@ export class DeviceModeToolbar {
217
217
  private widthInput: EmulationComponents.DeviceSizeInputElement.SizeInputElement;
218
218
  private heightInput: EmulationComponents.DeviceSizeInputElement.SizeInputElement;
219
219
  private deviceScaleItem!: UI.Toolbar.ToolbarComboBox;
220
+ private deviceScaleItems: UI.Toolbar.ToolbarItem[] = [];
220
221
  private deviceSelectItem!: UI.Toolbar.ToolbarComboBox;
221
222
  private scaleItem!: UI.Toolbar.ToolbarComboBox;
222
223
  private uaItem!: UI.Toolbar.ToolbarComboBox;
@@ -341,10 +342,14 @@ export class DeviceModeToolbar {
341
342
  this.deviceScaleItem = new UI.Toolbar.ToolbarComboBox(
342
343
  this.onDeviceScaleChange.bind(this), i18nString(UIStrings.devicePixelRatio), 'dark-text', 'device-pixel-ratio');
343
344
  this.deviceScaleItem.turnShrinkable();
344
- this.deviceScaleItem.setVisible(this.showDeviceScaleFactorSetting.get());
345
345
  const deviceScaleSpan = uiI18n.getFormatLocalizedString(str_, UIStrings.dpr, {PH1: this.deviceScaleItem.element});
346
- mainToolbar.append(...deviceScaleSpan.childNodes);
347
- mainToolbar.appendToolbarItem(this.deviceScaleItem);
346
+ for (const node of Array.from(deviceScaleSpan.childNodes)) {
347
+ const item = node === this.deviceScaleItem.element ? this.deviceScaleItem :
348
+ new UI.Toolbar.ToolbarText(node.textContent || '');
349
+ item.setVisible(this.showDeviceScaleFactorSetting.get());
350
+ this.deviceScaleItems.push(item);
351
+ mainToolbar.appendToolbarItem(item);
352
+ }
348
353
  mainToolbar.appendToolbarItem(new UI.Toolbar.ToolbarItem(this.createEmptyToolbarElement()));
349
354
  this.uaItem = new UI.Toolbar.ToolbarComboBox(
350
355
  this.onUAChange.bind(this), i18nString(UIStrings.deviceType), 'dark-text', 'device-type');
@@ -758,7 +763,11 @@ export class DeviceModeToolbar {
758
763
 
759
764
  private updateDeviceScaleFactorVisibility(): void {
760
765
  if (this.deviceScaleItem) {
761
- this.deviceScaleItem.setVisible(this.showDeviceScaleFactorSetting.get());
766
+ const visible = this.showDeviceScaleFactorSetting.get();
767
+ this.deviceScaleItem.setVisible(visible);
768
+ for (const item of this.deviceScaleItems) {
769
+ item.setVisible(visible);
770
+ }
762
771
  }
763
772
  }
764
773
 
@@ -291,7 +291,9 @@ interface AffectedCountViewInput {
291
291
  }
292
292
  type AffectedCountView = (input: AffectedCountViewInput, output: object, target: HTMLElement) => void;
293
293
  export const AFFECTED_COUNT_DEFAULT_VIEW: AffectedCountView = (input, output, target) => {
294
- render(html`${i18nString(UIStrings.dAffected, {PH1: input.count})}`, target);
294
+ render(
295
+ html`${i18nString(UIStrings.dAffected, {PH1: input.count})}`, target,
296
+ {container: {classes: ['blocked-url-count']}});
295
297
  };
296
298
 
297
299
  function matchesUrl(conditions: SDK.NetworkManager.RequestCondition, url: string): boolean {
@@ -304,7 +306,7 @@ export class AffectedCountWidget extends UI.Widget.Widget {
304
306
  #lookUpRequestCount?: (condition: SDK.NetworkManager.RequestCondition) => number;
305
307
 
306
308
  constructor(target?: HTMLElement, view = AFFECTED_COUNT_DEFAULT_VIEW) {
307
- super(target, {classes: ['blocked-url-count']});
309
+ super(target);
308
310
  this.#view = view;
309
311
  }
310
312
 
@@ -289,8 +289,13 @@ export const DEFAULT_VIEW: View = (input, output, target) => {
289
289
  </ul>
290
290
  </li>
291
291
  </ul>
292
- `}></devtools-tree>
293
- `, target);
292
+ `}></devtools-tree>`, target, {
293
+ container: {
294
+ classes: ['request-payload-view'],
295
+ attributes: {
296
+ jslog: `${VisualLogging.pane('payload').track({resize: true})}`,
297
+ },
298
+ }});
294
299
  // clang-format on
295
300
  };
296
301
 
@@ -305,7 +310,7 @@ export class RequestPayloadView extends UI.Widget.VBox {
305
310
  #viewQueryParamSource = false;
306
311
 
307
312
  constructor(target?: HTMLElement, view = DEFAULT_VIEW) {
308
- super({jslog: `${VisualLogging.pane('payload').track({resize: true})}`, classes: ['request-payload-view']});
313
+ super();
309
314
  this.#view = view;
310
315
  }
311
316
 
@@ -407,9 +407,9 @@ export const DEFAULT_VIEW: View = (input, output, target) => {
407
407
  }
408
408
  }
409
409
 
410
- render(
411
- // clang-format off
412
- html`<style>${networkingTimingTableStyles}</style>
410
+ // clang-format off
411
+ render(html`
412
+ <style>${networkingTimingTableStyles}</style>
413
413
  <table
414
414
  class=${classes}
415
415
  jslog=${VisualLogging.pane('timing').track({
@@ -532,9 +532,8 @@ ${uiI18n.getFormatLocalizedStringTemplate(str_, UIStrings.duringDevelopmentYouCa
532
532
  html`<devtools-link href="https://web.dev/custom-metrics/#server-timing-api" .jslogContext=${'server-timing-api'}>${i18nString(UIStrings.theServerTimingApi)}</devtools-link>`})}
533
533
  </td>
534
534
  </tr>` : nothing}
535
- </table>`,
536
- // clang-format on
537
- target);
535
+ </table>`, target, {container: {classes: ['resource-timing-view']}});
536
+ // clang-format on
538
537
  };
539
538
 
540
539
  export class RequestTimingView extends UI.Widget.VBox {
@@ -543,7 +542,7 @@ export class RequestTimingView extends UI.Widget.VBox {
543
542
  #lastMinimumBoundary = -1;
544
543
  readonly #view: View;
545
544
  constructor(target?: HTMLElement, view = DEFAULT_VIEW) {
546
- super(target, {classes: ['resource-timing-view']});
545
+ super(target);
547
546
  this.#view = view;
548
547
  }
549
548
 
@@ -626,8 +626,9 @@ interface ControlPaneInput {
626
626
  type ControlPaneView = (input: ControlPaneInput, output: object, target: HTMLElement) => void;
627
627
 
628
628
  const CONTROL_PANE_DEFAULT_VIEW: ControlPaneView = (input, _output, target) => {
629
- render(
630
- input.chartsInfo.map(chartInfo => {
629
+ // clang-format off
630
+ render(html`
631
+ ${input.chartsInfo.map(chartInfo => {
631
632
  const chartName = chartInfo.metrics[0].name;
632
633
  const active = input.enabledCharts.has(chartName);
633
634
  const value = input.metricValues.get(chartName) || 0;
@@ -637,8 +638,9 @@ const CONTROL_PANE_DEFAULT_VIEW: ControlPaneView = (input, _output, target) => {
637
638
  value,
638
639
  (e: Event) => input.onCheckboxChange(chartName, e),
639
640
  );
640
- }),
641
- target);
641
+ })}
642
+ `, target, {container: {classes: ['perfmon-control-pane']}});
643
+ // clang-format on
642
644
  };
643
645
 
644
646
  export class ControlPane extends UI.Widget.VBox {
@@ -651,7 +653,7 @@ export class ControlPane extends UI.Widget.VBox {
651
653
  readonly #view: ControlPaneView;
652
654
 
653
655
  constructor(element: HTMLElement, view = CONTROL_PANE_DEFAULT_VIEW) {
654
- super(element, {useShadowDom: false, classes: ['perfmon-control-pane']});
656
+ super(element, {useShadowDom: false});
655
657
  this.#view = view;
656
658
 
657
659
  this.#enabledChartsSetting = Common.Settings.Settings.instance().createSetting(
@@ -300,7 +300,7 @@ export class HeapSnapshotSortableDataGrid extends Common.ObjectWrapper
300
300
  let field1 = nodeA[sortFields.fieldName1];
301
301
  // @ts-expect-error
302
302
  let field2 = nodeB[sortFields.fieldName1];
303
- let result: number|(0 | 1 | -1) = field1 < field2 ? -1 : (field1 > field2 ? 1 : 0);
303
+ let result: number = field1 < field2 ? -1 : (field1 > field2 ? 1 : 0);
304
304
  if (!sortFields.ascending1) {
305
305
  result = -result;
306
306
  }
@@ -136,31 +136,23 @@ export class HeapSnapshotGridNode extends
136
136
  Common.ObjectWrapper.eventMixin<HeapSnapshotGridNode.EventTypes, typeof HeapSnapshotGridNodeBase>(
137
137
  HeapSnapshotGridNodeBase) {
138
138
  dataGridInternal: HeapSnapshotSortableDataGrid;
139
- instanceCount: number;
140
- readonly savedChildren: Map<number, HeapSnapshotGridNode>;
139
+ instanceCount = 0;
140
+ readonly savedChildren = new Map<number, HeapSnapshotGridNode>();
141
+ /**
142
+ * List of position ranges for all visible nodes: [startPos1, endPos1),...,[startPosN, endPosN)
143
+ * Position is an item position in the provider.
144
+ */
141
145
  retrievedChildrenRanges: Array<{
142
146
  from: number,
143
147
  to: number,
144
- }>;
145
- providerObject: HeapSnapshotModel.ChildrenProvider.ChildrenProvider|null;
146
- reachableFromWindow: boolean;
148
+ }> = [];
149
+ providerObject: HeapSnapshotModel.ChildrenProvider.ChildrenProvider|null = null;
150
+ reachableFromWindow = false;
147
151
  populated?: boolean;
148
152
 
149
153
  constructor(tree: HeapSnapshotSortableDataGrid, hasChildren: boolean) {
150
154
  super(null, hasChildren);
151
155
  this.dataGridInternal = tree;
152
- this.instanceCount = 0;
153
-
154
- this.savedChildren = new Map();
155
-
156
- /**
157
- * List of position ranges for all visible nodes: [startPos1, endPos1),...,[startPosN, endPosN)
158
- * Position is an item position in the provider.
159
- */
160
- this.retrievedChildrenRanges = [];
161
-
162
- this.providerObject = null;
163
- this.reachableFromWindow = false;
164
156
  }
165
157
 
166
158
  get name(): string|undefined {