chrome-devtools-frontend 1.0.1679704 → 1.0.1681091

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 (54) hide show
  1. package/AUTHORS +1 -0
  2. package/front_end/core/platform/TypescriptUtilities.ts +0 -9
  3. package/front_end/core/platform/platform.ts +1 -1
  4. package/front_end/core/sdk/ConsoleModel.ts +6 -3
  5. package/front_end/core/sdk/DOMModel.ts +102 -0
  6. package/front_end/core/sdk/EmulationModel.ts +4 -2
  7. package/front_end/core/sdk/NetworkManager.ts +7 -6
  8. package/front_end/core/sdk/PageResourceLoader.ts +4 -3
  9. package/front_end/core/sdk/RuntimeModel.ts +5 -3
  10. package/front_end/core/sdk/SDKSettings.ts +47 -0
  11. package/front_end/core/sdk/sdk-meta.ts +0 -138
  12. package/front_end/entrypoints/inspector_main/RenderingOptions.ts +4 -2
  13. package/front_end/entrypoints/inspector_main/inspector_main-meta.ts +32 -0
  14. package/front_end/entrypoints/main/MainImpl.ts +1 -1
  15. package/front_end/generated/InspectorBackendCommands.ts +3 -1
  16. package/front_end/generated/SupportedCSSProperties.ts +20 -0
  17. package/front_end/generated/protocol-mapping.d.ts +7 -0
  18. package/front_end/generated/protocol-proxy-api.d.ts +5 -0
  19. package/front_end/generated/protocol.ts +15 -3
  20. package/front_end/panels/console/ConsoleView.ts +2 -1
  21. package/front_end/panels/console/console-meta.ts +10 -5
  22. package/front_end/panels/elements/DOMTreeContextMenu.ts +541 -0
  23. package/front_end/panels/elements/ElementsTreeElement.ts +27 -494
  24. package/front_end/panels/elements/ElementsTreeOutline.ts +173 -287
  25. package/front_end/panels/elements/StylesSidebarPane.ts +2 -1
  26. package/front_end/panels/elements/elements.ts +3 -0
  27. package/front_end/panels/issues/CorsIssueDetailsView.ts +13 -9
  28. package/front_end/panels/mobile_throttling/NetworkPanelIndicator.ts +3 -1
  29. package/front_end/panels/network/NetworkConfigView.ts +2 -1
  30. package/front_end/panels/network/NetworkPanel.ts +1 -1
  31. package/front_end/panels/network/network-meta.ts +60 -0
  32. package/front_end/panels/profiler/HeapDetachedElementsDataGrid.ts +2 -1
  33. package/front_end/panels/profiler/ProfileLauncherView.ts +19 -16
  34. package/front_end/panels/profiler/ProfileSidebarTreeElement.ts +1 -1
  35. package/front_end/panels/security/security.ts +6 -0
  36. package/front_end/panels/sources/SourcesView.ts +8 -107
  37. package/front_end/panels/sources/TabbedEditorContainer.ts +110 -7
  38. package/front_end/panels/sources/sources-meta.ts +16 -0
  39. package/front_end/panels/timeline/TimelineLoader.ts +1 -1
  40. package/front_end/panels/timeline/TimelineUIUtils.ts +6 -0
  41. package/front_end/panels/timeline/components/LayoutShiftDetails.ts +4 -3
  42. package/front_end/panels/timeline/components/LiveMetricsView.ts +1 -1
  43. package/front_end/panels/timeline/components/MetricCard.ts +4 -3
  44. package/front_end/panels/timeline/components/NetworkRequestDetails.ts +5 -2
  45. package/front_end/panels/timeline/components/TimelineRangeSummaryView.ts +1 -1
  46. package/front_end/panels/timeline/components/TimelineSummary.ts +8 -5
  47. package/front_end/third_party/chromium/README.chromium +1 -1
  48. package/front_end/ui/legacy/TabbedPane.ts +34 -2
  49. package/front_end/ui/legacy/components/quick_open/CommandMenu.ts +5 -5
  50. package/front_end/ui/legacy/components/quick_open/FilteredListWidget.ts +7 -7
  51. package/front_end/ui/legacy/components/quick_open/QuickOpen.ts +1 -1
  52. package/front_end/ui/legacy/components/quick_open/quick_open-meta.ts +2 -2
  53. package/front_end/ui/visual_logging/KnownContextValues.ts +29 -0
  54. package/package.json +1 -1
package/AUTHORS CHANGED
@@ -24,6 +24,7 @@ Anna Agoha <annaagoha@gmail.com>
24
24
  Anthony Xie <anthonyxie64@gmail.com>
25
25
  Axel Chong <haxatron1@gmail.com>
26
26
  Anton Bershanskyi <bershanskyi@gmail.com>
27
+ Ashish Shrees <flowoker1@gmail.com>
27
28
  Aviv Keller <me@aviv.sh>
28
29
  Biboswan Roy <biboswan98@gmail.com>
29
30
  Boris Verkhovskiy <boris.verk@gmail.com>
@@ -17,15 +17,6 @@ export function assertNever(_type: never, message: string): never {
17
17
  throw new Error(message);
18
18
  }
19
19
 
20
- /**
21
- * This is useful to check on the type-level that the unhandled cases of
22
- * a switch are exactly `T` (where T is usually a union type of enum values).
23
- * @param caseVariable
24
- */
25
- export function assertUnhandled<T>(_caseVariable: T): T {
26
- return _caseVariable;
27
- }
28
-
29
20
  export type FieldsThatExtend<Type, Selector> = {
30
21
  [Key in keyof Type]: Type[Key] extends Selector ? Key : never;
31
22
  }[keyof Type];
@@ -24,7 +24,7 @@ import * as UserVisibleError from './UserVisibleError.js';
24
24
  * `Platform.TypeScriptUtilities.assertNotNullOrUndefined` causes a compile
25
25
  * error).
26
26
  */
