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
@@ -0,0 +1,58 @@
|
|
1
|
+
// Copyright 2024 The Chromium Authors. All rights reserved.
|
2
|
+
// Use of this source code is governed by a BSD-style license that can be
|
3
|
+
// found in the LICENSE file.
|
4
|
+
|
5
|
+
import {describeWithEnvironment} from '../../../testing/EnvironmentHelpers.js';
|
6
|
+
import {getFirstOrError, getInsightOrError} from '../../../testing/InsightHelpers.js';
|
7
|
+
import {TraceLoader} from '../../../testing/TraceLoader.js';
|
8
|
+
|
9
|
+
export async function processTrace(testContext: Mocha.Suite|Mocha.Context|null, traceFile: string) {
|
10
|
+
const {parsedTrace, insights} = await TraceLoader.traceEngine(testContext, traceFile);
|
11
|
+
if (!insights) {
|
12
|
+
throw new Error('No insights');
|
13
|
+
}
|
14
|
+
|
15
|
+
return {data: parsedTrace, insights};
|
16
|
+
}
|
17
|
+
|
18
|
+
describeWithEnvironment('LCPDiscovery', function() {
|
19
|
+
it('calculates image lcp attributes', async () => {
|
20
|
+
const {data, insights} = await processTrace(this, 'lcp-images.json.gz');
|
21
|
+
const firstNav = getFirstOrError(data.Meta.navigationsByNavigationId.values());
|
22
|
+
const insight = getInsightOrError('LCPDiscovery', insights, firstNav);
|
23
|
+
const {shouldIncreasePriorityHint, shouldPreloadImage, shouldRemoveLazyLoading} = insight;
|
24
|
+
|
25
|
+
assert.strictEqual(shouldRemoveLazyLoading, false);
|
26
|
+
assert.strictEqual(shouldPreloadImage, false);
|
27
|
+
assert.strictEqual(shouldIncreasePriorityHint, true);
|
28
|
+
});
|
29
|
+
|
30
|
+
it('calculates the LCP optimal time as the document request download start time', async () => {
|
31
|
+
const {data, insights} = await processTrace(this, 'web-dev-with-commit.json.gz');
|
32
|
+
const firstNav = getFirstOrError(data.Meta.navigationsByNavigationId.values());
|
33
|
+
const insight = getInsightOrError('LCPDiscovery', insights, firstNav);
|
34
|
+
assert.strictEqual(
|
35
|
+
insight.earliestDiscoveryTimeTs,
|
36
|
+
// this is the TTFB for the document request
|
37
|
+
122411004828,
|
38
|
+
);
|
39
|
+
});
|
40
|
+
|
41
|
+
describe('warnings', function() {
|
42
|
+
it('warns when there is no lcp', async () => {
|
43
|
+
const {data, insights} = await processTrace(this, 'user-timings.json.gz');
|
44
|
+
const firstNav = getFirstOrError(data.Meta.navigationsByNavigationId.values());
|
45
|
+
const insight = getInsightOrError('LCPDiscovery', insights, firstNav);
|
46
|
+
|
47
|
+
assert.strictEqual(insight.warnings?.[0], 'NO_LCP');
|
48
|
+
});
|
49
|
+
|
50
|
+
it('no main document url', async () => {
|
51
|
+
const {data, insights} = await processTrace(this, 'about-blank-first.json.gz');
|
52
|
+
const firstNav = getFirstOrError(data.Meta.navigationsByNavigationId.values());
|
53
|
+
const insight = getInsightOrError('LCPDiscovery', insights, firstNav);
|
54
|
+
|
55
|
+
assert.strictEqual(insight.warnings?.[0], 'NO_DOCUMENT_REQUEST');
|
56
|
+
});
|
57
|
+
});
|
58
|
+
});
|
@@ -0,0 +1,101 @@
|
|
1
|
+
// Copyright 2024 The Chromium Authors. All rights reserved.
|
2
|
+
// Use of this source code is governed by a BSD-style license that can be
|
3
|
+
// found in the LICENSE file.
|
4
|
+
|
5
|
+
import * as i18n from '../../../core/i18n/i18n.js';
|
6
|
+
import * as Handlers from '../handlers/handlers.js';
|
7
|
+
import * as Helpers from '../helpers/helpers.js';
|
8
|
+
import * as Types from '../types/types.js';
|
9
|
+
|
10
|
+
import {type InsightModel, type InsightSetContext, InsightWarning, type RequiredData} from './types.js';
|
11
|
+
|
12
|
+
const UIStrings = {
|
13
|
+
/**
|
14
|
+
*@description Title of an insight that provides details about the LCP metric, and the network requests necessary to load it. Details how the LCP request was discoverable - in other words, the path necessary to load it (ex: network requests, JavaScript)
|
15
|
+
*/
|
16
|
+
title: 'LCP request discovery',
|
17
|
+
/**
|
18
|
+
*@description Description of an insight that provides details about the LCP metric, and the network requests necessary to load it.
|
19
|
+
*/
|
20
|
+
description:
|
21
|
+
'Optimize LCP by making the LCP image [discoverable](https://web.dev/articles/optimize-lcp#1_eliminate_resource_load_delay) from the HTML immediately, and [avoiding lazy-loading](https://web.dev/articles/lcp-lazy-loading)',
|
22
|
+
};
|
23
|
+
|
24
|
+
const str_ = i18n.i18n.registerUIStrings('models/trace/insights/LCPDiscovery.ts', UIStrings);
|
25
|
+
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
26
|
+
|
27
|
+
export function deps(): ['NetworkRequests', 'PageLoadMetrics', 'LargestImagePaint', 'Meta'] {
|
28
|
+
return ['NetworkRequests', 'PageLoadMetrics', 'LargestImagePaint', 'Meta'];
|
29
|
+
}
|
30
|
+
|
31
|
+
export type LCPDiscoveryInsightModel = InsightModel<{
|
32
|
+
lcpEvent?: Types.Events.LargestContentfulPaintCandidate,
|
33
|
+
shouldRemoveLazyLoading?: boolean,
|
34
|
+
shouldIncreasePriorityHint?: boolean,
|
35
|
+
shouldPreloadImage?: boolean,
|
36
|
+
/** The network request for the LCP image, if there was one. */
|
37
|
+
lcpRequest?: Types.Events.SyntheticNetworkRequest,
|
38
|
+
earliestDiscoveryTimeTs?: Types.Timing.MicroSeconds,
|
39
|
+
}>;
|
40
|
+
|
41
|
+
function finalize(partialModel: Omit<LCPDiscoveryInsightModel, 'title'|'description'>): LCPDiscoveryInsightModel {
|
42
|
+
return {title: i18nString(UIStrings.title), description: i18nString(UIStrings.description), ...partialModel};
|
43
|
+
}
|
44
|
+
|
45
|
+
export function generateInsight(
|
46
|
+
parsedTrace: RequiredData<typeof deps>, context: InsightSetContext): LCPDiscoveryInsightModel {
|
47
|
+
if (!context.navigation) {
|
48
|
+
return finalize({});
|
49
|
+
}
|
50
|
+
|
51
|
+
const networkRequests = parsedTrace.NetworkRequests;
|
52
|
+
|
53
|
+
const frameMetrics = parsedTrace.PageLoadMetrics.metricScoresByFrameId.get(context.frameId);
|
54
|
+
if (!frameMetrics) {
|
55
|
+
throw new Error('no frame metrics');
|
56
|
+
}
|
57
|
+
|
58
|
+
const navMetrics = frameMetrics.get(context.navigationId);
|
59
|
+
if (!navMetrics) {
|
60
|
+
throw new Error('no navigation metrics');
|
61
|
+
}
|
62
|
+
const metricScore = navMetrics.get(Handlers.ModelHandlers.PageLoadMetrics.MetricName.LCP);
|
63
|
+
const lcpEvent = metricScore?.event;
|
64
|
+
if (!lcpEvent || !Types.Events.isLargestContentfulPaintCandidate(lcpEvent)) {
|
65
|
+
return finalize({warnings: [InsightWarning.NO_LCP]});
|
66
|
+
}
|
67
|
+
|
68
|
+
const docRequest = networkRequests.byTime.find(req => req.args.data.requestId === context.navigationId);
|
69
|
+
if (!docRequest) {
|
70
|
+
return finalize({lcpEvent, warnings: [InsightWarning.NO_DOCUMENT_REQUEST]});
|
71
|
+
}
|
72
|
+
|
73
|
+
const lcpRequest = parsedTrace.LargestImagePaint.lcpRequestByNavigation.get(context.navigation);
|
74
|
+
if (!lcpRequest) {
|
75
|
+
return finalize({lcpEvent});
|
76
|
+
}
|
77
|
+
|
78
|
+
const initiatorUrl = lcpRequest.args.data.initiator?.url;
|
79
|
+
// TODO(b/372319476): Explore using trace event HTMLDocumentParser::FetchQueuedPreloads to determine if the request
|
80
|
+
// is discovered by the preload scanner.
|
81
|
+
const initiatedByMainDoc =
|
82
|
+
lcpRequest?.args.data.initiator?.type === 'parser' && docRequest.args.data.url === initiatorUrl;
|
83
|
+
const imgPreloadedOrFoundInHTML = lcpRequest?.args.data.isLinkPreload || initiatedByMainDoc;
|
84
|
+
|
85
|
+
const imageLoadingAttr = lcpEvent.args.data?.loadingAttr;
|
86
|
+
const imageFetchPriorityHint = lcpRequest?.args.data.fetchPriorityHint;
|
87
|
+
// This is the earliest discovery time an LCP request could have - it's TTFB.
|
88
|
+
const earliestDiscoveryTime = docRequest && docRequest.args.data.timing ?
|
89
|
+
Helpers.Timing.secondsToMicroseconds(docRequest.args.data.timing.requestTime) +
|
90
|
+
Helpers.Timing.millisecondsToMicroseconds(docRequest.args.data.timing.receiveHeadersStart) :
|
91
|
+
undefined;
|
92
|
+
|
93
|
+
return finalize({
|
94
|
+
lcpEvent,
|
95
|
+
shouldRemoveLazyLoading: imageLoadingAttr === 'lazy',
|
96
|
+
shouldIncreasePriorityHint: imageFetchPriorityHint !== 'high',
|
97
|
+
shouldPreloadImage: !imgPreloadedOrFoundInHTML,
|
98
|
+
lcpRequest,
|
99
|
+
earliestDiscoveryTimeTs: earliestDiscoveryTime ? Types.Timing.MicroSeconds(earliestDiscoveryTime) : undefined,
|
100
|
+
});
|
101
|
+
}
|
package/front_end/models/trace/insights/{LargestContentfulPaint.test.ts → LCPPhases.test.ts}
RENAMED
@@ -16,11 +16,11 @@ export async function processTrace(testContext: Mocha.Suite|Mocha.Context|null,
|
|
16
16
|
return {data: parsedTrace, insights};
|
17
17
|
}
|
18
18
|
|
19
|
-
describeWithEnvironment('
|
19
|
+
describeWithEnvironment('LCPPhases', function() {
|
20
20
|
it('calculates text lcp phases', async () => {
|
21
21
|
const {data, insights} = await processTrace(this, 'lcp-web-font.json.gz');
|
22
22
|
const firstNav = getFirstOrError(data.Meta.navigationsByNavigationId.values());
|
23
|
-
const insight = getInsightOrError('
|
23
|
+
const insight = getInsightOrError('LCPPhases', insights, firstNav);
|
24
24
|
|
25
25
|
assert.strictEqual(insight.lcpMs, 106.482);
|
26
26
|
|
@@ -32,7 +32,7 @@ describeWithEnvironment('LargestContentfulPaint', function() {
|
|
32
32
|
it('calculates image lcp phases', async () => {
|
33
33
|
const {data, insights} = await processTrace(this, 'lcp-images.json.gz');
|
34
34
|
const firstNav = getFirstOrError(data.Meta.navigationsByNavigationId.values());
|
35
|
-
const insight = getInsightOrError('
|
35
|
+
const insight = getInsightOrError('LCPPhases', insights, firstNav);
|
36
36
|
|
37
37
|
assert.strictEqual(insight.lcpMs, 109.623);
|
38
38
|
|
@@ -49,33 +49,11 @@ describeWithEnvironment('LargestContentfulPaint', function() {
|
|
49
49
|
assert.deepEqual(phases, {ttfb: '6.94', loadTime: '12.09', loadDelay: '33.74', renderDelay: '56.85'});
|
50
50
|
});
|
51
51
|
|
52
|
-
it('calculates image lcp attributes', async () => {
|
53
|
-
const {data, insights} = await processTrace(this, 'lcp-images.json.gz');
|
54
|
-
const firstNav = getFirstOrError(data.Meta.navigationsByNavigationId.values());
|
55
|
-
const insight = getInsightOrError('LargestContentfulPaint', insights, firstNav);
|
56
|
-
const {shouldIncreasePriorityHint, shouldPreloadImage, shouldRemoveLazyLoading} = insight;
|
57
|
-
|
58
|
-
assert.strictEqual(shouldRemoveLazyLoading, false);
|
59
|
-
assert.strictEqual(shouldPreloadImage, false);
|
60
|
-
assert.strictEqual(shouldIncreasePriorityHint, true);
|
61
|
-
});
|
62
|
-
|
63
|
-
it('calculates the LCP optimal time as the document request download start time', async () => {
|
64
|
-
const {data, insights} = await processTrace(this, 'web-dev-with-commit.json.gz');
|
65
|
-
const firstNav = getFirstOrError(data.Meta.navigationsByNavigationId.values());
|
66
|
-
const insight = getInsightOrError('LargestContentfulPaint', insights, firstNav);
|
67
|
-
assert.strictEqual(
|
68
|
-
insight.earliestDiscoveryTimeTs,
|
69
|
-
// this is the TTFB for the document request
|
70
|
-
122411004828,
|
71
|
-
);
|
72
|
-
});
|
73
|
-
|
74
52
|
describe('warnings', function() {
|
75
53
|
it('warns when there is no lcp', async () => {
|
76
54
|
const {data, insights} = await processTrace(this, 'user-timings.json.gz');
|
77
55
|
const firstNav = getFirstOrError(data.Meta.navigationsByNavigationId.values());
|
78
|
-
const insight = getInsightOrError('
|
56
|
+
const insight = getInsightOrError('LCPPhases', insights, firstNav);
|
79
57
|
|
80
58
|
assert.strictEqual(insight.lcpMs, undefined);
|
81
59
|
assert.strictEqual(insight.phases, undefined);
|
@@ -85,7 +63,7 @@ describeWithEnvironment('LargestContentfulPaint', function() {
|
|
85
63
|
it('no main document url', async () => {
|
86
64
|
const {data, insights} = await processTrace(this, 'about-blank-first.json.gz');
|
87
65
|
const firstNav = getFirstOrError(data.Meta.navigationsByNavigationId.values());
|
88
|
-
const insight = getInsightOrError('
|
66
|
+
const insight = getInsightOrError('LCPPhases', insights, firstNav);
|
89
67
|
|
90
68
|
assert.strictEqual(insight.lcpMs, 204.909);
|
91
69
|
assert.strictEqual(insight.phases, undefined);
|
@@ -96,7 +74,7 @@ describeWithEnvironment('LargestContentfulPaint', function() {
|
|
96
74
|
it('can handle old traces with missing data and return null for breakdowns of the phases', async () => {
|
97
75
|
const {data, insights} = await processTrace(this, 'multiple-navigations.json.gz');
|
98
76
|
const firstNav = getFirstOrError(data.Meta.navigationsByNavigationId.values());
|
99
|
-
const insight = getInsightOrError('
|
77
|
+
const insight = getInsightOrError('LCPPhases', insights, firstNav);
|
100
78
|
// This insight has invalid phase data, so we expect the value to be undefined.
|
101
79
|
assert.isUndefined(insight.phases);
|
102
80
|
});
|
@@ -2,12 +2,27 @@
|
|
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 Handlers from '../handlers/handlers.js';
|
6
7
|
import * as Helpers from '../helpers/helpers.js';
|
7
8
|
import * as Types from '../types/types.js';
|
8
9
|
|
9
|
-
import {
|
10
|
-
|
10
|
+
import {type InsightModel, type InsightSetContext, InsightWarning, type RequiredData} from './types.js';
|
11
|
+
|
12
|
+
const UIStrings = {
|
13
|
+
/**
|
14
|
+
*@description Title of an insight that provides details about the LCP metric, broken down by phases / parts.
|
15
|
+
*/
|
16
|
+
title: 'LCP by phase',
|
17
|
+
/**
|
18
|
+
* @description Description of a DevTools insight that presents a breakdown for the LCP metric by phases.
|
19
|
+
* This is displayed after a user expands the section to see more. No character length limits.
|
20
|
+
*/
|
21
|
+
description:
|
22
|
+
'Each [phase has specific improvement strategies](https://web.dev/articles/optimize-lcp#lcp-breakdown). Ideally, most of the LCP time should be spent on loading the resources, not within delays.',
|
23
|
+
};
|
24
|
+
const str_ = i18n.i18n.registerUIStrings('models/trace/insights/LCPPhases.ts', UIStrings);
|
25
|
+
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
11
26
|
|
12
27
|
export function deps(): ['NetworkRequests', 'PageLoadMetrics', 'LargestImagePaint', 'Meta'] {
|
13
28
|
return ['NetworkRequests', 'PageLoadMetrics', 'LargestImagePaint', 'Meta'];
|
@@ -35,17 +50,13 @@ interface LCPPhases {
|
|
35
50
|
renderDelay: Types.Timing.MilliSeconds;
|
36
51
|
}
|
37
52
|
|
38
|
-
export type
|
53
|
+
export type LCPPhasesInsightModel = InsightModel<{
|
39
54
|
lcpMs?: Types.Timing.MilliSeconds,
|
40
55
|
lcpTs?: Types.Timing.MilliSeconds,
|
41
56
|
lcpEvent?: Types.Events.LargestContentfulPaintCandidate,
|
42
|
-
phases?: LCPPhases,
|
43
|
-
shouldRemoveLazyLoading?: boolean,
|
44
|
-
shouldIncreasePriorityHint?: boolean,
|
45
|
-
shouldPreloadImage?: boolean,
|
46
57
|
/** The network request for the LCP image, if there was one. */
|
47
58
|
lcpRequest?: Types.Events.SyntheticNetworkRequest,
|
48
|
-
|
59
|
+
phases?: LCPPhases,
|
49
60
|
}>;
|
50
61
|
|
51
62
|
function anyValuesNaN(...values: number[]): boolean {
|
@@ -59,7 +70,7 @@ function anyValuesNaN(...values: number[]): boolean {
|
|
59
70
|
*/
|
60
71
|
function breakdownPhases(
|
61
72
|
nav: Types.Events.NavigationStart, docRequest: Types.Events.SyntheticNetworkRequest,
|
62
|
-
lcpMs: Types.Timing.MilliSeconds, lcpRequest: Types.Events.SyntheticNetworkRequest|
|
73
|
+
lcpMs: Types.Timing.MilliSeconds, lcpRequest: Types.Events.SyntheticNetworkRequest|undefined): LCPPhases|null {
|
63
74
|
const docReqTiming = docRequest.args.data.timing;
|
64
75
|
if (!docReqTiming) {
|
65
76
|
throw new Error('no timing for document request');
|
@@ -99,9 +110,14 @@ function breakdownPhases(
|
|
99
110
|
};
|
100
111
|
}
|
101
112
|
|
102
|
-
|
113
|
+
function finalize(partialModel: Omit<LCPPhasesInsightModel, 'title'|'description'>): LCPPhasesInsightModel {
|
114
|
+
return {title: i18nString(UIStrings.title), description: i18nString(UIStrings.description), ...partialModel};
|
115
|
+
}
|
116
|
+
|
117
|
+
export function generateInsight(
|
118
|
+
parsedTrace: RequiredData<typeof deps>, context: InsightSetContext): LCPPhasesInsightModel {
|
103
119
|
if (!context.navigation) {
|
104
|
-
return {};
|
120
|
+
return finalize({});
|
105
121
|
}
|
106
122
|
|
107
123
|
const networkRequests = parsedTrace.NetworkRequests;
|
@@ -118,52 +134,35 @@ export function generateInsight(parsedTrace: RequiredData<typeof deps>, context:
|
|
118
134
|
const metricScore = navMetrics.get(Handlers.ModelHandlers.PageLoadMetrics.MetricName.LCP);
|
119
135
|
const lcpEvent = metricScore?.event;
|
120
136
|
if (!lcpEvent || !Types.Events.isLargestContentfulPaintCandidate(lcpEvent)) {
|
121
|
-
return {warnings: [InsightWarning.NO_LCP]};
|
137
|
+
return finalize({warnings: [InsightWarning.NO_LCP]});
|
122
138
|
}
|
123
139
|
|
124
140
|
// This helps calculate the phases.
|
125
141
|
const lcpMs = Helpers.Timing.microSecondsToMilliseconds(metricScore.timing);
|
126
142
|
// This helps position things on the timeline's UI accurately for a trace.
|
127
143
|
const lcpTs = metricScore.event?.ts ? Helpers.Timing.microSecondsToMilliseconds(metricScore.event?.ts) : undefined;
|
128
|
-
const lcpRequest =
|
144
|
+
const lcpRequest = parsedTrace.LargestImagePaint.lcpRequestByNavigation.get(context.navigation);
|
145
|
+
|
129
146
|
const docRequest = networkRequests.byTime.find(req => req.args.data.requestId === context.navigationId);
|
130
147
|
if (!docRequest) {
|
131
|
-
return {lcpMs, lcpTs, lcpEvent, warnings: [InsightWarning.NO_DOCUMENT_REQUEST]};
|
148
|
+
return finalize({lcpMs, lcpTs, lcpEvent, lcpRequest, warnings: [InsightWarning.NO_DOCUMENT_REQUEST]});
|
132
149
|
}
|
133
150
|
|
134
151
|
if (!lcpRequest) {
|
135
|
-
return {
|
152
|
+
return finalize({
|
136
153
|
lcpMs,
|
137
154
|
lcpTs,
|
138
155
|
lcpEvent,
|
156
|
+
lcpRequest,
|
139
157
|
phases: breakdownPhases(context.navigation, docRequest, lcpMs, lcpRequest) ?? undefined,
|
140
|
-
};
|
158
|
+
});
|
141
159
|
}
|
142
160
|
|
143
|
-
|
144
|
-
// TODO(b/372319476): Explore using trace event HTMLDocumentParser::FetchQueuedPreloads to determine if the request
|
145
|
-
// is discovered by the preload scanner.
|
146
|
-
const initiatedByMainDoc =
|
147
|
-
lcpRequest?.args.data.initiator?.type === 'parser' && docRequest.args.data.url === initiatorUrl;
|
148
|
-
const imgPreloadedOrFoundInHTML = lcpRequest?.args.data.isLinkPreload || initiatedByMainDoc;
|
149
|
-
|
150
|
-
const imageLoadingAttr = lcpEvent.args.data?.loadingAttr;
|
151
|
-
const imageFetchPriorityHint = lcpRequest?.args.data.fetchPriorityHint;
|
152
|
-
// This is the earliest discovery time an LCP request could have - it's TTFB.
|
153
|
-
const earliestDiscoveryTime = docRequest && docRequest.args.data.timing ?
|
154
|
-
Helpers.Timing.secondsToMicroseconds(docRequest.args.data.timing.requestTime) +
|
155
|
-
Helpers.Timing.millisecondsToMicroseconds(docRequest.args.data.timing.receiveHeadersStart) :
|
156
|
-
undefined;
|
157
|
-
|
158
|
-
return {
|
161
|
+
return finalize({
|
159
162
|
lcpMs,
|
160
163
|
lcpTs,
|
161
164
|
lcpEvent,
|
162
|
-
phases: breakdownPhases(context.navigation, docRequest, lcpMs, lcpRequest) ?? undefined,
|
163
|
-
shouldRemoveLazyLoading: imageLoadingAttr === 'lazy',
|
164
|
-
shouldIncreasePriorityHint: imageFetchPriorityHint !== 'high',
|
165
|
-
shouldPreloadImage: !imgPreloadedOrFoundInHTML,
|
166
165
|
lcpRequest,
|
167
|
-
|
168
|
-
};
|
166
|
+
phases: breakdownPhases(context.navigation, docRequest, lcpMs, lcpRequest) ?? undefined,
|
167
|
+
});
|
169
168
|
}
|
@@ -2,12 +2,13 @@
|
|
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
|
-
export * as
|
5
|
+
export * as CLSCulprits from './CLSCulprits.js';
|
6
6
|
export * as DocumentLatency from './DocumentLatency.js';
|
7
7
|
export * as FontDisplay from './FontDisplay.js';
|
8
8
|
export * as InteractionToNextPaint from './InteractionToNextPaint.js';
|
9
|
-
export * as
|
9
|
+
export * as LCPDiscovery from './LCPDiscovery.js';
|
10
|
+
export * as LCPPhases from './LCPPhases.js';
|
10
11
|
export * as RenderBlocking from './RenderBlocking.js';
|
11
12
|
export * as SlowCSSSelector from './SlowCSSSelector.js';
|
12
|
-
export * as
|
13
|
+
export * as ThirdParties from './ThirdParties.js';
|
13
14
|
export * as Viewport from './Viewport.js';
|
@@ -16,7 +16,7 @@ export async function processTrace(testContext: Mocha.Suite|Mocha.Context|null,
|
|
16
16
|
return {data: parsedTrace, insights};
|
17
17
|
}
|
18
18
|
|
19
|
-
describeWithEnvironment('
|
19
|
+
describeWithEnvironment('RenderBlocking', function() {
|
20
20
|
it('finds render blocking requests', async () => {
|
21
21
|
const {data, insights} = await processTrace(this, 'load-simple.json.gz');
|
22
22
|
assert.deepStrictEqual(
|
@@ -2,15 +2,15 @@
|
|
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 Protocol from '../../../generated/protocol.js';
|
6
7
|
import * as Handlers from '../handlers/handlers.js';
|
7
8
|
import * as Helpers from '../helpers/helpers.js';
|
8
9
|
import type * as Lantern from '../lantern/lantern.js';
|
9
|
-
import * as Types from '../types/types.js';
|
10
|
+
import type * as Types from '../types/types.js';
|
10
11
|
|
11
|
-
import {findLCPRequest} from './Common.js';
|
12
12
|
import {
|
13
|
-
type
|
13
|
+
type InsightModel,
|
14
14
|
type InsightSetContext,
|
15
15
|
type InsightSetContextWithNavigation,
|
16
16
|
InsightWarning,
|
@@ -18,7 +18,23 @@ import {
|
|
18
18
|
type RequiredData,
|
19
19
|
} from './types.js';
|
20
20
|
|
21
|
-
|
21
|
+
const UIStrings = {
|
22
|
+
/**
|
23
|
+
* @description Title of an insight that provides the user with the list of network requests that blocked and therefore slowed down the page rendering and becoming visible to the user.
|
24
|
+
*/
|
25
|
+
title: 'Render blocking requests',
|
26
|
+
/**
|
27
|
+
* @description Text to describe that there are requests blocking rendering, which may affect LCP.
|
28
|
+
*/
|
29
|
+
description: 'Requests are blocking the page\'s initial render, which may delay LCP. ' +
|
30
|
+
'[Deferring or inlining](https://web.dev/learn/performance/understanding-the-critical-path#render-blocking_resources/) ' +
|
31
|
+
'can move these network requests out of the critical path.',
|
32
|
+
};
|
33
|
+
|
34
|
+
const str_ = i18n.i18n.registerUIStrings('models/trace/insights/RenderBlocking.ts', UIStrings);
|
35
|
+
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
36
|
+
|
37
|
+
export type RenderBlockingInsightModel = InsightModel<{
|
22
38
|
renderBlockingRequests: Types.Events.SyntheticNetworkRequest[],
|
23
39
|
requestIdToWastedMs?: Map<string, number>,
|
24
40
|
}>;
|
@@ -85,28 +101,13 @@ function estimateSavingsWithGraphs(
|
|
85
101
|
}
|
86
102
|
|
87
103
|
function hasImageLCP(parsedTrace: RequiredData<typeof deps>, context: InsightSetContextWithNavigation): boolean {
|
88
|
-
|
89
|
-
if (!frameMetrics) {
|
90
|
-
throw new Error('no frame metrics');
|
91
|
-
}
|
92
|
-
|
93
|
-
const navMetrics = frameMetrics.get(context.navigationId);
|
94
|
-
if (!navMetrics) {
|
95
|
-
throw new Error('no navigation metrics');
|
96
|
-
}
|
97
|
-
const metricScore = navMetrics.get(Handlers.ModelHandlers.PageLoadMetrics.MetricName.LCP);
|
98
|
-
const lcpEvent = metricScore?.event;
|
99
|
-
if (!lcpEvent || !Types.Events.isLargestContentfulPaintCandidate(lcpEvent)) {
|
100
|
-
return false;
|
101
|
-
}
|
102
|
-
|
103
|
-
return findLCPRequest(parsedTrace, context, lcpEvent) !== null;
|
104
|
+
return parsedTrace.LargestImagePaint.lcpRequestByNavigation.get(context.navigation) !== undefined;
|
104
105
|
}
|
105
106
|
|
106
107
|
function computeSavings(
|
107
108
|
parsedTrace: RequiredData<typeof deps>, context: InsightSetContextWithNavigation,
|
108
109
|
renderBlockingRequests: Types.Events.SyntheticNetworkRequest[]):
|
109
|
-
Pick<
|
110
|
+
Pick<RenderBlockingInsightModel, 'metricSavings'|'requestIdToWastedMs'>|undefined {
|
110
111
|
if (!context.lantern) {
|
111
112
|
return;
|
112
113
|
}
|
@@ -149,12 +150,16 @@ function computeSavings(
|
|
149
150
|
return {metricSavings, requestIdToWastedMs};
|
150
151
|
}
|
151
152
|
|
153
|
+
function finalize(partialModel: Omit<RenderBlockingInsightModel, 'title'|'description'>): RenderBlockingInsightModel {
|
154
|
+
return {title: i18nString(UIStrings.title), description: i18nString(UIStrings.description), ...partialModel};
|
155
|
+
}
|
156
|
+
|
152
157
|
export function generateInsight(
|
153
|
-
parsedTrace: RequiredData<typeof deps>, context: InsightSetContext):
|
158
|
+
parsedTrace: RequiredData<typeof deps>, context: InsightSetContext): RenderBlockingInsightModel {
|
154
159
|
if (!context.navigation) {
|
155
|
-
return {
|
160
|
+
return finalize({
|
156
161
|
renderBlockingRequests: [],
|
157
|
-
};
|
162
|
+
});
|
158
163
|
}
|
159
164
|
|
160
165
|
const firstPaintTs = parsedTrace.PageLoadMetrics.metricScoresByFrameId.get(context.frameId)
|
@@ -162,10 +167,10 @@ export function generateInsight(
|
|
162
167
|
?.get(Handlers.ModelHandlers.PageLoadMetrics.MetricName.FP)
|
163
168
|
?.event?.ts;
|
164
169
|
if (!firstPaintTs) {
|
165
|
-
return {
|
170
|
+
return finalize({
|
166
171
|
renderBlockingRequests: [],
|
167
172
|
warnings: [InsightWarning.NO_FP],
|
168
|
-
};
|
173
|
+
});
|
169
174
|
}
|
170
175
|
|
171
176
|
let renderBlockingRequests: Types.Events.SyntheticNetworkRequest[] = [];
|
@@ -211,9 +216,9 @@ export function generateInsight(
|
|
211
216
|
return b.dur - a.dur;
|
212
217
|
});
|
213
218
|
|
214
|
-
return {
|
219
|
+
return finalize({
|
215
220
|
relatedEvents: renderBlockingRequests,
|
216
221
|
renderBlockingRequests,
|
217
222
|
...savings,
|
218
|
-
};
|
223
|
+
});
|
219
224
|
}
|
@@ -2,17 +2,34 @@
|
|
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 SelectorTiming, SelectorTimingsKey} from '../types/TraceEvents.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
|
+
/**
|
14
|
+
*@description Title of an insight that provides details about slow CSS selectors.
|
15
|
+
*/
|
16
|
+
title: 'CSS Selector costs',
|
17
|
+
|
18
|
+
/**
|
19
|
+
* @description Text to describe how to improve the performance of CSS selectors.
|
20
|
+
*/
|
21
|
+
description:
|
22
|
+
'If Recalculate Style costs remain high, selector optimization can reduce them. [Optimize the selectors](https://developer.chrome.com/docs/devtools/performance/selector-stats) with both high elapsed time and high slow-path %. Simpler selectors, fewer selectors, a smaller DOM, and a shallower DOM will all reduce matching costs.',
|
23
|
+
};
|
24
|
+
|
25
|
+
const str_ = i18n.i18n.registerUIStrings('models/trace/insights/SlowCSSSelector.ts', UIStrings);
|
26
|
+
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
10
27
|
|
11
28
|
export function deps(): ['SelectorStats'] {
|
12
29
|
return ['SelectorStats'];
|
13
30
|
}
|
14
31
|
|
15
|
-
export type
|
32
|
+
export type SlowCSSSelectorInsightModel = InsightModel<{
|
16
33
|
totalElapsedMs: Types.Timing.MilliSeconds,
|
17
34
|
totalMatchAttempts: number,
|
18
35
|
totalMatchCount: number,
|
@@ -51,8 +68,12 @@ function aggregateSelectorStats(
|
|
51
68
|
return [...selectorMap.values()];
|
52
69
|
}
|
53
70
|
|
71
|
+
function finalize(partialModel: Omit<SlowCSSSelectorInsightModel, 'title'|'description'>): SlowCSSSelectorInsightModel {
|
72
|
+
return {title: i18nString(UIStrings.title), description: i18nString(UIStrings.description), ...partialModel};
|
73
|
+
}
|
74
|
+
|
54
75
|
export function generateInsight(
|
55
|
-
parsedTrace: RequiredData<typeof deps>, context: InsightSetContext):
|
76
|
+
parsedTrace: RequiredData<typeof deps>, context: InsightSetContext): SlowCSSSelectorInsightModel {
|
56
77
|
const selectorStatsData = parsedTrace.SelectorStats;
|
57
78
|
|
58
79
|
if (!selectorStatsData) {
|
@@ -81,7 +102,7 @@ export function generateInsight(
|
|
81
102
|
return b[SelectorTimingsKey.MatchAttempts] - a[SelectorTimingsKey.MatchAttempts];
|
82
103
|
});
|
83
104
|
|
84
|
-
return {
|
105
|
+
return finalize({
|
85
106
|
// TODO: should we identify UpdateLayout events as linked to this insight?
|
86
107
|
relatedEvents: [],
|
87
108
|
totalElapsedMs: Types.Timing.MilliSeconds(totalElapsedUs / 1000.0),
|
@@ -89,5 +110,5 @@ export function generateInsight(
|
|
89
110
|
totalMatchCount,
|
90
111
|
topElapsedMs: sortByElapsedMs.slice(0, 3),
|
91
112
|
topMatchAttempts: sortByMatchAttempts.slice(0, 3),
|
92
|
-
};
|
113
|
+
});
|
93
114
|
}
|
@@ -15,12 +15,12 @@ export async function processTrace(testContext: Mocha.Suite|Mocha.Context|null,
|
|
15
15
|
return {data: parsedTrace, insights};
|
16
16
|
}
|
17
17
|
|
18
|
-
describeWithEnvironment('
|
18
|
+
describeWithEnvironment('ThirdParties', function() {
|
19
19
|
it('categorizes third party web requests (simple)', async () => {
|
20
20
|
const {data, insights} = await processTrace(this, 'load-simple.json.gz');
|
21
21
|
assert.strictEqual(insights.size, 2);
|
22
22
|
const insight =
|
23
|
-
getInsightOrError('
|
23
|
+
getInsightOrError('ThirdParties', insights, getFirstOrError(data.Meta.navigationsByNavigationId.values()));
|
24
24
|
|
25
25
|
const entityByRequestResult = [...insight.entityByRequest.entries()].map(([request, entity]) => {
|
26
26
|
return [request.args.data.url, entity.name];
|
@@ -72,7 +72,7 @@ describeWithEnvironment('ThirdPartyWeb', function() {
|
|
72
72
|
const {data, insights} = await processTrace(this, 'lantern/paul/trace.json.gz');
|
73
73
|
assert.strictEqual(insights.size, 1);
|
74
74
|
const insight =
|
75
|
-
getInsightOrError('
|
75
|
+
getInsightOrError('ThirdParties', insights, getFirstOrError(data.Meta.navigationsByNavigationId.values()));
|
76
76
|
|
77
77
|
const entityNames = [...insight.entityByRequest.values()].map(entity => entity.name);
|
78
78
|
assert.deepEqual([...new Set(entityNames)], [
|