chrome-devtools-frontend 1.0.1669021 → 1.0.1672388

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 (208) hide show
  1. package/.agents/skills/fixing-skipped-tests/SKILL.md +6 -6
  2. package/.agents/skills/gerrit-cli/SKILL.md +4 -10
  3. package/.agents/skills/gerrit-cli/references/commands.md +45 -2
  4. package/.agents/skills/gerrit-cli/references/workflows.md +7 -0
  5. package/.agents/skills/gerrit-cli/scripts/import_upstream.py +34 -152
  6. package/config/typescript/tsconfig.eslint.json +1 -1
  7. package/docs/contributing/settings-experiments-features.md +2 -8
  8. package/docs/ecosystem/automatic_workspace_folders.md +0 -19
  9. package/eslint.config.mjs +2 -2
  10. package/front_end/core/common/Lazy.ts +3 -3
  11. package/front_end/core/common/SettingRegistration.ts +0 -7
  12. package/front_end/core/common/Settings.ts +0 -38
  13. package/front_end/core/host/UserMetrics.ts +187 -953
  14. package/front_end/core/host/UserMetricsEnums.d.ts +949 -0
  15. package/front_end/core/root/Runtime.ts +21 -133
  16. package/front_end/core/sdk/CSSMetadata.ts +70 -65
  17. package/front_end/core/sdk/CategorizedBreakpoint.ts +0 -1
  18. package/front_end/core/sdk/ChildTargetManager.ts +0 -2
  19. package/front_end/core/sdk/EmulationModel.ts +0 -2
  20. package/front_end/core/sdk/EventBreakpointsModel.ts +0 -4
  21. package/front_end/core/sdk/NetworkManager.ts +0 -3
  22. package/front_end/core/sdk/PageResourceLoader.ts +9 -9
  23. package/front_end/core/sdk/RehydratingConnection.ts +52 -4
  24. package/front_end/core/sdk/Target.ts +0 -4
  25. package/front_end/devtools_compatibility.js +886 -0
  26. package/front_end/entrypoints/inspector_main/RenderingOptions.ts +7 -6
  27. package/front_end/entrypoints/main/ExecutionContextSelector.ts +0 -1
  28. package/front_end/entrypoints/main/MainImpl.ts +18 -22
  29. package/front_end/foundation/Universe.ts +7 -2
  30. package/front_end/generated/InspectorBackendCommands.ts +3 -10
  31. package/front_end/generated/protocol-mapping.d.ts +0 -42
  32. package/front_end/generated/protocol-proxy-api.d.ts +0 -38
  33. package/front_end/generated/protocol.ts +9 -169
  34. package/front_end/models/ai_assistance/AiAgent2.ts +11 -3
  35. package/front_end/models/ai_assistance/AiConversation.ts +1 -0
  36. package/front_end/models/ai_assistance/AiHistoryStorage.ts +8 -5
  37. package/front_end/models/ai_assistance/AiSetting.ts +108 -0
  38. package/front_end/models/ai_assistance/AiUtils.ts +47 -0
  39. package/front_end/models/ai_assistance/ChangeManager.ts +1 -0
  40. package/front_end/models/ai_assistance/ExtensionScope.ts +3 -12
  41. package/front_end/models/ai_assistance/agents/AiAgent.ts +11 -18
  42. package/front_end/models/ai_assistance/agents/ContextSelectionAgent.ts +3 -0
  43. package/front_end/models/ai_assistance/agents/ExecuteJavascript.ts +42 -17
  44. package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +3 -2
  45. package/front_end/models/ai_assistance/agents/StorageAgent.ts +253 -155
  46. package/front_end/models/ai_assistance/agents/StylingAgent.snapshot.txt +2 -2
  47. package/front_end/models/ai_assistance/ai_assistance.ts +4 -0
  48. package/front_end/models/ai_assistance/contexts/PerformanceTraceContext.ts +12 -6
  49. package/front_end/models/ai_assistance/data_formatters/FileFormatter.ts +3 -1
  50. package/front_end/models/ai_assistance/data_formatters/NetworkRequestFormatter.ts +1 -0
  51. package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.ts +1 -0
  52. package/front_end/models/ai_assistance/injected.ts +1 -0
  53. package/front_end/models/ai_assistance/performance/AICallTree.ts +1 -0
  54. package/front_end/models/ai_assistance/skills/Skill.ts +1 -1
  55. package/front_end/models/ai_assistance/skills/SkillRegistry.ts +2 -0
  56. package/front_end/models/ai_assistance/skills/performance.md +10 -0
  57. package/front_end/models/ai_assistance/tools/ExecuteJavaScript.ts +52 -5
  58. package/front_end/models/ai_assistance/tools/GetElementAccessibilityDetails.ts +4 -4
  59. package/front_end/models/ai_assistance/tools/GetLighthouseAudits.ts +4 -4
  60. package/front_end/models/ai_assistance/tools/GetNetworkRequestDetails.ts +5 -4
  61. package/front_end/models/ai_assistance/tools/GetStyles.ts +5 -4
  62. package/front_end/models/ai_assistance/tools/ListNetworkRequests.ts +5 -4
  63. package/front_end/models/ai_assistance/tools/README.md +1 -1
  64. package/front_end/models/ai_assistance/tools/RecordPerformanceTrace.ts +63 -0
  65. package/front_end/models/ai_assistance/tools/ResolveDevtoolsNodePath.ts +5 -5
  66. package/front_end/models/ai_assistance/tools/Tool.ts +118 -24
  67. package/front_end/models/ai_assistance/tools/ToolRegistry.ts +2 -0
  68. package/front_end/models/badges/UserBadges.ts +2 -0
  69. package/front_end/models/bindings/NetworkProject.ts +5 -0
  70. package/front_end/models/bindings/ResourceScriptMapping.ts +2 -0
  71. package/front_end/models/bindings/ResourceUtils.ts +3 -0
  72. package/front_end/models/crux-manager/CrUXManager.ts +1 -0
  73. package/front_end/models/emulation/DeviceModeModel.ts +140 -7
  74. package/front_end/models/emulation/EmulatedDevices.ts +246 -793
  75. package/front_end/models/issues_manager/IssuesManager.ts +10 -2
  76. package/front_end/models/live-metrics/LiveMetrics.ts +41 -9
  77. package/front_end/models/logs/LogManager.ts +8 -5
  78. package/front_end/models/logs/NetworkLog.ts +1 -0
  79. package/front_end/models/persistence/IsolatedFileSystemManager.ts +21 -3
  80. package/front_end/models/persistence/NetworkPersistenceManager.ts +6 -0
  81. package/front_end/models/project_settings/ProjectSettingsModel.ts +8 -12
  82. package/front_end/models/trace_source_maps_resolver/SourceMapsResolver.ts +3 -1
  83. package/front_end/models/workspace/IgnoreListManager.ts +2 -0
  84. package/front_end/models/workspace/UISourceCode.ts +2 -0
  85. package/front_end/models/workspace_diff/WorkspaceDiff.ts +4 -0
  86. package/front_end/panels/ai_assistance/AiAssistancePanel.ts +22 -22
  87. package/front_end/panels/ai_assistance/ai_assistance-meta.ts +0 -7
  88. package/front_end/panels/ai_assistance/components/ChatInput.ts +4 -0
  89. package/front_end/panels/ai_assistance/components/ChatMessage.ts +79 -34
  90. package/front_end/panels/ai_assistance/components/WalkthroughView.ts +1 -2
  91. package/front_end/panels/ai_assistance/components/walkthroughView.css +1 -1
  92. package/front_end/panels/application/ApplicationPanelSidebar.ts +9 -106
  93. package/front_end/panels/application/ApplicationPanelTreeElement.ts +1 -1
  94. package/front_end/panels/application/application.ts +0 -10
  95. package/front_end/panels/application/components/components.ts +0 -4
  96. package/front_end/panels/browser_debugger/CategorizedBreakpointsSidebarPane.ts +0 -5
  97. package/front_end/panels/browser_debugger/EventListenerBreakpointsSidebarPane.ts +6 -12
  98. package/front_end/panels/browser_debugger/browser_debugger-meta.ts +5 -3
  99. package/front_end/panels/console/ConsoleFormat.ts +2 -62
  100. package/front_end/panels/console/ConsoleViewMessage.ts +14 -7
  101. package/front_end/panels/emulation/AdvancedApp.ts +1 -2
  102. package/front_end/panels/emulation/DeviceModeToolbar.ts +83 -69
  103. package/front_end/panels/emulation/DeviceModeView.ts +4 -134
  104. package/front_end/panels/emulation/DeviceModeWrapper.ts +52 -69
  105. package/front_end/panels/emulation/MediaQueryInspector.ts +2 -2
  106. package/front_end/panels/emulation/emulation-meta.ts +12 -12
  107. package/front_end/panels/issues/IssuesPane.ts +3 -1
  108. package/front_end/panels/lighthouse/LighthouseController.ts +6 -0
  109. package/front_end/panels/linear_memory_inspector/components/LinearMemoryInspector.ts +17 -21
  110. package/front_end/panels/linear_memory_inspector/components/LinearMemoryNavigator.ts +206 -126
  111. package/front_end/panels/linear_memory_inspector/components/linearMemoryInspector.css +1 -1
  112. package/front_end/panels/mobile_throttling/CalibrationController.ts +1 -1
  113. package/front_end/panels/mobile_throttling/MobileThrottlingSelector.ts +3 -3
  114. package/front_end/panels/mobile_throttling/NetworkPanelIndicator.ts +6 -6
  115. package/front_end/panels/mobile_throttling/NetworkThrottlingSelector.ts +11 -11
  116. package/front_end/panels/mobile_throttling/ThrottlingManager.ts +13 -13
  117. package/front_end/panels/mobile_throttling/ThrottlingPresets.ts +10 -10
  118. package/front_end/panels/mobile_throttling/ThrottlingSettingsTab.ts +28 -28
  119. package/front_end/panels/mobile_throttling/mobile_throttling-meta.ts +6 -6
  120. package/front_end/panels/network/RequestHeadersView.ts +1 -1
  121. package/front_end/panels/network/ResourceChunkView.ts +243 -144
  122. package/front_end/panels/network/ResourceDirectSocketChunkView.ts +52 -29
  123. package/front_end/panels/network/ResourceWebSocketFrameView.ts +21 -35
  124. package/front_end/panels/network/resourceChunkView.css +41 -36
  125. package/front_end/panels/profiler/HeapDetachedElementsDataGrid.ts +21 -12
  126. package/front_end/panels/profiler/profiler.ts +4 -0
  127. package/front_end/panels/recorder/RecorderPanel.ts +6 -14
  128. package/front_end/panels/sensors/LocationsSettingsTab.ts +7 -7
  129. package/front_end/panels/settings/AISettingsTab.ts +75 -31
  130. package/front_end/panels/settings/SettingsScreen.ts +8 -13
  131. package/front_end/panels/settings/components/SyncSection.ts +3 -4
  132. package/front_end/panels/settings/emulation/DevicesSettingsTab.ts +200 -18
  133. package/front_end/panels/settings/emulation/devicesSettingsTab.css +18 -0
  134. package/front_end/panels/settings/settings-meta.ts +0 -1
  135. package/front_end/panels/sources/CategorizedBreakpointL10n.ts +0 -2
  136. package/front_end/panels/sources/DebuggerPausedMessage.ts +11 -5
  137. package/front_end/panels/sources/DebuggerPlugin.ts +1 -1
  138. package/front_end/panels/sources/EditingLocationHistoryManager.ts +12 -9
  139. package/front_end/panels/sources/SourcesPanel.ts +19 -17
  140. package/front_end/panels/sources/SourcesView.ts +191 -96
  141. package/front_end/panels/sources/TabbedEditorContainer.ts +3 -4
  142. package/front_end/panels/sources/WatchExpressionsSidebarPane.ts +2 -5
  143. package/front_end/panels/timeline/TimelineUIUtils.ts +15 -0
  144. package/front_end/panels/timeline/timeline-meta.ts +3 -5
  145. package/front_end/third_party/chromium/README.chromium +1 -1
  146. package/front_end/third_party/codemirror.next/chunk/angular.js +1 -1
  147. package/front_end/third_party/codemirror.next/chunk/codemirror.js +1 -1
  148. package/front_end/third_party/codemirror.next/chunk/codemirror.js.map +1 -1
  149. package/front_end/third_party/codemirror.next/chunk/cpp.js +1 -1
  150. package/front_end/third_party/codemirror.next/chunk/cpp.js.map +1 -1
  151. package/front_end/third_party/codemirror.next/chunk/java.js +1 -1
  152. package/front_end/third_party/codemirror.next/chunk/java.js.map +1 -1
  153. package/front_end/third_party/codemirror.next/chunk/legacy.js +1 -1
  154. package/front_end/third_party/codemirror.next/chunk/less.js +1 -1
  155. package/front_end/third_party/codemirror.next/chunk/less.js.map +1 -1
  156. package/front_end/third_party/codemirror.next/chunk/markdown.js +1 -1
  157. package/front_end/third_party/codemirror.next/chunk/markdown.js.map +1 -1
  158. package/front_end/third_party/codemirror.next/chunk/php.js +1 -1
  159. package/front_end/third_party/codemirror.next/chunk/php.js.map +1 -1
  160. package/front_end/third_party/codemirror.next/chunk/python.js +1 -1
  161. package/front_end/third_party/codemirror.next/chunk/python.js.map +1 -1
  162. package/front_end/third_party/codemirror.next/chunk/sass.js +1 -1
  163. package/front_end/third_party/codemirror.next/chunk/sass.js.map +1 -1
  164. package/front_end/third_party/codemirror.next/chunk/svelte.js +1 -1
  165. package/front_end/third_party/codemirror.next/chunk/svelte.js.map +1 -1
  166. package/front_end/third_party/codemirror.next/chunk/vue.js +1 -1
  167. package/front_end/third_party/codemirror.next/chunk/wast.js +1 -1
  168. package/front_end/third_party/codemirror.next/chunk/wast.js.map +1 -1
  169. package/front_end/third_party/codemirror.next/chunk/xml.js +1 -1
  170. package/front_end/third_party/codemirror.next/chunk/xml.js.map +1 -1
  171. package/front_end/third_party/codemirror.next/codemirror.next.d.ts +1332 -193
  172. package/front_end/third_party/codemirror.next/codemirror.next.js +1 -1
  173. package/front_end/third_party/codemirror.next/rebuild.sh +1 -1
  174. package/front_end/tsconfig.compatibility.json +2 -1
  175. package/front_end/tsconfig.json +1 -1
  176. package/front_end/ui/components/icon_button/IconButton.ts +1 -1
  177. package/front_end/ui/components/issue_counter/IssueCounter.ts +1 -1
  178. package/front_end/ui/components/settings/SettingCheckbox.ts +4 -7
  179. package/front_end/ui/components/settings/settings.ts +1 -2
  180. package/front_end/ui/legacy/Treeoutline.ts +52 -30
  181. package/front_end/ui/legacy/components/object_ui/CSSStyleSanitizer.ts +74 -0
  182. package/front_end/ui/legacy/components/object_ui/CustomPreviewComponent.ts +6 -1
  183. package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +47 -54
  184. package/front_end/ui/legacy/components/object_ui/object_ui.ts +2 -0
  185. package/front_end/ui/legacy/components/quick_open/CommandMenu.ts +5 -27
  186. package/front_end/ui/legacy/components/settings_ui/SettingsUI.ts +10 -12
  187. package/front_end/ui/settings/SettingUIRegistration.ts +0 -8
  188. package/front_end/ui/visual_logging/KnownContextValues.ts +21 -0
  189. package/inspector_overlay/tsconfig.json +8 -2
  190. package/package.json +3 -2
  191. package/.agents/skills/gerrit-cli/scripts/gerrit_client_wrapper.py +0 -47
  192. package/front_end/core/sdk/CSSModel.test.api.ts +0 -102
  193. package/front_end/core/sdk/DOMModel.test.api.ts +0 -104
  194. package/front_end/foundation/Universe.test.api.ts +0 -73
  195. package/front_end/panels/application/SharedStorageEventsView.ts +0 -128
  196. package/front_end/panels/application/SharedStorageItemsView.ts +0 -179
  197. package/front_end/panels/application/SharedStorageListTreeElement.ts +0 -65
  198. package/front_end/panels/application/SharedStorageModel.ts +0 -249
  199. package/front_end/panels/application/SharedStorageTreeElement.ts +0 -40
  200. package/front_end/panels/application/components/SharedStorageAccessGrid.ts +0 -191
  201. package/front_end/panels/application/components/SharedStorageMetadataView.ts +0 -133
  202. package/front_end/panels/application/components/sharedStorageAccessGrid.css +0 -29
  203. package/front_end/panels/application/components/sharedStorageMetadataView.css +0 -29
  204. package/front_end/panels/application/sharedStorageEventsView.css +0 -9
  205. package/front_end/panels/network/OriginalResourceChunkView.ts +0 -340
  206. package/front_end/panels/network/originalResourceChunkView.css +0 -49
  207. package/front_end/ui/components/settings/SettingDeprecationWarning.ts +0 -47
  208. package/front_end/ui/components/settings/settingDeprecationWarning.css +0 -14
