chrome-devtools-frontend 1.0.1541169 → 1.0.1542501

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 (69) hide show
  1. package/docs/get_the_code.md +9 -0
  2. package/front_end/Tests.js +6 -1
  3. package/front_end/core/common/Settings.ts +140 -106
  4. package/front_end/core/host/UserMetrics.ts +5 -0
  5. package/front_end/core/sdk/IOModel.ts +1 -4
  6. package/front_end/core/sdk/ServerSentEventsProtocol.ts +4 -0
  7. package/front_end/entrypoints/main/MainImpl.ts +18 -7
  8. package/front_end/foundation/README.md +10 -0
  9. package/front_end/foundation/Universe.ts +21 -0
  10. package/front_end/foundation/foundation.ts +7 -0
  11. package/front_end/generated/SupportedCSSProperties.js +42 -42
  12. package/front_end/models/ai_assistance/BuiltInAi.ts +2 -1
  13. package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +44 -34
  14. package/front_end/models/ai_code_completion/AiCodeCompletion.ts +72 -31
  15. package/front_end/models/har/Importer.ts +14 -0
  16. package/front_end/models/issues_manager/IssuesManager.ts +0 -5
  17. package/front_end/models/javascript_metadata/NativeFunctions.js +0 -4
  18. package/front_end/models/trace/handlers/ScriptsHandler.ts +26 -0
  19. package/front_end/models/trace/types/TraceEvents.ts +1 -1
  20. package/front_end/panels/ai_assistance/AiAssistancePanel.ts +117 -103
  21. package/front_end/panels/ai_assistance/components/ChatView.ts +7 -31
  22. package/front_end/panels/ai_assistance/components/MarkdownRendererWithCodeBlock.ts +1 -1
  23. package/front_end/panels/ai_assistance/components/PerformanceAgentMarkdownRenderer.ts +1 -1
  24. package/front_end/panels/ai_assistance/components/chatView.css +1 -1
  25. package/front_end/panels/console/ConsoleInsightTeaser.ts +5 -0
  26. package/front_end/panels/console/ConsolePrompt.ts +8 -1
  27. package/front_end/panels/sources/AiCodeCompletionPlugin.ts +17 -1
  28. package/front_end/panels/timeline/overlays/components/EntryLabelOverlay.ts +4 -1
  29. package/front_end/third_party/chromium/README.chromium +1 -1
  30. package/front_end/third_party/puppeteer/README.chromium +2 -2
  31. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/NetworkManager.d.ts.map +1 -1
  32. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/NetworkManager.js +3 -1
  33. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/NetworkManager.js.map +1 -1
  34. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.d.ts +2 -2
  35. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.js +2 -2
  36. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/version.d.ts +1 -1
  37. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/version.js +1 -1
  38. package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.js +4 -4
  39. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/NetworkManager.d.ts.map +1 -1
  40. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/NetworkManager.js +3 -1
  41. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/NetworkManager.js.map +1 -1
  42. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.d.ts +2 -2
  43. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.js +2 -2
  44. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/version.d.ts +1 -1
  45. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/version.js +1 -1
  46. package/front_end/third_party/puppeteer/package/package.json +1 -1
  47. package/front_end/third_party/puppeteer/package/src/cdp/NetworkManager.ts +3 -1
  48. package/front_end/third_party/puppeteer/package/src/revisions.ts +2 -2
  49. package/front_end/third_party/puppeteer/package/src/util/version.ts +1 -1
  50. package/front_end/ui/components/markdown_view/MarkdownLinksMap.ts +0 -4
  51. package/front_end/ui/components/markdown_view/MarkdownView.docs.ts +95 -0
  52. package/front_end/ui/components/markdown_view/MarkdownView.ts +6 -7
  53. package/front_end/ui/components/text_editor/AiCodeCompletionProvider.ts +246 -13
  54. package/front_end/ui/components/text_editor/config.ts +1 -1
  55. package/front_end/ui/legacy/Widget.ts +13 -4
  56. package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +43 -33
  57. package/front_end/ui/visual_logging/KnownContextValues.ts +12 -0
  58. package/mcp/mcp.ts +2 -0
  59. package/package.json +1 -1
  60. package/front_end/models/issues_manager/UserReidentificationIssue.ts +0 -72
  61. package/front_end/models/issues_manager/descriptions/userReidentificationBlocked.md +0 -5
  62. package/front_end/ui/components/docs/markdown_image/basic.html +0 -19
  63. package/front_end/ui/components/docs/markdown_image/basic.ts +0 -38
  64. package/front_end/ui/components/docs/markdown_link/basic.html +0 -17
  65. package/front_end/ui/components/docs/markdown_link/basic.ts +0 -19
  66. package/front_end/ui/components/docs/markdown_view/basic.html +0 -25
  67. package/front_end/ui/components/docs/markdown_view/basic.ts +0 -67
  68. package/front_end/ui/components/docs/markdown_view/code-block.html +0 -30
  69. package/front_end/ui/components/docs/markdown_view/code-block.ts +0 -71
@@ -10,7 +10,6 @@ import type {EventDescriptor, EventTargetEvent, GenericEvents} from './EventTarg
10
10
  import {ObjectWrapper} from './Object.js';
