chrome-devtools-frontend 1.0.1601661 → 1.0.1602543
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.
- package/.agents/skills/version-control/SKILL.md +71 -0
- package/AUTHORS +1 -0
- package/front_end/core/common/Settings.ts +1 -871
- package/front_end/core/common/VersionController.ts +880 -0
- package/front_end/core/common/common.ts +2 -0
- package/front_end/core/host/InspectorFrontendHostStub.ts +0 -5
- package/front_end/core/platform/HostRuntime.ts +9 -3
- package/front_end/core/protocol_client/InspectorBackend.ts +8 -0
- package/front_end/core/root/Runtime.ts +5 -8
- package/front_end/core/sdk/DOMModel.ts +5 -4
- package/front_end/core/sdk/Target.ts +5 -0
- package/front_end/core/sdk/WebMCPModel.ts +98 -0
- package/front_end/core/sdk/sdk.ts +2 -0
- package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshot.ts +13 -19
- package/front_end/entrypoints/inspector_main/InspectorMain.ts +1 -1
- package/front_end/entrypoints/main/GlobalAiButton.ts +1 -1
- package/front_end/generated/InspectorBackendCommands.ts +6 -5
- package/front_end/generated/protocol.ts +36 -3
- package/front_end/models/ai_assistance/AiConversation.ts +3 -3
- package/front_end/models/ai_assistance/agents/AccessibilityAgent.ts +217 -9
- package/front_end/models/ai_assistance/agents/AiAgent.ts +14 -1
- package/front_end/models/ai_assistance/agents/ContextSelectionAgent.ts +19 -4
- package/front_end/models/ai_assistance/agents/NetworkAgent.ts +7 -1
- package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +14 -2
- package/front_end/models/ai_assistance/agents/StylingAgent.ts +0 -23
- package/front_end/models/heap_snapshot_model/HeapSnapshotModel.ts +7 -7
- package/front_end/models/javascript_metadata/NativeFunctions.js +4 -0
- package/front_end/models/lighthouse/RunTypes.ts +3 -1
- package/front_end/models/live-metrics/LiveMetrics.ts +51 -31
- package/front_end/panels/accessibility/ARIAAttributesView.ts +2 -2
- package/front_end/panels/ai_assistance/AiAssistancePanel.ts +9 -2
- package/front_end/panels/ai_assistance/components/ChatInput.ts +3 -2
- package/front_end/panels/ai_assistance/components/ChatMessage.ts +84 -27
- package/front_end/panels/ai_assistance/components/chatMessage.css +31 -2
- package/front_end/panels/application/AppManifestView.ts +2 -2
- package/front_end/panels/application/BackgroundServiceView.ts +9 -9
- package/front_end/panels/application/FrameDetailsView.ts +4 -13
- package/front_end/panels/application/IndexedDBViews.ts +1 -1
- package/front_end/panels/application/KeyValueStorageItemsView.ts +4 -4
- package/front_end/panels/application/ServiceWorkerCacheViews.ts +3 -3
- package/front_end/panels/application/components/PermissionsPolicySection.ts +1 -1
- package/front_end/panels/application/components/permissionsPolicySection.css +54 -52
- package/front_end/panels/application/frameDetailsReportView.css +13 -1
- package/front_end/panels/common/AiCodeCompletionSummaryToolbar.ts +2 -1
- package/front_end/panels/console_counters/WarningErrorCounter.ts +7 -14
- package/front_end/panels/elements/CSSValueTraceView.ts +9 -1
- package/front_end/panels/elements/NodeStackTraceWidget.ts +2 -1
- package/front_end/panels/elements/PropertiesWidget.ts +14 -13
- package/front_end/panels/elements/PropertyRenderer.ts +10 -9
- package/front_end/panels/elements/StandaloneStylesContainer.ts +15 -2
- package/front_end/panels/elements/StylePropertyTreeElement.ts +22 -1
- package/front_end/panels/elements/StylesSidebarPane.ts +34 -25
- package/front_end/panels/elements/stylePropertiesTreeOutline.css +5 -0
- package/front_end/panels/issues/AffectedSelectivePermissionsInterventionView.ts +2 -2
- package/front_end/panels/lighthouse/LighthouseController.ts +4 -1
- package/front_end/panels/media/EventDisplayTable.ts +3 -2
- package/front_end/panels/network/EventSourceMessagesView.ts +2 -2
- package/front_end/panels/network/RequestPayloadView.ts +2 -2
- package/front_end/panels/network/ResourceChunkView.ts +1 -1
- package/front_end/panels/profiler/HeapDetachedElementsView.ts +9 -4
- package/front_end/panels/profiler/HeapProfileView.ts +8 -4
- package/front_end/panels/profiler/HeapSnapshotDataGrids.ts +40 -33
- package/front_end/panels/profiler/HeapSnapshotGridNodes.ts +1 -1
- package/front_end/panels/profiler/HeapSnapshotProxy.ts +1 -1
- package/front_end/panels/profiler/HeapSnapshotView.ts +12 -18
- package/front_end/panels/profiler/LiveHeapProfileView.ts +3 -4
- package/front_end/panels/profiler/ProfileHeader.ts +5 -11
- package/front_end/panels/profiler/ProfileView.ts +1 -1
- package/front_end/panels/recorder/RecorderController.ts +4 -3
- package/front_end/panels/recorder/components/CreateRecordingView.ts +2 -1
- package/front_end/panels/recorder/components/RecordingView.ts +2 -2
- package/front_end/panels/recorder/models/RecordingPlayer.ts +3 -0
- package/front_end/panels/security/SecurityPanel.ts +3 -3
- package/front_end/panels/sensors/SensorsView.ts +149 -125
- package/front_end/panels/timeline/EventsTimelineTreeView.ts +2 -2
- package/front_end/panels/timeline/TimelineDetailsView.ts +6 -37
- package/front_end/panels/timeline/TimelineTreeView.ts +19 -17
- package/front_end/panels/timeline/TimelineUIUtils.ts +0 -118
- package/front_end/panels/timeline/components/IgnoreListSetting.ts +1 -1
- package/front_end/panels/timeline/components/SidebarInsightsTab.ts +2 -2
- package/front_end/panels/timeline/components/TimelineRangeSummaryView.ts +162 -9
- package/front_end/panels/timeline/components/timelineRangeSummaryView.css +22 -8
- package/front_end/panels/webauthn/WebauthnPane.ts +52 -0
- package/front_end/panels/whats_new/ReleaseNoteText.ts +10 -10
- package/front_end/panels/whats_new/resources/WNDT.md +6 -6
- package/front_end/third_party/chromium/README.chromium +1 -1
- package/front_end/third_party/puppeteer/README.chromium +2 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/ChromeLauncher.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/ChromeLauncher.js +4 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/ChromeLauncher.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.d.ts +2 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.js +2 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/version.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/version.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.js +3 -3
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/ChromeLauncher.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/ChromeLauncher.js +4 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/ChromeLauncher.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.d.ts +2 -2
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.js +2 -2
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/version.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/version.js +1 -1
- package/front_end/third_party/puppeteer/package/package.json +1 -1
- package/front_end/third_party/puppeteer/package/src/node/ChromeLauncher.ts +8 -0
- package/front_end/third_party/puppeteer/package/src/revisions.ts +2 -2
- package/front_end/third_party/puppeteer/package/src/util/version.ts +1 -1
- package/front_end/ui/legacy/Toolbar.ts +25 -3
- package/front_end/ui/legacy/Treeoutline.ts +7 -3
- package/front_end/ui/legacy/UIUtils.ts +13 -11
- package/front_end/ui/legacy/Widget.ts +40 -40
- package/front_end/ui/legacy/components/data_grid/DataGrid.ts +1 -1
- package/front_end/ui/legacy/components/data_grid/SortableDataGrid.ts +2 -2
- package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +39 -23
- package/front_end/ui/legacy/components/perf_ui/GCActionDelegate.ts +20 -4
- package/front_end/ui/legacy/treeoutline.css +4 -0
- package/front_end/ui/visual_logging/KnownContextValues.ts +2 -0
- package/package.json +1 -1
|
@@ -21,6 +21,7 @@ import {
|
|
|
21
21
|
type SettingRegistration,
|
|
22
22
|
SettingType,
|
|
23
23
|
} from './SettingRegistration.js';
|
|
24
|
+
import {VersionController} from './VersionController.js';
|
|
24
25
|
|
|
25
26
|
export interface SettingsCreationOptions {
|
|
26
27
|
syncedStorage: SettingsStorage;
|
|
@@ -680,877 +681,6 @@ export class RegExpSetting extends Setting<any> {
|
|
|
680
681
|
}
|
|
681
682
|
}
|
|
682
683
|
|
|
683
|
-
// The VersionController does a lot of mapping and restructuring which often need
|
|
684
|
-
// typecasting to any, allow it in there
|
|
685
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
686
|
-
export class VersionController {
|
|
687
|
-
static readonly GLOBAL_VERSION_SETTING_NAME = 'inspectorVersion';
|
|
688
|
-
static readonly SYNCED_VERSION_SETTING_NAME = 'syncedInspectorVersion';
|
|
689
|
-
static readonly LOCAL_VERSION_SETTING_NAME = 'localInspectorVersion';
|
|
690
|
-
|
|
691
|
-
static readonly CURRENT_VERSION = 42;
|
|
692
|
-
|
|
693
|
-
readonly #settings: Settings;
|
|
694
|
-
readonly #globalVersionSetting: Setting<number>;
|
|
695
|
-
readonly #syncedVersionSetting: Setting<number>;
|
|
696
|
-
readonly #localVersionSetting: Setting<number>;
|
|
697
|
-
|
|
698
|
-
constructor(settings: Settings) {
|
|
699
|
-
this.#settings = settings;
|
|
700
|
-
// If no version setting is found, we initialize with the current version and don't do anything.
|
|
701
|
-
this.#globalVersionSetting = this.#settings.createSetting(
|
|
702
|
-
VersionController.GLOBAL_VERSION_SETTING_NAME, VersionController.CURRENT_VERSION, SettingStorageType.GLOBAL);
|
|
703
|
-
this.#syncedVersionSetting = this.#settings.createSetting(
|
|
704
|
-
VersionController.SYNCED_VERSION_SETTING_NAME, VersionController.CURRENT_VERSION, SettingStorageType.SYNCED);
|
|
705
|
-
this.#localVersionSetting = this.#settings.createSetting(
|
|
706
|
-
VersionController.LOCAL_VERSION_SETTING_NAME, VersionController.CURRENT_VERSION, SettingStorageType.LOCAL);
|
|
707
|
-
}
|
|
708
|
-
|
|
709
|
-
/**
|
|
710
|
-
* Force re-sets all version number settings to the current version without
|
|
711
|
-
* running any migrations.
|
|
712
|
-
*/
|
|
713
|
-
resetToCurrent(): void {
|
|
714
|
-
this.#globalVersionSetting.set(VersionController.CURRENT_VERSION);
|
|
715
|
-
this.#syncedVersionSetting.set(VersionController.CURRENT_VERSION);
|
|
716
|
-
this.#localVersionSetting.set(VersionController.CURRENT_VERSION);
|
|
717
|
-
}
|
|
718
|
-
|
|
719
|
-
#removeSetting(setting: {name: string, storage: SettingsStorage}): void {
|
|
720
|
-
const name = setting.name;
|
|
721
|
-
|
|
722
|
-
this.#settings.getRegistry().delete(name);
|
|
723
|
-
this.#settings.moduleSettings.delete(name);
|
|
724
|
-
|
|
725
|
-
setting.storage.remove(name);
|
|
726
|
-
}
|
|
727
|
-
|
|
728
|
-
/**
|
|
729
|
-
* Runs the appropriate migrations and updates the version settings accordingly.
|
|
730
|
-
*
|
|
731
|
-
* To determine what migrations to run we take the minimum of all version number settings.
|
|
732
|
-
*
|
|
733
|
-
* IMPORTANT: All migrations must be idempotent since they might be applied multiple times.
|
|
734
|
-
*/
|
|
735
|
-
updateVersion(): void {
|
|
736
|
-
const currentVersion = VersionController.CURRENT_VERSION;
|
|
737
|
-
const minimumVersion =
|
|
738
|
-
Math.min(this.#globalVersionSetting.get(), this.#syncedVersionSetting.get(), this.#localVersionSetting.get());
|
|
739
|
-
const methodsToRun = this.methodsToRunToUpdateVersion(minimumVersion, currentVersion);
|
|
740
|
-
console.assert(
|
|
741
|
-
// @ts-expect-error
|
|
742
|
-
this[`updateVersionFrom${currentVersion}To${currentVersion + 1}`] === undefined,
|
|
743
|
-
'Unexpected migration method found. Increment CURRENT_VERSION or remove the method.');
|
|
744
|
-
for (const method of methodsToRun) {
|
|
745
|
-
// @ts-expect-error Special version method matching
|
|
746
|
-
this[method].call(this);
|
|
747
|
-
}
|
|
748
|
-
this.resetToCurrent();
|
|
749
|
-
}
|
|
750
|
-
|
|
751
|
-
private methodsToRunToUpdateVersion(oldVersion: number, currentVersion: number): string[] {
|
|
752
|
-
const result = [];
|
|
753
|
-
for (let i = oldVersion; i < currentVersion; ++i) {
|
|
754
|
-
result.push('updateVersionFrom' + i + 'To' + (i + 1));
|
|
755
|
-
}
|
|
756
|
-
return result;
|
|
757
|
-
}
|
|
758
|
-
|
|
759
|
-
updateVersionFrom0To1(): void {
|
|
760
|
-
this.clearBreakpointsWhenTooMany(this.#settings.createLocalSetting('breakpoints', []), 500000);
|
|
761
|
-
}
|
|
762
|
-
|
|
763
|
-
updateVersionFrom1To2(): void {
|
|
764
|
-
this.#settings.createSetting('previouslyViewedFiles', []).set([]);
|
|
765
|
-
}
|
|
766
|
-
|
|
767
|
-
updateVersionFrom2To3(): void {
|
|
768
|
-
this.#settings.createSetting('fileSystemMapping', {}).set({});
|
|
769
|
-
this.#removeSetting(this.#settings.createSetting('fileMappingEntries', []));
|
|
770
|
-
}
|
|
771
|
-
|
|
772
|
-
updateVersionFrom3To4(): void {
|
|
773
|
-
const advancedMode = this.#settings.createSetting('showHeaSnapshotObjectsHiddenProperties', false);
|
|
774
|
-
this.#settings.moduleSetting('showAdvancedHeapSnapshotProperties').set(advancedMode.get());
|
|
775
|
-
this.#removeSetting(advancedMode);
|
|
776
|
-
}
|
|
777
|
-
|
|
778
|
-
updateVersionFrom4To5(): void {
|
|
779
|
-
const settingNames: Record<string, string> = {
|
|
780
|
-
FileSystemViewSidebarWidth: 'fileSystemViewSplitViewState',
|
|
781
|
-
elementsSidebarWidth: 'elementsPanelSplitViewState',
|
|
782
|
-
StylesPaneSplitRatio: 'stylesPaneSplitViewState',
|
|
783
|
-
heapSnapshotRetainersViewSize: 'heapSnapshotSplitViewState',
|
|
784
|
-
'InspectorView.splitView': 'InspectorView.splitViewState',
|
|
785
|
-
'InspectorView.screencastSplitView': 'InspectorView.screencastSplitViewState',
|
|
786
|
-
'Inspector.drawerSplitView': 'Inspector.drawerSplitViewState',
|
|
787
|
-
layerDetailsSplitView: 'layerDetailsSplitViewState',
|
|
788
|
-
networkSidebarWidth: 'networkPanelSplitViewState',
|
|
789
|
-
sourcesSidebarWidth: 'sourcesPanelSplitViewState',
|
|
790
|
-
scriptsPanelNavigatorSidebarWidth: 'sourcesPanelNavigatorSplitViewState',
|
|
791
|
-
sourcesPanelSplitSidebarRatio: 'sourcesPanelDebuggerSidebarSplitViewState',
|
|
792
|
-
'timeline-details': 'timelinePanelDetailsSplitViewState',
|
|
793
|
-
'timeline-split': 'timelinePanelRecorsSplitViewState',
|
|
794
|
-
'timeline-view': 'timelinePanelTimelineStackSplitViewState',
|
|
795
|
-
auditsSidebarWidth: 'auditsPanelSplitViewState',
|
|
796
|
-
layersSidebarWidth: 'layersPanelSplitViewState',
|
|
797
|
-
profilesSidebarWidth: 'profilesPanelSplitViewState',
|
|
798
|
-
resourcesSidebarWidth: 'resourcesPanelSplitViewState',
|
|
799
|
-
};
|
|
800
|
-
const empty = {};
|
|
801
|
-
for (const oldName in settingNames) {
|
|
802
|
-
const newName = settingNames[oldName];
|
|
803
|
-
const oldNameH = oldName + 'H';
|
|
804
|
-
|
|
805
|
-
let newValue: object|null = null;
|
|
806
|
-
const oldSetting = this.#settings.createSetting(oldName, empty);
|
|
807
|
-
if (oldSetting.get() !== empty) {
|
|
808
|
-
newValue = newValue || {};
|
|
809
|
-
// @ts-expect-error
|
|
810
|
-
newValue.vertical = {};
|
|
811
|
-
// @ts-expect-error
|
|
812
|
-
newValue.vertical.size = oldSetting.get();
|
|
813
|
-
this.#removeSetting(oldSetting);
|
|
814
|
-
}
|
|
815
|
-
const oldSettingH = this.#settings.createSetting(oldNameH, empty);
|
|
816
|
-
if (oldSettingH.get() !== empty) {
|
|
817
|
-
newValue = newValue || {};
|
|
818
|
-
// @ts-expect-error
|
|
819
|
-
newValue.horizontal = {};
|
|
820
|
-
// @ts-expect-error
|
|
821
|
-
newValue.horizontal.size = oldSettingH.get();
|
|
822
|
-
this.#removeSetting(oldSettingH);
|
|
823
|
-
}
|
|
824
|
-
if (newValue) {
|
|
825
|
-
this.#settings.createSetting(newName, {}).set(newValue);
|
|
826
|
-
}
|
|
827
|
-
}
|
|
828
|
-
}
|
|
829
|
-
|
|
830
|
-
updateVersionFrom5To6(): void {
|
|
831
|
-
const settingNames: Record<string, string> = {
|
|
832
|
-
debuggerSidebarHidden: 'sourcesPanelSplitViewState',
|
|
833
|
-
navigatorHidden: 'sourcesPanelNavigatorSplitViewState',
|
|
834
|
-
'WebInspector.Drawer.showOnLoad': 'Inspector.drawerSplitViewState',
|
|
835
|
-
};
|
|
836
|
-
|
|
837
|
-
for (const oldName in settingNames) {
|
|
838
|
-
const oldSetting = this.#settings.createSetting(oldName, null);
|
|
839
|
-
if (oldSetting.get() === null) {
|
|
840
|
-
this.#removeSetting(oldSetting);
|
|
841
|
-
continue;
|
|
842
|
-
}
|
|
843
|
-
|
|
844
|
-
const newName = settingNames[oldName];
|
|
845
|
-
const invert = oldName === 'WebInspector.Drawer.showOnLoad';
|
|
846
|
-
const hidden = oldSetting.get() !== invert;
|
|
847
|
-
this.#removeSetting(oldSetting);
|
|
848
|
-
const showMode = hidden ? 'OnlyMain' : 'Both';
|
|
849
|
-
|
|
850
|
-
const newSetting = this.#settings.createSetting(newName, {});
|
|
851
|
-
const newValue = newSetting.get() || {};
|
|
852
|
-
|
|
853
|
-
// @ts-expect-error
|
|
854
|
-
newValue.vertical = newValue.vertical || {};
|
|
855
|
-
|
|
856
|
-
// @ts-expect-error
|
|
857
|
-
newValue.vertical.showMode = showMode;
|
|
858
|
-
|
|
859
|
-
// @ts-expect-error
|
|
860
|
-
newValue.horizontal = newValue.horizontal || {};
|
|
861
|
-
|
|
862
|
-
// @ts-expect-error
|
|
863
|
-
newValue.horizontal.showMode = showMode;
|
|
864
|
-
newSetting.set(newValue);
|
|
865
|
-
}
|
|
866
|
-
}
|
|
867
|
-
|
|
868
|
-
updateVersionFrom6To7(): void {
|
|
869
|
-
const settingNames = {
|
|
870
|
-
sourcesPanelNavigatorSplitViewState: 'sourcesPanelNavigatorSplitViewState',
|
|
871
|
-
elementsPanelSplitViewState: 'elementsPanelSplitViewState',
|
|
872
|
-
stylesPaneSplitViewState: 'stylesPaneSplitViewState',
|
|
873
|
-
sourcesPanelDebuggerSidebarSplitViewState: 'sourcesPanelDebuggerSidebarSplitViewState',
|
|
874
|
-
};
|
|
875
|
-
|
|
876
|
-
const empty = {};
|
|
877
|
-
for (const name in settingNames) {
|
|
878
|
-
const setting =
|
|
879
|
-
this.#settings.createSetting<{vertical?: {size?: number}, horizontal?: {size?: number}}>(name, empty);
|
|
880
|
-
const value = setting.get();
|
|
881
|
-
if (value === empty) {
|
|
882
|
-
continue;
|
|
883
|
-
}
|
|
884
|
-
// Zero out saved percentage sizes, and they will be restored to defaults.
|
|
885
|
-
if (value.vertical?.size && value.vertical.size < 1) {
|
|
886
|
-
value.vertical.size = 0;
|
|
887
|
-
}
|
|
888
|
-
if (value.horizontal?.size && value.horizontal.size < 1) {
|
|
889
|
-
value.horizontal.size = 0;
|
|
890
|
-
}
|
|
891
|
-
setting.set(value);
|
|
892
|
-
}
|
|
893
|
-
}
|
|
894
|
-
|
|
895
|
-
updateVersionFrom7To8(): void {
|
|
896
|
-
}
|
|
897
|
-
|
|
898
|
-
updateVersionFrom8To9(): void {
|
|
899
|
-
const settingNames = ['skipStackFramesPattern', 'workspaceFolderExcludePattern'];
|
|
900
|
-
|
|
901
|
-
for (let i = 0; i < settingNames.length; ++i) {
|
|
902
|
-
const setting = this.#settings.createSetting<string|unknown[]>(settingNames[i], '');
|
|
903
|
-
let value = setting.get();
|
|
904
|
-
if (!value) {
|
|
905
|
-
return;
|
|
906
|
-
}
|
|
907
|
-
if (typeof value === 'string') {
|
|
908
|
-
value = [value];
|
|
909
|
-
}
|
|
910
|
-
for (let j = 0; j < value.length; ++j) {
|
|
911
|
-
if (typeof value[j] === 'string') {
|
|
912
|
-
value[j] = {pattern: value[j]};
|
|
913
|
-
}
|
|
914
|
-
}
|
|
915
|
-
setting.set(value);
|
|
916
|
-
}
|
|
917
|
-
}
|
|
918
|
-
|
|
919
|
-
updateVersionFrom9To10(): void {
|
|
920
|
-
// This one is localStorage specific, which is fine.
|
|
921
|
-
if (!window.localStorage) {
|
|
922
|
-
return;
|
|
923
|
-
}
|
|
924
|
-
for (const key in window.localStorage) {
|
|
925
|
-
if (key.startsWith('revision-history')) {
|
|
926
|
-
window.localStorage.removeItem(key);
|
|
927
|
-
}
|
|
928
|
-
}
|
|
929
|
-
}
|
|
930
|
-
|
|
931
|
-
updateVersionFrom10To11(): void {
|
|
932
|
-
const oldSettingName = 'customDevicePresets';
|
|
933
|
-
const newSettingName = 'customEmulatedDeviceList';
|
|
934
|
-
const oldSetting = this.#settings.createSetting<unknown>(oldSettingName, undefined);
|
|
935
|
-
const list = oldSetting.get();
|
|
936
|
-
if (!Array.isArray(list)) {
|
|
937
|
-
return;
|
|
938
|
-
}
|
|
939
|
-
const newList = [];
|
|
940
|
-
for (let i = 0; i < list.length; ++i) {
|
|
941
|
-
const value = list[i];
|
|
942
|
-
|
|
943
|
-
const device: Record<string, any> = {};
|
|
944
|
-
device['title'] = value['title'];
|
|
945
|
-
device['type'] = 'unknown';
|
|
946
|
-
device['user-agent'] = value['userAgent'];
|
|
947
|
-
device['capabilities'] = [];
|
|
948
|
-
if (value['touch']) {
|
|
949
|
-
device['capabilities'].push('touch');
|
|
950
|
-
}
|
|
951
|
-
if (value['mobile']) {
|
|
952
|
-
device['capabilities'].push('mobile');
|
|
953
|
-
}
|
|
954
|
-
device['screen'] = {};
|
|
955
|
-
device['screen']['vertical'] = {width: value['width'], height: value['height']};
|
|
956
|
-
device['screen']['horizontal'] = {width: value['height'], height: value['width']};
|
|
957
|
-
device['screen']['device-pixel-ratio'] = value['deviceScaleFactor'];
|
|
958
|
-
device['modes'] = [];
|
|
959
|
-
device['show-by-default'] = true;
|
|
960
|
-
device['show'] = 'Default';
|
|
961
|
-
newList.push(device);
|
|
962
|
-
}
|
|
963
|
-
if (newList.length) {
|
|
964
|
-
this.#settings.createSetting<unknown[]>(newSettingName, []).set(newList);
|
|
965
|
-
}
|
|
966
|
-
this.#removeSetting(oldSetting);
|
|
967
|
-
}
|
|
968
|
-
|
|
969
|
-
updateVersionFrom11To12(): void {
|
|
970
|
-
this.migrateSettingsFromLocalStorage();
|
|
971
|
-
}
|
|
972
|
-
|
|
973
|
-
updateVersionFrom12To13(): void {
|
|
974
|
-
this.migrateSettingsFromLocalStorage();
|
|
975
|
-
this.#removeSetting(this.#settings.createSetting('timelineOverviewMode', ''));
|
|
976
|
-
}
|
|
977
|
-
|
|
978
|
-
updateVersionFrom13To14(): void {
|
|
979
|
-
const defaultValue = {throughput: -1, latency: 0};
|
|
980
|
-
this.#settings.createSetting('networkConditions', defaultValue).set(defaultValue);
|
|
981
|
-
}
|
|
982
|
-
|
|
983
|
-
updateVersionFrom14To15(): void {
|
|
984
|
-
const setting = this.#settings.createLocalSetting<any>('workspaceExcludedFolders', {});
|
|
985
|
-
const oldValue = setting.get();
|
|
986
|
-
const newValue: Record<string, string[]> = {};
|
|
987
|
-
for (const fileSystemPath in oldValue) {
|
|
988
|
-
newValue[fileSystemPath] = [];
|
|
989
|
-
for (const entry of oldValue[fileSystemPath]) {
|
|
990
|
-
newValue[fileSystemPath].push(entry.path);
|
|
991
|
-
}
|
|
992
|
-
}
|
|
993
|
-
setting.set(newValue);
|
|
994
|
-
}
|
|
995
|
-
|
|
996
|
-
updateVersionFrom15To16(): void {
|
|
997
|
-
const setting = this.#settings.createSetting<any>('InspectorView.panelOrder', {});
|
|
998
|
-
const tabOrders = setting.get();
|
|
999
|
-
for (const key of Object.keys(tabOrders)) {
|
|
1000
|
-
tabOrders[key] = (tabOrders[key] + 1) * 10;
|
|
1001
|
-
}
|
|
1002
|
-
setting.set(tabOrders);
|
|
1003
|
-
}
|
|
1004
|
-
|
|
1005
|
-
updateVersionFrom16To17(): void {
|
|
1006
|
-
const setting = this.#settings.createSetting<any>('networkConditionsCustomProfiles', []);
|
|
1007
|
-
const oldValue = setting.get();
|
|
1008
|
-
const newValue = [];
|
|
1009
|
-
if (Array.isArray(oldValue)) {
|
|
1010
|
-
for (const preset of oldValue) {
|
|
1011
|
-
if (typeof preset.title === 'string' && typeof preset.value === 'object' &&
|
|
1012
|
-
typeof preset.value.throughput === 'number' && typeof preset.value.latency === 'number') {
|
|
1013
|
-
newValue.push({
|
|
1014
|
-
title: preset.title,
|
|
1015
|
-
value: {download: preset.value.throughput, upload: preset.value.throughput, latency: preset.value.latency},
|
|
1016
|
-
});
|
|
1017
|
-
}
|
|
1018
|
-
}
|
|
1019
|
-
}
|
|
1020
|
-
setting.set(newValue);
|
|
1021
|
-
}
|
|
1022
|
-
|
|
1023
|
-
updateVersionFrom17To18(): void {
|
|
1024
|
-
const setting = this.#settings.createLocalSetting<any>('workspaceExcludedFolders', {});
|
|
1025
|
-
const oldValue = setting.get();
|
|
1026
|
-
const newValue: Record<string, string> = {};
|
|
1027
|
-
for (const oldKey in oldValue) {
|
|
1028
|
-
let newKey = oldKey.replace(/\\/g, '/');
|
|
1029
|
-
if (!newKey.startsWith('file://')) {
|
|
1030
|
-
if (newKey.startsWith('/')) {
|
|
1031
|
-
newKey = 'file://' + newKey;
|
|
1032
|
-
} else {
|
|
1033
|
-
newKey = 'file:///' + newKey;
|
|
1034
|
-
}
|
|
1035
|
-
}
|
|
1036
|
-
newValue[newKey] = oldValue[oldKey];
|
|
1037
|
-
}
|
|
1038
|
-
setting.set(newValue);
|
|
1039
|
-
}
|
|
1040
|
-
|
|
1041
|
-
updateVersionFrom18To19(): void {
|
|
1042
|
-
const defaultColumns = {status: true, type: true, initiator: true, size: true, time: true};
|
|
1043
|
-
const visibleColumnSettings = this.#settings.createSetting<any>('networkLogColumnsVisibility', defaultColumns);
|
|
1044
|
-
const visibleColumns = visibleColumnSettings.get();
|
|
1045
|
-
visibleColumns.name = true;
|
|
1046
|
-
visibleColumns.timeline = true;
|
|
1047
|
-
|
|
1048
|
-
const configs: Record<string, {
|
|
1049
|
-
visible: number,
|
|
1050
|
-
}> = {};
|
|
1051
|
-
for (const columnId in visibleColumns) {
|
|
1052
|
-
if (!visibleColumns.hasOwnProperty(columnId)) {
|
|
1053
|
-
continue;
|
|
1054
|
-
}
|
|
1055
|
-
configs[columnId.toLowerCase()] = {visible: visibleColumns[columnId]};
|
|
1056
|
-
}
|
|
1057
|
-
const newSetting = this.#settings.createSetting('networkLogColumns', {});
|
|
1058
|
-
newSetting.set(configs);
|
|
1059
|
-
this.#removeSetting(visibleColumnSettings);
|
|
1060
|
-
}
|
|
1061
|
-
|
|
1062
|
-
updateVersionFrom19To20(): void {
|
|
1063
|
-
const oldSetting = this.#settings.createSetting('InspectorView.panelOrder', {});
|
|
1064
|
-
const newSetting = this.#settings.createSetting('panel-tabOrder', {});
|
|
1065
|
-
newSetting.set(oldSetting.get());
|
|
1066
|
-
this.#removeSetting(oldSetting);
|
|
1067
|
-
}
|
|
1068
|
-
|
|
1069
|
-
updateVersionFrom20To21(): void {
|
|
1070
|
-
const networkColumns = this.#settings.createSetting('networkLogColumns', {});
|
|
1071
|
-
const columns = (networkColumns.get() as Record<string, string>);
|
|
1072
|
-
delete columns['timeline'];
|
|
1073
|
-
delete columns['waterfall'];
|
|
1074
|
-
networkColumns.set(columns);
|
|
1075
|
-
}
|
|
1076
|
-
|
|
1077
|
-
updateVersionFrom21To22(): void {
|
|
1078
|
-
const breakpointsSetting = this.#settings.createLocalSetting<any>('breakpoints', []);
|
|
1079
|
-
const breakpoints = breakpointsSetting.get();
|
|
1080
|
-
for (const breakpoint of breakpoints) {
|
|
1081
|
-
breakpoint['url'] = breakpoint['sourceFileId'];
|
|
1082
|
-
delete breakpoint['sourceFileId'];
|
|
1083
|
-
}
|
|
1084
|
-
breakpointsSetting.set(breakpoints);
|
|
1085
|
-
}
|
|
1086
|
-
|
|
1087
|
-
updateVersionFrom22To23(): void {
|
|
1088
|
-
// This update is no-op.
|
|
1089
|
-
}
|
|
1090
|
-
|
|
1091
|
-
updateVersionFrom23To24(): void {
|
|
1092
|
-
const oldSetting = this.#settings.createSetting('searchInContentScripts', false);
|
|
1093
|
-
const newSetting = this.#settings.createSetting('searchInAnonymousAndContentScripts', false);
|
|
1094
|
-
newSetting.set(oldSetting.get());
|
|
1095
|
-
this.#removeSetting(oldSetting);
|
|
1096
|
-
}
|
|
1097
|
-
|
|
1098
|
-
updateVersionFrom24To25(): void {
|
|
1099
|
-
const defaultColumns = {status: true, type: true, initiator: true, size: true, time: true};
|
|
1100
|
-
|
|
1101
|
-
const networkLogColumnsSetting = this.#settings.createSetting<any>('networkLogColumns', defaultColumns);
|
|
1102
|
-
const columns = networkLogColumnsSetting.get();
|
|
1103
|
-
delete columns.product;
|
|
1104
|
-
networkLogColumnsSetting.set(columns);
|
|
1105
|
-
}
|
|
1106
|
-
|
|
1107
|
-
updateVersionFrom25To26(): void {
|
|
1108
|
-
const oldSetting = this.#settings.createSetting('messageURLFilters', {});
|
|
1109
|
-
const urls = Object.keys(oldSetting.get());
|
|
1110
|
-
const textFilter = urls.map(url => `-url:${url}`).join(' ');
|
|
1111
|
-
if (textFilter) {
|
|
1112
|
-
const textFilterSetting = this.#settings.createSetting<any>('console.textFilter', '');
|
|
1113
|
-
const suffix = textFilterSetting.get() ? ` ${textFilterSetting.get()}` : '';
|
|
1114
|
-
textFilterSetting.set(`${textFilter}${suffix}`);
|
|
1115
|
-
}
|
|
1116
|
-
this.#removeSetting(oldSetting);
|
|
1117
|
-
}
|
|
1118
|
-
|
|
1119
|
-
updateVersionFrom26To27(): void {
|
|
1120
|
-
const settings = this.#settings;
|
|
1121
|
-
function renameKeyInObjectSetting(settingName: string, from: string, to: string): void {
|
|
1122
|
-
const setting = settings.createSetting<any>(settingName, {});
|
|
1123
|
-
const value = setting.get();
|
|
1124
|
-
if (from in value) {
|
|
1125
|
-
value[to] = value[from];
|
|
1126
|
-
delete value[from];
|
|
1127
|
-
setting.set(value);
|
|
1128
|
-
}
|
|
1129
|
-
}
|
|
1130
|
-
|
|
1131
|
-
function renameInStringSetting(settingName: string, from: string, to: string): void {
|
|
1132
|
-
const setting = settings.createSetting(settingName, '');
|
|
1133
|
-
const value = setting.get();
|
|
1134
|
-
if (value === from) {
|
|
1135
|
-
setting.set(to);
|
|
1136
|
-
}
|
|
1137
|
-
}
|
|
1138
|
-
|
|
1139
|
-
renameKeyInObjectSetting('panel-tabOrder', 'audits2', 'audits');
|
|
1140
|
-
renameKeyInObjectSetting('panel-closeableTabs', 'audits2', 'audits');
|
|
1141
|
-
renameInStringSetting('panel-selectedTab', 'audits2', 'audits');
|
|
1142
|
-
}
|
|
1143
|
-
|
|
1144
|
-
updateVersionFrom27To28(): void {
|
|
1145
|
-
const setting = this.#settings.createSetting('uiTheme', 'systemPreferred');
|
|
1146
|
-
if (setting.get() === 'default') {
|
|
1147
|
-
setting.set('systemPreferred');
|
|
1148
|
-
}
|
|
1149
|
-
}
|
|
1150
|
-
|
|
1151
|
-
updateVersionFrom28To29(): void {
|
|
1152
|
-
const settings = this.#settings;
|
|
1153
|
-
function renameKeyInObjectSetting(settingName: string, from: string, to: string): void {
|
|
1154
|
-
const setting = settings.createSetting<any>(settingName, {});
|
|
1155
|
-
const value = setting.get();
|
|
1156
|
-
if (from in value) {
|
|
1157
|
-
value[to] = value[from];
|
|
1158
|
-
delete value[from];
|
|
1159
|
-
setting.set(value);
|
|
1160
|
-
}
|
|
1161
|
-
}
|
|
1162
|
-
|
|
1163
|
-
function renameInStringSetting(settingName: string, from: string, to: string): void {
|
|
1164
|
-
const setting = settings.createSetting(settingName, '');
|
|
1165
|
-
const value = setting.get();
|
|
1166
|
-
if (value === from) {
|
|
1167
|
-
setting.set(to);
|
|
1168
|
-
}
|
|
1169
|
-
}
|
|
1170
|
-
|
|
1171
|
-
renameKeyInObjectSetting('panel-tabOrder', 'audits', 'lighthouse');
|
|
1172
|
-
renameKeyInObjectSetting('panel-closeableTabs', 'audits', 'lighthouse');
|
|
1173
|
-
renameInStringSetting('panel-selectedTab', 'audits', 'lighthouse');
|
|
1174
|
-
}
|
|
1175
|
-
|
|
1176
|
-
updateVersionFrom29To30(): void {
|
|
1177
|
-
// Create new location agnostic setting
|
|
1178
|
-
const closeableTabSetting = this.#settings.createSetting('closeableTabs', {});
|
|
1179
|
-
|
|
1180
|
-
// Read current settings
|
|
1181
|
-
const panelCloseableTabSetting = this.#settings.createSetting('panel-closeableTabs', {});
|
|
1182
|
-
const drawerCloseableTabSetting = this.#settings.createSetting('drawer-view-closeableTabs', {});
|
|
1183
|
-
const openTabsInPanel = panelCloseableTabSetting.get();
|
|
1184
|
-
const openTabsInDrawer = panelCloseableTabSetting.get();
|
|
1185
|
-
|
|
1186
|
-
// Set #value of new setting
|
|
1187
|
-
const newValue = Object.assign(openTabsInDrawer, openTabsInPanel);
|
|
1188
|
-
closeableTabSetting.set(newValue);
|
|
1189
|
-
|
|
1190
|
-
// Remove old settings
|
|
1191
|
-
this.#removeSetting(panelCloseableTabSetting);
|
|
1192
|
-
this.#removeSetting(drawerCloseableTabSetting);
|
|
1193
|
-
}
|
|
1194
|
-
|
|
1195
|
-
updateVersionFrom30To31(): void {
|
|
1196
|
-
// Remove recorder_recordings setting that was used for storing recordings
|
|
1197
|
-
// by an old recorder experiment.
|
|
1198
|
-
const recordingsSetting = this.#settings.createSetting('recorder_recordings', []);
|
|
1199
|
-
this.#removeSetting(recordingsSetting);
|
|
1200
|
-
}
|
|
1201
|
-
|
|
1202
|
-
updateVersionFrom31To32(): void {
|
|
1203
|
-
// Introduce the new 'resourceTypeName' property on stored breakpoints. Prior to
|
|
1204
|
-
// this change we synchronized the breakpoint only by URL, but since we don't
|
|
1205
|
-
// know on which resource type the given breakpoint was set, we just assume
|
|
1206
|
-
// 'script' here to keep things simple.
|
|
1207
|
-
|
|
1208
|
-
const breakpointsSetting = this.#settings.createLocalSetting<any>('breakpoints', []);
|
|
1209
|
-
const breakpoints = breakpointsSetting.get();
|
|
1210
|
-
for (const breakpoint of breakpoints) {
|
|
1211
|
-
breakpoint['resourceTypeName'] = 'script';
|
|
1212
|
-
}
|
|
1213
|
-
breakpointsSetting.set(breakpoints);
|
|
1214
|
-
}
|
|
1215
|
-
|
|
1216
|
-
updateVersionFrom32To33(): void {
|
|
1217
|
-
const previouslyViewedFilesSetting = this.#settings.createLocalSetting<any>('previouslyViewedFiles', []);
|
|
1218
|
-
let previouslyViewedFiles = previouslyViewedFilesSetting.get();
|
|
1219
|
-
|
|
1220
|
-
// Discard old 'previouslyViewedFiles' items that don't have a 'url' property.
|
|
1221
|
-
|
|
1222
|
-
previouslyViewedFiles = previouslyViewedFiles.filter((previouslyViewedFile: any) => 'url' in previouslyViewedFile);
|
|
1223
|
-
|
|
1224
|
-
// Introduce the new 'resourceTypeName' property on previously viewed files.
|
|
1225
|
-
// Prior to this change we only keyed them based on the URL, but since we
|
|
1226
|
-
// don't know which resource type the given file had, we just assume 'script'
|
|
1227
|
-
// here to keep things simple.
|
|
1228
|
-
for (const previouslyViewedFile of previouslyViewedFiles) {
|
|
1229
|
-
previouslyViewedFile['resourceTypeName'] = 'script';
|
|
1230
|
-
}
|
|
1231
|
-
|
|
1232
|
-
previouslyViewedFilesSetting.set(previouslyViewedFiles);
|
|
1233
|
-
}
|
|
1234
|
-
|
|
1235
|
-
updateVersionFrom33To34(): void {
|
|
1236
|
-
// Introduces the 'isLogpoint' property on stored breakpoints. This information was
|
|
1237
|
-
// previously encoded in the 'condition' itself. This migration leaves the condition
|
|
1238
|
-
// alone but ensures that 'isLogpoint' is accurate for already stored breakpoints.
|
|
1239
|
-
// This enables us to use the 'isLogpoint' property in code.
|
|
1240
|
-
// A separate migration will remove the special encoding from the condition itself
|
|
1241
|
-
// once all refactorings are done.
|
|
1242
|
-
|
|
1243
|
-
// The prefix/suffix are hardcoded here, since these constants will be removed in
|
|
1244
|
-
// the future.
|
|
1245
|
-
const logpointPrefix = '/** DEVTOOLS_LOGPOINT */ console.log(';
|
|
1246
|
-
const logpointSuffix = ')';
|
|
1247
|
-
|
|
1248
|
-
const breakpointsSetting = this.#settings.createLocalSetting<any>('breakpoints', []);
|
|
1249
|
-
const breakpoints = breakpointsSetting.get();
|
|
1250
|
-
for (const breakpoint of breakpoints) {
|
|
1251
|
-
const isLogpoint =
|
|
1252
|
-
breakpoint.condition.startsWith(logpointPrefix) && breakpoint.condition.endsWith(logpointSuffix);
|
|
1253
|
-
breakpoint['isLogpoint'] = isLogpoint;
|
|
1254
|
-
}
|
|
1255
|
-
breakpointsSetting.set(breakpoints);
|
|
1256
|
-
}
|
|
1257
|
-
|
|
1258
|
-
updateVersionFrom34To35(): void {
|
|
1259
|
-
// Uses the 'isLogpoint' property on stored breakpoints to remove the prefix/suffix
|
|
1260
|
-
// from logpoints. This way, we store the entered log point condition as the user
|
|
1261
|
-
// entered it.
|
|
1262
|
-
|
|
1263
|
-
// The prefix/suffix are hardcoded here, since these constants will be removed in
|
|
1264
|
-
// the future.
|
|
1265
|
-
const logpointPrefix = '/** DEVTOOLS_LOGPOINT */ console.log(';
|
|
1266
|
-
const logpointSuffix = ')';
|
|
1267
|
-
|
|
1268
|
-
const breakpointsSetting = this.#settings.createLocalSetting<any>('breakpoints', []);
|
|
1269
|
-
const breakpoints = breakpointsSetting.get();
|
|
1270
|
-
for (const breakpoint of breakpoints) {
|
|
1271
|
-
const {condition, isLogpoint} = breakpoint;
|
|
1272
|
-
if (isLogpoint) {
|
|
1273
|
-
breakpoint.condition = condition.slice(logpointPrefix.length, condition.length - logpointSuffix.length);
|
|
1274
|
-
}
|
|
1275
|
-
}
|
|
1276
|
-
breakpointsSetting.set(breakpoints);
|
|
1277
|
-
}
|
|
1278
|
-
|
|
1279
|
-
updateVersionFrom35To36(): void {
|
|
1280
|
-
// We have changed the default from 'false' to 'true' and this updates the existing setting just for once.
|
|
1281
|
-
this.#settings.createSetting('showThirdPartyIssues', true).set(true);
|
|
1282
|
-
}
|
|
1283
|
-
|
|
1284
|
-
updateVersionFrom36To37(): void {
|
|
1285
|
-
const updateStorage = (storage: SettingsStorage): void => {
|
|
1286
|
-
for (const key of storage.keys()) {
|
|
1287
|
-
const normalizedKey = Settings.normalizeSettingName(key);
|
|
1288
|
-
if (normalizedKey !== key) {
|
|
1289
|
-
const value = storage.get(key);
|
|
1290
|
-
this.#removeSetting({name: key, storage});
|
|
1291
|
-
storage.set(normalizedKey, value);
|
|
1292
|
-
}
|
|
1293
|
-
}
|
|
1294
|
-
};
|
|
1295
|
-
updateStorage(this.#settings.globalStorage);
|
|
1296
|
-
updateStorage(this.#settings.syncedStorage);
|
|
1297
|
-
updateStorage(this.#settings.localStorage);
|
|
1298
|
-
|
|
1299
|
-
for (const key of this.#settings.globalStorage.keys()) {
|
|
1300
|
-
if ((key.startsWith('data-grid-') && key.endsWith('-column-weights')) || key.endsWith('-tab-order') ||
|
|
1301
|
-
key === 'views-location-override' || key === 'closeable-tabs') {
|
|
1302
|
-
const setting = this.#settings.createSetting(key, {});
|
|
1303
|
-
setting.set(Platform.StringUtilities.toKebabCaseKeys(setting.get()));
|
|
1304
|
-
}
|
|
1305
|
-
if (key.endsWith('-selected-tab')) {
|
|
1306
|
-
const setting = this.#settings.createSetting(key, '');
|
|
1307
|
-
setting.set(Platform.StringUtilities.toKebabCase(setting.get()));
|
|
1308
|
-
}
|
|
1309
|
-
}
|
|
1310
|
-
}
|
|
1311
|
-
|
|
1312
|
-
updateVersionFrom37To38(): void {
|
|
1313
|
-
const getConsoleInsightsEnabledSetting = (): Setting<boolean>|undefined => {
|
|
1314
|
-
try {
|
|
1315
|
-
return this.#settings.moduleSetting('console-insights-enabled') as Setting<boolean>;
|
|
1316
|
-
} catch {
|
|
1317
|
-
return;
|
|
1318
|
-
}
|
|
1319
|
-
};
|
|
1320
|
-
|
|
1321
|
-
const consoleInsightsEnabled = getConsoleInsightsEnabledSetting();
|
|
1322
|
-
const onboardingFinished = this.#settings.createLocalSetting('console-insights-onboarding-finished', false);
|
|
1323
|
-
|
|
1324
|
-
if (consoleInsightsEnabled && consoleInsightsEnabled.get() === true && onboardingFinished.get() === false) {
|
|
1325
|
-
consoleInsightsEnabled.set(false);
|
|
1326
|
-
}
|
|
1327
|
-
if (consoleInsightsEnabled && consoleInsightsEnabled.get() === false) {
|
|
1328
|
-
onboardingFinished.set(false);
|
|
1329
|
-
}
|
|
1330
|
-
}
|
|
1331
|
-
|
|
1332
|
-
updateVersionFrom38To39(): void {
|
|
1333
|
-
const PREFERRED_NETWORK_COND = 'preferred-network-condition';
|
|
1334
|
-
// crrev.com/c/5582013 renamed "Slow 3G" to "3G" and "Fast 3G" => "Slow 4G".
|
|
1335
|
-
// Any users with the old values need to have them moved to avoid breaking DevTools.
|
|
1336
|
-
// Note: we load the raw value via the globalStorage here because
|
|
1337
|
-
// `createSetting` creates if it is not present, and we do not want that;
|
|
1338
|
-
// we only want to update existing, old values.
|
|
1339
|
-
const setting = this.#settings.globalStorage.get(PREFERRED_NETWORK_COND);
|
|
1340
|
-
if (!setting) {
|
|
1341
|
-
return;
|
|
1342
|
-
}
|
|
1343
|
-
try {
|
|
1344
|
-
const networkSetting = JSON.parse(setting) as unknown as {
|
|
1345
|
-
// Can't use SDK type here as it creates a common<>sdk circular
|
|
1346
|
-
// dep. This type is not exhaustive but contains the fields we
|
|
1347
|
-
// need.
|
|
1348
|
-
title: string,
|
|
1349
|
-
i18nTitleKey?: string,
|
|
1350
|
-
};
|
|
1351
|
-
if (networkSetting.title === 'Slow 3G') {
|
|
1352
|
-
networkSetting.title = '3G';
|
|
1353
|
-
networkSetting.i18nTitleKey = '3G';
|
|
1354
|
-
this.#settings.globalStorage.set(PREFERRED_NETWORK_COND, JSON.stringify(networkSetting));
|
|
1355
|
-
} else if (networkSetting.title === 'Fast 3G') {
|
|
1356
|
-
networkSetting.title = 'Slow 4G';
|
|
1357
|
-
networkSetting.i18nTitleKey = 'Slow 4G';
|
|
1358
|
-
this.#settings.globalStorage.set(PREFERRED_NETWORK_COND, JSON.stringify(networkSetting));
|
|
1359
|
-
}
|
|
1360
|
-
} catch {
|
|
1361
|
-
// If parsing the setting threw, it's in some invalid state, so remove it.
|
|
1362
|
-
this.#settings.globalStorage.remove(PREFERRED_NETWORK_COND);
|
|
1363
|
-
}
|
|
1364
|
-
}
|
|
1365
|
-
|
|
1366
|
-
/**
|
|
1367
|
-
* There are two related migrations here for handling network throttling persistence:
|
|
1368
|
-
* 1. Go through all user custom throttling conditions and add a `key` property.
|
|
1369
|
-
* 2. If the user has a 'preferred-network-condition' setting, take the value
|
|
1370
|
-
* of that and set the right key for the new 'active-network-condition-key'
|
|
1371
|
-
* setting. Then, remove the now-obsolete 'preferred-network-condition'
|
|
1372
|
-
* setting.
|
|
1373
|
-
*/
|
|
1374
|
-
updateVersionFrom39To40(): void {
|
|
1375
|
-
const hasCustomNetworkConditionsSetting = (): boolean => {
|
|
1376
|
-
try {
|
|
1377
|
-
// this will error if it does not exist
|
|
1378
|
-
this.#settings.moduleSetting('custom-network-conditions');
|
|
1379
|
-
return true;
|
|
1380
|
-
} catch {
|
|
1381
|
-
return false;
|
|
1382
|
-
}
|
|
1383
|
-
};
|
|
1384
|
-
if (hasCustomNetworkConditionsSetting()) {
|
|
1385
|
-
/**
|
|
1386
|
-
* We added keys to custom network throttling conditions in M140, so we
|
|
1387
|
-
* need to go through any existing profiles the user has and add the key to
|
|
1388
|
-
* them.
|
|
1389
|
-
* We can't use the SDK.NetworkManager.Condition here as it would be a
|
|
1390
|
-
* circular dependency. All that matters is that these conditions are
|
|
1391
|
-
* objects, and we need to set the right key on each one. The actual keys &
|
|
1392
|
-
* values in the object are not important.
|
|
1393
|
-
*/
|
|
1394
|
-
const conditionsSetting =
|
|
1395
|
-
this.#settings.moduleSetting('custom-network-conditions') as Setting<Array<{key?: string}>>;
|
|
1396
|
-
const customConditions = conditionsSetting.get();
|
|
1397
|
-
if (customConditions?.length > 0) {
|
|
1398
|
-
customConditions.forEach((condition, i) => {
|
|
1399
|
-
// This could be run multiple times, make sure that we don't override any
|
|
1400
|
-
// existing keys.
|
|
1401
|
-
if (condition.key) {
|
|
1402
|
-
return;
|
|
1403
|
-
}
|
|
1404
|
-
// The format of this key is important: see
|
|
1405
|
-
// SDK.NetworkManager.UserDefinedThrottlingConditionKey
|
|
1406
|
-
condition.key = `USER_CUSTOM_SETTING_${i + 1}`;
|
|
1407
|
-
});
|
|
1408
|
-
conditionsSetting.set(customConditions);
|
|
1409
|
-
}
|
|
1410
|
-
}
|
|
1411
|
-
|
|
1412
|
-
// Additionally, we need to make sure we persist the right throttling for
|
|
1413
|
-
// users who have a preferred-network-condition set.
|
|
1414
|
-
const PREFERRED_NETWORK_COND_SETTING = 'preferred-network-condition';
|
|
1415
|
-
// We shipped a change to how we persist network throttling conditions and
|
|
1416
|
-
// added a `key` property rather than rely on any user visible string which
|
|
1417
|
-
// is more likely to change. This migration step tries to update the
|
|
1418
|
-
// setting for users, or removes it if we fail, so they start fresh next
|
|
1419
|
-
// time they load DevTools.
|
|
1420
|
-
const setting = this.#settings.globalStorage.get(PREFERRED_NETWORK_COND_SETTING);
|
|
1421
|
-
if (!setting) {
|
|
1422
|
-
return;
|
|
1423
|
-
}
|
|
1424
|
-
// The keys here are the UI Strings as of July 2025 (shipped in M139).
|
|
1425
|
-
// This migration shipped in M140. The values are the values of the
|
|
1426
|
-
// `PredefinedThrottlingConditionKey` in SDK.NetworkManager.
|
|
1427
|
-
const UI_STRING_TO_NEW_KEY = {
|
|
1428
|
-
'Fast 4G': 'SPEED_FAST_4G',
|
|
1429
|
-
'Slow 4G': 'SPEED_SLOW_4G',
|
|
1430
|
-
'3G': 'SPEED_3G',
|
|
1431
|
-
'No throttling': 'NO_THROTTLING',
|
|
1432
|
-
Offline: 'OFFLINE'
|
|
1433
|
-
};
|
|
1434
|
-
try {
|
|
1435
|
-
const networkSetting = JSON.parse(setting) as unknown as {
|
|
1436
|
-
// Can't use SDK type here as it creates a common<>sdk circular
|
|
1437
|
-
// dep. We only rely on the i18nTitleKey.
|
|
1438
|
-
i18nTitleKey?: string,
|
|
1439
|
-
};
|
|
1440
|
-
if (networkSetting.i18nTitleKey && UI_STRING_TO_NEW_KEY.hasOwnProperty(networkSetting.i18nTitleKey)) {
|
|
1441
|
-
const key = UI_STRING_TO_NEW_KEY[networkSetting.i18nTitleKey as keyof typeof UI_STRING_TO_NEW_KEY];
|
|
1442
|
-
|
|
1443
|
-
// The second argument is the default value, so it's important that we
|
|
1444
|
-
// set this to the default, and then update it to the new key.
|
|
1445
|
-
const newSetting = this.#settings.createSetting('active-network-condition-key', 'NO_THROTTLING');
|
|
1446
|
-
newSetting.set(key);
|
|
1447
|
-
}
|
|
1448
|
-
} finally {
|
|
1449
|
-
// This setting is now not used, so we can remove it.
|
|
1450
|
-
this.#settings.globalStorage.remove(PREFERRED_NETWORK_COND_SETTING);
|
|
1451
|
-
}
|
|
1452
|
-
}
|
|
1453
|
-
|
|
1454
|
-
// This migration handles two setting renames that requires inverted logic
|
|
1455
|
-
// (from "Hide X" to "X") and flipped the default values to true.
|
|
1456
|
-
updateVersionFrom40To41(): void {
|
|
1457
|
-
// 1. Rename 'Hide network messages' to 'Network messages'
|
|
1458
|
-
if (this.#settings.syncedStorage.has('hide-network-messages')) {
|
|
1459
|
-
const oldNetworkSetting = this.#settings.createSetting('hide-network-messages', false, SettingStorageType.SYNCED);
|
|
1460
|
-
if (!this.#settings.syncedStorage.has('network-messages')) {
|
|
1461
|
-
const newNetworkSetting = this.#settings.createSetting('network-messages', true, SettingStorageType.SYNCED);
|
|
1462
|
-
// If the user had a saved preference for the old setting, migrate it by
|
|
1463
|
-
// inverting the value to match the new logic.
|
|
1464
|
-
newNetworkSetting.set(!oldNetworkSetting.get());
|
|
1465
|
-
}
|
|
1466
|
-
this.#removeSetting(oldNetworkSetting);
|
|
1467
|
-
}
|
|
1468
|
-
|
|
1469
|
-
// 2. Rename 'Hide `chrome` frame in Layers view' to 'Chrome frame in Layers view'
|
|
1470
|
-
if (this.#settings.syncedStorage.has('frame-viewer-hide-chrome-window')) {
|
|
1471
|
-
const oldChromeFrameSetting =
|
|
1472
|
-
this.#settings.createSetting('frame-viewer-hide-chrome-window', false, SettingStorageType.SYNCED);
|
|
1473
|
-
if (!this.#settings.syncedStorage.has('frame-viewer-chrome-window')) {
|
|
1474
|
-
const newChromeFrameSetting =
|
|
1475
|
-
this.#settings.createSetting('frame-viewer-chrome-window', true, SettingStorageType.SYNCED);
|
|
1476
|
-
// Similar to above, move the preference and invert the boolean.
|
|
1477
|
-
newChromeFrameSetting.set(!oldChromeFrameSetting.get());
|
|
1478
|
-
}
|
|
1479
|
-
this.#removeSetting(oldChromeFrameSetting);
|
|
1480
|
-
}
|
|
1481
|
-
}
|
|
1482
|
-
|
|
1483
|
-
/**
|
|
1484
|
-
* The recording in recorder panel may have unreasonably long titles
|
|
1485
|
-
* or a lot of steps which can cause renderer crashes.
|
|
1486
|
-
* Similar to https://crbug.com/40918380
|
|
1487
|
-
*/
|
|
1488
|
-
updateVersionFrom41To42(): void {
|
|
1489
|
-
const recordingsSetting = this.#settings.createSetting<Array<{flow: {steps: unknown[], title: string}}>>(
|
|
1490
|
-
'recorder-recordings-ng',
|
|
1491
|
-
[],
|
|
1492
|
-
);
|
|
1493
|
-
const recordings = recordingsSetting.get();
|
|
1494
|
-
if (recordings.length === 0) {
|
|
1495
|
-
return;
|
|
1496
|
-
}
|
|
1497
|
-
|
|
1498
|
-
for (const recording of recordings) {
|
|
1499
|
-
recording.flow.title = Platform.StringUtilities.trimEndWithMaxLength(recording.flow.title, 300);
|
|
1500
|
-
recording.flow.steps = recording.flow.steps.slice(0, 4096);
|
|
1501
|
-
}
|
|
1502
|
-
|
|
1503
|
-
recordingsSetting.set(recordings);
|
|
1504
|
-
}
|
|
1505
|
-
|
|
1506
|
-
/*
|
|
1507
|
-
* Any new migration should be added before this comment.
|
|
1508
|
-
*
|
|
1509
|
-
* IMPORTANT: Migrations must be idempotent, since they may be applied
|
|
1510
|
-
* multiple times! E.g. when renaming a setting one has to check that the
|
|
1511
|
-
* a setting with the new name does not yet exist.
|
|
1512
|
-
* ----------------------------------------------------------------------- */
|
|
1513
|
-
|
|
1514
|
-
private migrateSettingsFromLocalStorage(): void {
|
|
1515
|
-
// This step migrates all the settings except for the ones below into the browser profile.
|
|
1516
|
-
const localSettings = new Set<string>([
|
|
1517
|
-
'advancedSearchConfig',
|
|
1518
|
-
'breakpoints',
|
|
1519
|
-
'consoleHistory',
|
|
1520
|
-
'domBreakpoints',
|
|
1521
|
-
'eventListenerBreakpoints',
|
|
1522
|
-
'fileSystemMapping',
|
|
1523
|
-
'lastSelectedSourcesSidebarPaneTab',
|
|
1524
|
-
'previouslyViewedFiles',
|
|
1525
|
-
'savedURLs',
|
|
1526
|
-
'watchExpressions',
|
|
1527
|
-
'workspaceExcludedFolders',
|
|
1528
|
-
'xhrBreakpoints',
|
|
1529
|
-
]);
|
|
1530
|
-
if (!window.localStorage) {
|
|
1531
|
-
return;
|
|
1532
|
-
}
|
|
1533
|
-
|
|
1534
|
-
for (const key in window.localStorage) {
|
|
1535
|
-
if (localSettings.has(key)) {
|
|
1536
|
-
continue;
|
|
1537
|
-
}
|
|
1538
|
-
const value = window.localStorage[key];
|
|
1539
|
-
window.localStorage.removeItem(key);
|
|
1540
|
-
this.#settings.globalStorage.set(key, value);
|
|
1541
|
-
}
|
|
1542
|
-
}
|
|
1543
|
-
|
|
1544
|
-
private clearBreakpointsWhenTooMany(breakpointsSetting: Setting<unknown[]>, maxBreakpointsCount: number): void {
|
|
1545
|
-
// If there are too many breakpoints in a storage, it is likely due to a recent bug that caused
|
|
1546
|
-
// periodical breakpoints duplication leading to inspector slowness.
|
|
1547
|
-
if (breakpointsSetting.get().length > maxBreakpointsCount) {
|
|
1548
|
-
breakpointsSetting.set([]);
|
|
1549
|
-
}
|
|
1550
|
-
}
|
|
1551
|
-
}
|
|
1552
|
-
/* eslint-enable @typescript-eslint/no-explicit-any */
|
|
1553
|
-
|
|
1554
684
|
export const enum SettingStorageType {
|
|
1555
685
|
/** Persists with the active Chrome profile but also syncs the settings across devices via Chrome Sync. */
|
|
1556
686
|
SYNCED = 'Synced',
|