chrome-devtools-frontend 1.0.1669021 → 1.0.1672557
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/fixing-skipped-tests/SKILL.md +6 -6
- package/.agents/skills/gerrit-cli/SKILL.md +4 -10
- package/.agents/skills/gerrit-cli/references/commands.md +45 -2
- package/.agents/skills/gerrit-cli/references/workflows.md +7 -0
- package/.agents/skills/gerrit-cli/scripts/import_upstream.py +34 -152
- package/config/typescript/tsconfig.eslint.json +1 -1
- package/docs/contributing/settings-experiments-features.md +2 -8
- package/docs/ecosystem/automatic_workspace_folders.md +0 -19
- package/eslint.config.mjs +5 -5
- package/front_end/core/common/Lazy.ts +3 -3
- package/front_end/core/common/SettingRegistration.ts +0 -7
- package/front_end/core/common/Settings.ts +0 -38
- package/front_end/core/host/UserMetrics.ts +187 -953
- package/front_end/core/host/UserMetricsEnums.ts +949 -0
- package/front_end/core/root/Runtime.ts +21 -138
- package/front_end/core/sdk/CSSMetadata.ts +70 -65
- package/front_end/core/sdk/CategorizedBreakpoint.ts +0 -1
- package/front_end/core/sdk/ChildTargetManager.ts +0 -2
- package/front_end/core/sdk/EmulationModel.ts +0 -2
- package/front_end/core/sdk/EventBreakpointsModel.ts +0 -4
- package/front_end/core/sdk/NetworkManager.ts +0 -3
- package/front_end/core/sdk/PageResourceLoader.ts +9 -9
- package/front_end/core/sdk/RehydratingConnection.ts +52 -4
- package/front_end/core/sdk/Target.ts +0 -4
- package/front_end/devtools_compatibility.js +886 -0
- package/front_end/entrypoints/inspector_main/RenderingOptions.ts +7 -6
- package/front_end/entrypoints/main/ExecutionContextSelector.ts +0 -1
- package/front_end/entrypoints/main/MainImpl.ts +18 -22
- package/front_end/foundation/Universe.ts +7 -2
- package/front_end/generated/InspectorBackendCommands.ts +3 -10
- package/front_end/generated/{SupportedCSSProperties.js → SupportedCSSProperties.ts} +16 -0
- package/front_end/generated/protocol-mapping.d.ts +0 -42
- package/front_end/generated/protocol-proxy-api.d.ts +0 -38
- package/front_end/generated/protocol.ts +9 -169
- package/front_end/models/ai_assistance/AiAgent2.ts +11 -3
- package/front_end/models/ai_assistance/AiConversation.ts +1 -0
- package/front_end/models/ai_assistance/AiHistoryStorage.ts +8 -5
- package/front_end/models/ai_assistance/AiSetting.ts +108 -0
- package/front_end/models/ai_assistance/AiUtils.ts +47 -0
- package/front_end/models/ai_assistance/ChangeManager.ts +1 -0
- package/front_end/models/ai_assistance/ExtensionScope.ts +3 -12
- package/front_end/models/ai_assistance/agents/AiAgent.ts +11 -18
- package/front_end/models/ai_assistance/agents/ContextSelectionAgent.ts +3 -0
- package/front_end/models/ai_assistance/agents/ExecuteJavascript.ts +42 -17
- package/front_end/models/ai_assistance/agents/PerformanceAgent.snapshot.txt +1 -1
- package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +3 -2
- package/front_end/models/ai_assistance/agents/StorageAgent.ts +253 -155
- package/front_end/models/ai_assistance/agents/StylingAgent.snapshot.txt +2 -2
- package/front_end/models/ai_assistance/ai_assistance.ts +4 -0
- package/front_end/models/ai_assistance/contexts/PerformanceTraceContext.ts +12 -6
- package/front_end/models/ai_assistance/data_formatters/FileFormatter.ts +3 -1
- package/front_end/models/ai_assistance/data_formatters/NetworkRequestFormatter.ts +1 -0
- package/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.ts +4 -3
- package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.snapshot.txt +1 -1
- package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.ts +1 -0
- package/front_end/models/ai_assistance/injected.ts +1 -0
- package/front_end/models/ai_assistance/performance/AICallTree.ts +1 -0
- package/front_end/models/ai_assistance/skills/Skill.ts +1 -1
- package/front_end/models/ai_assistance/skills/SkillRegistry.ts +2 -0
- package/front_end/models/ai_assistance/skills/performance.md +10 -0
- package/front_end/models/ai_assistance/tools/ExecuteJavaScript.ts +52 -5
- package/front_end/models/ai_assistance/tools/GetElementAccessibilityDetails.ts +4 -4
- package/front_end/models/ai_assistance/tools/GetLighthouseAudits.ts +4 -4
- package/front_end/models/ai_assistance/tools/GetNetworkRequestDetails.ts +5 -4
- package/front_end/models/ai_assistance/tools/GetStyles.ts +5 -4
- package/front_end/models/ai_assistance/tools/ListNetworkRequests.ts +5 -4
- package/front_end/models/ai_assistance/tools/README.md +1 -1
- package/front_end/models/ai_assistance/tools/RecordPerformanceTrace.ts +63 -0
- package/front_end/models/ai_assistance/tools/ResolveDevtoolsNodePath.ts +5 -5
- package/front_end/models/ai_assistance/tools/Tool.ts +118 -24
- package/front_end/models/ai_assistance/tools/ToolRegistry.ts +2 -0
- package/front_end/models/badges/UserBadges.ts +2 -0
- package/front_end/models/bindings/NetworkProject.ts +5 -0
- package/front_end/models/bindings/ResourceScriptMapping.ts +2 -0
- package/front_end/models/bindings/ResourceUtils.ts +3 -0
- package/front_end/models/crux-manager/CrUXManager.ts +1 -0
- package/front_end/models/emulation/DeviceModeModel.ts +140 -7
- package/front_end/models/emulation/EmulatedDevices.ts +246 -793
- package/front_end/models/issues_manager/IssuesManager.ts +10 -2
- package/front_end/models/live-metrics/LiveMetrics.ts +41 -9
- package/front_end/models/logs/LogManager.ts +8 -5
- package/front_end/models/logs/NetworkLog.ts +1 -0
- package/front_end/models/persistence/IsolatedFileSystemManager.ts +21 -3
- package/front_end/models/persistence/NetworkPersistenceManager.ts +6 -0
- package/front_end/models/project_settings/ProjectSettingsModel.ts +8 -12
- package/front_end/models/trace/Processor.ts +42 -10
- package/front_end/models/trace/handlers/LayoutShiftsHandler.ts +12 -19
- package/front_end/models/trace/handlers/MetaHandler.ts +38 -5
- package/front_end/models/trace/insights/CLSCulprits.ts +1 -2
- package/front_end/models/trace/insights/CharacterSet.ts +1 -1
- package/front_end/models/trace/insights/Common.ts +21 -2
- package/front_end/models/trace/insights/DocumentLatency.ts +1 -1
- package/front_end/models/trace/insights/LCPBreakdown.ts +7 -6
- package/front_end/models/trace/insights/LCPDiscovery.ts +1 -1
- package/front_end/models/trace/insights/ModernHTTP.ts +7 -3
- package/front_end/models/trace/insights/NetworkDependencyTree.ts +1 -1
- package/front_end/models/trace/insights/RenderBlocking.ts +1 -1
- package/front_end/models/trace/insights/ThirdParties.ts +5 -2
- package/front_end/models/trace/insights/types.ts +11 -6
- package/front_end/models/trace/types/Configuration.ts +5 -0
- package/front_end/models/trace_source_maps_resolver/SourceMapsResolver.ts +3 -1
- package/front_end/models/workspace/IgnoreListManager.ts +2 -0
- package/front_end/models/workspace/UISourceCode.ts +2 -0
- package/front_end/models/workspace_diff/WorkspaceDiff.ts +4 -0
- package/front_end/panels/ai_assistance/AiAssistancePanel.ts +22 -22
- package/front_end/panels/ai_assistance/ai_assistance-meta.ts +0 -7
- package/front_end/panels/ai_assistance/components/ChatInput.ts +4 -0
- package/front_end/panels/ai_assistance/components/ChatMessage.ts +79 -34
- package/front_end/panels/ai_assistance/components/WalkthroughView.ts +1 -2
- package/front_end/panels/ai_assistance/components/walkthroughView.css +1 -1
- package/front_end/panels/application/ApplicationPanelSidebar.ts +9 -106
- package/front_end/panels/application/ApplicationPanelTreeElement.ts +1 -1
- package/front_end/panels/application/application.ts +0 -10
- package/front_end/panels/application/components/components.ts +0 -4
- package/front_end/panels/browser_debugger/CategorizedBreakpointsSidebarPane.ts +0 -5
- package/front_end/panels/browser_debugger/EventListenerBreakpointsSidebarPane.ts +6 -12
- package/front_end/panels/browser_debugger/browser_debugger-meta.ts +5 -3
- package/front_end/panels/console/ConsoleFormat.ts +2 -62
- package/front_end/panels/console/ConsoleViewMessage.ts +14 -7
- package/front_end/panels/elements/ElementsTreeElement.ts +1 -2
- package/front_end/panels/emulation/AdvancedApp.ts +1 -2
- package/front_end/panels/emulation/DeviceModeToolbar.ts +83 -69
- package/front_end/panels/emulation/DeviceModeView.ts +4 -134
- package/front_end/panels/emulation/DeviceModeWrapper.ts +52 -69
- package/front_end/panels/emulation/MediaQueryInspector.ts +2 -2
- package/front_end/panels/emulation/emulation-meta.ts +12 -12
- package/front_end/panels/issues/IssuesPane.ts +3 -1
- package/front_end/panels/lighthouse/LighthouseController.ts +6 -0
- package/front_end/panels/linear_memory_inspector/components/LinearMemoryInspector.ts +17 -21
- package/front_end/panels/linear_memory_inspector/components/LinearMemoryNavigator.ts +206 -126
- package/front_end/panels/linear_memory_inspector/components/linearMemoryInspector.css +1 -1
- package/front_end/panels/mobile_throttling/CalibrationController.ts +1 -1
- package/front_end/panels/mobile_throttling/MobileThrottlingSelector.ts +3 -3
- package/front_end/panels/mobile_throttling/NetworkPanelIndicator.ts +6 -6
- package/front_end/panels/mobile_throttling/NetworkThrottlingSelector.ts +14 -12
- package/front_end/panels/mobile_throttling/ThrottlingManager.ts +13 -13
- package/front_end/panels/mobile_throttling/ThrottlingPresets.ts +10 -10
- package/front_end/panels/mobile_throttling/ThrottlingSettingsTab.ts +28 -28
- package/front_end/panels/mobile_throttling/mobile_throttling-meta.ts +6 -6
- package/front_end/panels/network/RequestHeadersView.ts +1 -1
- package/front_end/panels/network/ResourceChunkView.ts +243 -144
- package/front_end/panels/network/ResourceDirectSocketChunkView.ts +52 -29
- package/front_end/panels/network/ResourceWebSocketFrameView.ts +21 -35
- package/front_end/panels/network/resourceChunkView.css +41 -36
- package/front_end/panels/profiler/HeapDetachedElementsDataGrid.ts +21 -12
- package/front_end/panels/profiler/profiler.ts +4 -0
- package/front_end/panels/recorder/RecorderPanel.ts +6 -14
- package/front_end/panels/sensors/LocationsSettingsTab.ts +7 -7
- package/front_end/panels/settings/AISettingsTab.ts +75 -31
- package/front_end/panels/settings/SettingsScreen.ts +8 -13
- package/front_end/panels/settings/components/SyncSection.ts +3 -4
- package/front_end/panels/settings/emulation/DevicesSettingsTab.ts +650 -18
- package/front_end/panels/settings/emulation/devicesSettingsTab.css +18 -0
- package/front_end/panels/settings/settings-meta.ts +0 -1
- package/front_end/panels/sources/CategorizedBreakpointL10n.ts +0 -2
- package/front_end/panels/sources/DebuggerPausedMessage.ts +11 -5
- package/front_end/panels/sources/DebuggerPlugin.ts +1 -1
- package/front_end/panels/sources/EditingLocationHistoryManager.ts +12 -9
- package/front_end/panels/sources/SourcesPanel.ts +19 -17
- package/front_end/panels/sources/SourcesView.ts +191 -96
- package/front_end/panels/sources/TabbedEditorContainer.ts +3 -4
- package/front_end/panels/sources/WatchExpressionsSidebarPane.ts +2 -5
- package/front_end/panels/timeline/TimelinePanel.ts +2 -0
- package/front_end/panels/timeline/TimelineUIUtils.ts +15 -0
- package/front_end/panels/timeline/components/CWVMetrics.ts +16 -3
- package/front_end/panels/timeline/components/cwvMetrics.css +4 -0
- package/front_end/panels/timeline/components/liveMetricsView.css +0 -17
- package/front_end/panels/timeline/components/metricValueStyles.css +17 -0
- package/front_end/panels/timeline/timeline-meta.ts +3 -5
- package/front_end/third_party/chromium/README.chromium +1 -1
- package/front_end/third_party/codemirror.next/chunk/angular.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/codemirror.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/codemirror.js.map +1 -1
- package/front_end/third_party/codemirror.next/chunk/cpp.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/cpp.js.map +1 -1
- package/front_end/third_party/codemirror.next/chunk/java.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/java.js.map +1 -1
- package/front_end/third_party/codemirror.next/chunk/legacy.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/less.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/less.js.map +1 -1
- package/front_end/third_party/codemirror.next/chunk/markdown.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/markdown.js.map +1 -1
- package/front_end/third_party/codemirror.next/chunk/php.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/php.js.map +1 -1
- package/front_end/third_party/codemirror.next/chunk/python.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/python.js.map +1 -1
- package/front_end/third_party/codemirror.next/chunk/sass.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/sass.js.map +1 -1
- package/front_end/third_party/codemirror.next/chunk/svelte.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/svelte.js.map +1 -1
- package/front_end/third_party/codemirror.next/chunk/vue.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/wast.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/wast.js.map +1 -1
- package/front_end/third_party/codemirror.next/chunk/xml.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/xml.js.map +1 -1
- package/front_end/third_party/codemirror.next/codemirror.next.d.ts +1332 -193
- package/front_end/third_party/codemirror.next/codemirror.next.js +1 -1
- package/front_end/third_party/codemirror.next/rebuild.sh +1 -1
- package/front_end/third_party/puppeteer/README.chromium +2 -2
- package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.d.ts +64 -15
- package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.js +65 -16
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Page.d.ts +50 -7
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Page.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Page.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/BidiOverCdp.d.ts +2 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/BidiOverCdp.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/BidiOverCdp.js +5 -5
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/BidiOverCdp.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Connection.d.ts +2 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Connection.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Connection.js +8 -6
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Connection.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Dialog.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Dialog.js +3 -0
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Dialog.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Browser.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Browser.js +16 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Browser.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Connection.d.ts +5 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Connection.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Connection.js +11 -6
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Connection.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Dialog.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Dialog.js +5 -0
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Dialog.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/NetworkManager.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/NetworkManager.js +10 -0
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/NetworkManager.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/common/BrowserConnector.js +4 -3
- package/front_end/third_party/puppeteer/package/lib/puppeteer/common/BrowserConnector.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/common/Debug.d.ts +27 -2
- package/front_end/third_party/puppeteer/package/lib/puppeteer/common/Debug.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/common/Debug.js +12 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/common/Debug.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/common/util.d.ts +2 -2
- package/front_end/third_party/puppeteer/package/lib/puppeteer/common/util.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/common/util.js +2 -2
- package/front_end/third_party/puppeteer/package/lib/puppeteer/common/util.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/node/ChromeLauncher.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/node/ChromeLauncher.js +2 -0
- package/front_end/third_party/puppeteer/package/lib/puppeteer/node/ChromeLauncher.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/node/ScreenRecorder.d.ts +2 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/node/ScreenRecorder.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/node/ScreenRecorder.js +5 -4
- package/front_end/third_party/puppeteer/package/lib/puppeteer/node/ScreenRecorder.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/revisions.d.ts +3 -3
- package/front_end/third_party/puppeteer/package/lib/puppeteer/revisions.js +3 -3
- package/front_end/third_party/puppeteer/package/lib/puppeteer/util/version.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/util/version.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/types.d.ts +64 -15
- package/front_end/third_party/puppeteer/package/package.json +2 -2
- package/front_end/third_party/puppeteer/package/src/api/Page.ts +50 -7
- package/front_end/third_party/puppeteer/package/src/bidi/BidiOverCdp.ts +9 -7
- package/front_end/third_party/puppeteer/package/src/bidi/Connection.ts +9 -6
- package/front_end/third_party/puppeteer/package/src/bidi/Dialog.ts +4 -0
- package/front_end/third_party/puppeteer/package/src/cdp/Browser.ts +24 -1
- package/front_end/third_party/puppeteer/package/src/cdp/Connection.ts +11 -6
- package/front_end/third_party/puppeteer/package/src/cdp/Dialog.ts +7 -0
- package/front_end/third_party/puppeteer/package/src/cdp/NetworkManager.ts +11 -0
- package/front_end/third_party/puppeteer/package/src/common/BrowserConnector.ts +7 -3
- package/front_end/third_party/puppeteer/package/src/common/Debug.ts +30 -5
- package/front_end/third_party/puppeteer/package/src/common/util.ts +2 -2
- package/front_end/third_party/puppeteer/package/src/node/ChromeLauncher.ts +2 -0
- package/front_end/third_party/puppeteer/package/src/node/ScreenRecorder.ts +6 -4
- package/front_end/third_party/puppeteer/package/src/revisions.ts +3 -3
- package/front_end/third_party/puppeteer/package/src/util/version.ts +1 -1
- package/front_end/tsconfig.compatibility.json +2 -1
- package/front_end/tsconfig.json +1 -1
- package/front_end/ui/components/icon_button/IconButton.ts +1 -1
- package/front_end/ui/components/issue_counter/IssueCounter.ts +1 -1
- package/front_end/ui/components/settings/SettingCheckbox.ts +4 -7
- package/front_end/ui/components/settings/settings.ts +1 -2
- package/front_end/ui/legacy/Treeoutline.ts +52 -30
- package/front_end/ui/legacy/components/object_ui/CSSStyleSanitizer.ts +74 -0
- package/front_end/ui/legacy/components/object_ui/CustomPreviewComponent.ts +6 -1
- package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +47 -54
- package/front_end/ui/legacy/components/object_ui/object_ui.ts +2 -0
- package/front_end/ui/legacy/components/quick_open/CommandMenu.ts +5 -27
- package/front_end/ui/legacy/components/settings_ui/SettingsUI.ts +10 -12
- package/front_end/ui/settings/SettingUIRegistration.ts +0 -8
- package/front_end/ui/visual_logging/KnownContextValues.ts +37 -0
- package/inspector_overlay/tsconfig.json +8 -2
- package/package.json +3 -2
- package/.agents/skills/gerrit-cli/scripts/gerrit_client_wrapper.py +0 -47
- package/front_end/core/sdk/CSSModel.test.api.ts +0 -102
- package/front_end/core/sdk/DOMModel.test.api.ts +0 -104
- package/front_end/foundation/Universe.test.api.ts +0 -73
- package/front_end/panels/application/SharedStorageEventsView.ts +0 -128
- package/front_end/panels/application/SharedStorageItemsView.ts +0 -179
- package/front_end/panels/application/SharedStorageListTreeElement.ts +0 -65
- package/front_end/panels/application/SharedStorageModel.ts +0 -249
- package/front_end/panels/application/SharedStorageTreeElement.ts +0 -40
- package/front_end/panels/application/components/SharedStorageAccessGrid.ts +0 -191
- package/front_end/panels/application/components/SharedStorageMetadataView.ts +0 -133
- package/front_end/panels/application/components/sharedStorageAccessGrid.css +0 -29
- package/front_end/panels/application/components/sharedStorageMetadataView.css +0 -29
- package/front_end/panels/application/sharedStorageEventsView.css +0 -9
- package/front_end/panels/network/OriginalResourceChunkView.ts +0 -340
- package/front_end/panels/network/originalResourceChunkView.css +0 -49
- package/front_end/ui/components/settings/SettingDeprecationWarning.ts +0 -47
- package/front_end/ui/components/settings/settingDeprecationWarning.css +0 -14
- /package/front_end/generated/{ARIAProperties.js → ARIAProperties.ts} +0 -0
|
@@ -1,128 +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
|
-
/* eslint-disable @devtools/no-imperative-dom-api */
|
|
5
|
-
|
|
6
|
-
import * as i18n from '../../core/i18n/i18n.js';
|
|
7
|
-
import * as SDK from '../../core/sdk/sdk.js';
|
|
8
|
-
import type * as Protocol from '../../generated/protocol.js';
|
|
9
|
-
import * as SourceFrame from '../../ui/legacy/components/source_frame/source_frame.js';
|
|
10
|
-
import * as UI from '../../ui/legacy/legacy.js';
|
|
11
|
-
import * as VisualLogging from '../../ui/visual_logging/visual_logging.js';
|
|
12
|
-
|
|
13
|
-
import * as ApplicationComponents from './components/components.js';
|
|
14
|
-
import sharedStorageEventsViewStyles from './sharedStorageEventsView.css.js';
|
|
15
|
-
|
|
16
|
-
const UIStrings = {
|
|
17
|
-
/**
|
|
18
|
-
* @description Placeholder text if no shared storage event has been selected.
|
|
19
|
-
* Shared storage allows to store and access data that can be shared across different sites.
|
|
20
|
-
* A shared storage event is for example an access from a site to that storage.
|
|
21
|
-
*/
|
|
22
|
-
noEventSelected: 'No shared storage event selected',
|
|
23
|
-
/**
|
|
24
|
-
* @description Placeholder text instructing the user how to display shared
|
|
25
|
-
* storage event details.
|
|
26
|
-
* Shared storage allows to store and access data that can be shared across different sites.
|
|
27
|
-
* A shared storage event is for example an access from a site to that storage.
|
|
28
|
-
*/
|
|
29
|
-
clickToDisplayBody: 'Click on any shared storage event to display the event parameters',
|
|
30
|
-
} as const;
|
|
31
|
-
const str_ = i18n.i18n.registerUIStrings('panels/application/SharedStorageEventsView.ts', UIStrings);
|
|
32
|
-
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
|
33
|
-
|
|
34
|
-
function eventEquals(
|
|
35
|
-
a: Protocol.Storage.SharedStorageAccessedEvent, b: Protocol.Storage.SharedStorageAccessedEvent): boolean {
|
|
36
|
-
return JSON.stringify(a) === JSON.stringify(b);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export class SharedStorageEventsView extends UI.SplitWidget.SplitWidget {
|
|
40
|
-
readonly #sharedStorageEventGrid = new ApplicationComponents.SharedStorageAccessGrid.SharedStorageAccessGrid();
|
|
41
|
-
#events: Protocol.Storage.SharedStorageAccessedEvent[] = [];
|
|
42
|
-
#noDisplayView: UI.Widget.VBox;
|
|
43
|
-
#defaultId: Protocol.Page.FrameId = '' as Protocol.Page.FrameId;
|
|
44
|
-
|
|
45
|
-
constructor() {
|
|
46
|
-
super(/* isVertical */ false, /* secondIsSidebar: */ true);
|
|
47
|
-
|
|
48
|
-
this.element.setAttribute('jslog', `${VisualLogging.pane('shared-storage-events')}`);
|
|
49
|
-
|
|
50
|
-
this.#noDisplayView =
|
|
51
|
-
new UI.EmptyWidget.EmptyWidget(i18nString(UIStrings.noEventSelected), i18nString(UIStrings.clickToDisplayBody));
|
|
52
|
-
this.#noDisplayView.setMinimumSize(0, 40);
|
|
53
|
-
this.#sharedStorageEventGrid.setMinimumSize(0, 80);
|
|
54
|
-
this.#sharedStorageEventGrid.onSelect = this.#onFocus.bind(this);
|
|
55
|
-
|
|
56
|
-
this.setMainWidget(this.#sharedStorageEventGrid);
|
|
57
|
-
this.setSidebarWidget(this.#noDisplayView);
|
|
58
|
-
this.hideSidebar();
|
|
59
|
-
|
|
60
|
-
this.#getMainFrameResourceTreeModel()?.addEventListener(
|
|
61
|
-
SDK.ResourceTreeModel.Events.PrimaryPageChanged, this.clearEvents, this);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
#getMainFrameResourceTreeModel(): SDK.ResourceTreeModel.ResourceTreeModel|null {
|
|
65
|
-
const primaryPageTarget = SDK.TargetManager.TargetManager.instance().primaryPageTarget();
|
|
66
|
-
return primaryPageTarget?.model(SDK.ResourceTreeModel.ResourceTreeModel) || null;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
#getMainFrame(): SDK.ResourceTreeModel.ResourceTreeFrame|null {
|
|
70
|
-
return this.#getMainFrameResourceTreeModel()?.mainFrame || null;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
get id(): Protocol.Page.FrameId {
|
|
74
|
-
return this.#getMainFrame()?.id || this.#defaultId;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
override wasShown(): void {
|
|
78
|
-
super.wasShown();
|
|
79
|
-
const sidebar = this.sidebarWidget();
|
|
80
|
-
if (sidebar) {
|
|
81
|
-
sidebar.registerRequiredCSS(sharedStorageEventsViewStyles);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
addEvent(event: Protocol.Storage.SharedStorageAccessedEvent): void {
|
|
86
|
-
// Only add event if main frame id matches.
|
|
87
|
-
if (event.mainFrameId !== this.id) {
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
// Only add if not already present.
|
|
92
|
-
if (this.#events.some(t => eventEquals(t, event))) {
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
if (this.showMode() !== UI.SplitWidget.ShowMode.BOTH) {
|
|
97
|
-
this.showBoth();
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
this.#events.push(event);
|
|
101
|
-
this.#sharedStorageEventGrid.events = this.#events;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
clearEvents(): void {
|
|
105
|
-
this.#events = [];
|
|
106
|
-
this.#sharedStorageEventGrid.events = this.#events;
|
|
107
|
-
this.setSidebarWidget(this.#noDisplayView);
|
|
108
|
-
this.hideSidebar();
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
#onFocus(event: Protocol.Storage.SharedStorageAccessedEvent): void {
|
|
112
|
-
const jsonView = SourceFrame.JSONView.JSONView.createViewSync(event);
|
|
113
|
-
jsonView.setMinimumSize(0, 40);
|
|
114
|
-
this.setSidebarWidget(jsonView);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
setDefaultIdForTesting(id: Protocol.Page.FrameId): void {
|
|
118
|
-
this.#defaultId = id;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
getEventsForTesting(): Protocol.Storage.SharedStorageAccessedEvent[] {
|
|
122
|
-
return this.#events;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
getSharedStorageAccessGridForTesting(): ApplicationComponents.SharedStorageAccessGrid.SharedStorageAccessGrid {
|
|
126
|
-
return this.#sharedStorageEventGrid;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
@@ -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
|
-
}
|