chrome-devtools-frontend 1.0.1376716 → 1.0.1380117
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/config/gni/devtools_grd_files.gni +15 -7
- package/config/gni/devtools_image_files.gni +2 -0
- package/front_end/Images/src/animation.svg +3 -0
- package/front_end/Images/src/brush-2.svg +3 -0
- package/front_end/core/common/SettingRegistration.ts +1 -1
- package/front_end/core/host/AidaClient.ts +1 -0
- package/front_end/core/host/InspectorFrontendHost.ts +4 -0
- package/front_end/core/i18n/ByteUtilities.test.ts +34 -0
- package/front_end/core/i18n/ByteUtilities.ts +65 -0
- package/front_end/core/i18n/NumberFormatter.ts +75 -0
- package/front_end/core/i18n/i18n.ts +4 -0
- package/front_end/core/i18n/time-utilities.test.ts +20 -2
- package/front_end/core/i18n/time-utilities.ts +125 -86
- package/front_end/core/platform/NumberUtilities.test.ts +3 -26
- package/front_end/core/platform/NumberUtilities.ts +0 -20
- package/front_end/core/root/Runtime.ts +6 -3
- package/front_end/core/sdk/CPUThrottlingManager.ts +4 -0
- package/front_end/core/sdk/CSSContainerQuery.test.ts +10 -16
- package/front_end/core/sdk/CSSContainerQuery.ts +3 -15
- package/front_end/core/sdk/CSSMatchedStyles.test.ts +4 -0
- package/front_end/core/sdk/CSSMatchedStyles.ts +5 -5
- package/front_end/core/sdk/CSSModel.ts +18 -0
- package/front_end/core/sdk/CSSPropertyParser.test.ts +16 -1
- package/front_end/core/sdk/CSSPropertyParser.ts +2 -2
- package/front_end/core/sdk/sdk-meta.ts +8 -0
- package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshot.ts +3 -3
- package/front_end/generated/ARIAProperties.js +4 -0
- package/front_end/generated/InspectorBackendCommands.js +8 -6
- package/front_end/generated/SupportedCSSProperties.js +17 -4
- package/front_end/generated/protocol-mapping.d.ts +15 -1
- package/front_end/generated/protocol-proxy-api.d.ts +14 -1
- package/front_end/generated/protocol.ts +26 -2
- package/front_end/models/extensions/ExtensionAPI.ts +9 -1
- package/front_end/models/heap_snapshot_model/HeapSnapshotModel.ts +2 -0
- package/front_end/models/javascript_metadata/NativeFunctions.js +8 -21
- package/front_end/models/live-metrics/web-vitals-injected/{rollup.config.js → rollup.config.mjs} +1 -1
- package/front_end/models/persistence/EditFileSystemView.ts +19 -9
- package/front_end/models/persistence/WorkspaceSettingsTab.ts +50 -54
- package/front_end/models/persistence/editFileSystemView.css +35 -15
- package/front_end/models/persistence/workspaceSettingsTab.css +21 -87
- package/front_end/models/timeline_model/timeline_model.ts +0 -6
- package/front_end/models/trace/Processor.test.ts +18 -17
- package/front_end/models/trace/Processor.ts +10 -14
- package/front_end/models/trace/README.md +0 -1
- package/front_end/models/{timeline_model → trace/extras}/TimelineJSProfile.ts +19 -29
- package/front_end/models/{timeline_model/TimelineModelFilter.test.ts → trace/extras/TraceFilter.test.ts} +15 -17
- package/front_end/models/trace/extras/TraceFilter.ts +62 -0
- package/front_end/models/{timeline_model/TimelineProfileTree.test.ts → trace/extras/TraceTree.test.ts} +44 -43
- package/front_end/models/{timeline_model/TimelineProfileTree.ts → trace/extras/TraceTree.ts} +65 -59
- package/front_end/models/trace/extras/extras.ts +3 -0
- package/front_end/models/trace/handlers/AnimationHandler.ts +0 -8
- package/front_end/models/trace/handlers/ExtensionTraceDataHandler.ts +1 -11
- package/front_end/models/trace/handlers/FramesHandler.test.ts +1 -6
- package/front_end/models/trace/handlers/FramesHandler.ts +1 -14
- package/front_end/models/trace/handlers/GPUHandler.test.ts +0 -2
- package/front_end/models/trace/handlers/GPUHandler.ts +1 -25
- package/front_end/models/trace/handlers/ImagePaintingHandler.ts +3 -0
- package/front_end/models/trace/handlers/InitiatorsHandler.test.ts +0 -1
- package/front_end/models/trace/handlers/InitiatorsHandler.ts +0 -20
- package/front_end/models/trace/handlers/InvalidationsHandler.test.ts +0 -1
- package/front_end/models/trace/handlers/InvalidationsHandler.ts +0 -18
- package/front_end/models/trace/handlers/LargestImagePaintHandler.test.ts +2 -2
- package/front_end/models/trace/handlers/LargestImagePaintHandler.ts +63 -3
- package/front_end/models/trace/handlers/LargestTextPaintHandler.ts +3 -0
- package/front_end/models/trace/handlers/LayerTreeHandler.test.ts +0 -2
- package/front_end/models/trace/handlers/LayerTreeHandler.ts +1 -18
- package/front_end/models/trace/handlers/LayoutShiftsHandler.test.ts +0 -3
- package/front_end/models/trace/handlers/LayoutShiftsHandler.ts +1 -20
- package/front_end/models/trace/handlers/MemoryHandler.test.ts +0 -1
- package/front_end/models/trace/handlers/MemoryHandler.ts +3 -0
- package/front_end/models/trace/handlers/MetaHandler.test.ts +1 -32
- package/front_end/models/trace/handlers/MetaHandler.ts +2 -30
- package/front_end/models/trace/handlers/NetworkRequestsHandler.test.ts +0 -26
- package/front_end/models/trace/handlers/NetworkRequestsHandler.ts +4 -23
- package/front_end/models/trace/handlers/PageFramesHandler.ts +3 -0
- package/front_end/models/trace/handlers/RendererHandler.test.ts +0 -4
- package/front_end/models/trace/handlers/RendererHandler.ts +1 -24
- package/front_end/models/trace/handlers/SamplesHandler.test.ts +0 -5
- package/front_end/models/trace/handlers/SamplesHandler.ts +0 -26
- package/front_end/models/trace/handlers/ScreenshotsHandler.test.ts +0 -1
- package/front_end/models/trace/handlers/SelectorStatsHandler.ts +3 -0
- package/front_end/models/trace/handlers/ServerTimingsHandler.ts +1 -16
- package/front_end/models/trace/handlers/Threads.test.ts +1 -2
- package/front_end/models/trace/handlers/UserInteractionsHandler.test.ts +4 -27
- package/front_end/models/trace/handlers/UserInteractionsHandler.ts +16 -25
- package/front_end/models/trace/handlers/UserTimingsHandler.ts +0 -17
- package/front_end/models/trace/handlers/WorkersHandler.test.ts +0 -1
- package/front_end/models/trace/handlers/WorkersHandler.ts +0 -23
- package/front_end/models/trace/handlers/types.ts +1 -8
- package/front_end/models/trace/insights/{CumulativeLayoutShift.test.ts → CLSCulprits.test.ts} +21 -21
- package/front_end/models/trace/insights/{CumulativeLayoutShift.ts → CLSCulprits.ts} +24 -5
- package/front_end/models/trace/insights/Common.ts +5 -55
- package/front_end/models/trace/insights/DocumentLatency.test.ts +2 -2
- package/front_end/models/trace/insights/DocumentLatency.ts +26 -6
- package/front_end/models/trace/insights/FontDisplay.ts +24 -5
- package/front_end/models/trace/insights/InteractionToNextPaint.test.ts +1 -1
- package/front_end/models/trace/insights/InteractionToNextPaint.ts +26 -6
- package/front_end/models/trace/insights/LCPDiscovery.test.ts +58 -0
- package/front_end/models/trace/insights/LCPDiscovery.ts +101 -0
- package/front_end/models/trace/insights/{LargestContentfulPaint.test.ts → LCPPhases.test.ts} +6 -28
- package/front_end/models/trace/insights/{LargestContentfulPaint.ts → LCPPhases.ts} +37 -38
- package/front_end/models/trace/insights/{InsightRunners.ts → Models.ts} +4 -3
- package/front_end/models/trace/insights/RenderBlocking.test.ts +1 -1
- package/front_end/models/trace/insights/RenderBlocking.ts +33 -28
- package/front_end/models/trace/insights/SlowCSSSelector.ts +26 -5
- package/front_end/models/trace/insights/{ThirdPartyWeb.test.ts → ThirdParties.test.ts} +3 -3
- package/front_end/models/trace/insights/{ThirdPartyWeb.ts → ThirdParties.ts} +24 -5
- package/front_end/models/trace/insights/Viewport.test.ts +1 -1
- package/front_end/models/trace/insights/Viewport.ts +27 -9
- package/front_end/models/trace/insights/insights.ts +1 -1
- package/front_end/models/trace/insights/types.ts +11 -9
- package/front_end/models/trace/types/TraceEvents.ts +51 -22
- package/front_end/panels/application/SharedStorageItemsView.test.ts +3 -3
- package/front_end/panels/application/SharedStorageItemsView.ts +5 -3
- package/front_end/panels/application/StorageView.ts +3 -3
- package/front_end/panels/application/components/StorageMetadataView.ts +1 -2
- package/front_end/panels/browser_debugger/XHRBreakpointsSidebarPane.ts +34 -31
- package/front_end/panels/coverage/CoverageView.ts +3 -3
- package/front_end/panels/elements/ComputedStyleModel.ts +9 -2
- package/front_end/panels/elements/ComputedStyleWidget.test.ts +72 -0
- package/front_end/panels/elements/ComputedStyleWidget.ts +12 -0
- package/front_end/panels/elements/ElementStatePaneWidget.test.ts +84 -30
- package/front_end/panels/elements/ElementStatePaneWidget.ts +42 -24
- package/front_end/panels/elements/ElementsTreeElement.ts +24 -11
- package/front_end/panels/elements/MetricsSidebarPane.ts +12 -7
- package/front_end/panels/elements/PropertyMatchers.ts +3 -0
- package/front_end/panels/elements/StylePropertiesSection.ts +15 -6
- package/front_end/panels/elements/StylePropertyTreeElement.test.ts +3 -1
- package/front_end/panels/elements/StylePropertyTreeElement.ts +8 -3
- package/front_end/panels/elements/stylePropertiesTreeOutline.css +2 -2
- package/front_end/panels/explain/components/ConsoleInsight.ts +8 -18
- package/front_end/panels/freestyler/AiAgent.test.ts +58 -1
- package/front_end/panels/freestyler/AiAgent.ts +58 -3
- package/front_end/panels/freestyler/DrJonesFileAgent.test.ts +99 -23
- package/front_end/panels/freestyler/DrJonesFileAgent.ts +53 -20
- package/front_end/panels/freestyler/DrJonesNetworkAgent.test.ts +15 -7
- package/front_end/panels/freestyler/DrJonesNetworkAgent.ts +36 -15
- package/front_end/panels/freestyler/DrJonesPerformanceAgent.test.ts +6 -6
- package/front_end/panels/freestyler/DrJonesPerformanceAgent.ts +48 -8
- package/front_end/panels/freestyler/FreestylerAgent.test.ts +15 -14
- package/front_end/panels/freestyler/FreestylerAgent.ts +52 -8
- package/front_end/panels/freestyler/FreestylerPanel.test.ts +539 -39
- package/front_end/panels/freestyler/FreestylerPanel.ts +349 -215
- package/front_end/panels/freestyler/components/FreestylerChatUi.test.ts +126 -34
- package/front_end/panels/freestyler/components/FreestylerChatUi.ts +320 -268
- package/front_end/panels/freestyler/components/UserActionRow.ts +156 -47
- package/front_end/panels/freestyler/components/freestylerChatUi.css +69 -34
- package/front_end/panels/freestyler/components/userActionRow.css +40 -67
- package/front_end/panels/freestyler/freestyler-meta.ts +3 -11
- package/front_end/panels/issues/components/HideIssuesMenu.ts +2 -11
- package/front_end/panels/layer_viewer/LayerDetailsView.ts +1 -2
- package/front_end/panels/layer_viewer/PaintProfilerView.ts +5 -5
- package/front_end/panels/lighthouse/LighthouseReportRenderer.ts +46 -0
- package/front_end/panels/mobile_throttling/ThrottlingSettingsTab.ts +26 -17
- package/front_end/panels/mobile_throttling/throttlingSettingsTab.css +25 -19
- package/front_end/panels/network/BinaryResourceView.ts +6 -7
- package/front_end/panels/network/EventSourceMessagesView.ts +1 -1
- package/front_end/panels/network/NetworkDataGridNode.ts +3 -3
- package/front_end/panels/network/NetworkLogView.ts +7 -8
- package/front_end/panels/network/RequestTimingView.test.ts +35 -1
- package/front_end/panels/network/RequestTimingView.ts +96 -0
- package/front_end/panels/network/ResourceWebSocketFrameView.ts +2 -2
- package/front_end/panels/network/networkTimingTable.css +2 -1
- package/front_end/panels/performance_monitor/PerformanceMonitor.ts +1 -1
- package/front_end/panels/profiler/HeapProfileView.ts +3 -3
- package/front_end/panels/profiler/HeapSnapshotView.ts +2 -2
- package/front_end/panels/profiler/HeapTimelineOverview.ts +12 -12
- package/front_end/panels/profiler/IsolateSelector.ts +3 -4
- package/front_end/panels/profiler/ProfileFlameChartDataProvider.ts +1 -1
- package/front_end/panels/profiler/ProfileSidebarTreeElement.ts +7 -6
- package/front_end/panels/profiler/ProfileView.ts +1 -1
- package/front_end/panels/recorder/components/RecordingView.ts +2 -2
- package/front_end/panels/recorder/injected/{rollup.config.js → rollup.config.mjs} +1 -1
- package/front_end/panels/recorder/recorderController.css +0 -4
- package/front_end/panels/security/CookieReportTreeElement.ts +1 -9
- package/front_end/panels/security/CookieReportView.ts +120 -0
- package/front_end/panels/security/SecurityPanel.ts +8 -2
- package/front_end/panels/security/cookieReportView.css +46 -0
- package/front_end/panels/security/sidebar.css +1 -2
- package/front_end/panels/sensors/LocationsSettingsTab.ts +26 -11
- package/front_end/panels/sensors/locationsSettingsTab.css +18 -18
- package/front_end/panels/settings/AISettingsTab.ts +6 -15
- package/front_end/panels/settings/KeybindsSettingsTab.ts +1 -1
- package/front_end/panels/settings/SettingsScreen.ts +61 -56
- package/front_end/panels/settings/aiSettingsTab.css +3 -14
- package/front_end/panels/settings/components/SyncSection.ts +1 -2
- package/front_end/panels/settings/components/syncSection.css +0 -10
- package/front_end/panels/settings/frameworkIgnoreListSettingsTab.css +3 -1
- package/front_end/panels/settings/keybindsSettingsTab.css +7 -10
- package/front_end/panels/settings/settingsScreen.css +27 -125
- package/front_end/panels/sources/DebuggerPlugin.ts +9 -4
- package/front_end/panels/sources/NavigatorView.ts +11 -13
- package/front_end/panels/timeline/ActiveFilters.ts +3 -4
- package/front_end/panels/timeline/AnimationsTrackAppender.ts +1 -2
- package/front_end/panels/timeline/CountersGraph.ts +2 -4
- package/front_end/panels/timeline/EventsTimelineTreeView.ts +7 -8
- package/front_end/panels/timeline/README.md +2 -1
- package/front_end/panels/timeline/TimelineController.ts +14 -4
- package/front_end/panels/timeline/TimelineEventOverview.ts +3 -4
- package/front_end/panels/timeline/TimelineFilters.ts +3 -4
- package/front_end/panels/timeline/TimelineFlameChartDataProvider.test.ts +1 -1
- package/front_end/panels/timeline/TimelineFlameChartDataProvider.ts +3 -10
- package/front_end/panels/timeline/TimelineFlameChartNetworkDataProvider.ts +1 -2
- package/front_end/panels/timeline/TimelineFlameChartView.ts +21 -12
- package/front_end/panels/timeline/TimelineLoader.test.ts +1 -2
- package/front_end/panels/timeline/TimelineLoader.ts +3 -4
- package/front_end/panels/timeline/TimelineMiniMap.ts +10 -0
- package/front_end/panels/timeline/TimelinePanel.ts +20 -8
- package/front_end/panels/timeline/TimelineTreeView.test.ts +12 -13
- package/front_end/panels/timeline/TimelineTreeView.ts +35 -40
- package/front_end/panels/timeline/TimelineUIUtils.test.ts +2 -2
- package/front_end/panels/timeline/TimelineUIUtils.ts +12 -14
- package/front_end/panels/timeline/components/LayoutShiftDetails.ts +6 -7
- package/front_end/panels/timeline/components/LiveMetricsView.test.ts +3 -3
- package/front_end/panels/timeline/components/LiveMetricsView.ts +14 -26
- package/front_end/panels/timeline/components/MetricCard.test.ts +1 -1
- package/front_end/panels/timeline/components/MetricCard.ts +46 -0
- package/front_end/panels/timeline/components/NetworkRequestDetails.ts +3 -4
- package/front_end/panels/timeline/components/SidebarSingleInsightSet.test.ts +2 -0
- package/front_end/panels/timeline/components/SidebarSingleInsightSet.ts +41 -36
- package/front_end/panels/timeline/components/insights/CLSCulprits.ts +19 -33
- package/front_end/panels/timeline/components/insights/DocumentLatency.ts +29 -40
- package/front_end/panels/timeline/components/insights/FontDisplay.ts +17 -23
- package/front_end/panels/timeline/components/insights/Helpers.ts +12 -16
- package/front_end/panels/timeline/components/insights/InteractionToNextPaint.ts +14 -26
- package/front_end/panels/timeline/components/insights/LCPDiscovery.ts +25 -37
- package/front_end/panels/timeline/components/insights/LCPPhases.ts +20 -47
- package/front_end/panels/timeline/components/insights/RenderBlocking.ts +19 -28
- package/front_end/panels/timeline/components/insights/SidebarInsight.ts +1 -2
- package/front_end/panels/timeline/components/insights/SlowCSSSelector.ts +18 -31
- package/front_end/panels/timeline/components/insights/Table.ts +5 -3
- package/front_end/panels/timeline/components/insights/ThirdParties.ts +18 -25
- package/front_end/panels/timeline/components/insights/Viewport.ts +14 -25
- package/front_end/panels/timeline/components/liveMetricsView.css +5 -13
- package/front_end/panels/timeline/components/metricCard.css +11 -0
- package/front_end/panels/timeline/components/sidebarInsightsTab.css +1 -1
- package/front_end/panels/timeline/overlays/OverlaysImpl.test.ts +5 -5
- package/front_end/panels/timeline/overlays/OverlaysImpl.ts +13 -12
- package/front_end/panels/timeline/timelineFlameChartView.css +1 -1
- package/front_end/panels/timeline/utils/AICallTree.test.ts +105 -0
- package/front_end/panels/timeline/utils/AICallTree.ts +25 -24
- package/front_end/testing/EnvironmentHelpers.ts +5 -18
- package/front_end/testing/InsightHelpers.ts +4 -4
- package/front_end/testing/TraceHelpers.ts +1 -1
- package/front_end/third_party/puppeteer/README.chromium +2 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Browser.d.ts +2 -3
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Browser.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Browser.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/ElementHandle.d.ts +14 -3
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/ElementHandle.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/ElementHandle.js +16 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/ElementHandle.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Input.d.ts +34 -5
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Input.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Input.js +51 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Input.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/ElementHandle.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/ElementHandle.js +10 -8
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/ElementHandle.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Frame.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Frame.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Frame.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Input.d.ts +14 -4
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Input.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Input.js +57 -23
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Input.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/ElementHandle.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/ElementHandle.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/ElementHandle.js +13 -10
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/ElementHandle.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Input.d.ts +15 -4
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Input.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Input.js +55 -26
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Input.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/CallbackRegistry.d.ts +0 -8
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/CallbackRegistry.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/CallbackRegistry.js +2 -11
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/CallbackRegistry.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConsoleMessage.d.ts +2 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConsoleMessage.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConsoleMessage.js +5 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConsoleMessage.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Errors.d.ts +7 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Errors.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Errors.js +9 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Errors.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/WaitTask.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/WaitTask.js +5 -3
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/WaitTask.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/environment.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/environment.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/environment.js +0 -3
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/environment.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/generated/injected.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/generated/injected.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/generated/version.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/generated/version.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/injected/injected.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.d.ts +3 -3
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.js +3 -3
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/Mutex.d.ts +2 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/incremental-id-generator.d.ts +14 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/incremental-id-generator.d.ts.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/incremental-id-generator.js +18 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/incremental-id-generator.js.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.d.ts +51 -10
- package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.js +215 -97
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Browser.d.ts +2 -3
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Browser.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Browser.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/ElementHandle.d.ts +14 -3
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/ElementHandle.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/ElementHandle.js +16 -2
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/ElementHandle.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Input.d.ts +34 -5
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Input.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Input.js +51 -2
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Input.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/ElementHandle.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/ElementHandle.js +10 -8
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/ElementHandle.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Frame.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Frame.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Frame.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Input.d.ts +14 -4
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Input.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Input.js +57 -23
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Input.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/ElementHandle.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/ElementHandle.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/ElementHandle.js +13 -10
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/ElementHandle.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Input.d.ts +15 -4
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Input.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Input.js +55 -26
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Input.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/CallbackRegistry.d.ts +0 -8
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/CallbackRegistry.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/CallbackRegistry.js +1 -9
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/CallbackRegistry.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/ConsoleMessage.d.ts +2 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/ConsoleMessage.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/ConsoleMessage.js +5 -2
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/ConsoleMessage.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Errors.d.ts +7 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Errors.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Errors.js +7 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Errors.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/WaitTask.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/WaitTask.js +5 -3
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/WaitTask.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/environment.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/environment.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/environment.js +0 -3
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/environment.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/generated/injected.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/generated/injected.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/generated/version.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/generated/version.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.d.ts +3 -3
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.js +3 -3
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/incremental-id-generator.d.ts +14 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/incremental-id-generator.d.ts.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/incremental-id-generator.js +15 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/incremental-id-generator.js.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/types.d.ts +51 -10
- package/front_end/third_party/puppeteer/package/package.json +4 -4
- package/front_end/third_party/puppeteer/package/src/api/Browser.ts +2 -3
- package/front_end/third_party/puppeteer/package/src/api/ElementHandle.ts +21 -3
- package/front_end/third_party/puppeteer/package/src/api/Input.ts +57 -8
- package/front_end/third_party/puppeteer/package/src/bidi/ElementHandle.ts +9 -7
- package/front_end/third_party/puppeteer/package/src/bidi/Frame.ts +1 -0
- package/front_end/third_party/puppeteer/package/src/bidi/Input.ts +72 -31
- package/front_end/third_party/puppeteer/package/src/cdp/ElementHandle.ts +14 -9
- package/front_end/third_party/puppeteer/package/src/cdp/Input.ts +71 -26
- package/front_end/third_party/puppeteer/package/src/common/CallbackRegistry.ts +1 -15
- package/front_end/third_party/puppeteer/package/src/common/ConsoleMessage.ts +8 -1
- package/front_end/third_party/puppeteer/package/src/common/Errors.ts +7 -0
- package/front_end/third_party/puppeteer/package/src/common/WaitTask.ts +9 -9
- package/front_end/third_party/puppeteer/package/src/environment.ts +1 -4
- package/front_end/third_party/puppeteer/package/src/generated/injected.ts +1 -1
- package/front_end/third_party/puppeteer/package/src/generated/version.ts +1 -1
- package/front_end/third_party/puppeteer/package/src/revisions.ts +3 -3
- package/front_end/third_party/puppeteer/package/src/util/incremental-id-generator.ts +20 -0
- package/front_end/third_party/puppeteer/puppeteer-tsconfig.json +1 -0
- package/front_end/ui/components/buttons/Button.test.ts +14 -0
- package/front_end/ui/components/buttons/Button.ts +27 -4
- package/front_end/ui/components/cards/card.css +7 -4
- package/front_end/ui/components/dialogs/Dialog.ts +2 -4
- package/front_end/ui/components/dialogs/ShortcutDialog.ts +15 -13
- package/front_end/ui/components/dialogs/dialog.css +2 -6
- package/front_end/ui/components/dialogs/shortcutDialog.css +33 -41
- package/front_end/ui/components/docs/freestyler/basic.ts +6 -8
- package/front_end/ui/components/docs/freestyler/empty_state.ts +6 -8
- package/front_end/ui/components/docs/performance_panel/track_example.html +1 -1
- package/front_end/ui/components/markdown_view/MarkdownView.test.ts +39 -17
- package/front_end/ui/components/markdown_view/MarkdownView.ts +77 -14
- package/front_end/ui/components/markdown_view/markdownView.css +15 -0
- package/front_end/ui/components/settings/SettingCheckbox.ts +3 -2
- package/front_end/ui/legacy/ContextMenu.ts +2 -2
- package/front_end/ui/legacy/InplaceEditor.ts +18 -14
- package/front_end/ui/legacy/TabbedPane.ts +0 -14
- package/front_end/ui/legacy/UIUtils.ts +0 -7
- package/front_end/ui/legacy/components/cookie_table/CookiesTable.ts +7 -2
- package/front_end/ui/legacy/components/data_grid/DataGrid.ts +8 -4
- package/front_end/ui/legacy/components/data_grid/ViewportDataGrid.ts +20 -11
- package/front_end/ui/legacy/components/inline_editor/LinkSwatch.test.ts +19 -0
- package/front_end/ui/legacy/components/inline_editor/LinkSwatch.ts +1 -1
- package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +1 -1
- package/front_end/ui/legacy/components/perf_ui/FlameChart.ts +5 -22
- package/front_end/ui/legacy/components/perf_ui/OverviewGrid.ts +129 -100
- package/front_end/ui/legacy/components/perf_ui/TimelineGrid.ts +4 -2
- package/front_end/ui/legacy/components/perf_ui/TimelineOverviewCalculator.test.ts +9 -4
- package/front_end/ui/legacy/components/perf_ui/TimelineOverviewCalculator.ts +6 -6
- package/front_end/ui/legacy/components/perf_ui/TimelineOverviewPane.ts +22 -4
- package/front_end/ui/legacy/components/perf_ui/flameChart.css +0 -2
- package/front_end/ui/legacy/components/source_frame/BinaryResourceViewFactory.test.ts +49 -0
- package/front_end/ui/legacy/components/source_frame/BinaryResourceViewFactory.ts +23 -46
- package/front_end/ui/legacy/components/source_frame/ImageView.ts +1 -1
- package/front_end/ui/legacy/components/utils/ImagePreview.ts +1 -1
- package/front_end/ui/legacy/textPrompt.css +1 -1
- package/front_end/ui/legacy/toolbar.css +4 -5
- package/front_end/ui/visual_logging/KnownContextValues.ts +174 -0
- package/front_end/ui/visual_logging/LoggingConfig.ts +6 -2
- package/package.json +7 -6
- package/scripts/build/ninja/bundle.gni +3 -3
- package/scripts/build/{rollup.config.js → rollup.config.mjs} +4 -4
- package/scripts/devtools_paths.py +8 -4
- package/scripts/eslint_rules/tests/check_test_definitions_test.js +8 -3
- package/scripts/tools/update_goldens_v2.py +1 -1
- package/front_end/models/timeline_model/TimelineModelFilter.ts +0 -61
- /package/front_end/Images/{rollup.config.js → rollup.config.mjs} +0 -0
@@ -5,8 +5,6 @@
|
|
5
5
|
import * as Helpers from '../helpers/helpers.js';
|
6
6
|
import * as Types from '../types/types.js';
|
7
7
|
|
8
|
-
import {HandlerState} from './types.js';
|
9
|
-
|
10
8
|
/**
|
11
9
|
* IMPORTANT!
|
12
10
|
* See UserTimings.md in this directory for some handy documentation on
|
@@ -43,7 +41,6 @@ export interface UserTimingsData {
|
|
43
41
|
*/
|
44
42
|
timestampEvents: readonly Types.Events.TimeStamp[];
|
45
43
|
}
|
46
|
-
let handlerState = HandlerState.UNINITIALIZED;
|
47
44
|
|
48
45
|
export function reset(): void {
|
49
46
|
syntheticEvents.length = 0;
|
@@ -51,7 +48,6 @@ export function reset(): void {
|
|
51
48
|
performanceMarkEvents.length = 0;
|
52
49
|
consoleTimings.length = 0;
|
53
50
|
timestampEvents.length = 0;
|
54
|
-
handlerState = HandlerState.INITIALIZED;
|
55
51
|
}
|
56
52
|
|
57
53
|
const resourceTimingNames = [
|
@@ -143,10 +139,6 @@ function userTimingComparator(
|
|
143
139
|
}
|
144
140
|
|
145
141
|
export function handleEvent(event: Types.Events.Event): void {
|
146
|
-
if (handlerState !== HandlerState.INITIALIZED) {
|
147
|
-
throw new Error('UserTimings handler is not initialized');
|
148
|
-
}
|
149
|
-
|
150
142
|
if (ignoredNames.includes(event.name)) {
|
151
143
|
return;
|
152
144
|
}
|
@@ -167,21 +159,12 @@ export function handleEvent(event: Types.Events.Event): void {
|
|
167
159
|
}
|
168
160
|
|
169
161
|
export async function finalize(): Promise<void> {
|
170
|
-
if (handlerState !== HandlerState.INITIALIZED) {
|
171
|
-
throw new Error('UserTimings handler is not initialized');
|
172
|
-
}
|
173
|
-
|
174
162
|
const asyncEvents = [...performanceMeasureEvents, ...consoleTimings];
|
175
163
|
syntheticEvents = Helpers.Trace.createMatchedSortedSyntheticEvents(asyncEvents);
|
176
164
|
syntheticEvents = syntheticEvents.sort((a, b) => userTimingComparator(a, b, [...syntheticEvents]));
|
177
|
-
handlerState = HandlerState.FINALIZED;
|
178
165
|
}
|
179
166
|
|
180
167
|
export function data(): UserTimingsData {
|
181
|
-
if (handlerState !== HandlerState.FINALIZED) {
|
182
|
-
throw new Error('UserTimings handler is not finalized');
|
183
|
-
}
|
184
|
-
|
185
168
|
return {
|
186
169
|
performanceMeasures: syntheticEvents.filter(e => e.cat === 'blink.user_timing') as
|
187
170
|
Types.Events.SyntheticUserTimingPair[],
|
@@ -9,7 +9,6 @@ describe('WorkersHandler', () => {
|
|
9
9
|
beforeEach(async function() {
|
10
10
|
Trace.Handlers.ModelHandlers.Workers.reset();
|
11
11
|
const events = await TraceLoader.rawEvents(this, 'two-workers.json.gz');
|
12
|
-
Trace.Handlers.ModelHandlers.Workers.initialize();
|
13
12
|
for (const event of events) {
|
14
13
|
Trace.Handlers.ModelHandlers.Workers.handleEvent(event);
|
15
14
|
}
|
@@ -4,47 +4,29 @@
|
|
4
4
|
|
5
5
|
import * as Types from '../types/types.js';
|
6
6
|
|
7
|
-
import {HandlerState} from './types.js';
|
8
|
-
|
9
7
|
export interface WorkersData {
|
10
8
|
workerSessionIdEvents: readonly Types.Events.TracingSessionIdForWorker[];
|
11
9
|
workerIdByThread: Map<Types.Events.ThreadID, Types.Events.WorkerId>;
|
12
10
|
workerURLById: Map<Types.Events.WorkerId, string>;
|
13
11
|
}
|
14
|
-
let handlerState = HandlerState.UNINITIALIZED;
|
15
12
|
|
16
13
|
const sessionIdEvents: Types.Events.TracingSessionIdForWorker[] = [];
|
17
14
|
const workerIdByThread: Map<Types.Events.ThreadID, Types.Events.WorkerId> = new Map();
|
18
15
|
const workerURLById: Map<Types.Events.WorkerId, string> = new Map();
|
19
16
|
|
20
|
-
export function initialize(): void {
|
21
|
-
if (handlerState !== HandlerState.UNINITIALIZED) {
|
22
|
-
throw new Error('Workers Handler was not reset');
|
23
|
-
}
|
24
|
-
|
25
|
-
handlerState = HandlerState.INITIALIZED;
|
26
|
-
}
|
27
|
-
|
28
17
|
export function reset(): void {
|
29
18
|
sessionIdEvents.length = 0;
|
30
19
|
workerIdByThread.clear();
|
31
20
|
workerURLById.clear();
|
32
|
-
handlerState = HandlerState.UNINITIALIZED;
|
33
21
|
}
|
34
22
|
|
35
23
|
export function handleEvent(event: Types.Events.Event): void {
|
36
|
-
if (handlerState !== HandlerState.INITIALIZED) {
|
37
|
-
throw new Error('Workers Handler is not initialized');
|
38
|
-
}
|
39
24
|
if (Types.Events.isTracingSessionIdForWorker(event)) {
|
40
25
|
sessionIdEvents.push(event);
|
41
26
|
}
|
42
27
|
}
|
43
28
|
|
44
29
|
export async function finalize(): Promise<void> {
|
45
|
-
if (handlerState !== HandlerState.INITIALIZED) {
|
46
|
-
throw new Error('Handler is not initialized');
|
47
|
-
}
|
48
30
|
for (const sessionIdEvent of sessionIdEvents) {
|
49
31
|
if (!sessionIdEvent.args.data) {
|
50
32
|
continue;
|
@@ -52,14 +34,9 @@ export async function finalize(): Promise<void> {
|
|
52
34
|
workerIdByThread.set(sessionIdEvent.args.data.workerThreadId, sessionIdEvent.args.data.workerId);
|
53
35
|
workerURLById.set(sessionIdEvent.args.data.workerId, sessionIdEvent.args.data.url);
|
54
36
|
}
|
55
|
-
handlerState = HandlerState.FINALIZED;
|
56
37
|
}
|
57
38
|
|
58
39
|
export function data(): WorkersData {
|
59
|
-
if (handlerState !== HandlerState.FINALIZED) {
|
60
|
-
throw new Error('Workers Handler is not finalized');
|
61
|
-
}
|
62
|
-
|
63
40
|
return {
|
64
41
|
workerSessionIdEvents: sessionIdEvents,
|
65
42
|
workerIdByThread,
|
@@ -7,9 +7,8 @@ import type * as ModelHandlers from './ModelHandlers.js';
|
|
7
7
|
|
8
8
|
export interface Handler {
|
9
9
|
reset(): void;
|
10
|
-
initialize?(freshRecording?: boolean): void;
|
11
10
|
handleEvent(data: {}): void;
|
12
|
-
finalize
|
11
|
+
finalize(): Promise<void>;
|
13
12
|
data(): unknown;
|
14
13
|
deps?(): HandlerName[];
|
15
14
|
handleUserConfig?(config: Types.Configuration.Configuration): void;
|
@@ -65,9 +64,3 @@ type DeepWriteable<T> = {
|
|
65
64
|
export type ParsedTraceMutable = DeepWriteable<ParsedTrace>;
|
66
65
|
|
67
66
|
export type Handlers = typeof ModelHandlers;
|
68
|
-
|
69
|
-
export const enum HandlerState {
|
70
|
-
UNINITIALIZED = 1,
|
71
|
-
INITIALIZED = 2,
|
72
|
-
FINALIZED = 3,
|
73
|
-
}
|
package/front_end/models/trace/insights/{CumulativeLayoutShift.test.ts → CLSCulprits.test.ts}
RENAMED
@@ -8,7 +8,7 @@ import {TraceLoader} from '../../../testing/TraceLoader.js';
|
|
8
8
|
import * as Helpers from '../helpers/helpers.js';
|
9
9
|
import * as Types from '../types/types.js';
|
10
10
|
|
11
|
-
import {
|
11
|
+
import {Models} from './insights.js';
|
12
12
|
|
13
13
|
export async function processTrace(testContext: Mocha.Suite|Mocha.Context|null, traceFile: string) {
|
14
14
|
const {parsedTrace, insights} = await TraceLoader.traceEngine(testContext, traceFile);
|
@@ -22,12 +22,12 @@ export async function processTrace(testContext: Mocha.Suite|Mocha.Context|null,
|
|
22
22
|
// Root cause invalidation window.
|
23
23
|
const INVALIDATION_WINDOW = Helpers.Timing.secondsToMicroseconds(Types.Timing.Seconds(0.5));
|
24
24
|
|
25
|
-
describeWithEnvironment('
|
25
|
+
describeWithEnvironment('CLSCulprits', function() {
|
26
26
|
describe('non composited animations', function() {
|
27
27
|
it('gets the correct non composited animations', async function() {
|
28
28
|
const {data, insights} = await processTrace(this, 'non-composited-animation.json.gz');
|
29
29
|
const firstNav = getFirstOrError(data.Meta.navigationsByNavigationId.values());
|
30
|
-
const insight = getInsightOrError('
|
30
|
+
const insight = getInsightOrError('CLSCulprits', insights, firstNav);
|
31
31
|
const {animationFailures} = insight;
|
32
32
|
|
33
33
|
const simpleAnimation = data.Animations.animations.find(animation => {
|
@@ -37,18 +37,18 @@ describeWithEnvironment('CumulativeLayoutShift', function() {
|
|
37
37
|
return animation.args.data.beginEvent.args.data.displayName === 'top';
|
38
38
|
});
|
39
39
|
|
40
|
-
const expected:
|
40
|
+
const expected: Models.CLSCulprits.NoncompositedAnimationFailure[] = [
|
41
41
|
{
|
42
42
|
name: 'simple-animation',
|
43
|
-
failureReasons: [
|
43
|
+
failureReasons: [Models.CLSCulprits.AnimationFailureReasons.UNSUPPORTED_CSS_PROPERTY],
|
44
44
|
unsupportedProperties: ['color'],
|
45
45
|
animation: simpleAnimation,
|
46
46
|
},
|
47
47
|
{
|
48
48
|
name: 'top',
|
49
49
|
failureReasons: [
|
50
|
-
|
51
|
-
|
50
|
+
Models.CLSCulprits.AnimationFailureReasons.TARGET_HAS_INVALID_COMPOSITING_STATE,
|
51
|
+
Models.CLSCulprits.AnimationFailureReasons.UNSUPPORTED_CSS_PROPERTY,
|
52
52
|
],
|
53
53
|
unsupportedProperties: ['top'],
|
54
54
|
animation: top,
|
@@ -60,7 +60,7 @@ describeWithEnvironment('CumulativeLayoutShift', function() {
|
|
60
60
|
it.skip('[crbug.com/370382177]: gets the correct non composited animations for shift', async function() {
|
61
61
|
const {data, insights} = await processTrace(this, 'non-composited-animation-shift.json.gz');
|
62
62
|
const firstNav = getFirstOrError(data.Meta.navigationsByNavigationId.values());
|
63
|
-
const insight = getInsightOrError('
|
63
|
+
const insight = getInsightOrError('CLSCulprits', insights, firstNav);
|
64
64
|
const {shifts, animationFailures} = insight;
|
65
65
|
|
66
66
|
const simpleAnimation = data.Animations.animations.find(animation => {
|
@@ -70,30 +70,30 @@ describeWithEnvironment('CumulativeLayoutShift', function() {
|
|
70
70
|
return animation.args.data.beginEvent.args.data.displayName === 'top';
|
71
71
|
});
|
72
72
|
|
73
|
-
const shiftAnimations:
|
73
|
+
const shiftAnimations: Models.CLSCulprits.NoncompositedAnimationFailure[] = [];
|
74
74
|
shifts.forEach(entry => {
|
75
75
|
shiftAnimations.push(...entry.nonCompositedAnimations);
|
76
76
|
});
|
77
|
-
const expectedWithShift:
|
77
|
+
const expectedWithShift: Models.CLSCulprits.NoncompositedAnimationFailure[] = [
|
78
78
|
{
|
79
79
|
name: 'simple-animation',
|
80
|
-
failureReasons: [
|
80
|
+
failureReasons: [Models.CLSCulprits.AnimationFailureReasons.UNSUPPORTED_CSS_PROPERTY],
|
81
81
|
unsupportedProperties: ['height', 'color', 'top'],
|
82
82
|
animation: simpleAnimation,
|
83
83
|
},
|
84
84
|
];
|
85
85
|
assert.deepStrictEqual(shiftAnimations, expectedWithShift);
|
86
86
|
|
87
|
-
const expectedAll:
|
87
|
+
const expectedAll: Models.CLSCulprits.NoncompositedAnimationFailure[] = [
|
88
88
|
{
|
89
89
|
name: 'simple-animation',
|
90
|
-
failureReasons: [
|
90
|
+
failureReasons: [Models.CLSCulprits.AnimationFailureReasons.UNSUPPORTED_CSS_PROPERTY],
|
91
91
|
unsupportedProperties: ['height', 'color', 'top'],
|
92
92
|
animation: simpleAnimation,
|
93
93
|
},
|
94
94
|
{
|
95
95
|
name: 'top',
|
96
|
-
failureReasons: [
|
96
|
+
failureReasons: [Models.CLSCulprits.AnimationFailureReasons.UNSUPPORTED_CSS_PROPERTY],
|
97
97
|
unsupportedProperties: ['top'],
|
98
98
|
animation: top,
|
99
99
|
},
|
@@ -105,7 +105,7 @@ describeWithEnvironment('CumulativeLayoutShift', function() {
|
|
105
105
|
it('returns no insights when there are no non-composited animations', async function() {
|
106
106
|
const {data, insights} = await processTrace(this, 'lcp-images.json.gz');
|
107
107
|
const firstNav = getFirstOrError(data.Meta.navigationsByNavigationId.values());
|
108
|
-
const insight = getInsightOrError('
|
108
|
+
const insight = getInsightOrError('CLSCulprits', insights, firstNav);
|
109
109
|
const {animationFailures} = insight;
|
110
110
|
|
111
111
|
assert.isEmpty(animationFailures);
|
@@ -115,7 +115,7 @@ describeWithEnvironment('CumulativeLayoutShift', function() {
|
|
115
115
|
it('returns correct layout shifts', async function() {
|
116
116
|
const {data, insights} = await processTrace(this, 'cls-single-frame.json.gz');
|
117
117
|
const firstNav = getFirstOrError(data.Meta.navigationsByNavigationId.values());
|
118
|
-
const insight = getInsightOrError('
|
118
|
+
const insight = getInsightOrError('CLSCulprits', insights, firstNav);
|
119
119
|
const {shifts} = insight;
|
120
120
|
|
121
121
|
assert.exists(shifts);
|
@@ -127,7 +127,7 @@ describeWithEnvironment('CumulativeLayoutShift', function() {
|
|
127
127
|
// Trace has a single iframe that gets created before the first layout shift and causes a layout shift.
|
128
128
|
const {data, insights} = await processTrace(this, 'iframe-shift.json.gz');
|
129
129
|
const firstNav = getFirstOrError(data.Meta.navigationsByNavigationId.values());
|
130
|
-
const insight = getInsightOrError('
|
130
|
+
const insight = getInsightOrError('CLSCulprits', insights, firstNav);
|
131
131
|
const {shifts} = insight;
|
132
132
|
|
133
133
|
assert.exists(shifts);
|
@@ -159,7 +159,7 @@ describeWithEnvironment('CumulativeLayoutShift', function() {
|
|
159
159
|
// Trace has font load before the second layout shift.
|
160
160
|
const {data, insights} = await processTrace(this, 'iframe-shift.json.gz');
|
161
161
|
const firstNav = getFirstOrError(data.Meta.navigationsByNavigationId.values());
|
162
|
-
const insight = getInsightOrError('
|
162
|
+
const insight = getInsightOrError('CLSCulprits', insights, firstNav);
|
163
163
|
const {shifts} = insight;
|
164
164
|
|
165
165
|
assert.exists(shifts);
|
@@ -193,7 +193,7 @@ describeWithEnvironment('CumulativeLayoutShift', function() {
|
|
193
193
|
it('handles potential unsized images root cause correctly', async function() {
|
194
194
|
const {data, insights} = await processTrace(this, 'unsized-images.json.gz');
|
195
195
|
const firstNav = getFirstOrError(data.Meta.navigationsByNavigationId.values());
|
196
|
-
const insight = getInsightOrError('
|
196
|
+
const insight = getInsightOrError('CLSCulprits', insights, firstNav);
|
197
197
|
const {shifts} = insight;
|
198
198
|
assert.exists(shifts);
|
199
199
|
assert.strictEqual(shifts.size, 2);
|
@@ -217,7 +217,7 @@ describeWithEnvironment('CumulativeLayoutShift', function() {
|
|
217
217
|
it('returns clusters correctly', async function() {
|
218
218
|
const {data, insights} = await processTrace(this, 'iframe-shift.json.gz');
|
219
219
|
const firstNav = getFirstOrError(data.Meta.navigationsByNavigationId.values());
|
220
|
-
const insight = getInsightOrError('
|
220
|
+
const insight = getInsightOrError('CLSCulprits', insights, firstNav);
|
221
221
|
const {shifts, clusters} = insight;
|
222
222
|
|
223
223
|
assert.exists(clusters);
|
@@ -233,7 +233,7 @@ describeWithEnvironment('CumulativeLayoutShift', function() {
|
|
233
233
|
|
234
234
|
it('returns clusters correctly for non-navigations', async function() {
|
235
235
|
const {insights} = await processTrace(this, 'cls-no-nav.json.gz');
|
236
|
-
const insight = getInsightOrError('
|
236
|
+
const insight = getInsightOrError('CLSCulprits', insights);
|
237
237
|
const {shifts, clusters} = insight;
|
238
238
|
|
239
239
|
assert.exists(clusters);
|
@@ -2,14 +2,28 @@
|
|
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 i18n from '../../../core/i18n/i18n.js';
|
5
6
|
import * as Platform from '../../../core/platform/platform.js';
|
6
7
|
import type * as Protocol from '../../../generated/protocol.js';
|
7
8
|
import * as Helpers from '../helpers/helpers.js';
|
8
9
|
import * as Types from '../types/types.js';
|
9
10
|
|
10
|
-
import type {
|
11
|
+
import type {InsightModel, InsightSetContext, RequiredData} from './types.js';
|
11
12
|
|
12
|
-
|
13
|
+
const UIStrings = {
|
14
|
+
/** Title of an insight that provides details about why elements shift/move on the page. The causes for these shifts are referred to as culprits ("reasons"). */
|
15
|
+
title: 'Layout shift culprits',
|
16
|
+
/**
|
17
|
+
* @description Description of a DevTools insight that identifies the reasons that elements shift on the page.
|
18
|
+
* This is displayed after a user expands the section to see more. No character length limits.
|
19
|
+
*/
|
20
|
+
description:
|
21
|
+
'Layout shifts occur when elements move absent any user interaction. [Investigate the causes of layout shifts](https://web.dev/articles/optimize-cls), such as elements being added, removed, or their fonts changing as the page loads.',
|
22
|
+
};
|
23
|
+
const str_ = i18n.i18n.registerUIStrings('models/trace/insights/CLSCulprits.ts', UIStrings);
|
24
|
+
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
25
|
+
|
26
|
+
export type CLSCulpritsInsightModel = InsightModel<{
|
13
27
|
animationFailures: readonly NoncompositedAnimationFailure[],
|
14
28
|
shifts: Map<Types.Events.SyntheticLayoutShift, LayoutShiftRootCausesData>,
|
15
29
|
clusters: Types.Events.SyntheticLayoutShiftCluster[],
|
@@ -406,7 +420,12 @@ function getFontRootCauses(
|
|
406
420
|
return rootCausesByShift;
|
407
421
|
}
|
408
422
|
|
409
|
-
|
423
|
+
function finalize(partialModel: Omit<CLSCulpritsInsightModel, 'title'|'description'>): CLSCulpritsInsightModel {
|
424
|
+
return {title: i18nString(UIStrings.title), description: i18nString(UIStrings.description), ...partialModel};
|
425
|
+
}
|
426
|
+
|
427
|
+
export function generateInsight(
|
428
|
+
parsedTrace: RequiredData<typeof deps>, context: InsightSetContext): CLSCulpritsInsightModel {
|
410
429
|
const isWithinContext = (event: Types.Events.Event): boolean => Helpers.Timing.eventIsInBounds(event, context.bounds);
|
411
430
|
|
412
431
|
const compositeAnimationEvents = parsedTrace.Animations.animations.filter(isWithinContext);
|
@@ -443,11 +462,11 @@ export function generateInsight(parsedTrace: RequiredData<typeof deps>, context:
|
|
443
462
|
relatedEvents.push(worstCluster);
|
444
463
|
}
|
445
464
|
|
446
|
-
return {
|
465
|
+
return finalize({
|
447
466
|
relatedEvents,
|
448
467
|
animationFailures,
|
449
468
|
shifts: rootCausesByShift,
|
450
469
|
clusters,
|
451
470
|
worstCluster,
|
452
|
-
};
|
471
|
+
});
|
453
472
|
}
|
@@ -2,14 +2,10 @@
|
|
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 type
|
6
|
-
import * as Helpers from '../helpers/helpers.js';
|
7
|
-
import type * as Types from '../types/types.js';
|
5
|
+
import type {InsightModels, TraceInsightSets} from './types.js';
|
8
6
|
|
9
|
-
|
10
|
-
|
11
|
-
export function getInsight<InsightName extends keyof InsightResults>(
|
12
|
-
insightName: InsightName, insights: TraceInsightSets|null, key: string|null): InsightResults[InsightName]|null {
|
7
|
+
export function getInsight<InsightName extends keyof InsightModels>(
|
8
|
+
insightName: InsightName, insights: TraceInsightSets|null, key: string|null): InsightModels[InsightName]|null {
|
13
9
|
if (!insights || !key) {
|
14
10
|
return null;
|
15
11
|
}
|
@@ -19,57 +15,11 @@ export function getInsight<InsightName extends keyof InsightResults>(
|
|
19
15
|
return null;
|
20
16
|
}
|
21
17
|
|
22
|
-
const insight = insightSets.
|
18
|
+
const insight = insightSets.model[insightName];
|
23
19
|
if (insight instanceof Error) {
|
24
20
|
return null;
|
25
21
|
}
|
26
22
|
|
27
23
|
// For some reason typescript won't narrow the type by removing Error, so do it manually.
|
28
|
-
return insight as
|
29
|
-
}
|
30
|
-
|
31
|
-
/**
|
32
|
-
* Finds a network request given a navigation context and URL.
|
33
|
-
* Considers redirects.
|
34
|
-
*/
|
35
|
-
export function findRequest(
|
36
|
-
parsedTrace: Pick<Handlers.Types.ParsedTrace, 'Meta'|'NetworkRequests'>, context: InsightSetContextWithNavigation,
|
37
|
-
url: string): Types.Events.SyntheticNetworkRequest|null {
|
38
|
-
const request = parsedTrace.NetworkRequests.byTime.find(req => {
|
39
|
-
const urlMatch = req.args.data.url === url || req.args.data.redirects.some(r => r.url === url);
|
40
|
-
if (!urlMatch) {
|
41
|
-
return false;
|
42
|
-
}
|
43
|
-
|
44
|
-
const nav = Helpers.Trace.getNavigationForTraceEvent(req, context.frameId, parsedTrace.Meta.navigationsByFrameId);
|
45
|
-
return nav === context.navigation;
|
46
|
-
});
|
47
|
-
return request ?? null;
|
48
|
-
}
|
49
|
-
|
50
|
-
export function findLCPRequest(
|
51
|
-
parsedTrace: Pick<Handlers.Types.ParsedTrace, 'Meta'|'NetworkRequests'|'LargestImagePaint'>,
|
52
|
-
context: InsightSetContextWithNavigation,
|
53
|
-
lcpEvent: Types.Events.LargestContentfulPaintCandidate): Types.Events.SyntheticNetworkRequest|null {
|
54
|
-
const lcpNodeId = lcpEvent.args.data?.nodeId;
|
55
|
-
if (!lcpNodeId) {
|
56
|
-
throw new Error('no lcp node id');
|
57
|
-
}
|
58
|
-
|
59
|
-
const imagePaint = parsedTrace.LargestImagePaint.get(lcpNodeId);
|
60
|
-
if (!imagePaint) {
|
61
|
-
return null;
|
62
|
-
}
|
63
|
-
|
64
|
-
const lcpUrl = imagePaint.args.data?.imageUrl;
|
65
|
-
if (!lcpUrl) {
|
66
|
-
throw new Error('no lcp url');
|
67
|
-
}
|
68
|
-
const lcpRequest = findRequest(parsedTrace, context, lcpUrl);
|
69
|
-
|
70
|
-
if (!lcpRequest) {
|
71
|
-
throw new Error('no lcp request found');
|
72
|
-
}
|
73
|
-
|
74
|
-
return lcpRequest;
|
24
|
+
return insight as InsightModels[InsightName];
|
75
25
|
}
|
@@ -58,7 +58,7 @@ describeWithEnvironment('DocumentLatency', function() {
|
|
58
58
|
|
59
59
|
const navigation = getFirstOrError(data.Meta.navigationsByNavigationId.values());
|
60
60
|
const context = createContextForNavigation(data, navigation, data.Meta.mainFrameId);
|
61
|
-
const insight = Trace.Insights.
|
61
|
+
const insight = Trace.Insights.Models.DocumentLatency.generateInsight(data, context);
|
62
62
|
assert.strictEqual(insight.data?.serverResponseTime, 1043);
|
63
63
|
assert(insight.data?.serverResponseTooSlow);
|
64
64
|
assert.deepEqual(insight.metricSavings, {FCP: 943, LCP: 943} as Trace.Insights.Types.MetricSavings);
|
@@ -92,7 +92,7 @@ describeWithEnvironment('DocumentLatency', function() {
|
|
92
92
|
|
93
93
|
const navigation = getFirstOrError(data.Meta.navigationsByNavigationId.values());
|
94
94
|
const context = createContextForNavigation(data, navigation, data.Meta.mainFrameId);
|
95
|
-
const insight = Trace.Insights.
|
95
|
+
const insight = Trace.Insights.Models.DocumentLatency.generateInsight(data, context);
|
96
96
|
assert.strictEqual(insight.data?.uncompressedResponseBytes, 39799);
|
97
97
|
assert.deepEqual(insight.metricSavings, {FCP: 0, LCP: 0} as Trace.Insights.Types.MetricSavings);
|
98
98
|
});
|
@@ -2,10 +2,26 @@
|
|
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 i18n from '../../../core/i18n/i18n.js';
|
5
6
|
import * as Helpers from '../helpers/helpers.js';
|
6
7
|
import * as Types from '../types/types.js';
|
7
8
|
|
8
|
-
import type {
|
9
|
+
import type {InsightModel, InsightSetContext, RequiredData} from './types.js';
|
10
|
+
|
11
|
+
const UIStrings = {
|
12
|
+
/**
|
13
|
+
*@description Title of an insight that provides a breakdown for how long it took to download the main document.
|
14
|
+
*/
|
15
|
+
title: 'Document request latency',
|
16
|
+
/**
|
17
|
+
*@description Description of an insight that provides a breakdown for how long it took to download the main document.
|
18
|
+
*/
|
19
|
+
description:
|
20
|
+
'Your first network request is the most important. Reduce its latency by avoiding redirects, ensuring a fast server response, and enabling text compression.',
|
21
|
+
};
|
22
|
+
|
23
|
+
const str_ = i18n.i18n.registerUIStrings('models/trace/insights/DocumentLatency.ts', UIStrings);
|
24
|
+
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
9
25
|
|
10
26
|
// Due to the way that DevTools throttling works we cannot see if server response took less than ~570ms.
|
11
27
|
// We set our failure threshold to 600ms to avoid those false positives but we want devs to shoot for 100ms.
|
@@ -15,7 +31,7 @@ const TARGET_MS = 100;
|
|
15
31
|
// Threshold for compression savings.
|
16
32
|
const IGNORE_THRESHOLD_IN_BYTES = 1400;
|
17
33
|
|
18
|
-
export type
|
34
|
+
export type DocumentLatencyInsightModel = InsightModel<{
|
19
35
|
data?: {
|
20
36
|
serverResponseTime: Types.Timing.MilliSeconds,
|
21
37
|
serverResponseTooSlow: boolean,
|
@@ -103,10 +119,14 @@ function getCompressionSavings(request: Types.Events.SyntheticNetworkRequest): n
|
|
103
119
|
return estimatedSavings < IGNORE_THRESHOLD_IN_BYTES ? 0 : estimatedSavings;
|
104
120
|
}
|
105
121
|
|
122
|
+
function finalize(partialModel: Omit<DocumentLatencyInsightModel, 'title'|'description'>): DocumentLatencyInsightModel {
|
123
|
+
return {title: i18nString(UIStrings.title), description: i18nString(UIStrings.description), ...partialModel};
|
124
|
+
}
|
125
|
+
|
106
126
|
export function generateInsight(
|
107
|
-
parsedTrace: RequiredData<typeof deps>, context: InsightSetContext):
|
127
|
+
parsedTrace: RequiredData<typeof deps>, context: InsightSetContext): DocumentLatencyInsightModel {
|
108
128
|
if (!context.navigation) {
|
109
|
-
return {};
|
129
|
+
return finalize({});
|
110
130
|
}
|
111
131
|
|
112
132
|
const documentRequest =
|
@@ -135,7 +155,7 @@ export function generateInsight(
|
|
135
155
|
LCP: overallSavingsMs as Types.Timing.MilliSeconds,
|
136
156
|
};
|
137
157
|
|
138
|
-
return {
|
158
|
+
return finalize({
|
139
159
|
relatedEvents: [documentRequest],
|
140
160
|
data: {
|
141
161
|
serverResponseTime,
|
@@ -145,5 +165,5 @@ export function generateInsight(
|
|
145
165
|
documentRequest,
|
146
166
|
},
|
147
167
|
metricSavings,
|
148
|
-
};
|
168
|
+
});
|
149
169
|
}
|
@@ -2,17 +2,31 @@
|
|
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 i18n from '../../../core/i18n/i18n.js';
|
5
6
|
import * as Platform from '../../../core/platform/platform.js';
|
6
7
|
import * as Helpers from '../helpers/helpers.js';
|
7
8
|
import * as Types from '../types/types.js';
|
8
9
|
|
9
|
-
import type {
|
10
|
+
import type {InsightModel, InsightSetContext, RequiredData} from './types.js';
|
11
|
+
|
12
|
+
const UIStrings = {
|
13
|
+
/** Title of an insight that provides details about the fonts used on the page, and the value of their `font-display` properties. */
|
14
|
+
title: 'Font display',
|
15
|
+
/**
|
16
|
+
* @description Text to tell the user about the font-display CSS feature to help improve a the UX of a page.
|
17
|
+
*/
|
18
|
+
description:
|
19
|
+
'Consider setting [`font-display`](https://developer.chrome.com/blog/font-display) to `swap` or `optional` to ensure text is consistently visible. `swap` can be further optimized to mitigate layout shifts with [font metric overrides](https://developer.chrome.com/blog/font-fallbacks).',
|
20
|
+
};
|
21
|
+
|
22
|
+
const str_ = i18n.i18n.registerUIStrings('models/trace/insights/FontDisplay.ts', UIStrings);
|
23
|
+
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
10
24
|
|
11
25
|
export function deps(): ['Meta', 'NetworkRequests', 'LayoutShifts'] {
|
12
26
|
return ['Meta', 'NetworkRequests', 'LayoutShifts'];
|
13
27
|
}
|
14
28
|
|
15
|
-
export type
|
29
|
+
export type FontDisplayInsightModel = InsightModel<{
|
16
30
|
fonts: Array<{
|
17
31
|
request: Types.Events.SyntheticNetworkRequest,
|
18
32
|
display: string,
|
@@ -20,7 +34,12 @@ export type FontDisplayResult = InsightResult<{
|
|
20
34
|
}>,
|
21
35
|
}>;
|
22
36
|
|
23
|
-
|
37
|
+
function finalize(partialModel: Omit<FontDisplayInsightModel, 'title'|'description'>): FontDisplayInsightModel {
|
38
|
+
return {title: i18nString(UIStrings.title), description: i18nString(UIStrings.description), ...partialModel};
|
39
|
+
}
|
40
|
+
|
41
|
+
export function generateInsight(
|
42
|
+
parsedTrace: RequiredData<typeof deps>, context: InsightSetContext): FontDisplayInsightModel {
|
24
43
|
const fonts = [];
|
25
44
|
for (const event of parsedTrace.LayoutShifts.beginRemoteFontLoadEvents) {
|
26
45
|
if (!Helpers.Timing.eventIsInBounds(event, context.bounds)) {
|
@@ -57,9 +76,9 @@ export function generateInsight(parsedTrace: RequiredData<typeof deps>, context:
|
|
57
76
|
|
58
77
|
const savings = Math.max(...fonts.map(f => f.wastedTime)) as Types.Timing.MilliSeconds;
|
59
78
|
|
60
|
-
return {
|
79
|
+
return finalize({
|
61
80
|
relatedEvents: fonts.map(f => f.request),
|
62
81
|
fonts,
|
63
82
|
metricSavings: {FCP: savings},
|
64
|
-
};
|
83
|
+
});
|
65
84
|
}
|
@@ -29,7 +29,7 @@ describeWithEnvironment('InteractionToNextPaint', function() {
|
|
29
29
|
bounds: data.Meta.traceBounds,
|
30
30
|
frameId: data.Meta.mainFrameId,
|
31
31
|
};
|
32
|
-
const insight = Trace.Insights.
|
32
|
+
const insight = Trace.Insights.Models.InteractionToNextPaint.generateInsight(data, context);
|
33
33
|
assert.strictEqual(insight.longestInteractionEvent?.dur, longest);
|
34
34
|
assert.strictEqual(insight.highPercentileInteractionEvent?.dur, highPercentile);
|
35
35
|
});
|
@@ -2,28 +2,48 @@
|
|
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 i18n from '../../../core/i18n/i18n.js';
|
5
6
|
import * as Helpers from '../helpers/helpers.js';
|
6
7
|
import type {SyntheticInteractionPair} from '../types/TraceEvents.js';
|
7
8
|
|
8
|
-
import type {
|
9
|
+
import type {InsightModel, InsightSetContext, RequiredData} from './types.js';
|
10
|
+
|
11
|
+
const UIStrings = {
|
12
|
+
/**
|
13
|
+
* @description Text to tell the user about the longest user interaction.
|
14
|
+
*/
|
15
|
+
description:
|
16
|
+
'Start investigating with the longest phase. [Delays can be minimized](https://web.dev/articles/optimize-inp#optimize_interactions). To reduce processing duration, [optimize the main-thread costs](https://web.dev/articles/optimize-long-tasks), often JS.',
|
17
|
+
/**
|
18
|
+
* @description Title for the performance insight "INP by phase", which shows a breakdown of INP by phases / sections.
|
19
|
+
*/
|
20
|
+
title: 'INP by phase',
|
21
|
+
};
|
22
|
+
|
23
|
+
const str_ = i18n.i18n.registerUIStrings('models/trace/insights/InteractionToNextPaint.ts', UIStrings);
|
24
|
+
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
9
25
|
|
10
26
|
export function deps(): ['UserInteractions'] {
|
11
27
|
return ['UserInteractions'];
|
12
28
|
}
|
13
29
|
|
14
|
-
export type
|
30
|
+
export type INPInsightModel = InsightModel<{
|
15
31
|
longestInteractionEvent?: SyntheticInteractionPair,
|
16
32
|
highPercentileInteractionEvent?: SyntheticInteractionPair,
|
17
33
|
}>;
|
18
34
|
|
19
|
-
|
35
|
+
function finalize(partialModel: Omit<INPInsightModel, 'title'|'description'>): INPInsightModel {
|
36
|
+
return {title: i18nString(UIStrings.title), description: i18nString(UIStrings.description), ...partialModel};
|
37
|
+
}
|
38
|
+
|
39
|
+
export function generateInsight(parsedTrace: RequiredData<typeof deps>, context: InsightSetContext): INPInsightModel {
|
20
40
|
const interactionEvents = parsedTrace.UserInteractions.interactionEventsWithNoNesting.filter(event => {
|
21
41
|
return Helpers.Timing.eventIsInBounds(event, context.bounds);
|
22
42
|
});
|
23
43
|
|
24
44
|
if (!interactionEvents.length) {
|
25
45
|
// A valid result, when there is no user interaction.
|
26
|
-
return {};
|
46
|
+
return finalize({});
|
27
47
|
}
|
28
48
|
|
29
49
|
const longestByInteractionId = new Map<number, SyntheticInteractionPair>();
|
@@ -43,9 +63,9 @@ export function generateInsight(parsedTrace: RequiredData<typeof deps>, context:
|
|
43
63
|
// See https://source.chromium.org/chromium/chromium/src/+/main:components/page_load_metrics/browser/responsiveness_metrics_normalization.cc;l=45-59;drc=cb0f9c8b559d9c7c3cb4ca94fc1118cc015d38ad
|
44
64
|
const highPercentileIndex = Math.min(9, Math.floor(normalizedInteractionEvents.length / 50));
|
45
65
|
|
46
|
-
return {
|
66
|
+
return finalize({
|
47
67
|
relatedEvents: [normalizedInteractionEvents[0]],
|
48
68
|
longestInteractionEvent: normalizedInteractionEvents[0],
|
49
69
|
highPercentileInteractionEvent: normalizedInteractionEvents[highPercentileIndex],
|
50
|
-
};
|
70
|
+
});
|
51
71
|
}
|