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
|
@@ -108,9 +108,7 @@ function getIssueCode(details: Protocol.Audits.SharedDictionaryIssueDetails): Is
|
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
-
export class SharedDictionaryIssue extends Issue {
|
|
112
|
-
readonly #issueDetails: Protocol.Audits.SharedDictionaryIssueDetails;
|
|
113
|
-
|
|
111
|
+
export class SharedDictionaryIssue extends Issue<Protocol.Audits.SharedDictionaryIssueDetails, IssueCode> {
|
|
114
112
|
constructor(
|
|
115
113
|
issueDetails: Protocol.Audits.SharedDictionaryIssueDetails, issuesModel: SDK.IssuesModel.IssuesModel|null) {
|
|
116
114
|
super(
|
|
@@ -121,13 +119,12 @@ export class SharedDictionaryIssue extends Issue {
|
|
|
121
119
|
issueDetails.sharedDictionaryError,
|
|
122
120
|
].join('::'),
|
|
123
121
|
},
|
|
124
|
-
issuesModel);
|
|
125
|
-
this.#issueDetails = issueDetails;
|
|
122
|
+
issueDetails, issuesModel);
|
|
126
123
|
}
|
|
127
124
|
|
|
128
125
|
override requests(): Iterable<Protocol.Audits.AffectedRequest> {
|
|
129
|
-
if (this
|
|
130
|
-
return [this
|
|
126
|
+
if (this.details().request) {
|
|
127
|
+
return [this.details().request];
|
|
131
128
|
}
|
|
132
129
|
return [];
|
|
133
130
|
}
|
|
@@ -136,12 +133,8 @@ export class SharedDictionaryIssue extends Issue {
|
|
|
136
133
|
return IssueCategory.OTHER;
|
|
137
134
|
}
|
|
138
135
|
|
|
139
|
-
details(): Protocol.Audits.SharedDictionaryIssueDetails {
|
|
140
|
-
return this.#issueDetails;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
136
|
getDescription(): MarkdownIssueDescription|null {
|
|
144
|
-
const description = issueDescriptions.get(this
|
|
137
|
+
const description = issueDescriptions.get(this.details().sharedDictionaryError);
|
|
145
138
|
if (!description) {
|
|
146
139
|
return null;
|
|
147
140
|
}
|
|
@@ -149,7 +142,7 @@ export class SharedDictionaryIssue extends Issue {
|
|
|
149
142
|
}
|
|
150
143
|
|
|
151
144
|
primaryKey(): string {
|
|
152
|
-
return JSON.stringify(this
|
|
145
|
+
return JSON.stringify(this.details());
|
|
153
146
|
}
|
|
154
147
|
|
|
155
148
|
getKind(): IssueKind {
|
|
@@ -13,40 +13,35 @@ export const lateImportStylesheetLoadingCode = [
|
|
|
13
13
|
Protocol.Audits.StyleSheetLoadingIssueReason.LateImportRule,
|
|
14
14
|
].join('::');
|
|
15
15
|
|
|
16
|
-
export class StylesheetLoadingIssue extends Issue {
|
|
17
|
-
#issueDetails: Protocol.Audits.StylesheetLoadingIssueDetails;
|
|
16
|
+
export class StylesheetLoadingIssue extends Issue<Protocol.Audits.StylesheetLoadingIssueDetails> {
|
|
18
17
|
constructor(
|
|
19
18
|
issueDetails: Protocol.Audits.StylesheetLoadingIssueDetails, issuesModel: SDK.IssuesModel.IssuesModel|null) {
|
|
20
19
|
const code =
|
|
21
20
|
`${Protocol.Audits.InspectorIssueCode.StylesheetLoadingIssue}::${issueDetails.styleSheetLoadingIssueReason}`;
|
|
22
|
-
super(code, issuesModel);
|
|
23
|
-
this.#issueDetails = issueDetails;
|
|
21
|
+
super(code, issueDetails, issuesModel);
|
|
24
22
|
}
|
|
25
23
|
|
|
26
24
|
override sources(): Protocol.Audits.SourceCodeLocation[] {
|
|
27
|
-
return [this
|
|
25
|
+
return [this.details().sourceCodeLocation];
|
|
28
26
|
}
|
|
29
27
|
override requests(): Protocol.Audits.AffectedRequest[] {
|
|
30
|
-
|
|
28
|
+
const details = this.details();
|
|
29
|
+
if (!details.failedRequestInfo) {
|
|
31
30
|
return [];
|
|
32
31
|
}
|
|
33
|
-
const {url, requestId} =
|
|
32
|
+
const {url, requestId} = details.failedRequestInfo;
|
|
34
33
|
if (!requestId) {
|
|
35
34
|
return [];
|
|
36
35
|
}
|
|
37
36
|
return [{url, requestId}];
|
|
38
37
|
}
|
|
39
38
|
|
|
40
|
-
details(): Protocol.Audits.StylesheetLoadingIssueDetails {
|
|
41
|
-
return this.#issueDetails;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
39
|
primaryKey(): string {
|
|
45
|
-
return JSON.stringify(this
|
|
40
|
+
return JSON.stringify(this.details());
|
|
46
41
|
}
|
|
47
42
|
|
|
48
43
|
getDescription(): MarkdownIssueDescription {
|
|
49
|
-
switch (this
|
|
44
|
+
switch (this.details().styleSheetLoadingIssueReason) {
|
|
50
45
|
case Protocol.Audits.StyleSheetLoadingIssueReason.LateImportRule:
|
|
51
46
|
return {
|
|
52
47
|
file: 'stylesheetLateImport.md',
|
|
@@ -26,9 +26,7 @@ const UIStrings = {
|
|
|
26
26
|
const str_ = i18n.i18n.registerUIStrings('models/issues_manager/UnencodedDigestIssue.ts', UIStrings);
|
|
27
27
|
const i18nLazyString = i18n.i18n.getLazilyComputedLocalizedString.bind(undefined, str_);
|
|
28
28
|
|
|
29
|
-
export class UnencodedDigestIssue extends Issue<
|
|
30
|
-
readonly #issueDetails: Protocol.Audits.UnencodedDigestIssueDetails;
|
|
31
|
-
|
|
29
|
+
export class UnencodedDigestIssue extends Issue<Protocol.Audits.UnencodedDigestIssueDetails> {
|
|
32
30
|
constructor(
|
|
33
31
|
issueDetails: Protocol.Audits.UnencodedDigestIssueDetails, issuesModel: SDK.IssuesModel.IssuesModel|null) {
|
|
34
32
|
super(
|
|
@@ -36,12 +34,7 @@ export class UnencodedDigestIssue extends Issue<string> {
|
|
|
36
34
|
code: `${Protocol.Audits.InspectorIssueCode.UnencodedDigestIssue}::${issueDetails.error}`,
|
|
37
35
|
umaCode: `${Protocol.Audits.InspectorIssueCode.UnencodedDigestIssue}::${issueDetails.error}`,
|
|
38
36
|
},
|
|
39
|
-
issuesModel);
|
|
40
|
-
this.#issueDetails = issueDetails;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
details(): Protocol.Audits.UnencodedDigestIssueDetails {
|
|
44
|
-
return this.#issueDetails;
|
|
37
|
+
issueDetails, issuesModel);
|
|
45
38
|
}
|
|
46
39
|
|
|
47
40
|
override primaryKey(): string {
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# Session History Item Has Been Marked Skippable
|
|
2
|
+
|
|
3
|
+
A session history item was added by this document without any interaction from the
|
|
4
|
+
user. As a result, this document's history items will be skipped if the user goes
|
|
5
|
+
back or forward via the browser's UI (e.g., back/forward buttons), to prevent pages
|
|
6
|
+
from trapping a user. If the user interacts with the page, the history items
|
|
7
|
+
will no longer be skipped.
|
|
@@ -709,11 +709,6 @@ export const NativeFunctions = [
|
|
|
709
709
|
signatures: [["property","cssText"]],
|
|
710
710
|
receivers: ["CSSStyleValue"]
|
|
711
711
|
},
|
|
712
|
-
{
|
|
713
|
-
name: "parse",
|
|
714
|
-
signatures: [["serializedOrigin"]],
|
|
715
|
-
receivers: ["Origin"]
|
|
716
|
-
},
|
|
717
712
|
{
|
|
718
713
|
name: "parse",
|
|
719
714
|
signatures: [["url","?base"]],
|
|
@@ -6990,6 +6985,10 @@ export const NativeFunctions = [
|
|
|
6990
6985
|
name: "Highlight",
|
|
6991
6986
|
signatures: [["...initRanges"]]
|
|
6992
6987
|
},
|
|
6988
|
+
{
|
|
6989
|
+
name: "getElementTransform",
|
|
6990
|
+
signatures: [["element","draw_transform"]]
|
|
6991
|
+
},
|
|
6993
6992
|
{
|
|
6994
6993
|
name: "configureHighDynamicRange",
|
|
6995
6994
|
signatures: [["options"]]
|
|
@@ -7382,14 +7381,6 @@ export const NativeFunctions = [
|
|
|
7382
7381
|
name: "compareComponent",
|
|
7383
7382
|
signatures: [["component","left","right"]]
|
|
7384
7383
|
},
|
|
7385
|
-
{
|
|
7386
|
-
name: "Origin",
|
|
7387
|
-
signatures: [["?serializedOrigin"]]
|
|
7388
|
-
},
|
|
7389
|
-
{
|
|
7390
|
-
name: "fromURL",
|
|
7391
|
-
signatures: [["serializedURL"]]
|
|
7392
|
-
},
|
|
7393
7384
|
{
|
|
7394
7385
|
name: "isSameOrigin",
|
|
7395
7386
|
signatures: [["other"]]
|
|
@@ -8905,11 +8896,11 @@ export const NativeFunctions = [
|
|
|
8905
8896
|
},
|
|
8906
8897
|
{
|
|
8907
8898
|
name: "texElementImage2D",
|
|
8908
|
-
signatures: [["target","level","internalformat","format","type","element"]]
|
|
8899
|
+
signatures: [["target","level","internalformat","format","type","element"],["target","level","internalformat","width","height","format","type","element"]]
|
|
8909
8900
|
},
|
|
8910
8901
|
{
|
|
8911
8902
|
name: "texElement2D",
|
|
8912
|
-
signatures: [["target","level","internalformat","format","type","element"]]
|
|
8903
|
+
signatures: [["target","level","internalformat","format","type","element"],["target","level","internalformat","width","height","format","type","element"]]
|
|
8913
8904
|
},
|
|
8914
8905
|
{
|
|
8915
8906
|
name: "drawingBufferStorage",
|
|
@@ -9097,7 +9088,7 @@ export const NativeFunctions = [
|
|
|
9097
9088
|
},
|
|
9098
9089
|
{
|
|
9099
9090
|
name: "copyElementImageToTexture",
|
|
9100
|
-
signatures: [["source","destination"]]
|
|
9091
|
+
signatures: [["source","destination"],["source","width","height","destination"]]
|
|
9101
9092
|
},
|
|
9102
9093
|
{
|
|
9103
9094
|
name: "setIndexBuffer",
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
Title: FunctionCodeResolver getFunctionCodeFromLocation [no source maps] lookup named function
|
|
2
|
+
Content:
|
|
3
|
+
se strict";
|
|
4
|
+
function fibonacci<FUNCTION_START>(e) { // 67 ms
|
|
5
|
+
return e <= 1 ? 1 : fibonacci(e - 1) + fibonacci(e - 2) // 2022 ms
|
|
6
|
+
} // 13 ms
|
|
7
|
+
<FUNCTION_END>const btn = document.querySele
|
|
8
|
+
=== end content
|
|
9
|
+
|
|
10
|
+
Title: FunctionCodeResolver getFunctionCodeFromLocation [no source maps] lookup anonymous function
|
|
11
|
+
Content:
|
|
12
|
+
btn.addEventListener("click", <FUNCTION_START>() => {
|
|
13
|
+
console.log(fibonacci(Number(params.get("x")))), // 5000 ms
|
|
14
|
+
btn.style.backgroundColor = "red" // 333 ms
|
|
15
|
+
}
|
|
16
|
+
<FUNCTION_END>);
|
|
17
|
+
const input = document.quer
|
|
18
|
+
=== end content
|
|
19
|
+
|
|
20
|
+
Title: FunctionCodeResolver getFunctionCodeFromLocation [source maps] lookup named function with generated location
|
|
21
|
+
Content:
|
|
22
|
+
function <FUNCTION_START>fibonacci(num) { // 67 ms
|
|
23
|
+
if (num <= 1) return 1; // 23 ms
|
|
24
|
+
|
|
25
|
+
return fibonacci(num - 1) + fibonacci(num - 2); // 1999 ms
|
|
26
|
+
} // 13 ms
|
|
27
|
+
|
|
28
|
+
<FUNCTION_END>const btn = document.querySele
|
|
29
|
+
=== end content
|
|
30
|
+
|
|
31
|
+
Title: FunctionCodeResolver getFunctionCodeFromLocation [source maps] lookup named function with original location
|
|
32
|
+
Content:
|
|
33
|
+
function <FUNCTION_START>fibonacci(num) { // 67 ms
|
|
34
|
+
if (num <= 1) return 1; // 23 ms
|
|
35
|
+
|
|
36
|
+
return fibonacci(num - 1) + fibonacci(num - 2); // 1999 ms
|
|
37
|
+
} // 13 ms
|
|
38
|
+
|
|
39
|
+
<FUNCTION_END>const btn = document.querySele
|
|
40
|
+
=== end content
|
|
41
|
+
|
|
42
|
+
Title: FunctionCodeResolver getFunctionCodeFromLocation [source maps, no source contents] lookup named function with generated location
|
|
43
|
+
Content:
|
|
44
|
+
se strict";
|
|
45
|
+
function fibonacci<FUNCTION_START>(e) { // 67 ms
|
|
46
|
+
return e <= 1 ? 1 : fibonacci(e - 1) + fibonacci(e - 2) // 2022 ms
|
|
47
|
+
} // 13 ms
|
|
48
|
+
<FUNCTION_END>const btn = document.querySele
|
|
49
|
+
=== end content
|
|
50
|
+
|
|
51
|
+
Title: FunctionCodeResolver getFunctionCodeFromLocation [source maps, no source contents] lookup named function with original location
|
|
52
|
+
Content:
|
|
53
|
+
se strict";
|
|
54
|
+
function fibonacci<FUNCTION_START>(e) { // 67 ms
|
|
55
|
+
return e <= 1 ? 1 : fibonacci(e - 1) + fibonacci(e - 2) // 2022 ms
|
|
56
|
+
} // 13 ms
|
|
57
|
+
<FUNCTION_END>const btn = document.querySele
|
|
58
|
+
=== end content
|
|
59
|
+
|
|
60
|
+
Title: FunctionCodeResolver getFunctionCodeFromLocation [source maps] lookup anonymous function with generated location
|
|
61
|
+
Content:
|
|
62
|
+
btn.addEventListener('click', <FUNCTION_START>() => {
|
|
63
|
+
console.log(fibonacci(Number(params.get('x')))); // 5000 ms
|
|
64
|
+
btn.style.backgroundColor = 'red'; // 333 ms
|
|
65
|
+
}<FUNCTION_END>);
|
|
66
|
+
|
|
67
|
+
const input = document.que
|
|
68
|
+
=== end content
|
|
69
|
+
|
|
70
|
+
Title: FunctionCodeResolver getFunctionCodeFromLocation [source maps] lookup anonymous function with original location
|
|
71
|
+
Content:
|
|
72
|
+
btn.addEventListener('click', <FUNCTION_START>() => {
|
|
73
|
+
console.log(fibonacci(Number(params.get('x')))); // 5000 ms
|
|
74
|
+
btn.style.backgroundColor = 'red'; // 333 ms
|
|
75
|
+
}<FUNCTION_END>);
|
|
76
|
+
|
|
77
|
+
const input = document.que
|
|
78
|
+
=== end content
|
|
79
|
+
|
|
80
|
+
Title: FunctionCodeResolver getFunctionCodeFromLocation [source maps, no source contents] lookup anonymous function with generated location
|
|
81
|
+
Content:
|
|
82
|
+
btn.addEventListener("click", <FUNCTION_START>() => {
|
|
83
|
+
console.log(fibonacci(Number(params.get("x")))), // 5000 ms
|
|
84
|
+
btn.style.backgroundColor = "red" // 333 ms
|
|
85
|
+
}
|
|
86
|
+
<FUNCTION_END>);
|
|
87
|
+
const input = document.quer
|
|
88
|
+
=== end content
|
|
89
|
+
|
|
90
|
+
Title: FunctionCodeResolver getFunctionCodeFromLocation [source maps, no source contents] lookup anonymous function with original location
|
|
91
|
+
Content:
|
|
92
|
+
btn.addEventListener("click", <FUNCTION_START>() => {
|
|
93
|
+
console.log(fibonacci(Number(params.get("x")))), // 5000 ms
|
|
94
|
+
btn.style.backgroundColor = "red" // 333 ms
|
|
95
|
+
}
|
|
96
|
+
<FUNCTION_END>);
|
|
97
|
+
const input = document.quer
|
|
98
|
+
=== end content
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
// Copyright 2025 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 * as SDK from '../../core/sdk/sdk.js';
|
|
7
|
+
import * as Bindings from '../bindings/bindings.js';
|
|
8
|
+
import * as Formatter from '../formatter/formatter.js';
|
|
9
|
+
import * as TextUtils from '../text_utils/text_utils.js';
|
|
10
|
+
import * as Workspace from '../workspace/workspace.js';
|
|
11
|
+
|
|
12
|
+
/** Represents the source code for a given function, including additional context of surrounding lines. */
|
|
13
|
+
export interface FunctionCode {
|
|
14
|
+
functionBounds: Workspace.UISourceCode.UIFunctionBounds;
|
|
15
|
+
/** The text of `uiSourceCode`. */
|
|
16
|
+
text: TextUtils.Text.Text;
|
|
17
|
+
/** The function text. */
|
|
18
|
+
code: string;
|
|
19
|
+
/** The range of `code` within `text`. */
|
|
20
|
+
range: TextUtils.TextRange.TextRange;
|
|
21
|
+
/** The function text, plus some additional context before and after. The actual function is wrapped in <FUNCTION_START>...<FUNCTION_END> */
|
|
22
|
+
codeWithContext: string;
|
|
23
|
+
/** The range of `codeWithContext` within `text`. */
|
|
24
|
+
rangeWithContext: TextUtils.TextRange.TextRange;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface CreateFunctionCodeOptions {
|
|
28
|
+
/** Number of characters to include before and after the function. Stacks with `contextLineLength`. */
|
|
29
|
+
contextLength?: number;
|
|
30
|
+
/** Number of lines to include before and after the function. Stacks with `contextLength`. */
|
|
31
|
+
contextLineLength?: number;
|
|
32
|
+
/** If true, appends profile data from the trace at the end of every line of the function in `codeWithContext`. This should match what is seen in the formatted view in the Sources panel. */
|
|
33
|
+
appendProfileData?: boolean;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
interface InputData {
|
|
37
|
+
text: TextUtils.Text.Text;
|
|
38
|
+
formattedContent: Formatter.ScriptFormatter.FormattedContent|null;
|
|
39
|
+
performanceData: Workspace.UISourceCode.LineColumnProfileMap|undefined;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const inputCache = new WeakMap<Workspace.UISourceCode.UISourceCode, Promise<InputData>>();
|
|
43
|
+
|
|
44
|
+
async function prepareInput(uiSourceCode: Workspace.UISourceCode.UISourceCode, content: string): Promise<InputData> {
|
|
45
|
+
const formattedContent = await format(uiSourceCode, content);
|
|
46
|
+
const text = new TextUtils.Text.Text(formattedContent ? formattedContent.formattedContent : content);
|
|
47
|
+
let performanceData = uiSourceCode.getDecorationData(Workspace.UISourceCode.DecoratorType.PERFORMANCE) as
|
|
48
|
+
Workspace.UISourceCode.LineColumnProfileMap |
|
|
49
|
+
undefined;
|
|
50
|
+
|
|
51
|
+
// Map profile data to the formatted view of the text.
|
|
52
|
+
if (formattedContent && performanceData) {
|
|
53
|
+
performanceData = Workspace.UISourceCode.createMappedProfileData(performanceData, (line, column) => {
|
|
54
|
+
return formattedContent.formattedMapping.originalToFormatted(line, column);
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return {text, formattedContent, performanceData};
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** Formatting and parsing line endings for Text is expensive, so cache it. */
|
|
62
|
+
async function prepareInputAndCache(
|
|
63
|
+
uiSourceCode: Workspace.UISourceCode.UISourceCode, content: string): Promise<InputData> {
|
|
64
|
+
let cachedPromise = inputCache.get(uiSourceCode);
|
|
65
|
+
if (cachedPromise) {
|
|
66
|
+
return await cachedPromise;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
cachedPromise = prepareInput(uiSourceCode, content);
|
|
70
|
+
inputCache.set(uiSourceCode, cachedPromise);
|
|
71
|
+
return await cachedPromise;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function extractPerformanceDataByLine(
|
|
75
|
+
textRange: TextUtils.TextRange.TextRange, performanceData: Workspace.UISourceCode.LineColumnProfileMap): number[] {
|
|
76
|
+
const {startLine, startColumn, endLine, endColumn} = textRange;
|
|
77
|
+
const byLine = new Array(endLine - startLine + 1).fill(0);
|
|
78
|
+
|
|
79
|
+
for (let line = startLine; line <= endLine; line++) {
|
|
80
|
+
const lineData = performanceData.get(line + 1);
|
|
81
|
+
if (!lineData) {
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// Fast-path for when the entire line's data is relevant.
|
|
86
|
+
if (line !== startLine && line !== endLine) {
|
|
87
|
+
byLine[line - startLine] = lineData.values().reduce((acc, cur) => acc + cur);
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const column0 = line === startLine ? startColumn + 1 : 0;
|
|
92
|
+
const column1 = line === endLine ? endColumn + 1 : Number.POSITIVE_INFINITY;
|
|
93
|
+
|
|
94
|
+
let totalData = 0;
|
|
95
|
+
for (const [column, data] of lineData) {
|
|
96
|
+
if (column >= column0 && column <= column1) {
|
|
97
|
+
totalData += data;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
byLine[line - startLine] = totalData;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
return byLine.map(data => Math.round(data * 10) / 10);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function createFunctionCode(
|
|
108
|
+
inputData: InputData, functionBounds: Workspace.UISourceCode.UIFunctionBounds,
|
|
109
|
+
options?: CreateFunctionCodeOptions): FunctionCode {
|
|
110
|
+
let {startLine, startColumn, endLine, endColumn} = functionBounds.range;
|
|
111
|
+
if (inputData.formattedContent) {
|
|
112
|
+
const startMapped = inputData.formattedContent.formattedMapping.originalToFormatted(startLine, startColumn);
|
|
113
|
+
startLine = startMapped[0];
|
|
114
|
+
startColumn = startMapped[1];
|
|
115
|
+
|
|
116
|
+
const endMapped = inputData.formattedContent.formattedMapping.originalToFormatted(endLine, endColumn);
|
|
117
|
+
endLine = endMapped[0];
|
|
118
|
+
endColumn = endMapped[1];
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
const text = inputData.text;
|
|
122
|
+
const content = text.value();
|
|
123
|
+
|
|
124
|
+
// Define two ranges - the first is just the function bounds, the second includes
|
|
125
|
+
// that plus some surrounding context as dictated by the options.
|
|
126
|
+
const range = new TextUtils.TextRange.TextRange(startLine, startColumn, endLine, endColumn);
|
|
127
|
+
|
|
128
|
+
const functionStartOffset = text.offsetFromPosition(startLine, startColumn);
|
|
129
|
+
const functionEndOffset = text.offsetFromPosition(endLine, endColumn);
|
|
130
|
+
|
|
131
|
+
let contextStartOffset = 0;
|
|
132
|
+
if (options?.contextLength !== undefined) {
|
|
133
|
+
const contextLength = options.contextLength;
|
|
134
|
+
contextStartOffset = Math.max(contextStartOffset, functionStartOffset - contextLength);
|
|
135
|
+
}
|
|
136
|
+
if (options?.contextLineLength !== undefined) {
|
|
137
|
+
const contextLineLength = options.contextLineLength;
|
|
138
|
+
const position = text.offsetFromPosition(Math.max(startLine - contextLineLength, 0), 0);
|
|
139
|
+
contextStartOffset = Math.max(contextStartOffset, position);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
let contextEndOffset = content.length;
|
|
143
|
+
if (options?.contextLength !== undefined) {
|
|
144
|
+
const contextLength = options.contextLength;
|
|
145
|
+
contextEndOffset = Math.min(contextEndOffset, functionEndOffset + contextLength);
|
|
146
|
+
}
|
|
147
|
+
if (options?.contextLineLength !== undefined) {
|
|
148
|
+
const contextLineLength = options.contextLineLength;
|
|
149
|
+
const position =
|
|
150
|
+
text.offsetFromPosition(Math.min(endLine + contextLineLength, text.lineCount() - 1), Number.POSITIVE_INFINITY);
|
|
151
|
+
contextEndOffset = Math.min(contextEndOffset, position);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
const contextStart = text.positionFromOffset(contextStartOffset);
|
|
155
|
+
const contextEnd = text.positionFromOffset(contextEndOffset);
|
|
156
|
+
const rangeWithContext = new TextUtils.TextRange.TextRange(
|
|
157
|
+
contextStart.lineNumber, contextStart.columnNumber, contextEnd.lineNumber, contextEnd.columnNumber);
|
|
158
|
+
|
|
159
|
+
// Grab substrings for the function range, and for the context range.
|
|
160
|
+
const code = content.substring(functionStartOffset, functionEndOffset);
|
|
161
|
+
const before = content.substring(contextStartOffset, functionStartOffset);
|
|
162
|
+
const after = content.substring(functionEndOffset, contextEndOffset);
|
|
163
|
+
|
|
164
|
+
let codeWithContext;
|
|
165
|
+
if (options?.appendProfileData && inputData.performanceData) {
|
|
166
|
+
const performanceDataByLine = extractPerformanceDataByLine(range, inputData.performanceData);
|
|
167
|
+
const lines = performanceDataByLine.map((data, i) => {
|
|
168
|
+
let line = text.lineAt(startLine + i);
|
|
169
|
+
|
|
170
|
+
const isLastLine = i === performanceDataByLine.length - 1;
|
|
171
|
+
if (i === 0) {
|
|
172
|
+
if (isLastLine) {
|
|
173
|
+
line = line.substring(startColumn, endColumn);
|
|
174
|
+
} else {
|
|
175
|
+
line = line.substring(startColumn);
|
|
176
|
+
}
|
|
177
|
+
} else if (isLastLine) {
|
|
178
|
+
line = line.substring(0, endColumn);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
if (isLastLine) {
|
|
182
|
+
// Don't ever annotate the last line - it could make the rest of the code on
|
|
183
|
+
// that line get commented out.
|
|
184
|
+
data = 0;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
return data ? `${line} // ${data} ms` : line;
|
|
188
|
+
});
|
|
189
|
+
const annotatedCode = lines.join('\n');
|
|
190
|
+
codeWithContext = before + `<FUNCTION_START>${annotatedCode}<FUNCTION_END>` + after;
|
|
191
|
+
} else {
|
|
192
|
+
codeWithContext = before + `<FUNCTION_START>${code}<FUNCTION_END>` + after;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
return {
|
|
196
|
+
functionBounds,
|
|
197
|
+
text,
|
|
198
|
+
code,
|
|
199
|
+
range,
|
|
200
|
+
codeWithContext,
|
|
201
|
+
rangeWithContext,
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* The input location may be a source mapped location or a raw location.
|
|
207
|
+
*/
|
|
208
|
+
export async function getFunctionCodeFromLocation(
|
|
209
|
+
target: SDK.Target.Target, url: Platform.DevToolsPath.UrlString, line: number, column: number,
|
|
210
|
+
options?: CreateFunctionCodeOptions): Promise<FunctionCode|null> {
|
|
211
|
+
const debuggerModel = target.model(SDK.DebuggerModel.DebuggerModel);
|
|
212
|
+
if (!debuggerModel) {
|
|
213
|
+
throw new Error('missing debugger model');
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
let uiSourceCode;
|
|
217
|
+
const debuggerWorkspaceBinding = Bindings.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding.instance();
|
|
218
|
+
const projects = debuggerWorkspaceBinding.workspace.projectsForType(Workspace.Workspace.projectTypes.Network);
|
|
219
|
+
for (const project of projects) {
|
|
220
|
+
uiSourceCode = project.uiSourceCodeForURL(url);
|
|
221
|
+
if (uiSourceCode) {
|
|
222
|
+
break;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
if (!uiSourceCode) {
|
|
227
|
+
return null;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
const rawLocations = await debuggerWorkspaceBinding.uiLocationToRawLocations(uiSourceCode, line, column);
|
|
231
|
+
const rawLocation = rawLocations.at(-1);
|
|
232
|
+
if (!rawLocation) {
|
|
233
|
+
return null;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
return await getFunctionCodeFromRawLocation(rawLocation, options);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
async function format(uiSourceCode: Workspace.UISourceCode.UISourceCode, content: string):
|
|
240
|
+
Promise<Formatter.ScriptFormatter.FormattedContent|null> {
|
|
241
|
+
const contentType = uiSourceCode.contentType();
|
|
242
|
+
const shouldFormat = !contentType.isFromSourceMap() && (contentType.isDocument() || contentType.isScript()) &&
|
|
243
|
+
TextUtils.TextUtils.isMinified(content);
|
|
244
|
+
if (!shouldFormat) {
|
|
245
|
+
return null;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
return await Formatter.ScriptFormatter.formatScriptContent(contentType.canonicalMimeType(), content, '\t');
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* Returns a {@link FunctionCode} for the given raw location.
|
|
253
|
+
*/
|
|
254
|
+
export async function getFunctionCodeFromRawLocation(
|
|
255
|
+
rawLocation: SDK.DebuggerModel.Location, options?: CreateFunctionCodeOptions): Promise<FunctionCode|null> {
|
|
256
|
+
const debuggerWorkspaceBinding = Bindings.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding.instance();
|
|
257
|
+
const functionBounds = await debuggerWorkspaceBinding.functionBoundsAtRawLocation(rawLocation);
|
|
258
|
+
if (!functionBounds) {
|
|
259
|
+
return null;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
await functionBounds.uiSourceCode.requestContentData();
|
|
263
|
+
const content = functionBounds.uiSourceCode.content();
|
|
264
|
+
if (!content) {
|
|
265
|
+
return null;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
const inputData = await prepareInputAndCache(functionBounds.uiSourceCode, content);
|
|
269
|
+
return createFunctionCode(inputData, functionBounds, options);
|
|
270
|
+
}
|
|
@@ -2,10 +2,12 @@
|
|
|
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
4
|
|
|
5
|
+
import * as FunctionCodeResolver from './FunctionCodeResolver.js';
|
|
5
6
|
import * as NamesResolver from './NamesResolver.js';
|
|
6
7
|
import * as ScopeChainModel from './ScopeChainModel.js';
|
|
7
8
|
|
|
8
9
|
export {
|
|
10
|
+
FunctionCodeResolver,
|
|
9
11
|
NamesResolver,
|
|
10
12
|
ScopeChainModel,
|
|
11
13
|
};
|