27
- export {assertNever, assertNotNullOrUndefined, assertUnhandled} from './TypescriptUtilities.js';
27
+ export {assertNever, assertNotNullOrUndefined} from './TypescriptUtilities.js';
28
28
  export {
29
29
  ArrayUtilities,
30
30
  Brand,
@@ -34,7 +34,7 @@ import {
34
34
  RuntimeModel,
35
35
  } from './RuntimeModel.js';
36
36
  import {SDKModel} from './SDKModel.js';
37
- import {preserveConsoleLogSettingDescriptor} from './SDKSettings.js';
37
+ import {consoleUserActivationEvalSettingDescriptor, preserveConsoleLogSettingDescriptor} from './SDKSettings.js';
38
38
  import {Capability, type Target, Type} from './Target.js';
39
39
  import type {TargetManager} from './TargetManager.js';
40
40
 
@@ -156,13 +156,16 @@ export class ConsoleModel extends SDKModel<EventTypes> {
156
156
  replMode: true,
157
157
  allowUnsafeEvalBlockedByCSP: false,
158
158
  },
159
- this.target().targetManager().settings.moduleSetting('console-user-activation-eval').get(),
159
+ this.target().targetManager().settings.resolve(consoleUserActivationEvalSettingDescriptor).get(),
160
160
  /* awaitPromise */ false);
161
161
  Host.userMetrics.actionTaken(Host.UserMetrics.Action.ConsoleEvaluated);
162
162
  if ('error' in result) {
163
163
  return;
164
164
  }
165
- await this.#console.showPromise();
165
+ try {
166
+ await this.#console.showPromise();
167
+ } catch {
168
+ }
166
169
  this.dispatchEventToListeners(
167
170
  Events.CommandEvaluated,
168
171
  {result: result.object, commandMessage: originatingMessage, exceptionDetails: result.exceptionDetails});
@@ -1066,6 +1066,102 @@ export class DOMNode extends Common.ObjectWrapper.ObjectWrapper<DOMNodeEventType
1066
1066
  });
1067
1067
  }
1068
1068
 
1069
+ duplicate(): void {
1070
+ if (this.isInShadowTree()) {
1071
+ return;
1072
+ }
1073
+
1074
+ const parentNode = this.parentNode ? this.parentNode : this;
1075
+ if (parentNode.nodeName() === '#document') {
1076
+ return;
1077
+ }
1078
+
1079
+ this.copyTo(parentNode, this.nextSibling);
1080
+ }
1081
+
1082
+ /**
1083
+ * Runs a script on the node's remote object that toggles a class name on
1084
+ * the node and injects a stylesheet into the head of the node's document
1085
+ * containing a rule to set "visibility: hidden" on the class and all it's
1086
+ * ancestors.
1087
+ */
1088
+ async toggleHideElement(): Promise<void> {
1089
+ let pseudoElementName = this.pseudoType() ? this.nodeName() : null;
1090
+ if (pseudoElementName && this.pseudoIdentifier()) {
1091
+ pseudoElementName += `(${this.pseudoIdentifier()})`;
1092
+ }
1093
+
1094
+ let effectiveNode: DOMNode|null = this;
1095
+ while (effectiveNode?.pseudoType()) {
1096
+ if (effectiveNode !== this && effectiveNode.pseudoType() === 'column') {
1097
+ // Ideally we would select the specific column pseudo element, but
1098
+ // we don't have a way to do that at the moment.
1099
+ pseudoElementName = '::column' + pseudoElementName;
1100
+ }
1101
+ effectiveNode = effectiveNode.parentNode;
1102
+ }
1103
+ if (!effectiveNode) {
1104
+ return;
1105
+ }
1106
+
1107
+ const hidden = this.marker('hidden-marker');
1108
+ const object = await effectiveNode.resolveToObject('');
1109
+
1110
+ if (!object) {
1111
+ return;
1112
+ }
1113
+
1114
+ await object.callFunction((toggleClassAndInjectStyleRule as (this: Object, ...arg1: unknown[]) => void),
1115
+ [{value: pseudoElementName}, {value: !hidden}]);
1116
+ object.release();
1117
+ this.setMarker('hidden-marker', hidden ? null : true);
1118
+
1119
+ function toggleClassAndInjectStyleRule(this: Element, pseudoElementName: string|null, hidden: boolean): void {
1120
+ const classNamePrefix = '__web-inspector-hide';
1121
+ const classNameSuffix = '-shortcut__';
1122
+ const styleTagId = '__web-inspector-hide-shortcut-style__';
1123
+ const pseudoElementNameEscaped = pseudoElementName ? pseudoElementName.replace(/[\(\)\:]/g, '_') : '';
1124
+ const className = classNamePrefix + pseudoElementNameEscaped + classNameSuffix;
1125
+ this.classList.toggle(className, hidden);
1126
+
1127
+ let localRoot: Element|HTMLHeadElement = this;
1128
+ while (localRoot.parentNode) {
1129
+ localRoot = (localRoot.parentNode as Element);
1130
+ }
1131
+ if (localRoot.nodeType === Node.DOCUMENT_NODE) {
1132
+ localRoot = document.head;
1133
+ }
1134
+
1135
+ let style = localRoot.querySelector('style#' + styleTagId);
1136
+ if (!style) {
1137
+ const selectors = [];
1138
+ selectors.push('.__web-inspector-hide-shortcut__');
1139
+ selectors.push('.__web-inspector-hide-shortcut__ *');
1140
+ const selector = selectors.join(', ');
1141
+ const ruleBody = ' visibility: hidden !important;';
1142
+ const rule = '\n' + selector + '\n{\n' + ruleBody + '\n}\n';
1143
+
1144
+ style = document.createElement('style');
1145
+ style.id = styleTagId;
1146
+ style.textContent = rule;
1147
+
1148
+ localRoot.appendChild(style);
1149
+ }
1150
+
1151
+ // In addition to putting them on the element we want to hide, we will
1152
+ // also add pseudo element classes to the style element to keep track of
1153
+ // which pseudo elements we have style rules for.
1154
+ if (pseudoElementName && !style.classList.contains(className)) {
1155
+ style.classList.add(className);
1156
+ style.textContent = `.${className}${pseudoElementName}, ${style.textContent}`;
1157
+ }
1158
+ }
1159
+ }
1160
+
1161
+ isToggledToHidden(): boolean {
1162
+ return Boolean(this.marker('hidden-marker'));
1163
+ }
1164
+
1069
1165
  isXMLNode(): boolean {
1070
1166
  return Boolean(this.#xmlVersion);
1071
1167
  }
@@ -2425,6 +2521,9 @@ export class DOMNodeSnapshot extends DOMNode {
2425
2521
  _callback?: ((arg0: string|null, arg1: DOMNode|null) => void)|undefined): void {
2426
2522
  }
2427
2523
 
2524
+ override duplicate(): void {
2525
+ }
2526
+
2428
2527
  override canInspectNode(): boolean {
2429
2528
  return false;
2430
2529
  }
@@ -2474,6 +2573,9 @@ export class DOMDocumentSnapshot extends DOMDocument {
2474
2573
  _callback?: ((arg0: string|null, arg1: DOMNode|null) => void)|undefined): void {
2475
2574
  }
2476
2575
 
2576
+ override duplicate(): void {
2577
+ }
2578
+
2477
2579
  override canInspectNode(): boolean {
2478
2580
  return false;
2479
2581
  }
@@ -12,6 +12,7 @@ import {SDKModel} from './SDKModel.js';
12
12
  import {
13
13
  avifFormatDisabledSettingDescriptor,
14
14
  cpuPressureSettingDescriptor,
15
+ emulateAutoDarkModeSettingDescriptor,
15
16
  emulatedCSSMediaFeatureColorGamutSettingDescriptor,
16
17
  emulatedCSSMediaFeatureForcedColorsSettingDescriptor,
17
18
  emulatedCSSMediaFeaturePrefersColorSchemeSettingDescriptor,
@@ -27,6 +28,7 @@ import {
27
28
  jpegXlFormatDisabledSettingDescriptor,
28
29
  localFontsDisabledSettingDescriptor,
29
30
  touchSettingDescriptor,
31
+ webpFormatDisabledSettingDescriptor,
30
32
  } from './SDKSettings.js';
31
33
  import {Capability, type Target} from './Target.js';
32
34
 
@@ -180,7 +182,7 @@ export class EmulationModel extends SDKModel<EmulationModelEventTypes> implement
180
182
  });