11
11
  import {
12
12
  getLocalizedSettingsCategory,
13
- getRegisteredSettings as getRegisteredSettingsInternal,
14
13
  type LearnMore,
15
14
  maybeRemoveSettingExtension,
16
15
  type RegExpSettingItem,
@@ -25,7 +24,21 @@ import {
25
24
 
26
25
  let settingsInstance: Settings|undefined;
27
26
 
27
+ export interface SettingsCreationOptions {
28
+ syncedStorage: SettingsStorage;
29
+ globalStorage: SettingsStorage;
30
+ localStorage: SettingsStorage;
31
+ settingRegistrations: SettingRegistration[];
32
+ logSettingAccess?: (name: string, value: number|string|boolean) => Promise<void>;
33
+ runSettingsMigration?: boolean;
34
+ }
35
+
28
36
  export class Settings {
37
+ readonly syncedStorage: SettingsStorage;
38
+ readonly globalStorage: SettingsStorage;
39
+ readonly localStorage: SettingsStorage;
40
+
41
+ readonly #settingRegistrations: SettingRegistration[];
29
42
  readonly #sessionStorage = new SettingsStorage({});
30
43
  settingNameSet = new Set<string>();
31
44
  orderValuesBySettingCategory = new Map<SettingCategory, Set<number>>();
@@ -34,15 +47,16 @@ export class Settings {
34
47
  readonly moduleSettings = new Map<string, Setting<unknown>>();
35
48
  #logSettingAccess?: (name: string, value: number|string|boolean) => Promise<void>;
36
49
 
37
- private constructor(
38
- readonly syncedStorage: SettingsStorage,
39
- readonly globalStorage: SettingsStorage,
40
- readonly localStorage: SettingsStorage,
41
- logSettingAccess?: (name: string, value: number|string|boolean) => Promise<void>,
42
- ) {
50
+ constructor(
51
+ {syncedStorage, globalStorage, localStorage, settingRegistrations, logSettingAccess, runSettingsMigration}:
52
+ SettingsCreationOptions) {
53
+ this.syncedStorage = syncedStorage;
54
+ this.globalStorage = globalStorage;
55
+ this.localStorage = localStorage;
56
+ this.#settingRegistrations = settingRegistrations;
43
57
  this.#logSettingAccess = logSettingAccess;
44
58
 
45
- for (const registration of this.getRegisteredSettings()) {
59
+ for (const registration of this.#settingRegistrations) {
46
60
  const {settingName, defaultValue, storageType} = registration;
47
61
  const isRegex = registration.settingType === SettingType.REGEX;
48
62
 
@@ -60,10 +74,14 @@ export class Settings {
60
74
 
61
75
  this.registerModuleSetting(setting);
62
76
  }
77
+
78
+ if (runSettingsMigration) {
79
+ new VersionController(this).updateVersion();
80
+ }
63
81
  }
64
82
 
65
83
  getRegisteredSettings(): SettingRegistration[] {
66
- return getRegisteredSettingsInternal();
84
+ return this.#settingRegistrations;
67
85
  }
68
86
 
69
87
  static hasInstance(): boolean {
@@ -75,15 +93,27 @@ export class Settings {
75
93
  syncedStorage: SettingsStorage|null,
76
94
  globalStorage: SettingsStorage|null,
77
95
  localStorage: SettingsStorage|null,
96
+ settingRegistrations: SettingRegistration[]|null,
78
97
  logSettingAccess?: (name: string, value: number|string|boolean) => Promise<void>,
79
- } = {forceNew: null, syncedStorage: null, globalStorage: null, localStorage: null}): Settings {
80
- const {forceNew, syncedStorage, globalStorage, localStorage, logSettingAccess} = opts;
98
+ runSettingsMigration?: boolean,
99
+ } = {forceNew: null, syncedStorage: null, globalStorage: null, localStorage: null, settingRegistrations: null}):
100
+ Settings {
101
+ const {
102
+ forceNew,
103
+ syncedStorage,
104
+ globalStorage,
105
+ localStorage,
106
+ settingRegistrations,
107
+ logSettingAccess,
108
+ runSettingsMigration
109
+ } = opts;
81
110
  if (!settingsInstance || forceNew) {
82
- if (!syncedStorage || !globalStorage || !localStorage) {
111
+ if (!syncedStorage || !globalStorage || !localStorage || !settingRegistrations) {
83
112
  throw new Error(`Unable to create settings: global and local storage must be provided: ${new Error().stack}`);
84
113
  }
85
114
 
86
- settingsInstance = new Settings(syncedStorage, globalStorage, localStorage, logSettingAccess);
115
+ settingsInstance = new Settings(
116
+ {syncedStorage, globalStorage, localStorage, settingRegistrations, logSettingAccess, runSettingsMigration});
87
117
  }
88
118
 
89
119
  return settingsInstance;
@@ -186,7 +216,7 @@ export class Settings {
186
216
  this.globalStorage.removeAll();
187
217
  this.syncedStorage.removeAll();
188
218
  this.localStorage.removeAll();
189
- new VersionController().resetToCurrent();
219
+ new VersionController(this).resetToCurrent();
190
220
  }
191
221
 
192
222
  private storageFromType(storageType?: SettingStorageType): SettingsStorage {
@@ -298,16 +328,6 @@ export class SettingsStorage {
298
328
  }
299
329
  }
300
330
 
301
- function removeSetting(setting: {name: string, storage: SettingsStorage}): void {
302
- const name = setting.name;
303
- const settings = Settings.instance();
304
-
305
- settings.getRegistry().delete(name);
306
- settings.moduleSettings.delete(name);
307
-
308
- setting.storage.remove(name);
309
- }
310
-
311
331
  export class Deprecation {
312
332
  readonly disabled: boolean;
313
333
  readonly warning: Platform.UIString.LocalizedString;
@@ -654,17 +674,19 @@ export class VersionController {
654
674
 
655
675
  static readonly CURRENT_VERSION = 40;
656
676
 
677
+ readonly #settings: Settings;
657
678
  readonly #globalVersionSetting: Setting<number>;
658
679
  readonly #syncedVersionSetting: Setting<number>;
659
680
  readonly #localVersionSetting: Setting<number>;
660
681
 
661
- constructor() {
682
+ constructor(settings: Settings) {
683
+ this.#settings = settings;
662
684
  // If no version setting is found, we initialize with the current version and don't do anything.
663
- this.#globalVersionSetting = Settings.instance().createSetting(
685
+ this.#globalVersionSetting = this.#settings.createSetting(
664
686
  VersionController.GLOBAL_VERSION_SETTING_NAME, VersionController.CURRENT_VERSION, SettingStorageType.GLOBAL);
665
- this.#syncedVersionSetting = Settings.instance().createSetting(
687
+ this.#syncedVersionSetting = this.#settings.createSetting(
666
688
  VersionController.SYNCED_VERSION_SETTING_NAME, VersionController.CURRENT_VERSION, SettingStorageType.SYNCED);
667
- this.#localVersionSetting = Settings.instance().createSetting(
689
+ this.#localVersionSetting = this.#settings.createSetting(
668
690
  VersionController.LOCAL_VERSION_SETTING_NAME, VersionController.CURRENT_VERSION, SettingStorageType.LOCAL);
669
691
  }
670
692
 
@@ -678,6 +700,15 @@ export class VersionController {
678
700
  this.#localVersionSetting.set(VersionController.CURRENT_VERSION);
679
701
  }
680
702
 
703
+ #removeSetting(setting: {name: string, storage: SettingsStorage}): void {
704
+ const name = setting.name;
705
+
706
+ this.#settings.getRegistry().delete(name);
707
+ this.#settings.moduleSettings.delete(name);
708
+
709
+ setting.storage.remove(name);
710
+ }
711
+
681
712
  /**
682
713
  * Runs the appropriate migrations and updates the version settings accordingly.
683
714
  *
@@ -710,22 +741,22 @@ export class VersionController {
710
741
  }
711
742
 
712
743
  updateVersionFrom0To1(): void {
713
- this.clearBreakpointsWhenTooMany(Settings.instance().createLocalSetting('breakpoints', []), 500000);
744
+ this.clearBreakpointsWhenTooMany(this.#settings.createLocalSetting('breakpoints', []), 500000);
714
745
  }
715
746
 
716
747
  updateVersionFrom1To2(): void {
717
- Settings.instance().createSetting('previouslyViewedFiles', []).set([]);
748
+ this.#settings.createSetting('previouslyViewedFiles', []).set([]);
718
749
  }
719
750
 
720
751
  updateVersionFrom2To3(): void {
721
- Settings.instance().createSetting('fileSystemMapping', {}).set({});
722
- removeSetting(Settings.instance().createSetting('fileMappingEntries', []));
752
+ this.#settings.createSetting('fileSystemMapping', {}).set({});
753
+ this.#removeSetting(this.#settings.createSetting('fileMappingEntries', []));
723
754
  }
724
755
 
725
756
  updateVersionFrom3To4(): void {
726
- const advancedMode = Settings.instance().createSetting('showHeaSnapshotObjectsHiddenProperties', false);
727
- moduleSetting('showAdvancedHeapSnapshotProperties').set(advancedMode.get());
728
- removeSetting(advancedMode);
757
+ const advancedMode = this.#settings.createSetting('showHeaSnapshotObjectsHiddenProperties', false);
758
+ this.#settings.moduleSetting('showAdvancedHeapSnapshotProperties').set(advancedMode.get());
759
+ this.#removeSetting(advancedMode);
729
760
  }
730
761
 
731
762
  updateVersionFrom4To5(): void {
@@ -756,26 +787,26 @@ export class VersionController {
756
787
  const oldNameH = oldName + 'H';
757
788
 
758
789
  let newValue: object|null = null;
759
- const oldSetting = Settings.instance().createSetting(oldName, empty);
790
+ const oldSetting = this.#settings.createSetting(oldName, empty);
760
791
  if (oldSetting.get() !== empty) {
761
792
  newValue = newValue || {};
762
793
  // @ts-expect-error
763
794
  newValue.vertical = {};
764
795
  // @ts-expect-error
765
796
  newValue.vertical.size = oldSetting.get();
766
- removeSetting(oldSetting);
797
+ this.#removeSetting(oldSetting);
767
798
  }
768
- const oldSettingH = Settings.instance().createSetting(oldNameH, empty);
799
+ const oldSettingH = this.#settings.createSetting(oldNameH, empty);
769
800
  if (oldSettingH.get() !== empty) {
770
801
  newValue = newValue || {};
771
802
  // @ts-expect-error
772
803
  newValue.horizontal = {};
773
804
  // @ts-expect-error
774
805
  newValue.horizontal.size = oldSettingH.get();
775
- removeSetting(oldSettingH);
806
+ this.#removeSetting(oldSettingH);
776
807
  }
777
808
  if (newValue) {
778
- Settings.instance().createSetting(newName, {}).set(newValue);
809
+ this.#settings.createSetting(newName, {}).set(newValue);
779
810
  }
780
811
  }
781
812
  }
@@ -788,19 +819,19 @@ export class VersionController {
788
819
  };
789
820
 
790
821
  for (const oldName in settingNames) {
791
- const oldSetting = Settings.instance().createSetting(oldName, null);
822
+ const oldSetting = this.#settings.createSetting(oldName, null);
792
823
  if (oldSetting.get() === null) {
793
- removeSetting(oldSetting);
824
+ this.#removeSetting(oldSetting);
794
825
  continue;
795
826
  }
796
827
 
797
828
  const newName = settingNames[oldName];
798
829
  const invert = oldName === 'WebInspector.Drawer.showOnLoad';
799
830
  const hidden = oldSetting.get() !== invert;
800
- removeSetting(oldSetting);
831
+ this.#removeSetting(oldSetting);
801
832
  const showMode = hidden ? 'OnlyMain' : 'Both';
802
833
 
803
- const newSetting = Settings.instance().createSetting(newName, {});
834
+ const newSetting = this.#settings.createSetting(newName, {});
804
835
  const newValue = newSetting.get() || {};
805
836
 
806
837
  // @ts-expect-error
@@ -829,7 +860,7 @@ export class VersionController {
829
860
  const empty = {};
830
861
  for (const name in settingNames) {
831
862
  const setting =
832
- Settings.instance().createSetting<{vertical?: {size?: number}, horizontal?: {size?: number}}>(name, empty);
863
+ this.#settings.createSetting<{vertical?: {size?: number}, horizontal?: {size?: number}}>(name, empty);
833
864
  const value = setting.get();
834
865
  if (value === empty) {
835
866
  continue;
@@ -852,7 +883,7 @@ export class VersionController {
852
883
  const settingNames = ['skipStackFramesPattern', 'workspaceFolderExcludePattern'];
853
884
 
854
885
  for (let i = 0; i < settingNames.length; ++i) {
855
- const setting = Settings.instance().createSetting<string|unknown[]>(settingNames[i], '');
886
+ const setting = this.#settings.createSetting<string|unknown[]>(settingNames[i], '');
856
887
  let value = setting.get();
857
888
  if (!value) {
858
889
  return;
@@ -884,7 +915,7 @@ export class VersionController {
884
915
  updateVersionFrom10To11(): void {
885
916
  const oldSettingName = 'customDevicePresets';
886
917
  const newSettingName = 'customEmulatedDeviceList';
887
- const oldSetting = Settings.instance().createSetting<unknown>(oldSettingName, undefined);
918
+ const oldSetting = this.#settings.createSetting<unknown>(oldSettingName, undefined);
888
919
  const list = oldSetting.get();
889
920
  if (!Array.isArray(list)) {
890
921
  return;
@@ -914,9 +945,9 @@ export class VersionController {
914
945
  newList.push(device);
915
946
  }
916
947
  if (newList.length) {
917
- Settings.instance().createSetting<unknown[]>(newSettingName, []).set(newList);
948
+ this.#settings.createSetting<unknown[]>(newSettingName, []).set(newList);
918
949
  }
919
- removeSetting(oldSetting);
950
+ this.#removeSetting(oldSetting);
920
951
  }
921
952
 
922
953
  updateVersionFrom11To12(): void {
@@ -925,16 +956,16 @@ export class VersionController {
925
956
 
926
957
  updateVersionFrom12To13(): void {
927
958
  this.migrateSettingsFromLocalStorage();
928
- removeSetting(Settings.instance().createSetting('timelineOverviewMode', ''));
959
+ this.#removeSetting(this.#settings.createSetting('timelineOverviewMode', ''));
929
960
  }
930
961
 
931
962
  updateVersionFrom13To14(): void {
932
963
  const defaultValue = {throughput: -1, latency: 0};
933
- Settings.instance().createSetting('networkConditions', defaultValue).set(defaultValue);
964
+ this.#settings.createSetting('networkConditions', defaultValue).set(defaultValue);
934
965
  }
935
966
 
936
967
  updateVersionFrom14To15(): void {
937
- const setting = Settings.instance().createLocalSetting<any>('workspaceExcludedFolders', {});
968
+ const setting = this.#settings.createLocalSetting<any>('workspaceExcludedFolders', {});
938
969
  const oldValue = setting.get();
939
970
  const newValue: Record<string, string[]> = {};
940
971
  for (const fileSystemPath in oldValue) {
@@ -947,7 +978,7 @@ export class VersionController {
947
978
  }
948
979
 
949
980
  updateVersionFrom15To16(): void {
950
- const setting = Settings.instance().createSetting<any>('InspectorView.panelOrder', {});
981
+ const setting = this.#settings.createSetting<any>('InspectorView.panelOrder', {});
951
982
  const tabOrders = setting.get();
952
983
  for (const key of Object.keys(tabOrders)) {
953
984
  tabOrders[key] = (tabOrders[key] + 1) * 10;
@@ -956,7 +987,7 @@ export class VersionController {
956
987
  }
957
988
 
958
989
  updateVersionFrom16To17(): void {
959
- const setting = Settings.instance().createSetting<any>('networkConditionsCustomProfiles', []);
990
+ const setting = this.#settings.createSetting<any>('networkConditionsCustomProfiles', []);
960
991
  const oldValue = setting.get();
961
992
  const newValue = [];
962
993
  if (Array.isArray(oldValue)) {
@@ -974,7 +1005,7 @@ export class VersionController {
974
1005
  }
975
1006
 
976
1007
  updateVersionFrom17To18(): void {
977
- const setting = Settings.instance().createLocalSetting<any>('workspaceExcludedFolders', {});
1008
+ const setting = this.#settings.createLocalSetting<any>('workspaceExcludedFolders', {});
978
1009
  const oldValue = setting.get();
979
1010
  const newValue: Record<string, string> = {};
980
1011
  for (const oldKey in oldValue) {
@@ -993,7 +1024,7 @@ export class VersionController {
993
1024
 
994
1025
  updateVersionFrom18To19(): void {
995
1026
  const defaultColumns = {status: true, type: true, initiator: true, size: true, time: true};
996
- const visibleColumnSettings = Settings.instance().createSetting<any>('networkLogColumnsVisibility', defaultColumns);
1027
+ const visibleColumnSettings = this.#settings.createSetting<any>('networkLogColumnsVisibility', defaultColumns);
997
1028
  const visibleColumns = visibleColumnSettings.get();
998
1029
  visibleColumns.name = true;
999
1030
  visibleColumns.timeline = true;
@@ -1007,20 +1038,20 @@ export class VersionController {
1007
1038
  }
1008
1039
  configs[columnId.toLowerCase()] = {visible: visibleColumns[columnId]};
1009
1040
  }
1010
- const newSetting = Settings.instance().createSetting('networkLogColumns', {});
1041
+ const newSetting = this.#settings.createSetting('networkLogColumns', {});
1011
1042
  newSetting.set(configs);
1012
- removeSetting(visibleColumnSettings);
1043
+ this.#removeSetting(visibleColumnSettings);
1013
1044
  }
1014
1045
 
1015
1046
  updateVersionFrom19To20(): void {
1016
- const oldSetting = Settings.instance().createSetting('InspectorView.panelOrder', {});
1017
- const newSetting = Settings.instance().createSetting('panel-tabOrder', {});
1047
+ const oldSetting = this.#settings.createSetting('InspectorView.panelOrder', {});
1048
+ const newSetting = this.#settings.createSetting('panel-tabOrder', {});
1018
1049
  newSetting.set(oldSetting.get());
1019
- removeSetting(oldSetting);
1050
+ this.#removeSetting(oldSetting);
1020
1051
  }
1021
1052
 
1022
1053
  updateVersionFrom20To21(): void {
1023
- const networkColumns = Settings.instance().createSetting('networkLogColumns', {});
1054
+ const networkColumns = this.#settings.createSetting('networkLogColumns', {});
1024
1055
  const columns = (networkColumns.get() as Record<string, string>);
1025
1056
  delete columns['timeline'];
1026
1057
  delete columns['waterfall'];
@@ -1028,7 +1059,7 @@ export class VersionController {
1028
1059
  }
1029
1060
 
1030
1061
  updateVersionFrom21To22(): void {
1031
- const breakpointsSetting = Settings.instance().createLocalSetting<any>('breakpoints', []);
1062
+ const breakpointsSetting = this.#settings.createLocalSetting<any>('breakpoints', []);
1032
1063
  const breakpoints = breakpointsSetting.get();
1033
1064
  for (const breakpoint of breakpoints) {
1034
1065
  breakpoint['url'] = breakpoint['sourceFileId'];
@@ -1042,36 +1073,37 @@ export class VersionController {
1042
1073
  }
1043
1074
 
1044
1075
  updateVersionFrom23To24(): void {
1045
- const oldSetting = Settings.instance().createSetting('searchInContentScripts', false);
1046
- const newSetting = Settings.instance().createSetting('searchInAnonymousAndContentScripts', false);
1076
+ const oldSetting = this.#settings.createSetting('searchInContentScripts', false);
1077
+ const newSetting = this.#settings.createSetting('searchInAnonymousAndContentScripts', false);
1047
1078
  newSetting.set(oldSetting.get());
1048
- removeSetting(oldSetting);
1079
+ this.#removeSetting(oldSetting);
1049
1080
  }
1050
1081
 
1051
1082
  updateVersionFrom24To25(): void {
1052
1083
  const defaultColumns = {status: true, type: true, initiator: true, size: true, time: true};
1053
1084
 
1054
- const networkLogColumnsSetting = Settings.instance().createSetting<any>('networkLogColumns', defaultColumns);
1085
+ const networkLogColumnsSetting = this.#settings.createSetting<any>('networkLogColumns', defaultColumns);
1055
1086
  const columns = networkLogColumnsSetting.get();
1056
1087
  delete columns.product;
1057
1088
  networkLogColumnsSetting.set(columns);
1058
1089
  }
1059
1090
 
1060
1091
  updateVersionFrom25To26(): void {
1061
- const oldSetting = Settings.instance().createSetting('messageURLFilters', {});
1092
+ const oldSetting = this.#settings.createSetting('messageURLFilters', {});
1062
1093
  const urls = Object.keys(oldSetting.get());
1063
1094
  const textFilter = urls.map(url => `-url:${url}`).join(' ');
1064
1095
  if (textFilter) {
1065
- const textFilterSetting = Settings.instance().createSetting<any>('console.textFilter', '');
1096
+ const textFilterSetting = this.#settings.createSetting<any>('console.textFilter', '');
1066
1097
  const suffix = textFilterSetting.get() ? ` ${textFilterSetting.get()}` : '';
1067
1098
  textFilterSetting.set(`${textFilter}${suffix}`);
1068
1099
  }
1069
- removeSetting(oldSetting);
1100
+ this.#removeSetting(oldSetting);
1070
1101
  }
1071
1102
 
1072
1103
  updateVersionFrom26To27(): void {
1104
+ const settings = this.#settings;
1073
1105
  function renameKeyInObjectSetting(settingName: string, from: string, to: string): void {
1074
- const setting = Settings.instance().createSetting<any>(settingName, {});
1106
+ const setting = settings.createSetting<any>(settingName, {});
1075
1107
  const value = setting.get();
1076
1108
  if (from in value) {
1077
1109
  value[to] = value[from];
@@ -1081,7 +1113,7 @@ export class VersionController {
1081
1113
  }
1082
1114
 
1083
1115
  function renameInStringSetting(settingName: string, from: string, to: string): void {
1084
- const setting = Settings.instance().createSetting(settingName, '');
1116
+ const setting = settings.createSetting(settingName, '');
1085
1117
  const value = setting.get();
1086
1118
  if (value === from) {
1087
1119
  setting.set(to);
@@ -1094,15 +1126,16 @@ export class VersionController {
1094
1126
  }
1095
1127
 
1096
1128
  updateVersionFrom27To28(): void {
1097
- const setting = Settings.instance().createSetting('uiTheme', 'systemPreferred');
1129
+ const setting = this.#settings.createSetting('uiTheme', 'systemPreferred');
1098
1130
  if (setting.get() === 'default') {
1099
1131
  setting.set('systemPreferred');
1100
1132
  }
1101
1133
  }
1102
1134
 
1103
1135
  updateVersionFrom28To29(): void {
1136
+ const settings = this.#settings;
1104
1137
  function renameKeyInObjectSetting(settingName: string, from: string, to: string): void {
1105
- const setting = Settings.instance().createSetting<any>(settingName, {});
1138
+ const setting = settings.createSetting<any>(settingName, {});
1106
1139
  const value = setting.get();
1107
1140
  if (from in value) {
1108
1141
  value[to] = value[from];
@@ -1112,7 +1145,7 @@ export class VersionController {
1112
1145
  }
1113
1146
 
1114
1147
  function renameInStringSetting(settingName: string, from: string, to: string): void {
1115
- const setting = Settings.instance().createSetting(settingName, '');
1148
+ const setting = settings.createSetting(settingName, '');
1116
1149
  const value = setting.get();
1117
1150
  if (value === from) {
1118
1151
  setting.set(to);
@@ -1126,11 +1159,11 @@ export class VersionController {
1126
1159
 
1127
1160
  updateVersionFrom29To30(): void {
1128
1161
  // Create new location agnostic setting
1129
- const closeableTabSetting = Settings.instance().createSetting('closeableTabs', {});
1162
+ const closeableTabSetting = this.#settings.createSetting('closeableTabs', {});
1130
1163
 
1131
1164
  // Read current settings
1132
- const panelCloseableTabSetting = Settings.instance().createSetting('panel-closeableTabs', {});
1133
- const drawerCloseableTabSetting = Settings.instance().createSetting('drawer-view-closeableTabs', {});
1165
+ const panelCloseableTabSetting = this.#settings.createSetting('panel-closeableTabs', {});
1166
+ const drawerCloseableTabSetting = this.#settings.createSetting('drawer-view-closeableTabs', {});
1134
1167
  const openTabsInPanel = panelCloseableTabSetting.get();
1135
1168
  const openTabsInDrawer = panelCloseableTabSetting.get();
1136
1169
 
@@ -1139,15 +1172,15 @@ export class VersionController {
1139
1172
  closeableTabSetting.set(newValue);
1140
1173
 
1141
1174
  // Remove old settings
1142
- removeSetting(panelCloseableTabSetting);
1143
- removeSetting(drawerCloseableTabSetting);
1175
+ this.#removeSetting(panelCloseableTabSetting);
1176
+ this.#removeSetting(drawerCloseableTabSetting);
1144
1177
  }
1145
1178
 
1146
1179
  updateVersionFrom30To31(): void {
1147
1180
  // Remove recorder_recordings setting that was used for storing recordings
1148
1181
  // by an old recorder experiment.
1149
- const recordingsSetting = Settings.instance().createSetting('recorder_recordings', []);
1150
- removeSetting(recordingsSetting);
1182
+ const recordingsSetting = this.#settings.createSetting('recorder_recordings', []);
1183
+ this.#removeSetting(recordingsSetting);
1151
1184
  }
1152
1185
 
1153
1186
  updateVersionFrom31To32(): void {
@@ -1156,7 +1189,7 @@ export class VersionController {
1156
1189
  // know on which resource type the given breakpoint was set, we just assume
1157
1190
  // 'script' here to keep things simple.
1158
1191
 
1159
- const breakpointsSetting = Settings.instance().createLocalSetting<any>('breakpoints', []);
1192
+ const breakpointsSetting = this.#settings.createLocalSetting<any>('breakpoints', []);
1160
1193
  const breakpoints = breakpointsSetting.get();
1161
1194
  for (const breakpoint of breakpoints) {
1162
1195
  breakpoint['resourceTypeName'] = 'script';
@@ -1165,7 +1198,7 @@ export class VersionController {
1165
1198
  }
1166
1199
 
1167
1200
  updateVersionFrom32To33(): void {
1168
- const previouslyViewedFilesSetting = Settings.instance().createLocalSetting<any>('previouslyViewedFiles', []);
1201
+ const previouslyViewedFilesSetting = this.#settings.createLocalSetting<any>('previouslyViewedFiles', []);
1169
1202
  let previouslyViewedFiles = previouslyViewedFilesSetting.get();
1170
1203
 
1171
1204
  // Discard old 'previouslyViewedFiles' items that don't have a 'url' property.
@@ -1196,7 +1229,7 @@ export class VersionController {
1196
1229
  const logpointPrefix = '/** DEVTOOLS_LOGPOINT */ console.log(';
1197
1230
  const logpointSuffix = ')';
1198
1231
 
1199
- const breakpointsSetting = Settings.instance().createLocalSetting<any>('breakpoints', []);
1232
+ const breakpointsSetting = this.#settings.createLocalSetting<any>('breakpoints', []);
1200
1233
  const breakpoints = breakpointsSetting.get();
1201
1234
  for (const breakpoint of breakpoints) {
1202
1235
  const isLogpoint =
@@ -1216,7 +1249,7 @@ export class VersionController {
1216
1249
  const logpointPrefix = '/** DEVTOOLS_LOGPOINT */ console.log(';
1217
1250
  const logpointSuffix = ')';
1218
1251
 
1219
- const breakpointsSetting = Settings.instance().createLocalSetting<any>('breakpoints', []);
1252
+ const breakpointsSetting = this.#settings.createLocalSetting<any>('breakpoints', []);
1220
1253
  const breakpoints = breakpointsSetting.get();
1221
1254
  for (const breakpoint of breakpoints) {
1222
1255
  const {condition, isLogpoint} = breakpoint;
@@ -1229,7 +1262,7 @@ export class VersionController {
1229
1262
 
1230
1263
  updateVersionFrom35To36(): void {
1231
1264
  // We have changed the default from 'false' to 'true' and this updates the existing setting just for once.
1232
- Settings.instance().createSetting('showThirdPartyIssues', true).set(true);
1265
+ this.#settings.createSetting('showThirdPartyIssues', true).set(true);
1233
1266
  }
1234
1267
 
1235
1268
  updateVersionFrom36To37(): void {
@@ -1238,23 +1271,23 @@ export class VersionController {
1238
1271
  const normalizedKey = Settings.normalizeSettingName(key);
1239
1272
  if (normalizedKey !== key) {
1240
1273
  const value = storage.get(key);
1241
- removeSetting({name: key, storage});
1274
+ this.#removeSetting({name: key, storage});
1242
1275
  storage.set(normalizedKey, value);
1243
1276
  }
1244
1277
  }
1245
1278
  };
1246
- updateStorage(Settings.instance().globalStorage);
1247
- updateStorage(Settings.instance().syncedStorage);
1248
- updateStorage(Settings.instance().localStorage);
1279
+ updateStorage(this.#settings.globalStorage);
1280
+ updateStorage(this.#settings.syncedStorage);
1281
+ updateStorage(this.#settings.localStorage);
1249
1282
 
1250
- for (const key of Settings.instance().globalStorage.keys()) {
1283
+ for (const key of this.#settings.globalStorage.keys()) {
1251
1284
  if ((key.startsWith('data-grid-') && key.endsWith('-column-weights')) || key.endsWith('-tab-order') ||
1252
1285
  key === 'views-location-override' || key === 'closeable-tabs') {
1253
- const setting = Settings.instance().createSetting(key, {});
1286
+ const setting = this.#settings.createSetting(key, {});
1254
1287
  setting.set(Platform.StringUtilities.toKebabCaseKeys(setting.get()));
1255
1288
  }
1256
1289
  if (key.endsWith('-selected-tab')) {
1257
- const setting = Settings.instance().createSetting(key, '');
1290
+ const setting = this.#settings.createSetting(key, '');
1258
1291
  setting.set(Platform.StringUtilities.toKebabCase(setting.get()));
1259
1292
  }
1260
1293
  }
@@ -1263,14 +1296,14 @@ export class VersionController {
1263
1296
  updateVersionFrom37To38(): void {
1264
1297
  const getConsoleInsightsEnabledSetting = (): Setting<boolean>|undefined => {
1265
1298
  try {
1266
- return moduleSetting('console-insights-enabled') as Setting<boolean>;
1299
+ return this.#settings.moduleSetting('console-insights-enabled') as Setting<boolean>;
1267
1300
  } catch {
1268
1301
  return;
1269
1302
  }
1270
1303
  };
1271
1304
 
1272
1305
  const consoleInsightsEnabled = getConsoleInsightsEnabledSetting();
1273
- const onboardingFinished = Settings.instance().createLocalSetting('console-insights-onboarding-finished', false);
1306
+ const onboardingFinished = this.#settings.createLocalSetting('console-insights-onboarding-finished', false);
1274
1307
 
1275
1308
  if (consoleInsightsEnabled && consoleInsightsEnabled.get() === true && onboardingFinished.get() === false) {
1276
1309
  consoleInsightsEnabled.set(false);
@@ -1287,7 +1320,7 @@ export class VersionController {
1287
1320
  // Note: we load the raw value via the globalStorage here because
1288
1321
  // `createSetting` creates if it is not present, and we do not want that;
1289
1322
  // we only want to update existing, old values.
1290
- const setting = Settings.instance().globalStorage.get(PREFERRED_NETWORK_COND);
1323
+ const setting = this.#settings.globalStorage.get(PREFERRED_NETWORK_COND);
1291
1324
  if (!setting) {
1292
1325
  return;
1293
1326
  }
@@ -1302,15 +1335,15 @@ export class VersionController {
1302
1335
  if (networkSetting.title === 'Slow 3G') {
1303
1336
  networkSetting.title = '3G';
1304
1337
  networkSetting.i18nTitleKey = '3G';
1305
- Settings.instance().globalStorage.set(PREFERRED_NETWORK_COND, JSON.stringify(networkSetting));
1338
+ this.#settings.globalStorage.set(PREFERRED_NETWORK_COND, JSON.stringify(networkSetting));
1306
1339
  } else if (networkSetting.title === 'Fast 3G') {
1307
1340
  networkSetting.title = 'Slow 4G';
1308
1341
  networkSetting.i18nTitleKey = 'Slow 4G';
1309
- Settings.instance().globalStorage.set(PREFERRED_NETWORK_COND, JSON.stringify(networkSetting));
1342
+ this.#settings.globalStorage.set(PREFERRED_NETWORK_COND, JSON.stringify(networkSetting));
1310
1343
  }
1311
1344
  } catch {
1312
1345
  // If parsing the setting threw, it's in some invalid state, so remove it.
1313
- Settings.instance().globalStorage.remove(PREFERRED_NETWORK_COND);
1346
+ this.#settings.globalStorage.remove(PREFERRED_NETWORK_COND);
1314
1347
  }
1315
1348
  }
1316
1349
 
@@ -1326,7 +1359,7 @@ export class VersionController {
1326
1359
  const hasCustomNetworkConditionsSetting = (): boolean => {
1327
1360
  try {
1328
1361
  // this will error if it does not exist
1329
- moduleSetting('custom-network-conditions');
1362
+ this.#settings.moduleSetting('custom-network-conditions');
1330
1363
  return true;
1331
1364
  } catch {
1332
1365
  return false;
@@ -1342,7 +1375,8 @@ export class VersionController {
1342
1375
  * objects, and we need to set the right key on each one. The actual keys &
1343
1376
  * values in the object are not important.
1344
1377
  */
1345
- const conditionsSetting = moduleSetting('custom-network-conditions') as Setting<Array<{key?: string}>>;
1378
+ const conditionsSetting =
1379
+ this.#settings.moduleSetting('custom-network-conditions') as Setting<Array<{key?: string}>>;
1346
1380
  const customConditions = conditionsSetting.get();
1347
1381
  if (customConditions?.length > 0) {
1348
1382
  customConditions.forEach((condition, i) => {
@@ -1367,7 +1401,7 @@ export class VersionController {
1367
1401
  // is more likely to change. This migration step tries to update the
1368
1402
  // setting for users, or removes it if we fail, so they start fresh next
1369
1403
  // time they load DevTools.
1370
- const setting = Settings.instance().globalStorage.get(PREFERRED_NETWORK_COND_SETTING);
1404
+ const setting = this.#settings.globalStorage.get(PREFERRED_NETWORK_COND_SETTING);
1371
1405
  if (!setting) {
1372
1406
  return;
1373
1407
  }
@@ -1392,12 +1426,12 @@ export class VersionController {
1392
1426
 
1393
1427
  // The second argument is the default value, so it's important that we
1394
1428
  // set this to the default, and then update it to the new key.
1395
- const newSetting = Settings.instance().createSetting('active-network-condition-key', 'NO_THROTTLING');
1429
+ const newSetting = this.#settings.createSetting('active-network-condition-key', 'NO_THROTTLING');
1396
1430
  newSetting.set(key);
1397
1431
  }
1398
1432
  } finally {
1399
1433
  // This setting is now not used, so we can remove it.
1400
- Settings.instance().globalStorage.remove(PREFERRED_NETWORK_COND_SETTING);
1434
+ this.#settings.globalStorage.remove(PREFERRED_NETWORK_COND_SETTING);
1401
1435
  }
1402
1436
  }
1403
1437
 
@@ -1435,7 +1469,7 @@ export class VersionController {
1435
1469
  }
1436
1470
  const value = window.localStorage[key];
1437
1471
  window.localStorage.removeItem(key);
1438
- Settings.instance().globalStorage.set(key, value);
1472
+ this.#settings.globalStorage.set(key, value);
1439
1473
  }
1440
1474
  }
1441
1475