chrome-devtools-frontend 1.0.1664496 → 1.0.1665921
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agents/skills/devtools-testing-guidance/SKILL.md +48 -0
- package/.agents/skills/devtools-ux-writing-refactor/SKILL.md +3 -3
- package/.agents/skills/repro-flaky-tests/SKILL.md +2 -2
- package/.agents/skills/ui-eng-vision-local-lit-renderer/SKILL.md +7 -1
- package/.agents/skills/ui-eng-vision-widget-promoter/SKILL.md +2 -0
- package/.agents/skills/version-control/SKILL.md +4 -3
- package/docs/ui_engineering.md +89 -0
- package/eslint.config.mjs +9 -2
- package/front_end/Images/rollup.config.mjs +1 -1
- package/front_end/Tests.js +15 -16
- package/front_end/core/common/Gzip.ts +2 -2
- package/front_end/core/common/Settings.ts +4 -20
- package/front_end/core/common/Srcset.ts +1 -1
- package/front_end/core/common/VersionController.ts +1 -1
- package/front_end/core/host/AidaClient.ts +19 -4
- package/front_end/core/host/AidaGcaTranslation.ts +2 -2
- package/front_end/core/host/GcaClient.ts +2 -2
- package/front_end/core/host/GdpClient.ts +3 -3
- package/front_end/core/host/InspectorFrontendHostStub.ts +1 -1
- package/front_end/core/host/ResourceLoader.ts +15 -15
- package/front_end/core/protocol_client/DevToolsCDPConnection.ts +2 -2
- package/front_end/core/protocol_client/InspectorBackend.ts +1 -1
- package/front_end/core/root/Runtime.ts +0 -1
- package/front_end/core/sdk/CSSMatchedStyles.ts +78 -3
- package/front_end/core/sdk/CSSMetadata.ts +17 -12
- package/front_end/core/sdk/CSSProperty.ts +1 -1
- package/front_end/core/sdk/CSSPropertyParserMatchers.ts +2 -2
- package/front_end/core/sdk/CSSRule.ts +3 -3
- package/front_end/core/sdk/CSSStyleSheetHeader.ts +3 -3
- package/front_end/core/sdk/CompilerSourceMappingContentProvider.ts +1 -1
- package/front_end/core/sdk/Connections.ts +1 -1
- package/front_end/core/sdk/DebuggerModel.ts +13 -13
- package/front_end/core/sdk/NetworkManager.ts +19 -19
- package/front_end/core/sdk/NetworkRequest.ts +57 -57
- package/front_end/core/sdk/OverlayModel.ts +1 -1
- package/front_end/core/sdk/PageResourceLoader.ts +2 -2
- package/front_end/core/sdk/RehydratingConnection.ts +5 -5
- package/front_end/core/sdk/ScreenCaptureModel.ts +1 -1
- package/front_end/core/sdk/Script.ts +2 -2
- package/front_end/core/sdk/ServerTiming.ts +7 -7
- package/front_end/core/sdk/ServiceWorkerCacheModel.ts +1 -1
- package/front_end/core/sdk/ServiceWorkerManager.ts +11 -11
- package/front_end/core/sdk/SourceMapScopeChainEntry.ts +2 -2
- package/front_end/core/sdk/SourceMapScopesInfo.ts +1 -1
- package/front_end/core/sdk/StorageKeyManager.ts +1 -1
- package/front_end/core/sdk/sdk-meta.ts +98 -98
- package/front_end/devtools_compatibility.js +15 -13
- package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshot.ts +4 -8
- package/front_end/entrypoints/main/MainImpl.ts +2 -3
- package/front_end/entrypoints/main/main-meta.ts +1 -16
- package/front_end/entrypoints/shell/shell.ts +1 -0
- package/front_end/entrypoints/trace_app/trace_app.ts +1 -0
- package/front_end/foundation/README.md +1 -1
- package/front_end/foundation/Universe.test.api.ts +73 -0
- package/front_end/foundation/Universe.ts +22 -0
- package/front_end/generated/InspectorBackendCommands.ts +2 -2
- package/front_end/generated/SupportedCSSProperties.js +1 -1
- package/front_end/generated/protocol.ts +19 -0
- package/front_end/models/ai_assistance/AiAgent2.ts +1 -1
- package/front_end/models/ai_assistance/AiConversation.ts +1 -1
- package/front_end/models/ai_assistance/BuiltInAi.ts +1 -1
- package/front_end/models/ai_assistance/ChangeManager.ts +0 -70
- package/front_end/models/ai_assistance/ExtensionScope.ts +2 -36
- package/front_end/models/ai_assistance/agents/AccessibilityAgent.ts +9 -9
- package/front_end/models/ai_assistance/agents/AiAgent.ts +10 -2
- package/front_end/models/ai_assistance/agents/ContextSelectionAgent.ts +4 -4
- package/front_end/models/ai_assistance/agents/ExecuteJavascript.ts +1 -1
- package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +21 -21
- package/front_end/models/ai_assistance/agents/StorageAgent.ts +4 -4
- package/front_end/models/ai_assistance/agents/StylingAgent.ts +1 -1
- package/front_end/models/ai_assistance/ai_assistance.ts +0 -5
- package/front_end/models/ai_assistance/data_formatters/FileFormatter.ts +11 -4
- package/front_end/models/ai_assistance/data_formatters/NetworkRequestFormatter.ts +8 -2
- package/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.ts +14 -11
- package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.ts +2 -2
- package/front_end/models/ai_assistance/performance/AICallTree.ts +2 -2
- package/front_end/models/ai_assistance/tools/ExecuteJavaScript.ts +1 -1
- package/front_end/models/ai_assistance/tools/GetNetworkRequestDetails.ts +9 -2
- package/front_end/models/ai_assistance/tools/GetStyles.ts +4 -4
- package/front_end/models/ai_assistance/tools/ListNetworkRequests.ts +2 -5
- package/front_end/models/ai_code_completion/AiCodeCompletion.ts +2 -2
- package/front_end/models/ai_code_generation/AiCodeGeneration.ts +2 -2
- package/front_end/models/badges/badges-meta.ts +27 -0
- package/front_end/models/bindings/CSSWorkspaceBinding.ts +4 -3
- package/front_end/models/bindings/ContentProviderBasedProject.ts +1 -1
- package/front_end/models/bindings/DebuggerLanguagePlugins.ts +6 -7
- package/front_end/models/bindings/DebuggerWorkspaceBinding.ts +5 -4
- package/front_end/models/bindings/PresentationConsoleMessageHelper.ts +72 -29
- package/front_end/models/bindings/ResourceMapping.ts +38 -32
- package/front_end/models/bindings/ResourceScriptMapping.ts +5 -7
- package/front_end/models/breakpoints/BreakpointManager.ts +2 -1
- package/front_end/models/har/Writer.ts +2 -2
- package/front_end/models/issues_manager/ElementAccessibilityIssue.ts +1 -1
- package/front_end/models/issues_manager/GenericIssue.ts +1 -1
- package/front_end/models/issues_manager/IssuesManager.ts +14 -5
- package/front_end/models/issues_manager/PartitioningBlobURLIssue.ts +1 -1
- package/front_end/models/issues_manager/SRIMessageSignatureIssue.ts +2 -2
- package/front_end/models/issues_manager/SourceFrameIssuesManager.ts +13 -2
- package/front_end/models/issues_manager/issues_manager.ts +0 -2
- package/front_end/models/live-metrics/LiveMetrics.ts +22 -5
- package/front_end/models/live-metrics/web-vitals-injected/rollup.config.mjs +1 -1
- package/front_end/models/live-metrics/web-vitals-injected/spec/spec.ts +10 -4
- package/front_end/models/logs/logs-meta.ts +23 -16
- package/front_end/models/persistence/AutomaticFileSystemWorkspaceBinding.ts +2 -2
- package/front_end/models/persistence/IsolatedFileSystem.ts +1 -1
- package/front_end/models/persistence/IsolatedFileSystemManager.ts +1 -1
- package/front_end/models/source_map_scopes/NamesResolver.ts +104 -86
- package/front_end/models/source_map_scopes/ScopeChainModel.ts +6 -2
- package/front_end/models/stack_trace/StackTraceModel.ts +1 -1
- package/front_end/models/trace/handlers/ExtensionTraceDataHandler.ts +1 -1
- package/front_end/models/trace/handlers/UserTimingsHandler.ts +17 -6
- package/front_end/models/trace/helpers/SamplesIntegrator.ts +1 -1
- package/front_end/models/trace/helpers/Timing.ts +1 -1
- package/front_end/models/trace/insights/Common.ts +1 -1
- package/front_end/models/trace/insights/DocumentLatency.ts +3 -3
- package/front_end/models/trace/insights/LCPDiscovery.ts +1 -1
- package/front_end/models/trace/insights/ModernHTTP.ts +1 -1
- package/front_end/models/trace_source_maps_resolver/SourceMapsResolver.ts +2 -2
- package/front_end/models/workspace_diff/WorkspaceDiff.ts +14 -9
- package/front_end/panels/ai_assistance/AiAssistancePanel.ts +2 -15
- package/front_end/panels/ai_assistance/ai_assistance.ts +1 -2
- package/front_end/panels/ai_assistance/components/ChatInput.ts +23 -19
- package/front_end/panels/ai_assistance/components/ChatMessage.ts +9 -18
- package/front_end/panels/ai_assistance/components/ChatView.ts +2 -35
- package/front_end/panels/ai_assistance/components/DisabledWidget.ts +1 -1
- package/front_end/panels/ai_assistance/components/ExploreWidget.ts +4 -4
- package/front_end/panels/ai_assistance/components/ImageResize.ts +74 -0
- package/front_end/panels/ai_assistance/components/WalkthroughView.ts +2 -2
- package/front_end/panels/animation/AnimationGroupPreviewUI.ts +28 -29
- package/front_end/panels/animation/AnimationTimeline.ts +3 -3
- package/front_end/panels/animation/animationTimeline.css +0 -2
- package/front_end/panels/application/AppManifestView.ts +1 -1
- package/front_end/panels/application/ApplicationPanelSidebar.ts +1 -1
- package/front_end/panels/application/CookieItemsView.ts +1 -1
- package/front_end/panels/application/CrashReportContextView.ts +3 -3
- package/front_end/panels/application/DeviceBoundSessionsModel.ts +1 -1
- package/front_end/panels/application/DeviceBoundSessionsTreeElement.ts +1 -1
- package/front_end/panels/application/DeviceBoundSessionsView.ts +1 -1
- package/front_end/panels/application/IndexedDBViews.ts +1 -1
- package/front_end/panels/application/KeyValueStorageItemsView.ts +1 -1
- package/front_end/panels/application/OriginTrialTreeView.ts +1 -1
- package/front_end/panels/application/ServiceWorkersView.ts +6 -6
- package/front_end/panels/application/StorageBucketsTreeElement.ts +1 -1
- package/front_end/panels/application/StorageItemsToolbar.ts +3 -3
- package/front_end/panels/application/WebMCPView.ts +7 -5
- package/front_end/panels/application/components/AdsView.ts +21 -6
- package/front_end/panels/application/components/BackForwardCacheView.ts +2 -2
- package/front_end/panels/application/components/ProtocolHandlersView.ts +1 -1
- package/front_end/panels/application/components/StorageMetadataView.ts +1 -1
- package/front_end/panels/application/preloading/components/MismatchedPreloadingGrid.ts +2 -2
- package/front_end/panels/application/preloading/components/PreloadingDetailsReportView.ts +2 -1
- package/front_end/panels/application/preloading/components/PreloadingString.ts +3 -3
- package/front_end/panels/application/preloading/components/UsedPreloadingView.ts +2 -1
- package/front_end/panels/autofill/AutofillView.ts +1 -1
- package/front_end/panels/browser_debugger/DOMBreakpointsSidebarPane.ts +1 -1
- package/front_end/panels/browser_debugger/XHRBreakpointsSidebarPane.ts +2 -2
- package/front_end/panels/changes/ChangesSidebar.ts +2 -2
- package/front_end/panels/changes/ChangesView.ts +4 -5
- package/front_end/panels/changes/CombinedDiffView.ts +3 -3
- package/front_end/panels/changes/changes-meta.ts +2 -2
- package/front_end/panels/common/AiCodeCompletionTeaser.ts +1 -1
- package/front_end/panels/common/AiCodeGenerationTeaser.ts +3 -3
- package/front_end/panels/common/BadgeNotification.ts +8 -8
- package/front_end/panels/common/DOMLinkifier.ts +1 -1
- package/front_end/panels/common/GdpSignUpDialog.ts +2 -2
- package/front_end/panels/common/GeminiRebrandPromoDialog.ts +1 -1
- package/front_end/panels/common/aiCodeCompletionDisclaimer.css +0 -1
- package/front_end/panels/console/ConsoleInsightTeaser.ts +1 -1
- package/front_end/panels/console/ConsolePinPane.ts +3 -3
- package/front_end/panels/console/ConsolePrompt.ts +6 -4
- package/front_end/panels/console/ConsoleSidebar.ts +8 -10
- package/front_end/panels/console_counters/WarningErrorCounter.ts +10 -11
- package/front_end/panels/coverage/CoverageView.ts +2 -2
- package/front_end/panels/css_overview/CSSOverviewCompletedView.ts +3 -3
- package/front_end/panels/css_overview/CSSOverviewSidebarPanel.ts +1 -1
- package/front_end/panels/developer_resources/DeveloperResourcesView.ts +1 -1
- package/front_end/panels/elements/CSSRuleValidator.ts +1 -1
- package/front_end/panels/elements/ComputedStyleWidget.ts +3 -2
- package/front_end/panels/elements/ElementsTreeElement.ts +3 -3
- package/front_end/panels/elements/EventListenersWidget.ts +1 -3
- package/front_end/panels/elements/LayoutPane.ts +23 -13
- package/front_end/panels/elements/StandaloneStylesContainer.ts +7 -7
- package/front_end/panels/elements/StylePropertiesSection.ts +33 -5
- package/front_end/panels/elements/StylePropertyTreeElement.ts +5 -5
- package/front_end/panels/elements/StylesAiCodeCompletionProvider.ts +6 -6
- package/front_end/panels/elements/StylesSidebarPane.ts +4 -3
- package/front_end/panels/elements/elements-meta.ts +18 -2
- package/front_end/panels/emulation/DeviceModeToolbar.ts +100 -40
- package/front_end/panels/emulation/DeviceModeView.ts +5 -4
- package/front_end/panels/emulation/MediaQueryInspector.ts +35 -19
- package/front_end/panels/event_listeners/EventListenersView.ts +4 -4
- package/front_end/panels/explain/components/ConsoleInsight.ts +8 -9
- package/front_end/panels/explain/explain-meta.ts +3 -3
- package/front_end/panels/layer_viewer/LayerTreeOutline.ts +135 -167
- package/front_end/panels/layer_viewer/Layers3DView.ts +10 -23
- package/front_end/panels/layer_viewer/layer_viewer-meta.ts +27 -0
- package/front_end/panels/lighthouse/LighthouseController.ts +44 -55
- package/front_end/panels/lighthouse/LighthousePanel.ts +9 -9
- package/front_end/panels/lighthouse/LighthouseReportSelector.ts +2 -2
- package/front_end/panels/lighthouse/LighthouseStartView.ts +9 -12
- package/front_end/panels/lighthouse/LighthouseStatusView.ts +33 -33
- package/front_end/panels/lighthouse/RadioSetting.ts +1 -1
- package/front_end/panels/lighthouse/lighthouse-meta.ts +131 -1
- package/front_end/panels/media/EventDisplayTable.ts +67 -94
- package/front_end/panels/media/PlayerListView.ts +1 -1
- package/front_end/panels/media/eventDisplayTable.css +9 -4
- package/front_end/panels/mobile_throttling/NetworkThrottlingSelector.ts +5 -5
- package/front_end/panels/mobile_throttling/ThrottlingSettingsTab.ts +1 -1
- package/front_end/panels/network/EventSourceMessagesView.ts +98 -107
- package/front_end/panels/network/NetworkLogViewColumns.ts +1 -1
- package/front_end/panels/network/NetworkWaterfallColumn.ts +1 -1
- package/front_end/panels/network/RequestConditionsDrawer.ts +2 -2
- package/front_end/panels/network/RequestCookiesView.ts +2 -2
- package/front_end/panels/network/RequestHeadersView.ts +5 -5
- package/front_end/panels/network/RequestPayloadView.ts +4 -4
- package/front_end/panels/network/RequestTimingView.ts +2 -2
- package/front_end/panels/network/components/DirectSocketConnectionView.ts +1 -1
- package/front_end/panels/network/eventSourceMessagesView.css +12 -3
- package/front_end/panels/network/networkTimingTable.css +2 -2
- package/front_end/panels/performance_monitor/PerformanceMonitor.ts +1 -1
- package/front_end/panels/profiler/BottomUpProfileDataGrid.ts +25 -29
- package/front_end/panels/profiler/HeapProfileView.ts +308 -247
- package/front_end/panels/profiler/HeapSnapshotDataGrids.ts +13 -3
- package/front_end/panels/profiler/HeapSnapshotView.ts +30 -10
- package/front_end/panels/profiler/HeapTimelineOverview.ts +5 -2
- package/front_end/panels/profiler/ProfileDataGrid.ts +128 -157
- package/front_end/panels/profiler/ProfileFlameChartDataProvider.ts +17 -5
- package/front_end/panels/profiler/ProfilesPanel.ts +2 -2
- package/front_end/panels/profiler/TopDownProfileDataGrid.ts +17 -21
- package/front_end/panels/profiler/profilesPanel.css +9 -13
- package/front_end/panels/protocol_monitor/ProtocolMonitor.ts +2 -2
- package/front_end/panels/recorder/CreateRecordingView.ts +4 -4
- package/front_end/panels/recorder/RecorderPanel.ts +6 -6
- package/front_end/panels/recorder/RecordingView.ts +1 -1
- package/front_end/panels/recorder/ReplaySection.ts +1 -1
- package/front_end/panels/recorder/StepView.ts +1 -1
- package/front_end/panels/recorder/injected/rollup.config.mjs +1 -1
- package/front_end/panels/search/SearchView.ts +1 -1
- package/front_end/panels/security/SecurityPanel.ts +54 -41
- package/front_end/panels/sensors/LocationsSettingsTab.ts +246 -233
- package/front_end/panels/sensors/SensorsView.ts +1 -1
- package/front_end/panels/settings/AISettingsTab.ts +11 -10
- package/front_end/panels/settings/SettingsScreen.ts +29 -24
- package/front_end/panels/settings/emulation/components/UserAgentClientHintsForm.ts +2 -2
- package/front_end/panels/sources/AiCodeCompletionPlugin.ts +5 -5
- package/front_end/panels/sources/BreakpointEditDialog.ts +2 -2
- package/front_end/panels/sources/BreakpointsView.ts +1 -1
- package/front_end/panels/sources/CallStackSidebarPane.ts +2 -2
- package/front_end/panels/sources/DebuggerPausedMessage.ts +2 -2
- package/front_end/panels/sources/DebuggerPlugin.ts +25 -22
- package/front_end/panels/sources/ScopeChainSidebarPane.ts +3 -1
- package/front_end/panels/sources/WatchExpressionsSidebarPane.ts +7 -5
- package/front_end/panels/sources/sources-meta.ts +1 -1
- package/front_end/panels/timeline/CountersGraph.ts +1 -2
- package/front_end/panels/timeline/ExtensionTrackAppender.ts +1 -1
- package/front_end/panels/timeline/TimelineDetailsView.ts +2 -2
- package/front_end/panels/timeline/TimelineFlameChartDataProvider.ts +2 -2
- package/front_end/panels/timeline/TimelineFlameChartView.ts +4 -4
- package/front_end/panels/timeline/TimelinePaintProfilerView.ts +1 -1
- package/front_end/panels/timeline/TimelinePanel.ts +53 -81
- package/front_end/panels/timeline/TimelineSelectorStatsView.ts +10 -3
- package/front_end/panels/timeline/TimelineUIUtils.ts +18 -4
- package/front_end/panels/timeline/TrackConfigBanner.ts +1 -1
- package/front_end/panels/timeline/components/ExportTraceOptions.ts +1 -1
- package/front_end/panels/timeline/components/LayoutShiftDetails.ts +8 -9
- package/front_end/panels/timeline/components/NetworkRequestTooltip.ts +1 -1
- package/front_end/panels/timeline/components/TimelineRangeSummaryView.ts +1 -1
- package/front_end/panels/timeline/components/insights/DuplicatedJavaScript.ts +2 -2
- package/front_end/panels/timeline/components/insights/LCPBreakdown.ts +1 -1
- package/front_end/panels/timeline/components/insights/LegacyJavaScript.ts +1 -1
- package/front_end/panels/timeline/components/insights/SlowCSSSelector.ts +2 -2
- package/front_end/panels/timeline/overlays/OverlaysImpl.ts +5 -0
- package/front_end/panels/timeline/overlays/components/TimespanBreakdownOverlay.ts +13 -8
- package/front_end/panels/timeline/overlays/components/timespanBreakdownOverlay.css +1 -0
- package/front_end/panels/timeline/timeline-meta.ts +169 -0
- package/front_end/panels/timeline/timelineFlameChartView.css +5 -0
- package/front_end/panels/webauthn/WebauthnPane.ts +1 -1
- package/front_end/panels/whats_new/ReleaseNoteText.ts +9 -9
- package/front_end/panels/whats_new/resources/WNDT.md +7 -8
- package/front_end/third_party/chromium/README.chromium +1 -1
- package/front_end/third_party/web-vitals/README.chromium +2 -2
- package/front_end/third_party/web-vitals/package/README.md +120 -19
- package/front_end/third_party/web-vitals/package/attribution.d.ts +16 -0
- package/front_end/third_party/web-vitals/package/attribution.js +18 -0
- package/front_end/third_party/web-vitals/package/dist/modules/attribution/onCLS.d.ts +1 -1
- package/front_end/third_party/web-vitals/package/dist/modules/attribution/onFCP.d.ts +1 -7
- package/front_end/third_party/web-vitals/package/dist/modules/attribution/onFCP.js +53 -32
- package/front_end/third_party/web-vitals/package/dist/modules/attribution/onINP.d.ts +2 -2
- package/front_end/third_party/web-vitals/package/dist/modules/attribution/onINP.js +43 -12
- package/front_end/third_party/web-vitals/package/dist/modules/attribution/onLCP.d.ts +1 -1
- package/front_end/third_party/web-vitals/package/dist/modules/attribution/onLCP.js +21 -3
- package/front_end/third_party/web-vitals/package/dist/modules/attribution/onTTFB.d.ts +1 -1
- package/front_end/third_party/web-vitals/package/dist/modules/attribution/onTTFB.js +30 -24
- package/front_end/third_party/web-vitals/package/dist/modules/lib/FCPEntryManager.d.ts +3 -0
- package/front_end/third_party/web-vitals/package/dist/modules/lib/FCPEntryManager.js +18 -0
- package/front_end/third_party/web-vitals/package/dist/modules/lib/InteractionManager.d.ts +2 -1
- package/front_end/third_party/web-vitals/package/dist/modules/lib/InteractionManager.js +18 -2
- package/front_end/third_party/web-vitals/package/dist/modules/lib/LCPEntryManager.d.ts +1 -0
- package/front_end/third_party/web-vitals/package/dist/modules/lib/LCPEntryManager.js +1 -0
- package/front_end/third_party/web-vitals/package/dist/modules/lib/bindReporter.d.ts +1 -1
- package/front_end/third_party/web-vitals/package/dist/modules/lib/generateUniqueID.js +1 -1
- package/front_end/third_party/web-vitals/package/dist/modules/lib/getLoadState.d.ts +1 -1
- package/front_end/third_party/web-vitals/package/dist/modules/lib/getLoadState.js +7 -7
- package/front_end/third_party/web-vitals/package/dist/modules/lib/getSelector.js +1 -1
- package/front_end/third_party/web-vitals/package/dist/modules/lib/getVisibilityWatcher.d.ts +1 -1
- package/front_end/third_party/web-vitals/package/dist/modules/lib/getVisibilityWatcher.js +4 -1
- package/front_end/third_party/web-vitals/package/dist/modules/lib/initMetric.d.ts +7 -3
- package/front_end/third_party/web-vitals/package/dist/modules/lib/initMetric.js +20 -11
- package/front_end/third_party/web-vitals/package/dist/modules/lib/initUnique.js +8 -3
- package/front_end/third_party/web-vitals/package/dist/modules/lib/observe.d.ts +3 -1
- package/front_end/third_party/web-vitals/package/dist/modules/lib/observe.js +19 -4
- package/front_end/third_party/web-vitals/package/dist/modules/lib/polyfills/interactionCountPolyfill.js +1 -1
- package/front_end/third_party/web-vitals/package/dist/modules/lib/softNavs.d.ts +3 -0
- package/front_end/third_party/web-vitals/package/dist/modules/lib/softNavs.js +38 -0
- package/front_end/third_party/web-vitals/package/dist/modules/lib/whenIdleOrHidden.js +5 -1
- package/front_end/third_party/web-vitals/package/dist/modules/onCLS.d.ts +1 -1
- package/front_end/third_party/web-vitals/package/dist/modules/onCLS.js +30 -11
- package/front_end/third_party/web-vitals/package/dist/modules/onFCP.d.ts +1 -1
- package/front_end/third_party/web-vitals/package/dist/modules/onFCP.js +36 -4
- package/front_end/third_party/web-vitals/package/dist/modules/onINP.d.ts +1 -1
- package/front_end/third_party/web-vitals/package/dist/modules/onINP.js +42 -22
- package/front_end/third_party/web-vitals/package/dist/modules/onLCP.d.ts +1 -1
- package/front_end/third_party/web-vitals/package/dist/modules/onLCP.js +109 -30
- package/front_end/third_party/web-vitals/package/dist/modules/onTTFB.d.ts +1 -1
- package/front_end/third_party/web-vitals/package/dist/modules/onTTFB.js +25 -7
- package/front_end/third_party/web-vitals/package/dist/modules/types/base.d.ts +24 -1
- package/front_end/third_party/web-vitals/package/dist/modules/types/fcp.d.ts +1 -1
- package/front_end/third_party/web-vitals/package/dist/modules/types/inp.d.ts +14 -6
- package/front_end/third_party/web-vitals/package/dist/modules/types/lcp.d.ts +1 -1
- package/front_end/third_party/web-vitals/package/dist/modules/types/ttfb.d.ts +2 -2
- package/front_end/third_party/web-vitals/package/dist/modules/types.d.ts +26 -4
- package/front_end/third_party/web-vitals/package/package.json +21 -22
- package/front_end/third_party/web-vitals/package/src/attribution/onCLS.ts +1 -1
- package/front_end/third_party/web-vitals/package/src/attribution/onFCP.ts +62 -39
- package/front_end/third_party/web-vitals/package/src/attribution/onINP.ts +52 -15
- package/front_end/third_party/web-vitals/package/src/attribution/onLCP.ts +25 -7
- package/front_end/third_party/web-vitals/package/src/attribution/onTTFB.ts +43 -37
- package/front_end/third_party/web-vitals/package/src/lib/{polyfills/getFirstHiddenTimePolyfill.ts → FCPEntryManager.ts} +4 -14
- package/front_end/third_party/web-vitals/package/src/lib/InteractionManager.ts +22 -2
- package/front_end/third_party/web-vitals/package/src/lib/LCPEntryManager.ts +1 -0
- package/front_end/third_party/web-vitals/package/src/lib/bindReporter.ts +1 -1
- package/front_end/third_party/web-vitals/package/src/lib/generateUniqueID.ts +1 -1
- package/front_end/third_party/web-vitals/package/src/lib/getLoadState.ts +11 -12
- package/front_end/third_party/web-vitals/package/src/lib/getSelector.ts +1 -1
- package/front_end/third_party/web-vitals/package/src/lib/getVisibilityWatcher.ts +4 -1
- package/front_end/third_party/web-vitals/package/src/lib/initMetric.ts +24 -11
- package/front_end/third_party/web-vitals/package/src/lib/initUnique.ts +12 -4
- package/front_end/third_party/web-vitals/package/src/lib/observe.ts +26 -5
- package/front_end/third_party/web-vitals/package/src/lib/polyfills/interactionCountPolyfill.ts +1 -1
- package/front_end/third_party/web-vitals/package/src/lib/softNavs.ts +48 -0
- package/front_end/third_party/web-vitals/package/src/lib/whenIdleOrHidden.ts +12 -4
- package/front_end/third_party/web-vitals/package/src/onCLS.ts +75 -18
- package/front_end/third_party/web-vitals/package/src/onFCP.ts +66 -7
- package/front_end/third_party/web-vitals/package/src/onINP.ts +100 -39
- package/front_end/third_party/web-vitals/package/src/onLCP.ts +169 -34
- package/front_end/third_party/web-vitals/package/src/onTTFB.ts +50 -13
- package/front_end/third_party/web-vitals/package/src/types/base.ts +31 -10
- package/front_end/third_party/web-vitals/package/src/types/fcp.ts +1 -1
- package/front_end/third_party/web-vitals/package/src/types/inp.ts +14 -6
- package/front_end/third_party/web-vitals/package/src/types/lcp.ts +1 -1
- package/front_end/third_party/web-vitals/package/src/types/ttfb.ts +2 -2
- package/front_end/third_party/web-vitals/package/src/types.ts +32 -9
- package/front_end/third_party/web-vitals/patches/0001-Add-onEachInteraction-to-onINP-options.patch +11 -11
- package/front_end/third_party/web-vitals/rebuild.sh +2 -2
- package/front_end/third_party/web-vitals/web-vitals-tsconfig.json +2 -0
- package/front_end/ui/components/buttons/Button.ts +16 -0
- package/front_end/ui/components/dialogs/Dialog.ts +1 -1
- package/front_end/ui/components/highlighting/HighlightManager.ts +6 -1
- package/front_end/ui/components/highlighting/highlighting.ts +1 -1
- package/front_end/ui/components/icon_button/FileSourceIcon.ts +1 -1
- package/front_end/ui/components/linkifier/LinkifierImpl.ts +1 -1
- package/front_end/ui/components/markdown_view/MarkdownLinksMap.ts +2 -2
- package/front_end/ui/components/settings/SettingCheckbox.ts +12 -7
- package/front_end/ui/components/text_editor/AiCodeCompletionProvider.ts +2 -2
- package/front_end/ui/components/text_editor/AiCodeGenerationProvider.ts +6 -6
- package/front_end/ui/components/text_editor/javascript.ts +3 -1
- package/front_end/ui/components/tooltips/Tooltip.ts +1 -1
- package/front_end/ui/legacy/ContextMenu.ts +12 -2
- package/front_end/ui/legacy/ListControl.ts +1 -1
- package/front_end/ui/legacy/SelectMenu.docs.ts +17 -19
- package/front_end/ui/legacy/Toolbar.ts +4 -1
- package/front_end/ui/legacy/Treeoutline.ts +1 -1
- package/front_end/ui/legacy/components/color_picker/spectrum.css +1 -2
- package/front_end/ui/legacy/components/data_grid/DataGrid.ts +1 -1
- package/front_end/ui/legacy/components/data_grid/DataGridElement.ts +50 -4
- package/front_end/ui/legacy/components/object_ui/JavaScriptREPL.ts +3 -1
- package/front_end/ui/legacy/components/perf_ui/ChartViewport.ts +4 -4
- package/front_end/ui/legacy/components/perf_ui/FlameChart.ts +8 -7
- package/front_end/ui/legacy/components/quick_open/CommandMenu.ts +14 -11
- package/front_end/ui/legacy/components/quick_open/QuickOpen.ts +1 -1
- package/front_end/ui/legacy/components/settings_ui/SettingsUI.ts +15 -5
- package/front_end/ui/legacy/components/source_frame/SourceFrame.ts +4 -4
- package/front_end/ui/legacy/components/utils/Linkifier.ts +5 -1
- package/front_end/ui/lit/render.ts +1 -1
- package/front_end/ui/settings/SettingUIRegistration.ts +8 -3
- package/front_end/ui/visual_logging/KnownContextValues.ts +8 -0
- package/front_end/ui/visual_logging/LoggingEvents.ts +1 -1
- package/inspector_overlay/main.ts +1 -1
- package/mcp/mcp.ts +5 -4
- package/package.json +13 -13
- package/front_end/models/ai_assistance/AgentProject.ts +0 -261
- package/front_end/models/ai_assistance/agents/PatchAgent.ts +0 -306
- package/front_end/models/issues_manager/CheckFormsIssuesTrigger.ts +0 -45
- package/front_end/models/text_utils/text_utils.ts +0 -5
- package/front_end/panels/ai_assistance/PatchWidget.ts +0 -867
- package/front_end/panels/ai_assistance/SelectWorkspaceDialog.ts +0 -368
- package/front_end/panels/ai_assistance/selectWorkspaceDialog.css +0 -92
|
@@ -15,18 +15,23 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import {LCPEntryManager} from './lib/LCPEntryManager.js';
|
|
18
|
-
import {onBFCacheRestore} from './lib/bfcache.js';
|
|
18
|
+
import {getBFCacheRestoreTime, onBFCacheRestore} from './lib/bfcache.js';
|
|
19
19
|
import {bindReporter} from './lib/bindReporter.js';
|
|
20
20
|
import {doubleRAF} from './lib/doubleRAF.js';
|
|
21
21
|
import {getActivationStart} from './lib/getActivationStart.js';
|
|
22
|
+
import {checkSoftNavsEnabled, storeSoftNavEntry} from './lib/softNavs.js';
|
|
22
23
|
import {getVisibilityWatcher} from './lib/getVisibilityWatcher.js';
|
|
23
24
|
import {initMetric} from './lib/initMetric.js';
|
|
24
25
|
import {initUnique} from './lib/initUnique.js';
|
|
25
26
|
import {observe} from './lib/observe.js';
|
|
26
|
-
import {runOnce} from './lib/runOnce.js';
|
|
27
27
|
import {whenActivated} from './lib/whenActivated.js';
|
|
28
28
|
import {whenIdleOrHidden} from './lib/whenIdleOrHidden.js';
|
|
29
|
-
import {
|
|
29
|
+
import type {
|
|
30
|
+
LCPMetric,
|
|
31
|
+
Metric,
|
|
32
|
+
MetricRatingThresholds,
|
|
33
|
+
ReportOpts,
|
|
34
|
+
} from './types.js';
|
|
30
35
|
|
|
31
36
|
/** Thresholds for LCP. See https://web.dev/articles/lcp#what_is_a_good_lcp_score */
|
|
32
37
|
export const LCPThresholds: MetricRatingThresholds = [2500, 4000];
|
|
@@ -46,76 +51,199 @@ export const onLCP = (
|
|
|
46
51
|
onReport: (metric: LCPMetric) => void,
|
|
47
52
|
opts: ReportOpts = {},
|
|
48
53
|
) => {
|
|
54
|
+
// As InteractionContentfulPaint entries used by soft navs can emit after
|
|
55
|
+
// LCP is finalized, we need a flag to know to ignore them.
|
|
56
|
+
let isFinalized = false;
|
|
57
|
+
const softNavsEnabled = checkSoftNavsEnabled(opts);
|
|
58
|
+
|
|
49
59
|
whenActivated(() => {
|
|
50
|
-
|
|
60
|
+
let visibilityWatcher = getVisibilityWatcher();
|
|
51
61
|
let metric = initMetric('LCP');
|
|
52
62
|
let report: ReturnType<typeof bindReporter>;
|
|
53
63
|
|
|
54
64
|
const lcpEntryManager = initUnique(opts, LCPEntryManager);
|
|
55
65
|
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
66
|
+
const initNewLCPMetric = (
|
|
67
|
+
navigation?: Metric['navigationType'],
|
|
68
|
+
navigationId?: number,
|
|
69
|
+
navigationInteractionId?: number,
|
|
70
|
+
navigationURL?: string,
|
|
71
|
+
navigationStartTime?: number,
|
|
72
|
+
) => {
|
|
73
|
+
metric = initMetric(
|
|
74
|
+
'LCP',
|
|
75
|
+
-1,
|
|
76
|
+
navigation,
|
|
77
|
+
navigationId,
|
|
78
|
+
navigationInteractionId,
|
|
79
|
+
navigationURL,
|
|
80
|
+
navigationStartTime,
|
|
81
|
+
);
|
|
82
|
+
report = bindReporter(
|
|
83
|
+
onReport,
|
|
84
|
+
metric,
|
|
85
|
+
LCPThresholds,
|
|
86
|
+
opts.reportAllChanges,
|
|
87
|
+
);
|
|
88
|
+
// Reset the finalized flag
|
|
89
|
+
isFinalized = false;
|
|
90
|
+
// If it's a soft nav, then need to reset the visibilityWatcher
|
|
91
|
+
if (navigation === 'soft-navigation') {
|
|
92
|
+
visibilityWatcher = getVisibilityWatcher(true);
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
const handleSoftNavEntry = (entry: PerformanceSoftNavigation) => {
|
|
97
|
+
if (lcpEntryManager._softNavigationEntryMap && entry.navigationId) {
|
|
98
|
+
storeSoftNavEntry(lcpEntryManager._softNavigationEntryMap, entry);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
if (!isFinalized) report(true);
|
|
102
|
+
initNewLCPMetric(
|
|
103
|
+
'soft-navigation',
|
|
104
|
+
entry.navigationId,
|
|
105
|
+
entry.interactionId,
|
|
106
|
+
entry.name,
|
|
107
|
+
entry.startTime,
|
|
108
|
+
);
|
|
109
|
+
// Soft Navs should contain the largest paint until now, so handle that
|
|
110
|
+
// as if it just happened, then listen for more.
|
|
111
|
+
// It can however be null in rare circumstances
|
|
112
|
+
// (see https://github.com/GoogleChrome/web-vitals/issues/725)
|
|
113
|
+
const largestInteractionContentfulPaint =
|
|
114
|
+
entry.getLargestInteractionContentfulPaint?.();
|
|
115
|
+
if (largestInteractionContentfulPaint) {
|
|
116
|
+
handleEntries([largestInteractionContentfulPaint]);
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
const handleEntries = (
|
|
121
|
+
entries: (
|
|
122
|
+
| LargestContentfulPaint
|
|
123
|
+
| InteractionContentfulPaint
|
|
124
|
+
| PerformanceSoftNavigation
|
|
125
|
+
)[],
|
|
126
|
+
) => {
|
|
127
|
+
// If reportAllChanges is set or soft navs is enabled then call this
|
|
128
|
+
// function for each entry, otherwise only consider the last one.
|
|
129
|
+
if (!opts.reportAllChanges && !softNavsEnabled) {
|
|
60
130
|
entries = entries.slice(-1);
|
|
61
131
|
}
|
|
62
132
|
|
|
63
133
|
for (const entry of entries) {
|
|
64
|
-
|
|
134
|
+
if (!entry) continue;
|
|
65
135
|
|
|
66
|
-
|
|
67
|
-
|
|
136
|
+
if (entry.entryType === 'soft-navigation') {
|
|
137
|
+
handleSoftNavEntry(entry as PerformanceSoftNavigation);
|
|
138
|
+
continue;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
let value = 0;
|
|
142
|
+
let metricEntries: LargestContentfulPaint[] = [];
|
|
143
|
+
let renderTime = entry.startTime;
|
|
144
|
+
if (entry.entryType === 'largest-contentful-paint') {
|
|
68
145
|
// The startTime attribute returns the value of the renderTime if it is
|
|
69
146
|
// not 0, and the value of the loadTime otherwise. The activationStart
|
|
70
147
|
// reference is used because LCP should be relative to page activation
|
|
71
148
|
// rather than navigation start if the page was prerendered. But in cases
|
|
72
149
|
// where `activationStart` occurs after the LCP, this time should be
|
|
73
150
|
// clamped at 0.
|
|
74
|
-
|
|
75
|
-
|
|
151
|
+
value = Math.max(entry.startTime - getActivationStart(), 0);
|
|
152
|
+
|
|
153
|
+
lcpEntryManager._processEntry(entry as LargestContentfulPaint);
|
|
154
|
+
metricEntries = [entry as LargestContentfulPaint];
|
|
155
|
+
} else if (entry.entryType === 'interaction-contentful-paint') {
|
|
156
|
+
const ICPEntry = entry as InteractionContentfulPaint;
|
|
157
|
+
// InteractionContentfulPaints should only happen after a
|
|
158
|
+
// PerformanceSoftNavigation so the metric should have been set
|
|
159
|
+
// with a non-zero navigationId mapping to a soft nav.
|
|
160
|
+
if (!metric.navigationId) continue;
|
|
161
|
+
|
|
162
|
+
// Ignore interactions not for this soft nav
|
|
163
|
+
// (either paints that have bled into this interaction or paints when
|
|
164
|
+
// we should have already finalized)
|
|
165
|
+
if (
|
|
166
|
+
'interactionId' in ICPEntry &&
|
|
167
|
+
ICPEntry.interactionId != metric.navigationInteractionId
|
|
168
|
+
) {
|
|
169
|
+
continue;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
renderTime = ICPEntry.largestContentfulPaint?.renderTime || 0;
|
|
173
|
+
|
|
174
|
+
// Paints should never be less than 0 but add cap just in case
|
|
175
|
+
value = Math.max(renderTime - entry.startTime, 0);
|
|
176
|
+
|
|
177
|
+
if (ICPEntry.largestContentfulPaint) {
|
|
178
|
+
lcpEntryManager._processEntry(ICPEntry.largestContentfulPaint);
|
|
179
|
+
metricEntries = [ICPEntry.largestContentfulPaint];
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// Only report if the page wasn't hidden prior to LCP.
|
|
184
|
+
if (renderTime < visibilityWatcher.firstHiddenTime) {
|
|
185
|
+
metric.value = value;
|
|
186
|
+
metric.entries = metricEntries;
|
|
76
187
|
report();
|
|
77
188
|
}
|
|
78
189
|
}
|
|
79
190
|
};
|
|
80
191
|
|
|
81
|
-
const
|
|
192
|
+
const types = ['largest-contentful-paint'] as (
|
|
193
|
+
| 'largest-contentful-paint'
|
|
194
|
+
| 'interaction-contentful-paint'
|
|
195
|
+
| 'soft-navigation'
|
|
196
|
+
)[];
|
|
197
|
+
if (softNavsEnabled) {
|
|
198
|
+
types.push('interaction-contentful-paint', 'soft-navigation');
|
|
199
|
+
}
|
|
200
|
+
const po = observe(types, handleEntries);
|
|
82
201
|
|
|
83
202
|
if (po) {
|
|
84
203
|
report = bindReporter(
|
|
85
204
|
onReport,
|
|
86
205
|
metric,
|
|
87
206
|
LCPThresholds,
|
|
88
|
-
opts
|
|
207
|
+
opts.reportAllChanges,
|
|
89
208
|
);
|
|
90
209
|
|
|
91
|
-
|
|
92
|
-
// any of three different event listeners below.
|
|
93
|
-
const stopListening = runOnce(() => {
|
|
94
|
-
handleEntries(po!.takeRecords() as LCPMetric['entries']);
|
|
95
|
-
po!.disconnect();
|
|
96
|
-
report(true);
|
|
97
|
-
});
|
|
210
|
+
const finalizeEventTypes = ['keydown', 'click', 'visibilitychange'];
|
|
98
211
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
const stopListeningWrapper = (event: Event) => {
|
|
102
|
-
if (event.isTrusted) {
|
|
212
|
+
const finalizeLCP = (event: Event) => {
|
|
213
|
+
if (event.isTrusted && !isFinalized) {
|
|
103
214
|
// Wrap the listener in an idle callback so it's run in a separate
|
|
104
215
|
// task to reduce potential INP impact.
|
|
105
216
|
// https://github.com/GoogleChrome/web-vitals/issues/383
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
217
|
+
const metricIdToFinalize = metric.id;
|
|
218
|
+
whenIdleOrHidden(() => {
|
|
219
|
+
if (!isFinalized) {
|
|
220
|
+
if (!softNavsEnabled) {
|
|
221
|
+
// Do some clean up since these won't be needed anymore.
|
|
222
|
+
po!.disconnect();
|
|
223
|
+
for (const type of finalizeEventTypes) {
|
|
224
|
+
removeEventListener(type, finalizeLCP, {capture: true});
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
// As this is in a whenIdleOrHidden check, whether we're still
|
|
228
|
+
// on the metric you meant to finalize, and ignore if we've moved
|
|
229
|
+
// on in the meantime.
|
|
230
|
+
if (metricIdToFinalize === metric.id) {
|
|
231
|
+
isFinalized = true;
|
|
232
|
+
report(true);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
109
235
|
});
|
|
110
236
|
}
|
|
111
237
|
};
|
|
112
238
|
|
|
113
|
-
//
|
|
239
|
+
// Finalize the current LCP after input or visibilitychange.
|
|
240
|
+
// Although the browser will automatically stop emitting entries in these
|
|
241
|
+
// cases, we don't know it's finalized, so we track to allow early report.
|
|
114
242
|
// Note: while scrolling is an input that stops LCP observation, it's
|
|
115
243
|
// unreliable since it can be programmatically generated.
|
|
116
244
|
// See: https://github.com/GoogleChrome/web-vitals/issues/75
|
|
117
|
-
for (const type of
|
|
118
|
-
addEventListener(type,
|
|
245
|
+
for (const type of finalizeEventTypes) {
|
|
246
|
+
addEventListener(type, finalizeLCP, {
|
|
119
247
|
capture: true,
|
|
120
248
|
});
|
|
121
249
|
}
|
|
@@ -123,16 +251,23 @@ export const onLCP = (
|
|
|
123
251
|
// Only report after a bfcache restore if the `PerformanceObserver`
|
|
124
252
|
// successfully registered.
|
|
125
253
|
onBFCacheRestore((event) => {
|
|
126
|
-
|
|
254
|
+
initNewLCPMetric(
|
|
255
|
+
'back-forward-cache',
|
|
256
|
+
metric.navigationId,
|
|
257
|
+
metric.navigationInteractionId,
|
|
258
|
+
metric.navigationURL,
|
|
259
|
+
getBFCacheRestoreTime(),
|
|
260
|
+
);
|
|
127
261
|
report = bindReporter(
|
|
128
262
|
onReport,
|
|
129
263
|
metric,
|
|
130
264
|
LCPThresholds,
|
|
131
|
-
opts
|
|
265
|
+
opts.reportAllChanges,
|
|
132
266
|
);
|
|
133
267
|
|
|
134
268
|
doubleRAF(() => {
|
|
135
269
|
metric.value = performance.now() - event.timeStamp;
|
|
270
|
+
isFinalized = true;
|
|
136
271
|
report(true);
|
|
137
272
|
});
|
|
138
273
|
});
|
|
@@ -15,12 +15,14 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import {bindReporter} from './lib/bindReporter.js';
|
|
18
|
-
import {
|
|
19
|
-
import {onBFCacheRestore} from './lib/bfcache.js';
|
|
18
|
+
import {checkSoftNavsEnabled} from './lib/softNavs.js';
|
|
20
19
|
import {getNavigationEntry} from './lib/getNavigationEntry.js';
|
|
21
|
-
import {MetricRatingThresholds, ReportOpts, TTFBMetric} from './types.js';
|
|
22
20
|
import {getActivationStart} from './lib/getActivationStart.js';
|
|
21
|
+
import {initMetric} from './lib/initMetric.js';
|
|
22
|
+
import {observe} from './lib/observe.js';
|
|
23
|
+
import {getBFCacheRestoreTime, onBFCacheRestore} from './lib/bfcache.js';
|
|
23
24
|
import {whenActivated} from './lib/whenActivated.js';
|
|
25
|
+
import type {MetricRatingThresholds, ReportOpts, TTFBMetric} from './types.js';
|
|
24
26
|
|
|
25
27
|
/** Thresholds for TTFB. See https://web.dev/articles/ttfb#what_is_a_good_ttfb_score */
|
|
26
28
|
export const TTFBThresholds: MetricRatingThresholds = [800, 1800];
|
|
@@ -59,6 +61,8 @@ export const onTTFB = (
|
|
|
59
61
|
onReport: (metric: TTFBMetric) => void,
|
|
60
62
|
opts: ReportOpts = {},
|
|
61
63
|
) => {
|
|
64
|
+
const softNavsEnabled = checkSoftNavsEnabled(opts);
|
|
65
|
+
|
|
62
66
|
let metric = initMetric('TTFB');
|
|
63
67
|
let report = bindReporter(
|
|
64
68
|
onReport,
|
|
@@ -68,34 +72,67 @@ export const onTTFB = (
|
|
|
68
72
|
);
|
|
69
73
|
|
|
70
74
|
whenReady(() => {
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
|
|
75
|
+
const hardNavEntry = getNavigationEntry();
|
|
76
|
+
if (hardNavEntry) {
|
|
77
|
+
const responseStart = hardNavEntry.responseStart;
|
|
74
78
|
// The activationStart reference is used because TTFB should be
|
|
75
79
|
// relative to page activation rather than navigation start if the
|
|
76
80
|
// page was prerendered. But in cases where `activationStart` occurs
|
|
77
81
|
// after the first byte is received, this time should be clamped at 0.
|
|
78
|
-
metric.value = Math.max(
|
|
79
|
-
navigationEntry.responseStart - getActivationStart(),
|
|
80
|
-
0,
|
|
81
|
-
);
|
|
82
|
+
metric.value = Math.max(responseStart - getActivationStart(), 0);
|
|
82
83
|
|
|
83
|
-
metric.entries = [
|
|
84
|
+
metric.entries = [hardNavEntry];
|
|
84
85
|
report(true);
|
|
85
86
|
|
|
86
87
|
// Only report TTFB after bfcache restores if a `navigation` entry
|
|
87
88
|
// was reported for the initial load.
|
|
88
89
|
onBFCacheRestore(() => {
|
|
89
|
-
metric = initMetric(
|
|
90
|
+
metric = initMetric(
|
|
91
|
+
'TTFB',
|
|
92
|
+
0,
|
|
93
|
+
'back-forward-cache',
|
|
94
|
+
metric.navigationId,
|
|
95
|
+
metric.navigationInteractionId,
|
|
96
|
+
metric.navigationURL,
|
|
97
|
+
getBFCacheRestoreTime(),
|
|
98
|
+
);
|
|
90
99
|
report = bindReporter(
|
|
91
100
|
onReport,
|
|
92
101
|
metric,
|
|
93
102
|
TTFBThresholds,
|
|
94
|
-
opts
|
|
103
|
+
opts.reportAllChanges,
|
|
95
104
|
);
|
|
96
105
|
|
|
97
106
|
report(true);
|
|
98
107
|
});
|
|
108
|
+
|
|
109
|
+
// Listen for soft-navigation entries and emit a dummy 0 TTFB entry
|
|
110
|
+
if (softNavsEnabled) {
|
|
111
|
+
const reportSoftNavTTFBs = (entries: PerformanceSoftNavigation[]) => {
|
|
112
|
+
entries.forEach((entry) => {
|
|
113
|
+
if (entry.navigationId) {
|
|
114
|
+
metric = initMetric(
|
|
115
|
+
'TTFB',
|
|
116
|
+
0,
|
|
117
|
+
'soft-navigation',
|
|
118
|
+
entry.navigationId,
|
|
119
|
+
entry.interactionId,
|
|
120
|
+
entry.name,
|
|
121
|
+
entry.startTime,
|
|
122
|
+
);
|
|
123
|
+
metric.entries = [entry];
|
|
124
|
+
report = bindReporter(
|
|
125
|
+
onReport,
|
|
126
|
+
metric,
|
|
127
|
+
TTFBThresholds,
|
|
128
|
+
opts.reportAllChanges,
|
|
129
|
+
);
|
|
130
|
+
report(true);
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
};
|
|
134
|
+
observe(['soft-navigation'], reportSoftNavTTFBs, opts);
|
|
135
|
+
}
|
|
99
136
|
}
|
|
100
137
|
});
|
|
101
138
|
};
|
|
@@ -72,6 +72,7 @@ export interface Metric {
|
|
|
72
72
|
* - 'prerender': for pages that were prerendered.
|
|
73
73
|
* - 'restore': for pages that were discarded by the browser and then
|
|
74
74
|
* restored by the user.
|
|
75
|
+
* - 'soft-navigation': for soft navigations.
|
|
75
76
|
*/
|
|
76
77
|
navigationType:
|
|
77
78
|
| 'navigate'
|
|
@@ -79,16 +80,37 @@ export interface Metric {
|
|
|
79
80
|
| 'back-forward'
|
|
80
81
|
| 'back-forward-cache'
|
|
81
82
|
| 'prerender'
|
|
82
|
-
| 'restore'
|
|
83
|
+
| 'restore'
|
|
84
|
+
| 'soft-navigation';
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* The navigationId the metric happened for. This is particularly relevant for soft navigations where
|
|
88
|
+
* the metric may be reported for a previous URL.
|
|
89
|
+
*/
|
|
90
|
+
navigationId: number;
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* For metrics specific to a soft navigation, the interactionId of the
|
|
94
|
+
* interaction that triggered that soft navigation.
|
|
95
|
+
*/
|
|
96
|
+
navigationInteractionId?: number;
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* The navigation startTime the metric is based from. This is particularly
|
|
100
|
+
* relevant for soft navigations where time origin is not 0.
|
|
101
|
+
*/
|
|
102
|
+
navigationStartTime?: number;
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* The navigation URL the metric happened for. This is particularly relevant for soft navigations where
|
|
106
|
+
* the metric may be reported for a previous URL.
|
|
107
|
+
*/
|
|
108
|
+
navigationURL?: string;
|
|
83
109
|
}
|
|
84
110
|
|
|
85
111
|
/** The union of supported metric types. */
|
|
86
112
|
export type MetricType =
|
|
87
|
-
|
|
|
88
|
-
| FCPMetric
|
|
89
|
-
| INPMetric
|
|
90
|
-
| LCPMetric
|
|
91
|
-
| TTFBMetric;
|
|
113
|
+
CLSMetric | FCPMetric | INPMetric | LCPMetric | TTFBMetric;
|
|
92
114
|
|
|
93
115
|
/** The union of supported metric attribution types. */
|
|
94
116
|
export type MetricWithAttribution =
|
|
@@ -124,6 +146,8 @@ export interface ReportCallback {
|
|
|
124
146
|
|
|
125
147
|
export interface ReportOpts {
|
|
126
148
|
reportAllChanges?: boolean;
|
|
149
|
+
durationThreshold?: number;
|
|
150
|
+
reportSoftNavs?: boolean;
|
|
127
151
|
}
|
|
128
152
|
|
|
129
153
|
export interface AttributionReportOpts extends ReportOpts {
|
|
@@ -146,7 +170,4 @@ export interface AttributionReportOpts extends ReportOpts {
|
|
|
146
170
|
* loading. This is equivalent to the corresponding `readyState` value.
|
|
147
171
|
*/
|
|
148
172
|
export type LoadState =
|
|
149
|
-
| '
|
|
150
|
-
| 'dom-interactive'
|
|
151
|
-
| 'dom-content-loaded'
|
|
152
|
-
| 'complete';
|
|
173
|
+
'loading' | 'dom-interactive' | 'dom-content-loaded' | 'complete';
|
|
@@ -54,7 +54,7 @@ export interface FCPAttribution {
|
|
|
54
54
|
* general page load issues. This can be used to access `serverTiming` for example:
|
|
55
55
|
* navigationEntry?.serverTiming
|
|
56
56
|
*/
|
|
57
|
-
navigationEntry?: PerformanceNavigationTiming;
|
|
57
|
+
navigationEntry?: PerformanceNavigationTiming | PerformanceSoftNavigation;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
/**
|
|
@@ -69,35 +69,43 @@ export interface INPAttribution {
|
|
|
69
69
|
* `generateTarget` configuration option was passed, then this will instead
|
|
70
70
|
* be the return value of that function, falling back to the default if that
|
|
71
71
|
* returns null or undefined.
|
|
72
|
+
* This value may not be set in cases where the event duration was less than
|
|
73
|
+
* the browser minimum reporting threshold, and thus no entry was dispatched.
|
|
72
74
|
*/
|
|
73
|
-
interactionTarget
|
|
75
|
+
interactionTarget?: string;
|
|
74
76
|
/**
|
|
75
77
|
* The time when the user first interacted during the frame where the INP
|
|
76
78
|
* candidate interaction occurred (if more than one interaction occurred
|
|
77
79
|
* within the frame, only the first time is reported).
|
|
80
|
+
* This value may not be set in cases where the event duration was less than
|
|
81
|
+
* the browser minimum reporting threshold, and thus no entry was dispatched.
|
|
78
82
|
*/
|
|
79
|
-
interactionTime
|
|
83
|
+
interactionTime?: DOMHighResTimeStamp;
|
|
80
84
|
/**
|
|
81
85
|
* The type of interaction, based on the event type of the `event` entry
|
|
82
86
|
* that corresponds to the interaction (i.e. the first `event` entry
|
|
83
87
|
* containing an `interactionId` dispatched in a given animation frame).
|
|
84
88
|
* For "pointerdown", "pointerup", or "click" events this will be "pointer",
|
|
85
89
|
* and for "keydown" or "keyup" events this will be "keyboard".
|
|
90
|
+
* This value may not be set in cases where the event duration was less than
|
|
91
|
+
* the browser minimum reporting threshold, and thus no entry was dispatched.
|
|
86
92
|
*/
|
|
87
|
-
interactionType
|
|
93
|
+
interactionType?: 'pointer' | 'keyboard';
|
|
88
94
|
/**
|
|
89
95
|
* The best-guess timestamp of the next paint after the interaction.
|
|
90
96
|
* In general, this timestamp is the same as the `startTime + duration` of
|
|
91
97
|
* the event timing entry. However, since duration values are rounded to the
|
|
92
98
|
* nearest 8ms (and can be rounded down), this value is clamped to always be
|
|
93
99
|
* reported after the processing times.
|
|
100
|
+
* This value may not be set in cases where the event duration was less than
|
|
101
|
+
* the browser minimum reporting threshold, and thus no entry was dispatched.
|
|
94
102
|
*/
|
|
95
|
-
nextPaintTime
|
|
103
|
+
nextPaintTime?: DOMHighResTimeStamp;
|
|
96
104
|
/**
|
|
97
105
|
* An array of Event Timing entries that were processed within the same
|
|
98
106
|
* animation frame as the INP candidate interaction.
|
|
99
|
-
* This array can be quite large so it will be empty
|
|
100
|
-
* `includeProcessedEventEntries` configuration option is set to `
|
|
107
|
+
* This array can be quite large so it will be empty unless the
|
|
108
|
+
* `includeProcessedEventEntries` configuration option is set to `true` to
|
|
101
109
|
* conserve memory if these entries are not required.
|
|
102
110
|
*/
|
|
103
111
|
processedEventEntries: PerformanceEventTiming[];
|
|
@@ -72,7 +72,7 @@ export interface LCPAttribution {
|
|
|
72
72
|
* general page load issues. This can be used to access `serverTiming` for example:
|
|
73
73
|
* navigationEntry?.serverTiming
|
|
74
74
|
*/
|
|
75
|
-
navigationEntry?: PerformanceNavigationTiming;
|
|
75
|
+
navigationEntry?: PerformanceNavigationTiming | PerformanceSoftNavigation;
|
|
76
76
|
/**
|
|
77
77
|
* The `resource` entry for the LCP resource (if applicable), which is useful
|
|
78
78
|
* for diagnosing resource load issues.
|
|
@@ -21,7 +21,7 @@ import type {Metric} from './base.js';
|
|
|
21
21
|
*/
|
|
22
22
|
export interface TTFBMetric extends Metric {
|
|
23
23
|
name: 'TTFB';
|
|
24
|
-
entries: PerformanceNavigationTiming[];
|
|
24
|
+
entries: PerformanceNavigationTiming[] | PerformanceSoftNavigation[];
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
/**
|
|
@@ -67,7 +67,7 @@ export interface TTFBAttribution {
|
|
|
67
67
|
* general page load issues. This can be used to access `serverTiming` for
|
|
68
68
|
* example: navigationEntry?.serverTiming
|
|
69
69
|
*/
|
|
70
|
-
navigationEntry?: PerformanceNavigationTiming;
|
|
70
|
+
navigationEntry?: PerformanceNavigationTiming | PerformanceSoftNavigation;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
/**
|
|
@@ -27,9 +27,13 @@ export * from './types/ttfb.js';
|
|
|
27
27
|
// --------------------------------------------------------------------------
|
|
28
28
|
|
|
29
29
|
interface PerformanceEntryMap {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
'event': PerformanceEventTiming;
|
|
31
|
+
'interaction-contentful-paint': InteractionContentfulPaint;
|
|
32
|
+
'layout-shift': LayoutShift;
|
|
33
|
+
'navigation': PerformanceNavigationTiming;
|
|
34
|
+
'paint': PerformancePaintTiming;
|
|
35
|
+
'resource': PerformanceResourceTiming;
|
|
36
|
+
'soft-navigation': PerformanceSoftNavigation;
|
|
33
37
|
}
|
|
34
38
|
|
|
35
39
|
// Update built-in types to be more accurate.
|
|
@@ -47,13 +51,18 @@ declare global {
|
|
|
47
51
|
): PerformanceEntryMap[K][];
|
|
48
52
|
}
|
|
49
53
|
|
|
54
|
+
// https://w3c.github.io/event-timing/#sec-modifications-perf-timeline
|
|
55
|
+
interface PerformanceEntry {
|
|
56
|
+
navigationId?: number;
|
|
57
|
+
}
|
|
58
|
+
|
|
50
59
|
// https://w3c.github.io/event-timing/#sec-modifications-perf-timeline
|
|
51
60
|
interface PerformanceObserverInit {
|
|
52
61
|
durationThreshold?: number;
|
|
53
62
|
}
|
|
54
63
|
|
|
55
64
|
// https://wicg.github.io/nav-speculation/prerendering.html#performance-navigation-timing-extension
|
|
56
|
-
interface PerformanceNavigationTiming {
|
|
65
|
+
interface PerformanceNavigationTiming extends PerformanceEntry {
|
|
57
66
|
activationStart?: number;
|
|
58
67
|
}
|
|
59
68
|
|
|
@@ -61,6 +70,7 @@ declare global {
|
|
|
61
70
|
interface PerformanceEventTiming extends PerformanceEntry {
|
|
62
71
|
duration: DOMHighResTimeStamp;
|
|
63
72
|
readonly interactionId: number;
|
|
73
|
+
readonly targetSelector: string;
|
|
64
74
|
}
|
|
65
75
|
|
|
66
76
|
// https://wicg.github.io/layout-instability/#sec-layout-shift-attribution
|
|
@@ -87,6 +97,23 @@ declare global {
|
|
|
87
97
|
readonly element: Element | null;
|
|
88
98
|
}
|
|
89
99
|
|
|
100
|
+
// https://github.com/WICG/soft-navigations
|
|
101
|
+
interface InteractionContentfulPaint extends PerformanceEntry {
|
|
102
|
+
readonly interactionId: number;
|
|
103
|
+
readonly largestContentfulPaint?: LargestContentfulPaint;
|
|
104
|
+
}
|
|
105
|
+
interface PerformanceSoftNavigation extends PerformanceEntry {
|
|
106
|
+
readonly interactionId: number;
|
|
107
|
+
readonly navigationType?: NavigationType;
|
|
108
|
+
readonly paintTime?: number;
|
|
109
|
+
readonly presentationTime?: number;
|
|
110
|
+
readonly getLargestInteractionContentfulPaint?: () => InteractionContentfulPaint | null;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
var PerformanceSoftNavigation: {
|
|
114
|
+
prototype: PerformanceSoftNavigation;
|
|
115
|
+
};
|
|
116
|
+
|
|
90
117
|
// https://w3c.github.io/long-animation-frame/#sec-PerformanceLongAnimationFrameTiming
|
|
91
118
|
export type ScriptInvokerType =
|
|
92
119
|
| 'classic-script'
|
|
@@ -98,11 +125,7 @@ declare global {
|
|
|
98
125
|
|
|
99
126
|
// https://w3c.github.io/long-animation-frame/#sec-PerformanceLongAnimationFrameTiming
|
|
100
127
|
export type ScriptWindowAttribution =
|
|
101
|
-
| '
|
|
102
|
-
| 'descendant'
|
|
103
|
-
| 'ancestor'
|
|
104
|
-
| 'same-page'
|
|
105
|
-
| 'other';
|
|
128
|
+
'self' | 'descendant' | 'ancestor' | 'same-page' | 'other';
|
|
106
129
|
|
|
107
130
|
// https://w3c.github.io/long-animation-frame/#sec-PerformanceLongAnimationFrameTiming
|
|
108
131
|
interface PerformanceScriptTiming extends PerformanceEntry {
|