181
183
  void this.updateCssMedia();
182
184
 
183
- const autoDarkModeSetting = settings.moduleSetting('emulate-auto-dark-mode');
185
+ const autoDarkModeSetting = settings.resolve(emulateAutoDarkModeSettingDescriptor);
184
186
  autoDarkModeSetting.addChangeListener(() => {
185
187
  const enabled = autoDarkModeSetting.get();
186
188
  mediaFeaturePrefersColorSchemeSetting.set(enabled ? 'dark' : '');
@@ -213,7 +215,7 @@ export class EmulationModel extends SDKModel<EmulationModelEventTypes> implement
213
215
 
214
216
  const avifFormatDisabledSetting = settings.resolve(avifFormatDisabledSettingDescriptor);
215
217
  const jpegXlFormatDisabledSetting = settings.resolve(jpegXlFormatDisabledSettingDescriptor);
216
- const webpFormatDisabledSetting = settings.moduleSetting('webp-format-disabled');
218
+ const webpFormatDisabledSetting = settings.resolve(webpFormatDisabledSettingDescriptor);
217
219
 
218
220
  const updateDisabledImageFormats = (): void => {
219
221
  const types = [];
@@ -26,6 +26,7 @@ import {
26
26
  } from './NetworkRequest.js';
27
27
  import {type ExecutionContext, RuntimeModel} from './RuntimeModel.js';
28
28
  import {SDKModel} from './SDKModel.js';
29
+ import {cacheDisabledSettingDescriptor, requestBlockingEnabledSettingDescriptor} from './SDKSettings.js';
29
30
  import {Capability, type Target} from './Target.js';
30
31
  import {type SDKModelObserver, TargetManager} from './TargetManager.js';
31
32
 
@@ -187,7 +188,7 @@ export class NetworkManager extends SDKModel<EventTypes> {
187
188
  const settings = this.target().targetManager().settings;
188
189
  this.activeNetworkThrottlingKey = activeNetworkThrottlingKeySetting(settings);
189
190
 
190
- if (settings.moduleSetting('cache-disabled').get()) {
191
+ if (settings.resolve(cacheDisabledSettingDescriptor).get()) {
191
192
  void this.#networkAgent.invoke_setCacheDisabled({cacheDisabled: true});
192
193
  }
193
194
 
@@ -211,7 +212,7 @@ export class NetworkManager extends SDKModel<EventTypes> {
211
212
  }
212
213
  this.#bypassServiceWorkerSetting.addChangeListener(this.bypassServiceWorkerChanged, this);
213
214
 
214
- settings.moduleSetting('cache-disabled').addChangeListener(this.cacheDisabledSettingChanged, this);
215
+ settings.resolve(cacheDisabledSettingDescriptor).addChangeListener(this.cacheDisabledSettingChanged, this);
215
216
  }
216
217
 
217
218
  static forRequest(request: NetworkRequest): NetworkManager|null {
@@ -555,7 +556,7 @@ export class NetworkManager extends SDKModel<EventTypes> {
555
556
 
556
557
  override dispose(): void {
557
558
  const settings = this.target().targetManager().settings;
558
- settings.moduleSetting('cache-disabled').removeChangeListener(this.cacheDisabledSettingChanged, this);
559
+ settings.resolve(cacheDisabledSettingDescriptor).removeChangeListener(this.cacheDisabledSettingChanged, this);
559
560
  settings.moduleSetting('network-log.preserve-log').removeChangeListener(this.preserveLogChanged, this);
560
561
  }
561
562
 
@@ -1992,7 +1993,7 @@ export class RequestConditions extends Common.ObjectWrapper.ObjectWrapper<Reques
1992
1993
  constructor(settings: Common.Settings.Settings) {
1993
1994
  super();
1994
1995
  this.#setting = settings.createSetting<RequestConditionsSetting[]>('network-blocked-patterns', []);
1995
- this.#conditionsEnabledSetting = settings.moduleSetting<boolean>('request-blocking-enabled');
1996
+ this.#conditionsEnabledSetting = settings.resolve(requestBlockingEnabledSettingDescriptor);
1996
1997
  for (const condition of this.#setting.get()) {
1997
1998
  try {
1998
1999
  this.#conditions.push(RequestCondition.createFromSetting(condition, settings));
@@ -2433,8 +2434,8 @@ export class MultitargetNetworkManager extends Common.ObjectWrapper.ObjectWrappe
2433
2434
 
2434
2435
  private async updateInterceptionPatterns(): Promise<void> {
2435
2436
  const settings = this.#targetManager.settings;
2436
- if (!settings.moduleSetting('cache-disabled').get()) {
2437
- settings.moduleSetting('cache-disabled').set(true);
2437
+ if (!settings.resolve(cacheDisabledSettingDescriptor).get()) {
2438
+ settings.resolve(cacheDisabledSettingDescriptor).set(true);
2438
2439
  }
2439
2440
  this.#updatingInterceptionPatternsPromise = null;
2440
2441
  const promises = ([] as Array<Promise<unknown>>);
@@ -17,6 +17,7 @@ import {
17
17
  type ResourceTreeFrame,
18
18
  ResourceTreeModel,
19
19
  } from './ResourceTreeModel.js';
20
+ import {cacheDisabledSettingDescriptor, enableRemoteFileLoadingSettingDescriptor} from './SDKSettings.js';
20
21
  import type {Target} from './Target.js';
21
22
  import {TargetManager} from './TargetManager.js';
22
23
 
@@ -433,7 +434,7 @@ export class PageResourceLoader extends Common.ObjectWrapper.ObjectWrapper<Event
433
434
  }> {
434
435
  const networkManager = (target.model(NetworkManager) as NetworkManager);
435
436
  const ioModel = (target.model(IOModel) as IOModel);
436
- const disableCache = this.#settings.moduleSetting('cache-disabled').get();
437
+ const disableCache = this.#settings.resolve(cacheDisabledSettingDescriptor).get();
437
438
  const resource = await networkManager.loadNetworkResource(frameId, url, {disableCache, includeCredentials: true});
438
439
  try {
439
440
  const content = resource.stream ?
@@ -470,11 +471,11 @@ export class PageResourceLoader extends Common.ObjectWrapper.ObjectWrapper<Event
470
471
  headers['User-Agent'] = currentUserAgent;
471
472
  }
472
473
 
473
- if (this.#settings.moduleSetting('cache-disabled').get()) {
474
+ if (this.#settings.resolve(cacheDisabledSettingDescriptor).get()) {
474
475
  headers['Cache-Control'] = 'no-cache';
475
476
  }
476
477
 
477
- const allowRemoteFilePaths = this.#settings.moduleSetting('network.enable-remote-file-loading').get();
478
+ const allowRemoteFilePaths = this.#settings.resolve(enableRemoteFileLoadingSettingDescriptor).get();
478
479
 
479
480
  return await new Promise(
480
481
  resolve => Host.ResourceLoader.load(url, headers, (success, _responseHeaders, content, errorDescription) => {
@@ -19,6 +19,7 @@ import {
19
19
  ScopeRemoteObject,
20
20
  } from './RemoteObject.js';
21
21
  import {SDKModel} from './SDKModel.js';
22
+ import {customFormattersSettingDescriptor} from './SDKSettings.js';
22
23
  import {Capability, type Target, Type} from './Target.js';
23
24
 
24
25
  export class RuntimeModel extends SDKModel<EventTypes> {
@@ -32,12 +33,13 @@ export class RuntimeModel extends SDKModel<EventTypes> {
32
33
  this.target().registerRuntimeDispatcher(new RuntimeDispatcher(this));
33
34
  void this.agent.invoke_enable();
34
35
 
35
- const settings = this.target().targetManager().context.get(Common.Settings.Settings);
36
- if (settings.moduleSetting('custom-formatters').get()) {
36
+ const customFormattersSetting =
37
+ this.target().targetManager().context.get(Common.Settings.Settings).resolve(customFormattersSettingDescriptor);
38
+ if (customFormattersSetting.get()) {
37
39
  void this.agent.invoke_setCustomObjectFormatterEnabled({enabled: true});
38
40
  }
39
41
 
40
- settings.moduleSetting('custom-formatters').addChangeListener(this.customFormattersStateChanged.bind(this));
42
+ customFormattersSetting.addChangeListener(this.customFormattersStateChanged.bind(this));
41
43
  }
42
44
 
43
45
  static isSideEffectFailure(response: Protocol.Runtime.EvaluateResponse|EvaluationResult): boolean {
@@ -265,3 +265,50 @@ export const jpegXlFormatDisabledSettingDescriptor: Common.Settings.SettingDescr
265
265
  defaultValue: false,
266
266
  storageType: Common.Settings.SettingStorageType.SESSION,
267
267
  };
268
+
269
+ export const webpFormatDisabledSettingDescriptor: Common.Settings.SettingDescriptor<boolean> = {
270
+ name: 'webp-format-disabled',
271
+ type: Common.Settings.SettingType.BOOLEAN,
272
+ defaultValue: false,
273
+ storageType: Common.Settings.SettingStorageType.SESSION,
274
+ };
275
+
276
+ export const customFormattersSettingDescriptor: Common.Settings.SettingDescriptor<boolean> = {
277
+ name: 'custom-formatters',
278
+ type: Common.Settings.SettingType.BOOLEAN,
279
+ defaultValue: false,
280
+ };
281
+
282
+ export const requestBlockingEnabledSettingDescriptor: Common.Settings.SettingDescriptor<boolean> = {
283
+ name: 'request-blocking-enabled',
284
+ type: Common.Settings.SettingType.BOOLEAN,
285
+ defaultValue: false,
286
+ storageType: Common.Settings.SettingStorageType.LOCAL,
287
+ };
288
+
289
+ export const cacheDisabledSettingDescriptor: Common.Settings.SettingDescriptor<boolean> = {
290
+ name: 'cache-disabled',
291
+ type: Common.Settings.SettingType.BOOLEAN,
292
+ defaultValue: false,
293
+ };
294
+
295
+ export const emulateAutoDarkModeSettingDescriptor: Common.Settings.SettingDescriptor<boolean> = {
296
+ name: 'emulate-auto-dark-mode',
297
+ type: Common.Settings.SettingType.BOOLEAN,
298
+ defaultValue: false,
299
+ storageType: Common.Settings.SettingStorageType.SESSION,
300
+ };
301
+
302
+ export const enableRemoteFileLoadingSettingDescriptor: Common.Settings.SettingDescriptor<boolean> = {
303
+ name: 'network.enable-remote-file-loading',
304
+ type: Common.Settings.SettingType.BOOLEAN,
305
+ defaultValue: false,
306
+ storageType: Common.Settings.SettingStorageType.SYNCED,
307
+ };
308
+
309
+ export const consoleUserActivationEvalSettingDescriptor: Common.Settings.SettingDescriptor<boolean> = {
310
+ name: 'console-user-activation-eval',
311
+ type: Common.Settings.SettingType.BOOLEAN,
312
+ defaultValue: true,
313
+ storageType: Common.Settings.SettingStorageType.SYNCED,
314
+ };
@@ -6,56 +6,6 @@ import * as Common from '../common/common.js';
6
6
  import * as i18n from '../i18n/i18n.js';
7
7
 
8
8
  const UIStrings = {
9
- /**
10
- * @description Title of a setting that disables WebP format.
11
- */
12
- disableWebpFormat: 'Disable `WebP` format',
13
- /**
14
- * @description Title of a setting that enables WebP format.
15
- */
16
- enableWebpFormat: 'Enable `WebP` format',
17
- /**
18
- * @description Title of a setting under the Console category in Settings.
19
- */
20
- customFormatters: 'Custom formatters',
21
- /**
22
- * @description Title of a setting under the Network category.
23
- */
24
- networkRequestBlocking: 'Network request blocking',
25
- /**
26
- * @description Title of a setting under the Network category that can be invoked through the Command Menu.
27
- */
28
- enableNetworkRequestBlocking: 'Enable network request blocking',
29
- /**
30
- * @description Title of a setting under the Network category that can be invoked through the Command Menu.
31
- */
32
- disableNetworkRequestBlocking: 'Disable network request blocking',
33
- /**
34
- * @description Title of a setting under the Network category that can be invoked through the Command Menu.
35
- */
36
- enableCache: 'Enable cache',
37
- /**
38
- * @description Title of a setting under the Network category that can be invoked through the Command Menu.
39
- */
40
- disableCache: 'Disable cache while DevTools is open',
41
- /**
42
- * @description The name of a checkbox setting in the Rendering tool. This setting
43
- * emulates that the webpage is in auto dark mode.
44
- */
45
- emulateAutoDarkMode: 'Emulate auto dark mode',
46
- /**
47
- * @description Label of a checkbox in the DevTools settings UI.
48
- */
49
- enableRemoteFileLoading: 'Allow loading remote file path resources in DevTools',
50
- /**
51
- * @description Tooltip text for a setting that controls whether external resource can be loaded in DevTools.
52
- */
53
- remoteFileLoadingInfo: 'Example resources are source maps. Disabled by default for security reasons.',
54
- /**
55
- * @description Tooltip text for a setting that controls the network cache. Disabling the network cache can simulate the network connections of users that are visiting a page for the first time.
56
- */
57
- networkCacheExplanation:
58
- 'Disabling the network cache will simulate a network experience similar to a first time visitor.',
59
9
  /**
60
10
  * @description Title of a setting under the Console category in Settings.
61
11
  */
@@ -71,94 +21,6 @@ const UIStrings = {
71
21
  const str_ = i18n.i18n.registerUIStrings('core/sdk/sdk-meta.ts', UIStrings);
72
22
  const i18nLazyString = i18n.i18n.getLazilyComputedLocalizedString.bind(undefined, str_);
73
23
 
74
- Common.Settings.registerSettingExtension({
75
- category: Common.Settings.SettingCategory.RENDERING,
76
- settingName: 'webp-format-disabled',
77
- settingType: Common.Settings.SettingType.BOOLEAN,
78
- storageType: Common.Settings.SettingStorageType.SESSION,
79
- options: [
80
- {
81
- value: true,
82
- title: i18nLazyString(UIStrings.disableWebpFormat),
83
- },
84
- {
85
- value: false,
86
- title: i18nLazyString(UIStrings.enableWebpFormat),
87
- },
88
- ],
89
- defaultValue: false,
90
- });
91
-
92
- Common.Settings.registerSettingExtension({
93
- category: Common.Settings.SettingCategory.CONSOLE,
94
- title: i18nLazyString(UIStrings.customFormatters),
95
- settingName: 'custom-formatters',
96
- settingType: Common.Settings.SettingType.BOOLEAN,
97
- defaultValue: false,
98
- });
99
-
100
- Common.Settings.registerSettingExtension({
101
- category: Common.Settings.SettingCategory.NETWORK,
102
- title: i18nLazyString(UIStrings.networkRequestBlocking),
103
- settingName: 'request-blocking-enabled',
104
- settingType: Common.Settings.SettingType.BOOLEAN,
105
- storageType: Common.Settings.SettingStorageType.LOCAL,
106
- defaultValue: false,
107
- options: [
108
- {
109
- value: true,
110
- title: i18nLazyString(UIStrings.enableNetworkRequestBlocking),
111
- },
112
- {
113
- value: false,
114
- title: i18nLazyString(UIStrings.disableNetworkRequestBlocking),
115
- },
116
- ],
117
- });
118
-
119
- Common.Settings.registerSettingExtension({
120
- category: Common.Settings.SettingCategory.NETWORK,
121
- title: i18nLazyString(UIStrings.disableCache),
122
- settingName: 'cache-disabled',
123
- settingType: Common.Settings.SettingType.BOOLEAN,
124
- order: 0,
125
- defaultValue: false,
126
- options: [
127
- {
128
- value: true,
129
- title: i18nLazyString(UIStrings.disableCache),
130
- },
131
- {
132
- value: false,
133
- title: i18nLazyString(UIStrings.enableCache),
134
- },
135
- ],
136
- learnMore: {
137
- tooltip: i18nLazyString(UIStrings.networkCacheExplanation),
138
- },
139
- });
140
-
141
- Common.Settings.registerSettingExtension({
142
- category: Common.Settings.SettingCategory.RENDERING,
143
- title: i18nLazyString(UIStrings.emulateAutoDarkMode),
144
- settingName: 'emulate-auto-dark-mode',
145
- settingType: Common.Settings.SettingType.BOOLEAN,
146
- storageType: Common.Settings.SettingStorageType.SESSION,
147
- defaultValue: false,
148
- });
149
-
150
- Common.Settings.registerSettingExtension({
151
- category: Common.Settings.SettingCategory.SOURCES,
152
- storageType: Common.Settings.SettingStorageType.SYNCED,
153
- title: i18nLazyString(UIStrings.enableRemoteFileLoading),
154
- settingName: 'network.enable-remote-file-loading',
155
- settingType: Common.Settings.SettingType.BOOLEAN,
156
- defaultValue: false,
157
- learnMore: {
158
- tooltip: i18nLazyString(UIStrings.remoteFileLoadingInfo),
159
- },
160
- });
161
-
162
24
  Common.Settings.registerSettingExtension({
163
25
  category: Common.Settings.SettingCategory.CONSOLE,
164
26
  storageType: Common.Settings.SettingStorageType.SYNCED,
@@ -230,7 +230,8 @@ export class RenderingOptionsView extends UI.Widget.VBox {
230
230
  this.#appendCheckbox(i18nString(UIStrings.emulateAFocusedPage), i18nString(UIStrings.emulatesAFocusedPage),
231
231
  Common.Settings.Settings.instance().resolve(SDK.SDKSettings.emulatePageFocusSettingDescriptor),
232
232
  {toggle: Host.UserMetrics.Action.ToggleEmulateFocusedPageFromRenderingTab});
233
- const autoDarkModeSetting = Common.Settings.Settings.instance().moduleSetting('emulate-auto-dark-mode');
233
+ const autoDarkModeSetting =
234
+ Common.Settings.Settings.instance().resolve(SDK.SDKSettings.emulateAutoDarkModeSettingDescriptor);
234
235
  this.#appendCheckbox(i18nString(UIStrings.emulateAutoDarkMode), i18nString(UIStrings.emulatesAutoDarkMode),
235
236
  autoDarkModeSetting);
236
237
 
@@ -284,7 +285,8 @@ export class RenderingOptionsView extends UI.Widget.VBox {
284
285
  Common.Settings.Settings.instance().resolve(SDK.SDKSettings.avifFormatDisabledSettingDescriptor);
285
286
  const jpegXlFormatDisabledSetting =
286
287
  Common.Settings.Settings.instance().resolve(SDK.SDKSettings.jpegXlFormatDisabledSettingDescriptor);
287
- const webpFormatDisabledSetting = Common.Settings.Settings.instance().moduleSetting('webp-format-disabled');
288
+ const webpFormatDisabledSetting =
289
+ Common.Settings.Settings.instance().resolve(SDK.SDKSettings.webpFormatDisabledSettingDescriptor);
288
290
 
289
291
  this.#appendCheckbox(
290
292
  i18nString(UIStrings.disableAvifImageFormat), i18nString(UIStrings.requiresAPageReloadToApplyAnd),
@@ -11,6 +11,11 @@ import * as SettingsUI from '../../ui/settings/settings.js';
11
11
  import type * as InspectorMain from './inspector_main.js';
12
12
 
13
13
  const UIStrings = {
14
+ /**
15
+ * @description The name of a checkbox setting in the Rendering tool. This setting
16
+ * emulates that the webpage is in auto dark mode.
17
+ */
18
+ emulateAutoDarkMode: 'Emulate auto dark mode',
14
19
  /**
15
20
  * @description Title of an option under the Rendering category that can be invoked through the Command Menu.
16
21
  */
@@ -296,6 +301,14 @@ const UIStrings = {
296
301
  * @description Title of a setting that enables JPEG XL format.
297
302
  */
298
303
  enableJpegXlFormat: 'Enable `JPEG XL` format',
304
+ /**
305
+ * @description Title of a setting that disables WebP format.
306
+ */
307
+ disableWebpFormat: 'Disable `WebP` format',
308
+ /**
309
+ * @description Title of a setting that enables WebP format.
310
+ */
311
+ enableWebpFormat: 'Enable `WebP` format',
299
312
  /**
300
313
  * @description Title of an action that reloads the inspected page.
301
314
  */
@@ -938,3 +951,22 @@ SettingsUI.SettingUIRegistration.register(SDK.SDKSettings.jpegXlFormatDisabledSe
938
951
  },
939
952
  ],
940
953
  });
954
+
955
+ SettingsUI.SettingUIRegistration.register(SDK.SDKSettings.webpFormatDisabledSettingDescriptor, {
956
+ category: Common.Settings.SettingCategory.RENDERING,
957
+ options: [
958
+ {
959
+ value: true,
960
+ title: i18nLazyString(UIStrings.disableWebpFormat),
961
+ },
962
+ {
963
+ value: false,
964
+ title: i18nLazyString(UIStrings.enableWebpFormat),
965
+ },
966
+ ],
967
+ });
968
+
969
+ SettingsUI.SettingUIRegistration.register(SDK.SDKSettings.emulateAutoDarkModeSettingDescriptor, {
970
+ category: Common.Settings.SettingCategory.RENDERING,
971
+ title: i18nLazyString(UIStrings.emulateAutoDarkMode),
972
+ });
@@ -216,7 +216,7 @@ export class MainImpl {
216
216
 
217
217
  // Mark 'cache-disabled' as requiring user interaction when multiple CDP clients are attached.
218
218
  if (Root.Runtime.Runtime.queryParam('hasOtherClients')) {
219
- this.#universe.settings.moduleSetting('cache-disabled').setRequiresUserAction(true);
219
+ this.#universe.settings.resolve(SDK.SDKSettings.cacheDisabledSettingDescriptor).setRequiresUserAction(true);
220
220
  }
221
221
 
222
222
  Root.Runtime.experiments.removeAllExperimentsFromLocalStorage();
@@ -565,6 +565,8 @@ inspectorBackend.registerCommand("Emulation.setVisibleSize", [{"name": "width",
565
565
  inspectorBackend.registerCommand("Emulation.setDisabledImageTypes", [{"name": "imageTypes", "type": "array", "optional": false, "description": "Image types to disable.", "typeRef": "Emulation.DisabledImageType"}], [], "");
566
566
  inspectorBackend.registerCommand("Emulation.setDataSaverOverride", [{"name": "dataSaverEnabled", "type": "boolean", "optional": true, "description": "Override value. Omitting the parameter disables the override.", "typeRef": null}], [], "Override the value of navigator.connection.saveData");
567
567
  inspectorBackend.registerCommand("Emulation.setHardwareConcurrencyOverride", [{"name": "hardwareConcurrency", "type": "number", "optional": false, "description": "Hardware concurrency to report", "typeRef": null}], [], "");
568
+ inspectorBackend.registerEnum("Emulation.SetCPUPerformanceOverrideRequestPerformanceTier", {Unknown: "unknown", Low: "low", Mid: "mid", High: "high", Ultra: "ultra"});
569
+ inspectorBackend.registerCommand("Emulation.setCPUPerformanceOverride", [{"name": "performanceTier", "type": "string", "optional": true, "description": "Override value. Omitting the parameter disables the override.", "typeRef": "Emulation.SetCPUPerformanceOverrideRequestPerformanceTier"}], [], "Overrides the value of navigator.cpuPerformance");
568
570
  inspectorBackend.registerCommand("Emulation.setUserAgentOverride", [{"name": "userAgent", "type": "string", "optional": false, "description": "User agent to use.", "typeRef": null}, {"name": "acceptLanguage", "type": "string", "optional": true, "description": "Browser language to emulate.", "typeRef": null}, {"name": "platform", "type": "string", "optional": true, "description": "The platform navigator.platform should return.", "typeRef": null}, {"name": "userAgentMetadata", "type": "object", "optional": true, "description": "To be sent in Sec-CH-UA-* headers and returned in navigator.userAgentData", "typeRef": "Emulation.UserAgentMetadata"}], [], "Allows overriding user agent with the given string. `userAgentMetadata` must be set for Client Hint headers to be sent.");
569
571
  inspectorBackend.registerCommand("Emulation.setAutomationOverride", [{"name": "enabled", "type": "boolean", "optional": false, "description": "Whether the override should be enabled.", "typeRef": null}], [], "Allows overriding the automation flag.");
570
572
  inspectorBackend.registerCommand("Emulation.setSmallViewportHeightDifferenceOverride", [{"name": "difference", "type": "number", "optional": false, "description": "This will cause an element of size 100svh to be `difference` pixels smaller than an element of size 100lvh.", "typeRef": null}], [], "Allows overriding the difference between the small and large viewport sizes, which determine the value of the `svh` and `lvh` unit, respectively. Only supported for top-level frames.");
@@ -1036,7 +1038,7 @@ inspectorBackend.registerEnum("Page.AdFrameExplanation", {ParentIsAd: "ParentIsA
1036
1038
  inspectorBackend.registerEnum("Page.SecureContextType", {Secure: "Secure", SecureLocalhost: "SecureLocalhost", InsecureScheme: "InsecureScheme", InsecureAncestor: "InsecureAncestor"});
1037
1039
  inspectorBackend.registerEnum("Page.CrossOriginIsolatedContextType", {Isolated: "Isolated", NotIsolated: "NotIsolated", NotIsolatedFeatureDisabled: "NotIsolatedFeatureDisabled"});
1038
1040
  inspectorBackend.registerEnum("Page.GatedAPIFeatures", {SharedArrayBuffers: "SharedArrayBuffers", SharedArrayBuffersTransferAllowed: "SharedArrayBuffersTransferAllowed", PerformanceMeasureMemory: "PerformanceMeasureMemory", PerformanceProfile: "PerformanceProfile"});
1039
- inspectorBackend.registerEnum("Page.PermissionsPolicyFeature", {Accelerometer: "accelerometer", AllScreensCapture: "all-screens-capture", AmbientLightSensor: "ambient-light-sensor", AriaNotify: "aria-notify", Autofill: "autofill", Autoplay: "autoplay", Bluetooth: "bluetooth", BrowsingTopics: "browsing-topics", Camera: "camera", CapturedSurfaceControl: "captured-surface-control", ChDpr: "ch-dpr", ChDeviceMemory: "ch-device-memory", ChDownlink: "ch-downlink", ChEct: "ch-ect", ChPrefersColorScheme: "ch-prefers-color-scheme", ChPrefersReducedMotion: "ch-prefers-reduced-motion", ChPrefersReducedTransparency: "ch-prefers-reduced-transparency", ChRtt: "ch-rtt", ChSaveData: "ch-save-data", ChUa: "ch-ua", ChUaArch: "ch-ua-arch", ChUaBitness: "ch-ua-bitness", ChUaHighEntropyValues: "ch-ua-high-entropy-values", ChUaPlatform: "ch-ua-platform", ChUaModel: "ch-ua-model", ChUaMobile: "ch-ua-mobile", ChUaFormFactors: "ch-ua-form-factors", ChUaFullVersion: "ch-ua-full-version", ChUaFullVersionList: "ch-ua-full-version-list", ChUaPlatformVersion: "ch-ua-platform-version", ChUaWow64: "ch-ua-wow64", ChViewportHeight: "ch-viewport-height", ChViewportWidth: "ch-viewport-width", ChWidth: "ch-width", ClipboardRead: "clipboard-read", ClipboardWrite: "clipboard-write", ComputePressure: "compute-pressure", ControlledFrame: "controlled-frame", CrossOriginIsolated: "cross-origin-isolated", DeferredFetch: "deferred-fetch", DeferredFetchMinimal: "deferred-fetch-minimal", DeviceAttributes: "device-attributes", DigitalCredentialsCreate: "digital-credentials-create", DigitalCredentialsGet: "digital-credentials-get", DirectSockets: "direct-sockets", DirectSocketsMulticast: "direct-sockets-multicast", DisplayCapture: "display-capture", DocumentDomain: "document-domain", EncryptedMedia: "encrypted-media", ExecutionWhileOutOfViewport: "execution-while-out-of-viewport", ExecutionWhileNotRendered: "execution-while-not-rendered", FocusWithoutUserActivation: "focus-without-user-activation", Fullscreen: "fullscreen", Frobulate: "frobulate", Gamepad: "gamepad", Geolocation: "geolocation", Gyroscope: "gyroscope", Hid: "hid", IdentityCredentialsGet: "identity-credentials-get", IdleDetection: "idle-detection", InterestCohort: "interest-cohort", JoinAdInterestGroup: "join-ad-interest-group", KeyboardMap: "keyboard-map", LanguageDetector: "language-detector", LanguageModel: "language-model", LocalFonts: "local-fonts", LocalNetwork: "local-network", LocalNetworkAccess: "local-network-access", LoopbackNetwork: "loopback-network", Magnetometer: "magnetometer", ManualText: "manual-text", MediaPlaybackWhileNotVisible: "media-playback-while-not-visible", Microphone: "microphone", Midi: "midi", OnDeviceSpeechRecognition: "on-device-speech-recognition", OtpCredentials: "otp-credentials", Payment: "payment", PictureInPicture: "picture-in-picture", PrivateStateTokenIssuance: "private-state-token-issuance", PrivateStateTokenRedemption: "private-state-token-redemption", PublickeyCredentialsCreate: "publickey-credentials-create", PublickeyCredentialsGet: "publickey-credentials-get", RecordAdAuctionEvents: "record-ad-auction-events", Rewriter: "rewriter", RunAdAuction: "run-ad-auction", ScreenWakeLock: "screen-wake-lock", Serial: "serial", SharedStorage: "shared-storage", SharedStorageSelectUrl: "shared-storage-select-url", SmartCard: "smart-card", SpeakerSelection: "speaker-selection", StorageAccess: "storage-access", SubApps: "sub-apps", Summarizer: "summarizer", SyncXhr: "sync-xhr", Tools: "tools", Translator: "translator", Unload: "unload", Usb: "usb", UsbUnrestricted: "usb-unrestricted", VerticalScroll: "vertical-scroll", WebAppInstallation: "web-app-installation", Webnn: "webnn", WebPrinting: "web-printing", WebShare: "web-share", WindowManagement: "window-management", Writer: "writer", XrSpatialTracking: "xr-spatial-tracking"});
1041
+ inspectorBackend.registerEnum("Page.PermissionsPolicyFeature", {Accelerometer: "accelerometer", AllScreensCapture: "all-screens-capture", AmbientLightSensor: "ambient-light-sensor", AriaNotify: "aria-notify", Autofill: "autofill", Autoplay: "autoplay", Bluetooth: "bluetooth", BrowsingTopics: "browsing-topics", Camera: "camera", CapturedSurfaceControl: "captured-surface-control", ChDpr: "ch-dpr", ChDeviceMemory: "ch-device-memory", ChDownlink: "ch-downlink", ChEct: "ch-ect", ChPrefersColorScheme: "ch-prefers-color-scheme", ChPrefersReducedMotion: "ch-prefers-reduced-motion", ChPrefersReducedTransparency: "ch-prefers-reduced-transparency", ChRtt: "ch-rtt", ChSaveData: "ch-save-data", ChUa: "ch-ua", ChUaArch: "ch-ua-arch", ChUaBitness: "ch-ua-bitness", ChUaHighEntropyValues: "ch-ua-high-entropy-values", ChUaPlatform: "ch-ua-platform", ChUaModel: "ch-ua-model", ChUaMobile: "ch-ua-mobile", ChUaFormFactors: "ch-ua-form-factors", ChUaFullVersion: "ch-ua-full-version", ChUaFullVersionList: "ch-ua-full-version-list", ChUaPlatformVersion: "ch-ua-platform-version", ChUaWow64: "ch-ua-wow64", ChViewportHeight: "ch-viewport-height", ChViewportWidth: "ch-viewport-width", ChWidth: "ch-width", ClipboardRead: "clipboard-read", ClipboardWrite: "clipboard-write", ComputePressure: "compute-pressure", ControlledFrame: "controlled-frame", CrossOriginIsolated: "cross-origin-isolated", DeferredFetch: "deferred-fetch", DeferredFetchMinimal: "deferred-fetch-minimal", DeviceAttributes: "device-attributes", DigitalCredentialsCreate: "digital-credentials-create", DigitalCredentialsGet: "digital-credentials-get", DirectSockets: "direct-sockets", DirectSocketsMulticast: "direct-sockets-multicast", DisplayCapture: "display-capture", DocumentDomain: "document-domain", EncryptedMedia: "encrypted-media", ExecutionWhileOutOfViewport: "execution-while-out-of-viewport", ExecutionWhileNotRendered: "execution-while-not-rendered", FocusWithoutUserActivation: "focus-without-user-activation", Fullscreen: "fullscreen", Frobulate: "frobulate", Gamepad: "gamepad", Geolocation: "geolocation", Gyroscope: "gyroscope", Hid: "hid", IdentityCredentialsGet: "identity-credentials-get", IdleDetection: "idle-detection", InterestCohort: "interest-cohort", KeyboardMap: "keyboard-map", LanguageDetector: "language-detector", LanguageModel: "language-model", LocalFonts: "local-fonts", LocalNetwork: "local-network", LocalNetworkAccess: "local-network-access", LoopbackNetwork: "loopback-network", Magnetometer: "magnetometer", ManualText: "manual-text", MediaPlaybackWhileNotVisible: "media-playback-while-not-visible", Microphone: "microphone", Midi: "midi", OnDeviceSpeechRecognition: "on-device-speech-recognition", OtpCredentials: "otp-credentials", Payment: "payment", PictureInPicture: "picture-in-picture", PrivateStateTokenIssuance: "private-state-token-issuance", PrivateStateTokenRedemption: "private-state-token-redemption", PublickeyCredentialsCreate: "publickey-credentials-create", PublickeyCredentialsGet: "publickey-credentials-get", Rewriter: "rewriter", ScreenWakeLock: "screen-wake-lock", Serial: "serial", SharedStorage: "shared-storage", SharedStorageSelectUrl: "shared-storage-select-url", SmartCard: "smart-card", SpeakerSelection: "speaker-selection", StorageAccess: "storage-access", SubApps: "sub-apps", Summarizer: "summarizer", SyncXhr: "sync-xhr", Tools: "tools", Translator: "translator", Unload: "unload", Usb: "usb", UsbUnrestricted: "usb-unrestricted", VerticalScroll: "vertical-scroll", WebAppInstallation: "web-app-installation", Webnn: "webnn", WebPrinting: "web-printing", WebShare: "web-share", WindowManagement: "window-management", Writer: "writer", XrSpatialTracking: "xr-spatial-tracking"});
1040
1042
  inspectorBackend.registerEnum("Page.PermissionsPolicyBlockReason", {Header: "Header", IframeAttribute: "IframeAttribute", InFencedFrameTree: "InFencedFrameTree", InIsolatedApp: "InIsolatedApp"});
1041
1043
  inspectorBackend.registerEnum("Page.OriginTrialTokenStatus", {Success: "Success", NotSupported: "NotSupported", Insecure: "Insecure", Expired: "Expired", WrongOrigin: "WrongOrigin", InvalidSignature: "InvalidSignature", Malformed: "Malformed", WrongVersion: "WrongVersion", FeatureDisabled: "FeatureDisabled", TokenDisabled: "TokenDisabled", FeatureDisabledForUser: "FeatureDisabledForUser", UnknownTrial: "UnknownTrial"});
1042
1044
  inspectorBackend.registerEnum("Page.OriginTrialStatus", {Enabled: "Enabled", ValidTokenNotProvided: "ValidTokenNotProvided", OSNotSupported: "OSNotSupported", TrialNotAllowed: "TrialNotAllowed"});