chrome-devtools-frontend 1.0.1548980 → 1.0.1550444
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/docs/contributing/settings-experiments-features.md +35 -0
- package/docs/styleguide/ux/components.md +53 -12
- package/docs/styleguide/ux/images/cards.png +0 -0
- package/docs/styleguide/ux/patterns.md +27 -0
- package/docs/ui_engineering.md +2 -2
- package/eslint.config.mjs +1 -0
- package/front_end/Tests.js +2 -0
- package/front_end/core/host/InspectorFrontendHost.ts +26 -558
- package/front_end/core/host/InspectorFrontendHostAPI.ts +6 -3
- package/front_end/core/host/InspectorFrontendHostStub.ts +558 -0
- package/front_end/core/host/ResourceLoader.ts +9 -23
- package/front_end/core/host/UserMetrics.ts +4 -4
- package/front_end/core/root/DevToolsContext.ts +4 -0
- package/front_end/core/root/Runtime.ts +10 -0
- package/front_end/core/sdk/CSSMatchedStyles.ts +2 -2
- package/front_end/core/sdk/CSSModel.ts +24 -24
- package/front_end/core/sdk/CSSPropertyParserMatchers.ts +11 -11
- package/front_end/core/sdk/CSSQuery.ts +1 -1
- package/front_end/core/sdk/CSSRule.ts +2 -2
- package/front_end/core/sdk/CSSStyleDeclaration.ts +1 -1
- package/front_end/core/sdk/CSSStyleSheetHeader.ts +1 -1
- package/front_end/core/sdk/DOMModel.ts +3 -0
- package/front_end/core/sdk/NetworkManager.ts +41 -41
- package/front_end/core/sdk/NetworkRequest.ts +4 -0
- package/front_end/core/sdk/OverlayModel.ts +2 -2
- package/front_end/core/sdk/PageResourceLoader.ts +71 -38
- package/front_end/core/sdk/SourceMap.ts +6 -0
- package/front_end/core/sdk/SourceMapCache.ts +21 -0
- package/front_end/core/sdk/SourceMapManager.ts +14 -7
- package/front_end/core/sdk/SourceMapScopesInfo.ts +6 -2
- package/front_end/core/sdk/TargetManager.ts +14 -2
- package/front_end/core/sdk/sdk-meta.ts +13 -0
- package/front_end/entrypoints/formatter_worker/FormatterActions.ts +1 -0
- package/front_end/entrypoints/formatter_worker/ScopeParser.ts +1 -1
- package/front_end/entrypoints/main/MainImpl.ts +5 -4
- package/front_end/foundation/Universe.ts +8 -1
- package/front_end/generated/Deprecation.ts +18 -4
- package/front_end/generated/InspectorBackendCommands.ts +38 -33
- package/front_end/generated/SupportedCSSProperties.js +41 -41
- package/front_end/generated/protocol-mapping.d.ts +20 -0
- package/front_end/generated/protocol-proxy-api.d.ts +17 -0
- package/front_end/generated/protocol.ts +146 -35
- package/front_end/models/ai_assistance/AiConversation.ts +5 -4
- package/front_end/models/ai_assistance/BuiltInAi.ts +79 -5
- package/front_end/models/ai_assistance/ChangeManager.ts +4 -4
- package/front_end/models/ai_assistance/ConversationHandler.ts +0 -15
- package/front_end/models/ai_assistance/agents/AiAgent.ts +9 -6
- package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +135 -3
- package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.ts +24 -0
- package/front_end/models/bindings/CompilerScriptMapping.ts +43 -0
- package/front_end/models/bindings/DebuggerWorkspaceBinding.ts +19 -0
- package/front_end/models/bindings/ResourceMapping.ts +73 -0
- package/front_end/models/bindings/ResourceScriptMapping.ts +50 -0
- package/front_end/models/issues_manager/AttributionReportingIssue.ts +6 -8
- package/front_end/models/issues_manager/BounceTrackingIssue.ts +4 -14
- package/front_end/models/issues_manager/ClientHintIssue.ts +5 -12
- package/front_end/models/issues_manager/ContentSecurityPolicyIssue.ts +5 -12
- package/front_end/models/issues_manager/CookieDeprecationMetadataIssue.ts +7 -14
- package/front_end/models/issues_manager/CookieIssue.ts +27 -30
- package/front_end/models/issues_manager/CorsIssue.ts +8 -17
- package/front_end/models/issues_manager/CrossOriginEmbedderPolicyIssue.ts +5 -8
- package/front_end/models/issues_manager/DeprecationIssue.ts +7 -14
- package/front_end/models/issues_manager/ElementAccessibilityIssue.ts +7 -14
- package/front_end/models/issues_manager/FederatedAuthRequestIssue.ts +4 -11
- package/front_end/models/issues_manager/FederatedAuthUserInfoRequestIssue.ts +4 -11
- package/front_end/models/issues_manager/GenericIssue.ts +28 -16
- package/front_end/models/issues_manager/HeavyAdIssue.ts +4 -11
- package/front_end/models/issues_manager/Issue.ts +12 -4
- package/front_end/models/issues_manager/IssueAggregator.ts +8 -2
- package/front_end/models/issues_manager/LowTextContrastIssue.ts +3 -10
- package/front_end/models/issues_manager/MixedContentIssue.ts +7 -13
- package/front_end/models/issues_manager/PartitioningBlobURLIssue.ts +4 -11
- package/front_end/models/issues_manager/PropertyRuleIssue.ts +6 -12
- package/front_end/models/issues_manager/QuirksModeIssue.ts +3 -10
- package/front_end/models/issues_manager/SRIMessageSignatureIssue.ts +7 -13
- package/front_end/models/issues_manager/SharedArrayBufferIssue.ts +4 -11
- package/front_end/models/issues_manager/SharedDictionaryIssue.ts +6 -13
- package/front_end/models/issues_manager/StylesheetLoadingIssue.ts +8 -13
- package/front_end/models/issues_manager/UnencodedDigestIssue.ts +2 -9
- package/front_end/models/issues_manager/descriptions/genericNavigationEntryMarkedSkippable.md +7 -0
- package/front_end/models/javascript_metadata/NativeFunctions.js +7 -16
- package/front_end/models/source_map_scopes/FunctionCodeResolver.snapshot.txt +98 -0
- package/front_end/models/source_map_scopes/FunctionCodeResolver.ts +270 -0
- package/front_end/models/source_map_scopes/source_map_scopes.ts +2 -0
- package/front_end/models/workspace/UISourceCode.ts +51 -44
- package/front_end/panels/ai_assistance/AiAssistancePanel.ts +76 -34
- package/front_end/panels/ai_assistance/aiAssistancePanel.css +1 -0
- package/front_end/panels/ai_assistance/components/ChatView.ts +23 -11
- package/front_end/panels/application/AppManifestView.ts +7 -6
- package/front_end/panels/application/ApplicationPanelSidebar.ts +21 -21
- package/front_end/panels/application/BackForwardCacheTreeElement.ts +2 -2
- package/front_end/panels/application/BounceTrackingMitigationsTreeElement.ts +2 -2
- package/front_end/panels/application/FrameDetailsView.ts +5 -6
- package/front_end/panels/application/InterestGroupTreeElement.ts +2 -2
- package/front_end/panels/application/OpenedWindowDetailsView.ts +2 -2
- package/front_end/panels/application/OriginTrialTreeView.ts +1 -1
- package/front_end/panels/application/PreloadingTreeElement.ts +3 -3
- package/front_end/panels/application/ReportingApiTreeElement.ts +2 -2
- package/front_end/panels/application/ServiceWorkerCacheTreeElement.ts +3 -3
- package/front_end/panels/application/ServiceWorkersView.ts +2 -2
- package/front_end/panels/application/SharedStorageListTreeElement.ts +2 -2
- package/front_end/panels/application/StorageBucketsTreeElement.ts +3 -3
- package/front_end/panels/application/StorageView.ts +2 -2
- package/front_end/panels/application/TrustTokensTreeElement.ts +4 -8
- package/front_end/panels/application/components/PermissionsPolicySection.ts +202 -158
- package/front_end/panels/application/components/ProtocolHandlersView.ts +118 -81
- package/front_end/panels/application/components/ServiceWorkerRouterView.ts +47 -41
- package/front_end/panels/application/components/SharedStorageMetadataView.ts +1 -1
- package/front_end/panels/application/components/StorageMetadataView.ts +31 -34
- package/front_end/panels/application/components/TrustTokensView.ts +77 -69
- package/front_end/panels/application/preloading/components/PreloadingGrid.ts +1 -1
- package/front_end/panels/application/preloading/components/RuleSetGrid.ts +1 -1
- package/front_end/panels/application/preloading/components/UsedPreloadingView.ts +1 -1
- package/front_end/panels/changes/ChangesSidebar.ts +2 -0
- package/front_end/panels/changes/CombinedDiffView.ts +2 -0
- package/front_end/panels/common/AnnotationManager.ts +71 -0
- package/front_end/panels/common/PersistenceUtils.ts +6 -7
- package/front_end/panels/common/common.ts +1 -0
- package/front_end/panels/console/ConsolePrompt.ts +4 -4
- package/front_end/panels/console/ConsoleView.ts +5 -4
- package/front_end/panels/console/ConsoleViewMessage.ts +16 -15
- package/front_end/panels/console/console-meta.ts +0 -13
- package/front_end/panels/console_counters/WarningErrorCounter.ts +2 -0
- package/front_end/panels/css_overview/CSSOverviewCompletedView.ts +1 -1
- package/front_end/panels/developer_resources/DeveloperResourcesView.ts +3 -1
- package/front_end/panels/elements/CSSRuleValidator.ts +7 -7
- package/front_end/panels/elements/CSSRuleValidatorHelper.ts +2 -2
- package/front_end/panels/elements/ColorSwatchPopoverIcon.ts +3 -3
- package/front_end/panels/elements/ElementsPanel.ts +49 -0
- package/front_end/panels/elements/ElementsTreeElement.ts +172 -121
- package/front_end/panels/elements/ElementsTreeOutline.ts +11 -3
- package/front_end/panels/elements/LayoutPane.ts +12 -10
- package/front_end/panels/elements/ShortcutTreeElement.ts +2 -2
- package/front_end/panels/elements/StyleEditorWidget.ts +2 -2
- package/front_end/panels/elements/StylePropertyTreeElement.ts +18 -18
- package/front_end/panels/elements/StylesSidebarPane.ts +4 -5
- package/front_end/panels/elements/TopLayerContainer.ts +2 -2
- package/front_end/panels/elements/components/AdornerManager.ts +3 -3
- package/front_end/panels/elements/components/ElementsBreadcrumbs.ts +1 -1
- package/front_end/panels/elements/components/ElementsTreeExpandButton.ts +1 -1
- package/front_end/panels/elements/components/QueryContainer.ts +1 -1
- package/front_end/panels/elements/components/StylePropertyEditor.ts +7 -7
- package/front_end/panels/emulation/DeviceModeWrapper.ts +48 -3
- package/front_end/panels/explain/components/ConsoleInsight.ts +6 -4
- package/front_end/panels/issues/AffectedResourcesView.ts +2 -2
- package/front_end/panels/issues/AttributionReportingIssueDetailsView.ts +2 -2
- package/front_end/panels/issues/IssueKindView.ts +2 -2
- package/front_end/panels/issues/IssueView.ts +4 -4
- package/front_end/panels/js_timeline/js_timeline-meta.ts +4 -2
- package/front_end/panels/linear_memory_inspector/components/LinearMemoryHighlightChipList.ts +28 -50
- package/front_end/panels/linear_memory_inspector/components/LinearMemoryInspector.ts +15 -11
- package/front_end/panels/linear_memory_inspector/components/LinearMemoryNavigator.ts +1 -1
- package/front_end/panels/linear_memory_inspector/components/LinearMemoryValueInterpreter.ts +1 -1
- package/front_end/panels/linear_memory_inspector/components/ValueInterpreterDisplay.ts +1 -1
- package/front_end/panels/media/PlayerListView.ts +100 -73
- package/front_end/panels/media/playerListView.css +5 -0
- package/front_end/panels/mobile_throttling/ThrottlingManager.ts +2 -2
- package/front_end/panels/mobile_throttling/ThrottlingSettingsTab.ts +4 -5
- package/front_end/panels/network/NetworkDataGridNode.ts +3 -3
- package/front_end/panels/network/NetworkFrameGrouper.ts +2 -2
- package/front_end/panels/network/NetworkItemView.ts +4 -4
- package/front_end/panels/network/NetworkLogViewColumns.ts +3 -3
- package/front_end/panels/network/RequestConditionsDrawer.ts +5 -5
- package/front_end/panels/network/RequestCookiesView.ts +2 -2
- package/front_end/panels/network/SignedExchangeInfoView.ts +2 -2
- package/front_end/panels/network/components/DirectSocketConnectionView.ts +17 -0
- package/front_end/panels/network/components/RequestTrustTokensView.ts +5 -6
- package/front_end/panels/network/resourceChunkView.css +4 -0
- package/front_end/panels/profiler/HeapSnapshotGridNodes.ts +3 -3
- package/front_end/panels/profiler/ProfileDataGrid.ts +2 -2
- package/front_end/panels/profiler/ProfilesPanel.ts +2 -2
- package/front_end/panels/protocol_monitor/JSONEditor.ts +1 -1
- package/front_end/panels/recorder/components/CreateRecordingView.ts +1 -1
- package/front_end/panels/recorder/components/ExtensionView.ts +1 -1
- package/front_end/panels/recorder/components/RecordingListView.ts +1 -1
- package/front_end/panels/recorder/components/RecordingView.ts +1 -1
- package/front_end/panels/recorder/components/StepView.ts +1 -1
- package/front_end/panels/screencast/ScreencastView.ts +8 -8
- package/front_end/panels/search/SearchView.ts +1 -1
- package/front_end/panels/security/CookieControlsTreeElement.ts +2 -2
- package/front_end/panels/security/CookieControlsView.ts +1 -1
- package/front_end/panels/security/CookieReportTreeElement.ts +2 -2
- package/front_end/panels/security/SecurityPanel.ts +5 -5
- package/front_end/panels/security/SecurityPanelSidebar.ts +3 -4
- package/front_end/panels/sensors/LocationsSettingsTab.ts +1 -1
- package/front_end/panels/settings/FrameworkIgnoreListSettingsTab.ts +1 -1
- package/front_end/panels/settings/KeybindsSettingsTab.ts +5 -5
- package/front_end/panels/settings/SettingsScreen.ts +7 -8
- package/front_end/panels/settings/WorkspaceSettingsTab.ts +1 -1
- package/front_end/panels/settings/emulation/DevicesSettingsTab.ts +1 -1
- package/front_end/panels/snippets/SnippetsQuickOpen.ts +16 -6
- package/front_end/panels/sources/BreakpointEditDialog.ts +3 -3
- package/front_end/panels/sources/BreakpointsView.ts +1 -1
- package/front_end/panels/sources/CSSPlugin.ts +4 -4
- package/front_end/panels/sources/CallStackSidebarPane.ts +4 -4
- package/front_end/panels/sources/DebuggerPausedMessage.ts +3 -3
- package/front_end/panels/sources/FilteredUISourceCodeListProvider.ts +40 -23
- package/front_end/panels/sources/GoToLineQuickOpen.ts +11 -5
- package/front_end/panels/sources/NavigatorView.ts +4 -4
- package/front_end/panels/sources/OpenFileQuickOpen.ts +11 -16
- package/front_end/panels/sources/OutlineQuickOpen.ts +23 -23
- package/front_end/panels/sources/ProfilePlugin.ts +21 -12
- package/front_end/panels/sources/SourcesView.ts +2 -2
- package/front_end/panels/sources/TabbedEditorContainer.ts +4 -5
- package/front_end/panels/sources/ThreadsSidebarPane.ts +2 -2
- package/front_end/panels/sources/UISourceCodeFrame.ts +5 -6
- package/front_end/panels/sources/filteredUISourceCodeListProvider.css +41 -0
- package/front_end/panels/timeline/TimelineHistoryManager.ts +2 -2
- package/front_end/panels/timeline/TimelinePanel.ts +29 -25
- package/front_end/panels/timeline/TimelineSelectorStatsView.ts +3 -3
- package/front_end/panels/timeline/components/CPUThrottlingSelector.ts +1 -1
- package/front_end/panels/timeline/components/LiveMetricsView.ts +1 -1
- package/front_end/panels/timeline/components/NetworkRequestTooltip.ts +1 -1
- package/front_end/panels/timeline/components/NetworkThrottlingSelector.ts +1 -1
- package/front_end/panels/timeline/components/OriginMap.ts +1 -1
- package/front_end/panels/timeline/components/insights/Checklist.ts +1 -1
- package/front_end/panels/timeline/components/insights/DOMSize.ts +1 -1
- package/front_end/panels/timeline/components/insights/ImageDelivery.ts +1 -1
- package/front_end/panels/timeline/components/insights/NetworkDependencyTree.ts +1 -1
- package/front_end/panels/timeline/components/insights/SlowCSSSelector.ts +2 -2
- package/front_end/panels/timeline/docs/flame_chart_migration.md +11 -16
- package/front_end/panels/timeline/overlays/components/EntriesLinkOverlay.ts +1 -1
- package/front_end/panels/timeline/overlays/components/EntryLabelOverlay.ts +1 -1
- package/front_end/panels/timeline/timeline-meta.ts +3 -2
- package/front_end/panels/utils/utils.ts +18 -3
- package/front_end/panels/whats_new/ReleaseNoteText.ts +10 -20
- package/front_end/panels/whats_new/resources/WNDT.md +8 -8
- package/front_end/third_party/chromium/README.chromium +1 -1
- package/front_end/third_party/puppeteer/third_party/mitt/README.chromium +1 -0
- package/front_end/third_party/puppeteer/third_party/parsel/README.chromium +1 -0
- package/front_end/third_party/puppeteer/third_party/rxjs/README.chromium +1 -0
- package/front_end/ui/components/adorners/Adorner.ts +21 -1
- package/front_end/ui/components/annotations/AnnotationRepository.ts +98 -0
- package/front_end/ui/components/annotations/AnnotationType.ts +10 -0
- package/front_end/ui/components/annotations/annotations.ts +6 -0
- package/front_end/ui/components/buttons/Button.ts +2 -2
- package/front_end/ui/components/buttons/FloatingButton.ts +2 -2
- package/front_end/ui/components/chrome_link/ChromeLink.ts +1 -1
- package/front_end/ui/components/dialogs/ButtonDialog.ts +1 -1
- package/front_end/ui/components/dialogs/Dialog.ts +1 -1
- package/front_end/ui/components/dialogs/ShortcutDialog.ts +1 -0
- package/front_end/ui/components/diff_view/DiffView.ts +1 -1
- package/front_end/ui/components/expandable_list/ExpandableList.ts +1 -1
- package/front_end/ui/components/highlighting/HighlightElement.ts +16 -2
- package/front_end/ui/components/highlighting/MarkupHighlight.ts +162 -0
- package/front_end/ui/components/highlighting/highlighting.ts +7 -0
- package/front_end/ui/components/icon_button/FileSourceIcon.ts +2 -2
- package/front_end/ui/components/icon_button/IconButton.ts +2 -2
- package/front_end/ui/components/icon_button/icon_button.ts +0 -2
- package/front_end/ui/components/issue_counter/IssueCounter.ts +2 -2
- package/front_end/ui/components/issue_counter/IssueLinkIcon.ts +2 -2
- package/front_end/ui/components/legacy_wrapper/LegacyWrapper.ts +1 -1
- package/front_end/ui/components/linkifier/LinkifierImpl.ts +1 -1
- package/front_end/ui/components/list/List.ts +184 -0
- package/front_end/ui/components/list/list.css +90 -0
- package/front_end/ui/components/{cards/cards.ts → list/lists.ts} +3 -3
- package/front_end/ui/components/markdown_view/CodeBlock.ts +1 -1
- package/front_end/ui/components/markdown_view/MarkdownImage.ts +4 -4
- package/front_end/ui/components/markdown_view/MarkdownLink.ts +1 -1
- package/front_end/ui/components/markdown_view/MarkdownView.ts +1 -1
- package/front_end/ui/components/menus/Menu.ts +1 -1
- package/front_end/ui/components/menus/SelectMenu.ts +1 -1
- package/front_end/ui/components/node_text/NodeText.ts +1 -1
- package/front_end/ui/components/panel_feedback/FeedbackButton.ts +1 -1
- package/front_end/ui/components/panel_feedback/PanelFeedback.ts +1 -1
- package/front_end/ui/components/panel_feedback/PreviewToggle.ts +1 -1
- package/front_end/ui/components/panel_introduction_steps/PanelIntroductionSteps.ts +1 -1
- package/front_end/ui/components/report_view/ReportView.ts +1 -1
- package/front_end/ui/components/request_link_icon/RequestLinkIcon.ts +2 -2
- package/front_end/ui/components/settings/SettingCheckbox.ts +1 -1
- package/front_end/ui/components/settings/SettingDeprecationWarning.ts +2 -2
- package/front_end/ui/components/snackbars/Snackbar.ts +1 -1
- package/front_end/ui/components/spinners/Spinner.ts +1 -1
- package/front_end/ui/components/srgb_overlay/SrgbOverlay.ts +1 -1
- package/front_end/ui/components/suggestion_input/SuggestionInput.ts +1 -0
- package/front_end/ui/components/survey_link/SurveyLink.ts +2 -2
- package/front_end/ui/components/switch/SwitchImpl.ts +1 -1
- package/front_end/ui/components/text_editor/TextEditor.ts +1 -0
- package/front_end/ui/components/text_editor/config.ts +2 -2
- package/front_end/ui/components/text_prompt/TextPrompt.ts +1 -1
- package/front_end/ui/components/tooltips/Tooltip.ts +1 -1
- package/front_end/ui/components/tree_outline/TreeOutline.ts +1 -1
- package/front_end/ui/kit/cards/Card.docs.ts +43 -0
- package/front_end/ui/{components/icon_button → kit/icons}/Icon.docs.ts +3 -4
- package/front_end/ui/{components/icon_button → kit/icons}/Icon.ts +6 -4
- package/front_end/ui/kit/kit.ts +6 -0
- package/front_end/ui/legacy/Infobar.ts +3 -3
- package/front_end/ui/legacy/InspectorView.ts +3 -3
- package/front_end/ui/legacy/SearchableView.ts +2 -2
- package/front_end/ui/legacy/SoftContextMenu.ts +5 -5
- package/front_end/ui/legacy/SoftDropDown.ts +2 -2
- package/front_end/ui/legacy/TabbedPane.ts +106 -8
- package/front_end/ui/legacy/Toolbar.ts +3 -3
- package/front_end/ui/legacy/Treeoutline.ts +2 -2
- package/front_end/ui/legacy/UIUtils.ts +4 -188
- package/front_end/ui/legacy/ViewManager.ts +27 -12
- package/front_end/ui/legacy/ViewRegistration.ts +21 -22
- package/front_end/ui/legacy/components/color_picker/ContrastDetails.ts +8 -8
- package/front_end/ui/legacy/components/color_picker/Spectrum.ts +4 -4
- package/front_end/ui/legacy/components/cookie_table/CookiesTable.ts +4 -4
- package/front_end/ui/legacy/components/inline_editor/FontEditor.ts +2 -2
- package/front_end/ui/legacy/components/inline_editor/Swatches.ts +5 -5
- package/front_end/ui/legacy/components/object_ui/CustomPreviewComponent.ts +3 -3
- package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +5 -4
- package/front_end/ui/legacy/components/perf_ui/LineLevelProfile.ts +73 -35
- package/front_end/ui/legacy/components/perf_ui/LiveHeapProfile.ts +11 -2
- package/front_end/ui/legacy/components/perf_ui/OverviewGrid.ts +3 -3
- package/front_end/ui/legacy/components/quick_open/CommandMenu.ts +23 -31
- package/front_end/ui/legacy/components/quick_open/FilteredListWidget.ts +11 -27
- package/front_end/ui/legacy/components/quick_open/HelpQuickOpen.ts +11 -15
- package/front_end/ui/legacy/components/quick_open/filteredListWidget.css +18 -65
- package/front_end/ui/legacy/components/source_frame/JSONView.ts +2 -1
- package/front_end/ui/legacy/components/utils/Linkifier.ts +3 -3
- package/front_end/ui/legacy/tabbedPane.css +10 -0
- package/front_end/ui/visual_logging/KnownContextValues.ts +3 -0
- package/inspector_overlay/README.md +3 -3
- package/mcp/HostBindings.ts +310 -0
- package/mcp/mcp.ts +18 -0
- package/mcp/tsconfig.json +6 -1
- package/package.json +26 -24
- /package/front_end/ui/{components → kit}/cards/Card.ts +0 -0
- /package/front_end/ui/{components → kit}/cards/card.css +0 -0
- /package/front_end/ui/{components/icon_button → kit/icons}/icon.css +0 -0
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
// Copyright 2021 The Chromium Authors
|
|
2
2
|
// Use of this source code is governed by a BSD-style license that can be
|
|
3
3
|
// found in the LICENSE file.
|
|
4
|
-
/* eslint-disable @devtools/no-lit-render-outside-of-view */
|
|
5
4
|
|
|
6
|
-
import '../../../ui/
|
|
5
|
+
import '../../../ui/kit/kit.js';
|
|
7
6
|
import '../../../ui/components/report_view/report_view.js';
|
|
8
7
|
|
|
9
8
|
import * as Common from '../../../core/common/common.js';
|
|
@@ -13,14 +12,12 @@ import * as SDK from '../../../core/sdk/sdk.js';
|
|
|
13
12
|
import * as Protocol from '../../../generated/protocol.js';
|
|
14
13
|
import * as NetworkForward from '../../../panels/network/forward/forward.js';
|
|
15
14
|
import * as Buttons from '../../../ui/components/buttons/buttons.js';
|
|
16
|
-
import * as
|
|
17
|
-
import
|
|
15
|
+
import * as UI from '../../../ui/legacy/legacy.js';
|
|
16
|
+
import {html, type LitTemplate, nothing, render, type TemplateResult} from '../../../ui/lit/lit.js';
|
|
18
17
|
import * as VisualLogging from '../../../ui/visual_logging/visual_logging.js';
|
|
19
18
|
|
|
20
19
|
import permissionsPolicySectionStyles from './permissionsPolicySection.css.js';
|
|
21
20
|
|
|
22
|
-
const {html} = Lit;
|
|
23
|
-
|
|
24
21
|
const UIStrings = {
|
|
25
22
|
/**
|
|
26
23
|
* @description Label for a button. When clicked more details (for the content this button refers to) will be shown.
|
|
@@ -72,179 +69,226 @@ export interface PermissionsPolicySectionData {
|
|
|
72
69
|
|
|
73
70
|
export function renderIconLink(
|
|
74
71
|
iconName: string, title: Platform.UIString.LocalizedString, clickHandler: (() => void)|(() => Promise<void>),
|
|
75
|
-
jsLogContext: string):
|
|
72
|
+
jsLogContext: string): TemplateResult {
|
|
76
73
|
// Disabled until https://crbug.com/1079231 is fixed.
|
|
77
74
|
// clang-format off
|
|
78
75
|
return html`
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
76
|
+
<devtools-button
|
|
77
|
+
.iconName=${iconName}
|
|
78
|
+
title=${title}
|
|
79
|
+
aria-label=${title}
|
|
80
|
+
.variant=${Buttons.Button.Variant.ICON}
|
|
81
|
+
.size=${Buttons.Button.Size.SMALL}
|
|
82
|
+
@click=${clickHandler}
|
|
83
|
+
jslog=${VisualLogging.action().track({click: true}).context(jsLogContext)}>
|
|
84
|
+
</devtools-button>`;
|
|
88
85
|
// clang-format on
|
|
89
86
|
}
|
|
90
87
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
set data(data: PermissionsPolicySectionData) {
|
|
96
|
-
this.#permissionsPolicySectionData = data;
|
|
97
|
-
void this.#render();
|
|
88
|
+
function renderAllowed(allowed: Protocol.Page.PermissionsPolicyFeatureState[]): LitTemplate {
|
|
89
|
+
if (!allowed.length) {
|
|
90
|
+
return nothing;
|
|
98
91
|
}
|
|
92
|
+
return html`
|
|
93
|
+
<devtools-report-key>${i18nString(UIStrings.allowedFeatures)}</devtools-report-key>
|
|
94
|
+
<devtools-report-value>${allowed.map(({feature}) => feature).join(', ')}</devtools-report-value>`;
|
|
95
|
+
}
|
|
99
96
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
97
|
+
function renderDisallowed(
|
|
98
|
+
data: Array<{
|
|
99
|
+
policy: Protocol.Page.PermissionsPolicyFeatureState,
|
|
100
|
+
blockReason?: Protocol.Page.PermissionsPolicyBlockReason,
|
|
101
|
+
linkTargetDOMNode?: SDK.DOMModel.DOMNode,
|
|
102
|
+
linkTargetRequest?: SDK.NetworkRequest.NetworkRequest,
|
|
103
|
+
}>,
|
|
104
|
+
showDetails: boolean,
|
|
105
|
+
onToggleShowDetails: () => void,
|
|
106
|
+
onRevealDOMNode: (linkTargetDOMNode: SDK.DOMModel.DOMNode) => Promise<void>,
|
|
107
|
+
onRevealHeader: (linkTargetRequest: SDK.NetworkRequest.NetworkRequest) => Promise<void>,
|
|
108
|
+
): LitTemplate {
|
|
109
|
+
if (!data.length) {
|
|
110
|
+
return nothing;
|
|
103
111
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
const allowed = this.#permissionsPolicySectionData.policies.filter(p => p.allowed).map(p => p.feature).sort();
|
|
107
|
-
if (!allowed.length) {
|
|
108
|
-
return Lit.nothing;
|
|
109
|
-
}
|
|
112
|
+
if (!showDetails) {
|
|
113
|
+
// clang-format off
|
|
110
114
|
return html`
|
|
111
|
-
<devtools-report-key>${i18nString(UIStrings.
|
|
115
|
+
<devtools-report-key>${i18nString(UIStrings.disabledFeatures)}</devtools-report-key>
|
|
112
116
|
<devtools-report-value>
|
|
113
|
-
${
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
.sort((a, b) => a.feature.localeCompare(b.feature));
|
|
121
|
-
if (!disallowed.length) {
|
|
122
|
-
return Lit.nothing;
|
|
123
|
-
}
|
|
124
|
-
if (!this.#permissionsPolicySectionData.showDetails) {
|
|
125
|
-
return html`
|
|
126
|
-
<devtools-report-key>${i18nString(UIStrings.disabledFeatures)}</devtools-report-key>
|
|
127
|
-
<devtools-report-value>
|
|
128
|
-
${disallowed.map(p => p.feature).join(', ')}
|
|
129
|
-
<devtools-button
|
|
130
|
-
class="disabled-features-button"
|
|
131
|
-
.variant=${Buttons.Button.Variant.OUTLINED}
|
|
132
|
-
@click=${() => this.#toggleShowPermissionsDisallowedDetails()}
|
|
133
|
-
jslog=${VisualLogging.action('show-disabled-features-details').track({
|
|
134
|
-
click: true,
|
|
135
|
-
})}>${i18nString(UIStrings.showDetails)}
|
|
117
|
+
${data.map(({policy}) => policy.feature).join(', ')}
|
|
118
|
+
<devtools-button
|
|
119
|
+
class="disabled-features-button"
|
|
120
|
+
.variant=${Buttons.Button.Variant.OUTLINED}
|
|
121
|
+
@click=${onToggleShowDetails}
|
|
122
|
+
jslog=${VisualLogging.action('show-disabled-features-details').track({click: true})}>
|
|
123
|
+
${i18nString(UIStrings.showDetails)}
|
|
136
124
|
</devtools-button>
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
125
|
+
</devtools-report-value>`;
|
|
126
|
+
// clang-format on
|
|
127
|
+
}
|
|
140
128
|
|
|
141
|
-
|
|
142
|
-
const
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
const revealHeader = async(): Promise<void> => {
|
|
162
|
-
if (!linkTargetRequest) {
|
|
163
|
-
return;
|
|
164
|
-
}
|
|
165
|
-
const headerName =
|
|
166
|
-
linkTargetRequest.responseHeaderValue('permissions-policy') ? 'permissions-policy' : 'feature-policy';
|
|
167
|
-
const requestLocation = NetworkForward.UIRequestLocation.UIRequestLocation.responseHeaderMatch(
|
|
168
|
-
linkTargetRequest,
|
|
169
|
-
{name: headerName, value: ''},
|
|
170
|
-
);
|
|
171
|
-
await Common.Revealer.reveal(requestLocation);
|
|
172
|
-
};
|
|
173
|
-
|
|
174
|
-
// Disabled until https://crbug.com/1079231 is fixed.
|
|
175
|
-
// clang-format off
|
|
176
|
-
return html`
|
|
177
|
-
<div class="permissions-row">
|
|
178
|
-
<div>
|
|
179
|
-
<devtools-icon class="allowed-icon extra-large" name="cross-circle">
|
|
180
|
-
</devtools-icon>
|
|
181
|
-
</div>
|
|
182
|
-
<div class="feature-name text-ellipsis">
|
|
183
|
-
${policy.feature}
|
|
184
|
-
</div>
|
|
185
|
-
<div class="block-reason">${blockReasonText}</div>
|
|
186
|
-
<div>
|
|
187
|
-
${
|
|
188
|
-
linkTargetDOMNode ? renderIconLink(
|
|
189
|
-
'code-circle', i18nString(UIStrings.clickToShowIframe),
|
|
190
|
-
() => Common.Revealer.reveal(linkTargetDOMNode), 'reveal-in-elements') :
|
|
191
|
-
Lit.nothing}
|
|
192
|
-
${
|
|
193
|
-
linkTargetRequest ? renderIconLink(
|
|
194
|
-
'arrow-up-down-circle',
|
|
195
|
-
i18nString(UIStrings.clickToShowHeader),
|
|
196
|
-
revealHeader,
|
|
197
|
-
'reveal-in-network') :
|
|
198
|
-
Lit.nothing}
|
|
199
|
-
</div>
|
|
129
|
+
const featureRows = data.map(({policy, blockReason, linkTargetDOMNode, linkTargetRequest}) => {
|
|
130
|
+
const blockReasonText = (() => {
|
|
131
|
+
switch (blockReason) {
|
|
132
|
+
case Protocol.Page.PermissionsPolicyBlockReason.IframeAttribute:
|
|
133
|
+
return i18nString(UIStrings.disabledByIframe);
|
|
134
|
+
case Protocol.Page.PermissionsPolicyBlockReason.Header:
|
|
135
|
+
return i18nString(UIStrings.disabledByHeader);
|
|
136
|
+
case Protocol.Page.PermissionsPolicyBlockReason.InFencedFrameTree:
|
|
137
|
+
return i18nString(UIStrings.disabledByFencedFrame);
|
|
138
|
+
default:
|
|
139
|
+
return '';
|
|
140
|
+
}
|
|
141
|
+
})();
|
|
142
|
+
// Disabled until https://crbug.com/1079231 is fixed.
|
|
143
|
+
// clang-format off
|
|
144
|
+
return html`
|
|
145
|
+
<div class="permissions-row">
|
|
146
|
+
<div>
|
|
147
|
+
<devtools-icon class="allowed-icon extra-large" name="cross-circle">
|
|
148
|
+
</devtools-icon>
|
|
200
149
|
</div>
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
150
|
+
<div class="feature-name text-ellipsis">${policy.feature}</div>
|
|
151
|
+
<div class="block-reason">${blockReasonText}</div>
|
|
152
|
+
<div>
|
|
153
|
+
${linkTargetDOMNode ?
|
|
154
|
+
renderIconLink('code-circle', i18nString(UIStrings.clickToShowIframe),
|
|
155
|
+
() => onRevealDOMNode(linkTargetDOMNode), 'reveal-in-elements') :
|
|
156
|
+
nothing}
|
|
157
|
+
${linkTargetRequest ?
|
|
158
|
+
renderIconLink('arrow-up-down-circle', i18nString(UIStrings.clickToShowHeader),
|
|
159
|
+
() => onRevealHeader(linkTargetRequest), 'reveal-in-network') :
|
|
160
|
+
nothing}
|
|
161
|
+
</div>
|
|
162
|
+
</div>`;
|
|
163
|
+
// clang-format on
|
|
164
|
+
});
|
|
204
165
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
166
|
+
// clang-format off
|
|
167
|
+
return html`
|
|
168
|
+
<devtools-report-key>${i18nString(UIStrings.disabledFeatures)}</devtools-report-key>
|
|
169
|
+
<devtools-report-value class="policies-list">
|
|
170
|
+
${featureRows}
|
|
171
|
+
<div class="permissions-row">
|
|
210
172
|
<devtools-button
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
})}>${i18nString(UIStrings.hideDetails)}
|
|
173
|
+
.variant=${Buttons.Button.Variant.OUTLINED}
|
|
174
|
+
@click=${onToggleShowDetails}
|
|
175
|
+
jslog=${VisualLogging.action('hide-disabled-features-details').track({click: true})}>
|
|
176
|
+
${i18nString(UIStrings.hideDetails)}
|
|
216
177
|
</devtools-button>
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
178
|
+
</div>
|
|
179
|
+
</devtools-report-value>`;
|
|
180
|
+
// clang-format on
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
interface ViewInput {
|
|
184
|
+
allowed: Protocol.Page.PermissionsPolicyFeatureState[];
|
|
185
|
+
disallowed: Array<{
|
|
186
|
+
policy: Protocol.Page.PermissionsPolicyFeatureState,
|
|
187
|
+
blockReason?: Protocol.Page.PermissionsPolicyBlockReason,
|
|
188
|
+
linkTargetDOMNode?: SDK.DOMModel.DOMNode,
|
|
189
|
+
linkTargetRequest?: SDK.NetworkRequest.NetworkRequest,
|
|
190
|
+
}>;
|
|
191
|
+
showDetails: boolean;
|
|
192
|
+
onToggleShowDetails: () => void;
|
|
193
|
+
onRevealDOMNode: (linkTargetDOMNode: SDK.DOMModel.DOMNode) => Promise<void>;
|
|
194
|
+
onRevealHeader: (linkTargetRequest: SDK.NetworkRequest.NetworkRequest) => Promise<void>;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
type View = (input: ViewInput, output: undefined, target: HTMLElement) => void;
|
|
198
|
+
|
|
199
|
+
const DEFAULT_VIEW: View = (input, output, target) => {
|
|
200
|
+
// clang-format off
|
|
201
|
+
render(html`
|
|
202
|
+
<style>${permissionsPolicySectionStyles}</style>
|
|
203
|
+
<devtools-report-section-header>
|
|
204
|
+
${i18n.i18n.lockedString('Permissions Policy')}
|
|
205
|
+
</devtools-report-section-header>
|
|
206
|
+
${renderAllowed(input.allowed)}
|
|
207
|
+
${(input.allowed.length > 0 && input.disallowed.length > 0) ?
|
|
208
|
+
html`<devtools-report-divider class="subsection-divider"></devtools-report-divider>` : nothing}
|
|
209
|
+
${renderDisallowed(
|
|
210
|
+
input.disallowed, input.showDetails,
|
|
211
|
+
input.onToggleShowDetails, input.onRevealDOMNode, input.onRevealHeader)}
|
|
212
|
+
<devtools-report-divider></devtools-report-divider>`, target);
|
|
213
|
+
// clang-format on
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
export class PermissionsPolicySection extends UI.Widget.Widget {
|
|
217
|
+
#policies: Protocol.Page.PermissionsPolicyFeatureState[] = [];
|
|
218
|
+
#showDetails = false;
|
|
219
|
+
#view: View;
|
|
220
|
+
|
|
221
|
+
constructor(element?: HTMLElement, view = DEFAULT_VIEW) {
|
|
222
|
+
super(element, {useShadowDom: true});
|
|
223
|
+
this.#view = view;
|
|
220
224
|
}
|
|
221
225
|
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
${Lit.Directives.until(this.#renderDisallowed(), Lit.nothing)}
|
|
235
|
-
<devtools-report-divider></devtools-report-divider>
|
|
236
|
-
`,
|
|
237
|
-
this.#shadow, {host: this},
|
|
238
|
-
);
|
|
239
|
-
// clang-format on
|
|
240
|
-
});
|
|
226
|
+
set policies(policies: Protocol.Page.PermissionsPolicyFeatureState[]) {
|
|
227
|
+
this.#policies = policies;
|
|
228
|
+
this.requestUpdate();
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
get policies(): Protocol.Page.PermissionsPolicyFeatureState[] {
|
|
232
|
+
return this.#policies;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
set showDetails(showDetails: boolean) {
|
|
236
|
+
this.#showDetails = showDetails;
|
|
237
|
+
this.requestUpdate();
|
|
241
238
|
}
|
|
242
|
-
}
|
|
243
239
|
|
|
244
|
-
|
|
240
|
+
get showDetails(): boolean {
|
|
241
|
+
return this.#showDetails;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
#toggleShowPermissionsDisallowedDetails(): void {
|
|
245
|
+
this.showDetails = !this.showDetails;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
async #revealDOMNode(linkTargetDOMNode: SDK.DOMModel.DOMNode): Promise<void> {
|
|
249
|
+
await Common.Revealer.reveal(linkTargetDOMNode);
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
async #revealHeader(linkTargetRequest: SDK.NetworkRequest.NetworkRequest): Promise<void> {
|
|
253
|
+
if (!linkTargetRequest) {
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
const headerName =
|
|
257
|
+
linkTargetRequest.responseHeaderValue('permissions-policy') ? 'permissions-policy' : 'feature-policy';
|
|
258
|
+
const requestLocation = NetworkForward.UIRequestLocation.UIRequestLocation.responseHeaderMatch(
|
|
259
|
+
linkTargetRequest,
|
|
260
|
+
{name: headerName, value: ''},
|
|
261
|
+
);
|
|
262
|
+
await Common.Revealer.reveal(requestLocation);
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
override async performUpdate(): Promise<void> {
|
|
266
|
+
const frameManager = SDK.FrameManager.FrameManager.instance();
|
|
267
|
+
const policies = this.#policies.sort((a, b) => a.feature.localeCompare(b.feature));
|
|
268
|
+
const allowed = policies.filter(p => p.allowed).sort((a, b) => a.feature.localeCompare(b.feature));
|
|
269
|
+
const disallowed = policies.filter(p => !p.allowed).sort((a, b) => a.feature.localeCompare(b.feature));
|
|
270
|
+
const disallowedData = this.#showDetails ? await Promise.all(disallowed.map(async policy => {
|
|
271
|
+
const frame = policy.locator ? frameManager.getFrame(policy.locator.frameId) : undefined;
|
|
272
|
+
const blockReason = policy.locator?.blockReason;
|
|
273
|
+
const linkTargetDOMNode = await ((blockReason === Protocol.Page.PermissionsPolicyBlockReason.IframeAttribute &&
|
|
274
|
+
frame?.getOwnerDOMNodeOrDocument()) ||
|
|
275
|
+
undefined);
|
|
276
|
+
const resource = frame?.resourceForURL(frame.url);
|
|
277
|
+
const linkTargetRequest =
|
|
278
|
+
(blockReason === Protocol.Page.PermissionsPolicyBlockReason.Header && resource?.request) || undefined;
|
|
279
|
+
return {policy, blockReason, linkTargetDOMNode, linkTargetRequest};
|
|
280
|
+
})) :
|
|
281
|
+
disallowed.map(policy => ({policy}));
|
|
245
282
|
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
283
|
+
this.#view(
|
|
284
|
+
{
|
|
285
|
+
allowed,
|
|
286
|
+
disallowed: disallowedData,
|
|
287
|
+
showDetails: this.#showDetails,
|
|
288
|
+
onToggleShowDetails: this.#toggleShowPermissionsDisallowedDetails.bind(this),
|
|
289
|
+
onRevealDOMNode: this.#revealDOMNode.bind(this),
|
|
290
|
+
onRevealHeader: this.#revealHeader.bind(this),
|
|
291
|
+
},
|
|
292
|
+
undefined, this.contentElement);
|
|
249
293
|
}
|
|
250
294
|
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
// Copyright 2022 The Chromium Authors
|
|
2
2
|
// Use of this source code is governed by a BSD-style license that can be
|
|
3
3
|
// found in the LICENSE file.
|
|
4
|
-
/* eslint-disable @devtools/no-lit-render-outside-of-view */
|
|
5
4
|
|
|
6
|
-
import '../../../ui/
|
|
5
|
+
import '../../../ui/kit/kit.js';
|
|
7
6
|
|
|
8
7
|
import * as Host from '../../../core/host/host.js';
|
|
9
8
|
import * as i18n from '../../../core/i18n/i18n.js';
|
|
@@ -12,13 +11,18 @@ import * as Buttons from '../../../ui/components/buttons/buttons.js';
|
|
|
12
11
|
import * as Input from '../../../ui/components/input/input.js';
|
|
13
12
|
import * as uiI18n from '../../../ui/i18n/i18n.js';
|
|
14
13
|
import * as UI from '../../../ui/legacy/legacy.js';
|
|
15
|
-
import
|
|
14
|
+
import {
|
|
15
|
+
html,
|
|
16
|
+
i18nTemplate as unboundI18nTemplate,
|
|
17
|
+
type LitTemplate,
|
|
18
|
+
nothing,
|
|
19
|
+
render,
|
|
20
|
+
type TemplateResult
|
|
21
|
+
} from '../../../ui/lit/lit.js';
|
|
16
22
|
import * as VisualLogging from '../../../ui/visual_logging/visual_logging.js';
|
|
17
23
|
|
|
18
24
|
import protocolHandlersViewStyles from './protocolHandlersView.css.js';
|
|
19
25
|
|
|
20
|
-
const {html} = Lit;
|
|
21
|
-
|
|
22
26
|
const PROTOCOL_DOCUMENT_URL = 'https://web.dev/url-protocol-handler/';
|
|
23
27
|
const UIStrings = {
|
|
24
28
|
/**
|
|
@@ -66,6 +70,50 @@ const UIStrings = {
|
|
|
66
70
|
|
|
67
71
|
const str_ = i18n.i18n.registerUIStrings('panels/application/components/ProtocolHandlersView.ts', UIStrings);
|
|
68
72
|
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
|
73
|
+
const i18nTemplate = unboundI18nTemplate.bind(undefined, str_);
|
|
74
|
+
|
|
75
|
+
function renderStatusMessage(
|
|
76
|
+
protocolHandlers: readonly ProtocolHandler[], manifestLink: Platform.DevToolsPath.UrlString): TemplateResult {
|
|
77
|
+
const manifestInTextLink =
|
|
78
|
+
UI.XLink.XLink.create(manifestLink, i18nString(UIStrings.manifest), undefined, undefined, 'manifest');
|
|
79
|
+
const statusString = protocolHandlers.length > 0 ? UIStrings.protocolDetected : UIStrings.protocolNotDetected;
|
|
80
|
+
// clang-format off
|
|
81
|
+
return html`
|
|
82
|
+
<div class="protocol-handlers-row status">
|
|
83
|
+
<devtools-icon class="inline-icon"
|
|
84
|
+
name=${protocolHandlers.length > 0 ? 'check-circle' : 'info'}>
|
|
85
|
+
</devtools-icon>
|
|
86
|
+
${uiI18n.getFormatLocalizedString(str_, statusString, {PH1: manifestInTextLink })}
|
|
87
|
+
</div>`;
|
|
88
|
+
// clang-format on
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function renderProtocolTest(
|
|
92
|
+
protocolHandlers: readonly ProtocolHandler[], queryInputState: string,
|
|
93
|
+
protocolSelectHandler: (evt: HTMLSelectElementEvent) => void,
|
|
94
|
+
queryInputChangeHandler: (evt: HTMLInputElementEvent) => void, testProtocolClickHandler: () => void): LitTemplate {
|
|
95
|
+
if (protocolHandlers.length === 0) {
|
|
96
|
+
return nothing;
|
|
97
|
+
}
|
|
98
|
+
// clang-format off
|
|
99
|
+
return html`
|
|
100
|
+
<div class="protocol-handlers-row">
|
|
101
|
+
<select class="protocol-select" @change=${protocolSelectHandler}
|
|
102
|
+
aria-label=${i18nString(UIStrings.dropdownLabel)}>
|
|
103
|
+
${protocolHandlers.filter(p => p.protocol).map(({protocol}) => html`
|
|
104
|
+
<option value=${protocol} jslog=${VisualLogging.item(protocol).track({click: true})}>
|
|
105
|
+
${protocol}://
|
|
106
|
+
</option>`)}
|
|
107
|
+
</select>
|
|
108
|
+
<input .value=${queryInputState} class="devtools-text-input" type="text"
|
|
109
|
+
@change=${queryInputChangeHandler} aria-label=${i18nString(UIStrings.textboxLabel)}
|
|
110
|
+
placeholder=${i18nString(UIStrings.textboxPlaceholder)} />
|
|
111
|
+
<devtools-button .variant=${Buttons.Button.Variant.PRIMARY} @click=${testProtocolClickHandler}>
|
|
112
|
+
${i18nString(UIStrings.testProtocol)}
|
|
113
|
+
</devtools-button>
|
|
114
|
+
</div>`;
|
|
115
|
+
// clang-format on
|
|
116
|
+
}
|
|
69
117
|
|
|
70
118
|
interface HTMLSelectElementEvent extends Event {
|
|
71
119
|
target: HTMLSelectElement;
|
|
@@ -75,6 +123,38 @@ interface HTMLInputElementEvent extends Event {
|
|
|
75
123
|
target: HTMLInputElement;
|
|
76
124
|
}
|
|
77
125
|
|
|
126
|
+
interface ViewInput {
|
|
127
|
+
protocolHandler: ProtocolHandler[];
|
|
128
|
+
manifestLink: Platform.DevToolsPath.UrlString;
|
|
129
|
+
queryInputState: string;
|
|
130
|
+
protocolSelectHandler: (evt: HTMLSelectElementEvent) => void;
|
|
131
|
+
queryInputChangeHandler: (evt: HTMLInputElementEvent) => void;
|
|
132
|
+
testProtocolClickHandler: () => void;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
type View = (input: ViewInput, output: undefined, target: HTMLElement) => void;
|
|
136
|
+
|
|
137
|
+
const DEFAULT_VIEW: View = (input, _output, target) => {
|
|
138
|
+
// inspectorCommonStyles is used for the <select> styling that is used for the dropdown
|
|
139
|
+
// clang-format off
|
|
140
|
+
render(html`
|
|
141
|
+
<style>${protocolHandlersViewStyles}</style>
|
|
142
|
+
<style>${UI.inspectorCommonStyles}</style>
|
|
143
|
+
<style>${Input.textInputStyles}</style>
|
|
144
|
+
${renderStatusMessage(input.protocolHandler, input.manifestLink)}
|
|
145
|
+
<div class="protocol-handlers-row">
|
|
146
|
+
${i18nTemplate(UIStrings.needHelpReadOur, {PH1: html`
|
|
147
|
+
<x-link href=${PROTOCOL_DOCUMENT_URL} tabindex=0 class="devtools-link" jslog=${
|
|
148
|
+
VisualLogging.link('learn-more').track({click: true, keydown: 'Enter|Space'})}>
|
|
149
|
+
${i18nString(UIStrings.protocolHandlerRegistrations)}
|
|
150
|
+
</x-link>`})}
|
|
151
|
+
</div>
|
|
152
|
+
${renderProtocolTest(input.protocolHandler, input.queryInputState, input.protocolSelectHandler,
|
|
153
|
+
input.queryInputChangeHandler, input.testProtocolClickHandler)}
|
|
154
|
+
`, target);
|
|
155
|
+
// clang-format on
|
|
156
|
+
};
|
|
157
|
+
|
|
78
158
|
export interface ProtocolHandler {
|
|
79
159
|
protocol: string;
|
|
80
160
|
url: string;
|
|
@@ -85,69 +165,39 @@ export interface ProtocolHandlersData {
|
|
|
85
165
|
manifestLink: Platform.DevToolsPath.UrlString;
|
|
86
166
|
}
|
|
87
167
|
|
|
88
|
-
export class ProtocolHandlersView extends
|
|
89
|
-
readonly #shadow = this.attachShadow({mode: 'open'});
|
|
168
|
+
export class ProtocolHandlersView extends UI.Widget.Widget {
|
|
90
169
|
#protocolHandlers: ProtocolHandler[] = [];
|
|
91
170
|
#manifestLink: Platform.DevToolsPath.UrlString = Platform.DevToolsPath.EmptyUrlString;
|
|
92
171
|
#selectedProtocolState = '';
|
|
93
172
|
#queryInputState = '';
|
|
173
|
+
#view: View;
|
|
94
174
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
this.#
|
|
98
|
-
this.#manifestLink = data.manifestLink;
|
|
99
|
-
if (isNewManifest) {
|
|
100
|
-
this.#update();
|
|
101
|
-
}
|
|
175
|
+
constructor(element?: HTMLElement, view: View = DEFAULT_VIEW) {
|
|
176
|
+
super(element, {useShadowDom: false});
|
|
177
|
+
this.#view = view;
|
|
102
178
|
}
|
|
103
179
|
|
|
104
|
-
|
|
105
|
-
this.#
|
|
106
|
-
this
|
|
107
|
-
this.#render();
|
|
180
|
+
set protocolHandlers(protocolHandlers: ProtocolHandler[]) {
|
|
181
|
+
this.#protocolHandlers = protocolHandlers;
|
|
182
|
+
this.requestUpdate();
|
|
108
183
|
}
|
|
109
184
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
UI.XLink.XLink.create(this.#manifestLink, i18nString(UIStrings.manifest), undefined, undefined, 'manifest');
|
|
113
|
-
const statusString = this.#protocolHandlers.length > 0 ? UIStrings.protocolDetected : UIStrings.protocolNotDetected;
|
|
114
|
-
// clang-format off
|
|
115
|
-
return html`
|
|
116
|
-
<div class="protocol-handlers-row status">
|
|
117
|
-
<devtools-icon class="inline-icon"
|
|
118
|
-
name=${this.#protocolHandlers.length > 0 ? 'check-circle' : 'info'}>
|
|
119
|
-
</devtools-icon>
|
|
120
|
-
${uiI18n.getFormatLocalizedString(str_, statusString, {
|
|
121
|
-
PH1: manifestInTextLink,
|
|
122
|
-
})}
|
|
123
|
-
</div>
|
|
124
|
-
`;
|
|
125
|
-
// clang-format on
|
|
185
|
+
get protocolHandlers(): ProtocolHandler[] {
|
|
186
|
+
return this.#protocolHandlers;
|
|
126
187
|
}
|
|
127
188
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
189
|
+
set manifestLink(manifestLink: Platform.DevToolsPath.UrlString) {
|
|
190
|
+
const isNewManifest = this.#manifestLink !== manifestLink;
|
|
191
|
+
this.#manifestLink = manifestLink;
|
|
192
|
+
if (isNewManifest) {
|
|
193
|
+
this.#queryInputState = '';
|
|
194
|
+
this.#selectedProtocolState = this.#protocolHandlers[0]?.protocol ?? '';
|
|
131
195
|
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
return html`
|
|
138
|
-
<div class="protocol-handlers-row">
|
|
139
|
-
<select class="protocol-select" @change=${this.#handleProtocolSelect} aria-label=${
|
|
140
|
-
i18nString(UIStrings.dropdownLabel)}>
|
|
141
|
-
${protocolOptions}
|
|
142
|
-
</select>
|
|
143
|
-
<input .value=${this.#queryInputState} class="devtools-text-input" type="text" @change=${
|
|
144
|
-
this.#handleQueryInputChange} aria-label=${i18nString(UIStrings.textboxLabel)}
|
|
145
|
-
placeholder=${i18nString(UIStrings.textboxPlaceholder)} />
|
|
146
|
-
<devtools-button .variant=${Buttons.Button.Variant.PRIMARY} @click=${this.#handleTestProtocolClick}>
|
|
147
|
-
${i18nString(UIStrings.testProtocol)}
|
|
148
|
-
</devtools-button>
|
|
149
|
-
</div>
|
|
150
|
-
`;
|
|
196
|
+
this.requestUpdate();
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
get manifestLink(): Platform.DevToolsPath.UrlString {
|
|
200
|
+
return this.#manifestLink;
|
|
151
201
|
}
|
|
152
202
|
|
|
153
203
|
#handleProtocolSelect = (evt: HTMLSelectElementEvent): void => {
|
|
@@ -156,7 +206,7 @@ export class ProtocolHandlersView extends HTMLElement {
|
|
|
156
206
|
|
|
157
207
|
#handleQueryInputChange = (evt: HTMLInputElementEvent): void => {
|
|
158
208
|
this.#queryInputState = evt.target.value;
|
|
159
|
-
this
|
|
209
|
+
this.requestUpdate();
|
|
160
210
|
};
|
|
161
211
|
|
|
162
212
|
#handleTestProtocolClick = (): void => {
|
|
@@ -165,29 +215,16 @@ export class ProtocolHandlersView extends HTMLElement {
|
|
|
165
215
|
Host.userMetrics.actionTaken(Host.UserMetrics.Action.CaptureTestProtocolClicked);
|
|
166
216
|
};
|
|
167
217
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
${uiI18n.getFormatLocalizedString(str_, UIStrings.needHelpReadOur, {PH1: protocolDocLink})}
|
|
180
|
-
</div>
|
|
181
|
-
${this.#renderProtocolTest()}
|
|
182
|
-
`, this.#shadow, {host: this});
|
|
183
|
-
// clang-format on
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
customElements.define('devtools-protocol-handlers-view', ProtocolHandlersView);
|
|
188
|
-
|
|
189
|
-
declare global {
|
|
190
|
-
interface HTMLElementTagNameMap {
|
|
191
|
-
'devtools-protocol-handlers-view': ProtocolHandlersView;
|
|
218
|
+
override performUpdate(): void {
|
|
219
|
+
this.#view(
|
|
220
|
+
{
|
|
221
|
+
protocolHandler: this.#protocolHandlers,
|
|
222
|
+
manifestLink: this.#manifestLink,
|
|
223
|
+
queryInputState: this.#queryInputState,
|
|
224
|
+
protocolSelectHandler: this.#handleProtocolSelect,
|
|
225
|
+
queryInputChangeHandler: this.#handleQueryInputChange,
|
|
226
|
+
testProtocolClickHandler: this.#handleTestProtocolClick,
|
|
227
|
+
},
|
|
228
|
+
undefined, this.contentElement);
|
|
192
229
|
}
|
|
193
230
|
}
|