@@ -1,179 +0,0 @@
1
- // Copyright 2022 The Chromium Authors
2
- // Use of this source code is governed by a BSD-style license that can be
3
- // found in the LICENSE file.
4
-
5
- import * as Common from '../../core/common/common.js';
6
- import * as i18n from '../../core/i18n/i18n.js';
7
- import type * as Protocol from '../../generated/protocol.js';
8
- import * as SourceFrame from '../../ui/legacy/components/source_frame/source_frame.js';
9
- import * as UI from '../../ui/legacy/legacy.js';
10
-
11
- import * as ApplicationComponents from './components/components.js';
12
- import {KeyValueStorageItemsView, type View as ViewFunction} from './KeyValueStorageItemsView.js';
13
- import {SharedStorageForOrigin} from './SharedStorageModel.js';
14
-
15
- const UIStrings = {
16
- /**
17
- * @description Text in SharedStorage Items View of the Application panel
18
- */
19
- sharedStorage: 'Shared storage',
20
- /**
21
- * @description Text for announcing that the "Shared Storage Items" table was cleared, that is, all
22
- * entries were deleted.
23
- */
24
- sharedStorageItemsCleared: 'Shared Storage items cleared',
25
- /**
26
- * @description Text for announcing that the filtered "Shared Storage Items" table was cleared, that is,
27
- * all filtered entries were deleted.
28
- */
29
- sharedStorageFilteredItemsCleared: 'Shared Storage filtered items cleared',
30
- /**
31
- * @description Text for announcing a Shared Storage key/value item has been deleted
32
- */
33
- sharedStorageItemDeleted: 'The storage item was deleted.',
34
- /**
35
- * @description Text for announcing a Shared Storage key/value item has been edited
36
- */
37
- sharedStorageItemEdited: 'The storage item was edited.',
38
- /**
39
- * @description Text for announcing a Shared Storage key/value item edit request has been canceled
40
- */
41
- sharedStorageItemEditCanceled: 'The storage item edit was canceled.',
42
- } as const;
43
- const str_ = i18n.i18n.registerUIStrings('panels/application/SharedStorageItemsView.ts', UIStrings);
44
- const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
45
-
46
- interface WrappedEntry {
47
- key: string;
48
- value: string;
49
- }
50
-
51
- export namespace SharedStorageItemsDispatcher {
52
- export const enum Events {
53
- FILTERED_ITEMS_CLEARED = 'FilteredItemsCleared',
54
- ITEM_DELETED = 'ItemDeleted',
55
- ITEM_EDITED = 'ItemEdited',
56
- ITEMS_CLEARED = 'ItemsCleared',
57
- ITEMS_REFRESHED = 'ItemsRefreshed',
58
- }
59
-
60
- export interface ItemDeletedEvent {
61
- key: string;
62
- }
63
-
64
- export interface ItemEditedEvent {
65
- columnIdentifier: string;
66
- oldText: string|null;
67
- newText: string;
68
- }
69
-
70
- export interface EventTypes {
71
- [Events.FILTERED_ITEMS_CLEARED]: void;
72
- [Events.ITEM_DELETED]: ItemDeletedEvent;
73
- [Events.ITEM_EDITED]: void;
74
- [Events.ITEMS_CLEARED]: void;
75
- [Events.ITEMS_REFRESHED]: void;
76
- }
77
- }
78
-
79
- export class SharedStorageItemsView extends KeyValueStorageItemsView {
80
- #sharedStorage: SharedStorageForOrigin;
81
- readonly sharedStorageItemsDispatcher: Common.ObjectWrapper.ObjectWrapper<SharedStorageItemsDispatcher.EventTypes>;
82
-
83
- constructor(sharedStorage: SharedStorageForOrigin, view?: ViewFunction) {
84
- super(
85
- i18nString(UIStrings.sharedStorage), 'shared-storage-items-view', /* editable=*/ true, view,
86
- new ApplicationComponents.SharedStorageMetadataView.SharedStorageMetadataView(
87
- sharedStorage, sharedStorage.securityOrigin));
88
-
89
- this.#sharedStorage = sharedStorage;
90
- this.performUpdate();
91
-
92
- this.#sharedStorage.addEventListener(
93
- SharedStorageForOrigin.Events.SHARED_STORAGE_CHANGED, this.#sharedStorageChanged, this);
94
-
95
- this.sharedStorageItemsDispatcher =
96
- new Common.ObjectWrapper.ObjectWrapper<SharedStorageItemsDispatcher.EventTypes>();
97
- }
98
-
99
- // Use `createView()` instead of the constructor to create a view, so that entries can be awaited asynchronously.
100
- static async createView(sharedStorage: SharedStorageForOrigin, viewFunction?: ViewFunction):
101
- Promise<SharedStorageItemsView> {
102
- const view = new SharedStorageItemsView(sharedStorage, viewFunction);
103
- await view.updateEntriesOnly();
104
- return view;
105
- }
106
-
107
- async updateEntriesOnly(): Promise<void> {
108
- const entries = await this.#sharedStorage.getEntries();
109
- if (entries) {
110
- this.#showSharedStorageItems(entries);
111
- }
112
- }
113
-
114
- async #sharedStorageChanged(): Promise<void> {
115
- await this.refreshItems();
116
- }
117
-
118
- override async refreshItems(): Promise<void> {
119
- await this.metadataView?.render();
120
- await this.updateEntriesOnly();
121
- this.sharedStorageItemsDispatcher.dispatchEventToListeners(SharedStorageItemsDispatcher.Events.ITEMS_REFRESHED);
122
- }
123
-
124
- override async deleteAllItems(): Promise<void> {
125
- if (!this.toolbar?.hasFilter()) {
126
- await this.#sharedStorage.clear();
127
- await this.refreshItems();
128
- this.sharedStorageItemsDispatcher.dispatchEventToListeners(SharedStorageItemsDispatcher.Events.ITEMS_CLEARED);
129
- UI.ARIAUtils.LiveAnnouncer.alert(i18nString(UIStrings.sharedStorageItemsCleared));
130
- return;
131
- }
132
-
133
- await Promise.all(this.keys().map(key => this.#sharedStorage.deleteEntry(key)));
134
-
135
- await this.refreshItems();
136
- this.sharedStorageItemsDispatcher.dispatchEventToListeners(
137
- SharedStorageItemsDispatcher.Events.FILTERED_ITEMS_CLEARED);
138
- UI.ARIAUtils.LiveAnnouncer.alert(i18nString(UIStrings.sharedStorageFilteredItemsCleared));
139
- }
140
-
141
- protected override isEditAllowed(columnIdentifier: string, _oldText: string, newText: string): boolean {
142
- if (columnIdentifier === 'key' && newText === '') {
143
- // The Shared Storage backend does not currently allow '' as a key, so we only set a new entry with a new key if its new key is nonempty.
144
- void this.refreshItems().then(() => {
145
- UI.ARIAUtils.LiveAnnouncer.alert(i18nString(UIStrings.sharedStorageItemEditCanceled));
146
- });
147
- return false;
148
- }
149
- return true;
150
- }
151
-
152
- protected async setItem(key: string, value: string): Promise<void> {
153
- await this.#sharedStorage.setEntry(key, value, false);
154
-
155
- await this.refreshItems();
156
- this.sharedStorageItemsDispatcher.dispatchEventToListeners(SharedStorageItemsDispatcher.Events.ITEM_EDITED);
157
- UI.ARIAUtils.LiveAnnouncer.alert(i18nString(UIStrings.sharedStorageItemEdited));
158
- }
159
-
160
- #showSharedStorageItems(items: Protocol.Storage.SharedStorageEntry[]): void {
161
- if (this.toolbar) {
162
- const filteredList = items.filter(item => this.toolbar?.filterRegex?.test(`${item.key} ${item.value}`) ?? true);
163
- this.showItems(filteredList);
164
- }
165
- }
166
-
167
- protected async removeItem(key: string): Promise<void> {
168
- await this.#sharedStorage.deleteEntry(key);
169
- await this.refreshItems();
170
- this.sharedStorageItemsDispatcher.dispatchEventToListeners(
171
- SharedStorageItemsDispatcher.Events.ITEM_DELETED, {key} as SharedStorageItemsDispatcher.ItemDeletedEvent);
172
- UI.ARIAUtils.LiveAnnouncer.alert(i18nString(UIStrings.sharedStorageItemDeleted));
173
- }
174
-
175
- protected async createPreview(key: string, value: string): Promise<UI.Widget.Widget|null> {
176
- const wrappedEntry = key && {key, value: value || ''} as WrappedEntry;
177
- return SourceFrame.JSONView.JSONView.createViewSync(wrappedEntry);
178
- }
179
- }
@@ -1,65 +0,0 @@
1
- // Copyright 2022 The Chromium Authors
2
- // Use of this source code is governed by a BSD-style license that can be
3
- // found in the LICENSE file.
4
-
5
- import * as Common from '../../core/common/common.js';
6
- import * as i18n from '../../core/i18n/i18n.js';
7
- import type * as Platform from '../../core/platform/platform.js';
8
- import type * as Protocol from '../../generated/protocol.js';
9
- import {createIcon} from '../../ui/kit/kit.js';
10
-
11
- import {ApplicationPanelTreeElement} from './ApplicationPanelTreeElement.js';
12
- import type {ResourcesPanel} from './ResourcesPanel.js';
13
- import {SharedStorageEventsView} from './SharedStorageEventsView.js';
14
-
15
- const UIStrings = {
16
- /**
17
- * @description Text in SharedStorage Category View of the Application panel
18
- */
19
- sharedStorage: 'Shared storage',
20
- } as const;
21
- const str_ = i18n.i18n.registerUIStrings('panels/application/SharedStorageListTreeElement.ts', UIStrings);
22
- const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
23
-
24
- export class SharedStorageListTreeElement extends ApplicationPanelTreeElement {
25
- readonly #expandedSetting: Common.Settings.Setting<boolean>;
26
- readonly view: SharedStorageEventsView;
27
-
28
- constructor(resourcesPanel: ResourcesPanel, expandedSettingsDefault = false) {
29
- super(resourcesPanel, i18nString(UIStrings.sharedStorage), false, 'shared-storage');
30
- this.#expandedSetting =
31
- Common.Settings.Settings.instance().createSetting('resources-shared-storage-expanded', expandedSettingsDefault);
32
- const sharedStorageIcon = createIcon('database');
33
- this.setLeadingIcons([sharedStorageIcon]);
34
- this.view = new SharedStorageEventsView();
35
- }
36
-
37
- override get itemURL(): Platform.DevToolsPath.UrlString {
38
- return 'shared-storage://' as Platform.DevToolsPath.UrlString;
39
- }
40
-
41
- override onselect(selectedByUser: boolean|undefined): boolean {
42
- super.onselect(selectedByUser);
43
- this.resourcesPanel.showView(this.view);
44
- return false;
45
- }
46
-
47
- override onattach(): void {
48
- super.onattach();
49
- if (this.#expandedSetting.get()) {
50
- this.expand();
51
- }
52
- }
53
-
54
- override onexpand(): void {
55
- this.#expandedSetting.set(true);
56
- }
57
-
58
- override oncollapse(): void {
59
- this.#expandedSetting.set(false);
60
- }
61
-
62
- addEvent(event: Protocol.Storage.SharedStorageAccessedEvent): void {
63
- this.view.addEvent(event);
64
- }
65
- }
@@ -1,249 +0,0 @@
1
- // Copyright 2022 The Chromium Authors
2
- // Use of this source code is governed by a BSD-style license that can be
3
- // found in the LICENSE file.
4
-
5
- import * as Common from '../../core/common/common.js';
6
- import * as SDK from '../../core/sdk/sdk.js';
7
- import type * as ProtocolProxyApi from '../../generated/protocol-proxy-api.js';
8
- import * as Protocol from '../../generated/protocol.js';
9
-
10
- export class SharedStorageForOrigin extends Common.ObjectWrapper.ObjectWrapper<SharedStorageForOrigin.EventTypes> {
11
- readonly #model: SharedStorageModel;
12
- readonly #securityOrigin: string;
13
-
14
- constructor(model: SharedStorageModel, securityOrigin: string) {
15
- super();
16
- this.#model = model;
17
- this.#securityOrigin = securityOrigin;
18
- }
19
-
20
- get securityOrigin(): string {
21
- return this.#securityOrigin;
22
- }
23
-
24
- async getMetadata(): Promise<Protocol.Storage.SharedStorageMetadata|null> {
25
- return await this.#model.storageAgent.invoke_getSharedStorageMetadata({ownerOrigin: this.securityOrigin})
26
- .then(({metadata}) => metadata);
27
- }
28
-
29
- async getEntries(): Promise<Protocol.Storage.SharedStorageEntry[]|null> {
30
- return await this.#model.storageAgent.invoke_getSharedStorageEntries({ownerOrigin: this.securityOrigin})
31
- .then(({entries}) => entries);
32
- }
33
-
34
- async setEntry(key: string, value: string, ignoreIfPresent: boolean): Promise<void> {
35
- await this.#model.storageAgent.invoke_setSharedStorageEntry(
36
- {ownerOrigin: this.securityOrigin, key, value, ignoreIfPresent});
37
- }
38
-
39
- async deleteEntry(key: string): Promise<void> {
40
- await this.#model.storageAgent.invoke_deleteSharedStorageEntry({ownerOrigin: this.securityOrigin, key});
41
- }
42
-
43
- async clear(): Promise<void> {
44
- await this.#model.storageAgent.invoke_clearSharedStorageEntries({ownerOrigin: this.securityOrigin});
45
- }
46
-
47
- async resetBudget(): Promise<void> {
48
- await this.#model.storageAgent.invoke_resetSharedStorageBudget({ownerOrigin: this.securityOrigin});
49
- }
50
- }
51
-
52
- export namespace SharedStorageForOrigin {
53
- export const enum Events {
54
- SHARED_STORAGE_CHANGED = 'SharedStorageChanged',
55
- }
56
-
57
- export interface SharedStorageChangedEvent {
58
- accessTime: Protocol.Network.TimeSinceEpoch;
59
- scope: Protocol.Storage.SharedStorageAccessScope;
60
- method: Protocol.Storage.SharedStorageAccessMethod;
61
- mainFrameId: Protocol.Page.FrameId;
62
- ownerSite: string;
63
- params: Protocol.Storage.SharedStorageAccessParams;
64
- }
65
-
66
- export interface EventTypes {
67
- [Events.SHARED_STORAGE_CHANGED]: SharedStorageChangedEvent;
68
- }
69
- }
70
-
71
- export class SharedStorageModel extends SDK.SDKModel.SDKModel<EventTypes> implements
72
- ProtocolProxyApi.StorageDispatcher {
73
- readonly #securityOriginManager: SDK.SecurityOriginManager.SecurityOriginManager;
74
- #storages: Map<string, SharedStorageForOrigin>;
75
- readonly storageAgent: ProtocolProxyApi.StorageApi;
76
- #enabled: boolean;
77
-
78
- constructor(target: SDK.Target.Target) {
79
- super(target);
80
- target.registerStorageDispatcher(this);
81
- this.#securityOriginManager = target.model(SDK.SecurityOriginManager.SecurityOriginManager) as
82
- SDK.SecurityOriginManager.SecurityOriginManager;
83
- this.#storages = new Map();
84
- this.storageAgent = target.storageAgent();
85
- this.#enabled = false;
86
- }
87
-
88
- async enable(): Promise<void> {
89
- if (this.#enabled) {
90
- return;
91
- }
92
-
93
- this.#securityOriginManager.addEventListener(
94
- SDK.SecurityOriginManager.Events.SecurityOriginAdded, this.#securityOriginAdded, this);
95
- this.#securityOriginManager.addEventListener(
96
- SDK.SecurityOriginManager.Events.SecurityOriginRemoved, this.#securityOriginRemoved, this);
97
-
98
- await this.storageAgent.invoke_setSharedStorageTracking({enable: true});
99
- this.#addAllOrigins();
100
- this.#enabled = true;
101
- }
102
-
103
- disable(): void {
104
- if (!this.#enabled) {
105
- return;
106
- }
107
-
108
- this.#securityOriginManager.removeEventListener(
109
- SDK.SecurityOriginManager.Events.SecurityOriginAdded, this.#securityOriginAdded, this);
110
- this.#securityOriginManager.removeEventListener(
111
- SDK.SecurityOriginManager.Events.SecurityOriginRemoved, this.#securityOriginRemoved, this);
112
-
113
- void this.storageAgent.invoke_setSharedStorageTracking({enable: false});
114
- this.#removeAllOrigins();
115
- this.#enabled = false;
116
- }
117
-
118
- override dispose(): void {
119
- this.disable();
120
- }
121
-
122
- #addAllOrigins(): void {
123
- for (const securityOrigin of this.#securityOriginManager.securityOrigins()) {
124
- void this.#maybeAddOrigin(securityOrigin);
125
- }
126
- }
127
-
128
- #removeAllOrigins(): void {
129
- for (const securityOrigin of this.#storages.keys()) {
130
- this.#removeOrigin(securityOrigin);
131
- }
132
- }
133
-
134
- #securityOriginAdded(event: Common.EventTarget.EventTargetEvent<string>): void {
135
- this.#maybeAddOrigin(event.data);
136
- }
137
-
138
- #maybeAddOrigin(securityOrigin: string): void {
139
- const parsedSecurityOrigin = new Common.ParsedURL.ParsedURL(securityOrigin);
140
- // These are "opaque" origins which are not supposed to support shared storage.
141
- if (!parsedSecurityOrigin.isValid || parsedSecurityOrigin.scheme === 'data' ||
142
- parsedSecurityOrigin.scheme === 'about' || parsedSecurityOrigin.scheme === 'javascript') {
143
- return;
144
- }
145
-
146
- // Only add origin if it's not already added.
147
- if (this.#storages.has(securityOrigin)) {
148
- return;
149
- }
150
-
151
- const storage = new SharedStorageForOrigin(this, securityOrigin);
152
- this.#storages.set(securityOrigin, storage);
153
- this.dispatchEventToListeners(Events.SHARED_STORAGE_ADDED, storage);
154
- }
155
-
156
- #securityOriginRemoved(event: Common.EventTarget.EventTargetEvent<string>): void {
157
- this.#removeOrigin(event.data);
158
- }
159
-
160
- #removeOrigin(securityOrigin: string): void {
161
- const storage = this.storageForOrigin(securityOrigin);
162
- if (!storage) {
163
- return;
164
- }
165
- this.#storages.delete(securityOrigin);
166
- this.dispatchEventToListeners(Events.SHARED_STORAGE_REMOVED, storage);
167
- }
168
-
169
- storages(): IterableIterator<SharedStorageForOrigin> {
170
- return this.#storages.values();
171
- }
172
-
173
- storageForOrigin(origin: string): SharedStorageForOrigin|null {
174
- return this.#storages.get(origin) || null;
175
- }
176
-
177
- numStoragesForTesting(): number {
178
- return this.#storages.size;
179
- }
180
-
181
- isChangeEvent(event: Protocol.Storage.SharedStorageAccessedEvent): boolean {
182
- return [
183
- Protocol.Storage.SharedStorageAccessMethod.Set,
184
- Protocol.Storage.SharedStorageAccessMethod.Append,
185
- Protocol.Storage.SharedStorageAccessMethod.Delete,
186
- Protocol.Storage.SharedStorageAccessMethod.Clear,
187
- ].includes(event.method);
188
- }
189
-
190
- sharedStorageAccessed(event: Protocol.Storage.SharedStorageAccessedEvent): void {
191
- if (this.isChangeEvent(event)) {
192
- const sharedStorage = this.storageForOrigin(event.ownerOrigin);
193
-
194
- if (sharedStorage) {
195
- const eventData = {
196
- accessTime: event.accessTime,
197
- method: event.method,
198
- mainFrameId: event.mainFrameId,
199
- ownerSite: event.ownerSite,
200
- params: event.params,
201
- scope: event.scope,
202
- };
203
-
204
- // Forward events that may have changed `sharedStorage` to listeners for `sharedStorage`.
205
- sharedStorage.dispatchEventToListeners(SharedStorageForOrigin.Events.SHARED_STORAGE_CHANGED, eventData);
206
- } else {
207
- void this.#maybeAddOrigin(event.ownerOrigin);
208
- }
209
- }
210
-
211
- this.dispatchEventToListeners(Events.SHARED_STORAGE_ACCESS, event);
212
- }
213
-
214
- sharedStorageWorkletOperationExecutionFinished(
215
- _event: Protocol.Storage.SharedStorageWorkletOperationExecutionFinishedEvent): void {
216
- }
217
-
218
- indexedDBListUpdated(_event: Protocol.Storage.IndexedDBListUpdatedEvent): void {
219
- }
220
-
221
- indexedDBContentUpdated(_event: Protocol.Storage.IndexedDBContentUpdatedEvent): void {
222
- }
223
-
224
- cacheStorageListUpdated(_event: Protocol.Storage.CacheStorageListUpdatedEvent): void {
225
- }
226
-
227
- cacheStorageContentUpdated(_event: Protocol.Storage.CacheStorageContentUpdatedEvent): void {
228
- }
229
-
230
- storageBucketCreatedOrUpdated(_event: Protocol.Storage.StorageBucketCreatedOrUpdatedEvent): void {
231
- }
232
-
233
- storageBucketDeleted(_event: Protocol.Storage.StorageBucketDeletedEvent): void {
234
- }
235
- }
236
-
237
- SDK.SDKModel.SDKModel.register(SharedStorageModel, {capabilities: SDK.Target.Capability.STORAGE, autostart: false});
238
-
239
- export const enum Events {
240
- SHARED_STORAGE_ACCESS = 'SharedStorageAccess',
241
- SHARED_STORAGE_ADDED = 'SharedStorageAdded',
242
- SHARED_STORAGE_REMOVED = 'SharedStorageRemoved',
243
- }
244
-
245
- export interface EventTypes {
246
- [Events.SHARED_STORAGE_ACCESS]: Protocol.Storage.SharedStorageAccessedEvent;
247
- [Events.SHARED_STORAGE_ADDED]: SharedStorageForOrigin;
248
- [Events.SHARED_STORAGE_REMOVED]: SharedStorageForOrigin;
249
- }
@@ -1,40 +0,0 @@
1
- // Copyright 2022 The Chromium Authors
2
- // Use of this source code is governed by a BSD-style license that can be
3
- // found in the LICENSE file.
4
-
5
- import type * as Platform from '../../core/platform/platform.js';
6
- import {createIcon} from '../../ui/kit/kit.js';
7
- import * as VisualLogging from '../../ui/visual_logging/visual_logging.js';
8
-
9
- import {ApplicationPanelTreeElement} from './ApplicationPanelTreeElement.js';
10
- import type {ResourcesPanel} from './ResourcesPanel.js';
11
- import {SharedStorageItemsView} from './SharedStorageItemsView.js';
12
- import type {SharedStorageForOrigin} from './SharedStorageModel.js';
13
-
14
- export class SharedStorageTreeElement extends ApplicationPanelTreeElement {
15
- view!: SharedStorageItemsView;
16
-
17
- constructor(resourcesPanel: ResourcesPanel, sharedStorage: SharedStorageForOrigin) {
18
- super(resourcesPanel, sharedStorage.securityOrigin, false, 'shared-storage-instance');
19
- }
20
-
21
- static async createElement(resourcesPanel: ResourcesPanel, sharedStorage: SharedStorageForOrigin):
22
- Promise<SharedStorageTreeElement> {
23
- const treeElement = new SharedStorageTreeElement(resourcesPanel, sharedStorage);
24
- treeElement.view = await SharedStorageItemsView.createView(sharedStorage);
25
- treeElement.view.element.setAttribute('jslog', `${VisualLogging.pane('shared-storage-data')}`);
26
- const sharedStorageIcon = createIcon('database');
27
- treeElement.setLeadingIcons([sharedStorageIcon]);
28
- return treeElement;
29
- }
30
-
31
- override get itemURL(): Platform.DevToolsPath.UrlString {
32
- return 'shared-storage://' as Platform.DevToolsPath.UrlString;
33
- }
34
-
35
- override onselect(selectedByUser: boolean|undefined): boolean {
36
- super.onselect(selectedByUser);
37
- this.resourcesPanel.showView(this.view);
38
- return false;
39
- }
40
- }