chrome-devtools-frontend 1.0.1608868 → 1.0.1609381

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.
Files changed (50) hide show
  1. package/front_end/core/host/AidaGcaTranslation.ts +13 -0
  2. package/front_end/core/sdk/PreloadingModel.ts +1 -1
  3. package/front_end/entrypoints/heap_snapshot_worker/AllocationProfile.ts +1 -1
  4. package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshot.ts +1 -1
  5. package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshotWorkerDispatcher.ts +1 -1
  6. package/front_end/generated/InspectorBackendCommands.ts +1 -2
  7. package/front_end/generated/protocol-mapping.d.ts +0 -9
  8. package/front_end/generated/protocol-proxy-api.d.ts +0 -7
  9. package/front_end/generated/protocol.ts +0 -20
  10. package/front_end/models/ai_assistance/agents/AccessibilityAgent.ts +4 -2
  11. package/front_end/models/ai_assistance/agents/ContextSelectionAgent.ts +5 -4
  12. package/front_end/models/ai_assistance/agents/ConversationSummaryAgent.ts +24 -1
  13. package/front_end/models/ai_assistance/agents/PerformanceAgent.snapshot.txt +2 -2
  14. package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +41 -22
  15. package/front_end/models/ai_assistance/agents/StylingAgent.snapshot.txt +2 -2
  16. package/front_end/models/ai_assistance/agents/StylingAgent.ts +5 -3
  17. package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.snapshot.txt +69 -69
  18. package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.ts +1 -1
  19. package/front_end/models/live-metrics/LiveMetrics.ts +43 -41
  20. package/front_end/models/trace/EntityMapper.ts +12 -0
  21. package/front_end/panels/ai_assistance/components/ChatMessage.ts +44 -15
  22. package/front_end/panels/ai_assistance/components/chatMessage.css +13 -0
  23. package/front_end/panels/application/ApplicationPanelSidebar.ts +8 -0
  24. package/front_end/panels/application/IndexedDBViews.ts +1 -1
  25. package/front_end/panels/application/ResourcesPanel.ts +8 -0
  26. package/front_end/panels/application/ServiceWorkerCacheViews.ts +1 -1
  27. package/front_end/panels/application/application-meta.ts +11 -0
  28. package/front_end/panels/application/application.ts +1 -0
  29. package/front_end/panels/application/components/StorageMetadataView.ts +31 -7
  30. package/front_end/panels/application/components/backForwardCacheView.css +4 -0
  31. package/front_end/panels/application/preloading/components/PreloadingDetailsReportView.ts +29 -0
  32. package/front_end/panels/elements/ElementsTreeElement.ts +4 -0
  33. package/front_end/panels/profiler/HeapSnapshotDataGrids.ts +1 -1
  34. package/front_end/panels/profiler/HeapSnapshotGridNodes.ts +1 -1
  35. package/front_end/panels/profiler/HeapSnapshotView.ts +1 -1
  36. package/front_end/panels/timeline/TimelinePanel.ts +2 -6
  37. package/front_end/panels/timeline/utils/Helpers.ts +1 -1
  38. package/front_end/third_party/chromium/README.chromium +1 -1
  39. package/front_end/ui/legacy/InspectorDrawerView.ts +188 -15
  40. package/front_end/ui/legacy/InspectorView.ts +162 -11
  41. package/front_end/ui/legacy/TabbedPane.ts +2 -2
  42. package/front_end/ui/legacy/inspectorDrawerTabbedPane.css +54 -0
  43. package/front_end/ui/visual_logging/KnownContextValues.ts +1 -0
  44. package/front_end/ui/visual_logging/LoggingDriver.ts +3 -3
  45. package/mcp/mcp.ts +1 -1
  46. package/package.json +1 -1
  47. /package/front_end/models/{heap_snapshot_model → heap_snapshot}/ChildrenProvider.ts +0 -0
  48. /package/front_end/models/{heap_snapshot_model → heap_snapshot}/HeapSnapshotModel.ts +0 -0
  49. /package/front_end/models/{heap_snapshot_model → heap_snapshot}/HeapSnapshotProxy.ts +0 -0
  50. /package/front_end/models/{heap_snapshot_model/heap_snapshot_model.ts → heap_snapshot/heap_snapshot.ts} +0 -0
@@ -75,7 +75,7 @@ First, examine the provided context, then use the functions to gather additional
75
75
  * Use the precision of Strunk & White, the brevity of Hemingway, and the simple clarity of Vonnegut. Don't add repeated information, and keep the whole answer short.
76
76
  * **CRITICAL** NEVER write full Python programs - you should only write individual statements that invoke a single function from the provided library.
77
77
  * **CRITICAL** NEVER output text before a function call. Always do a function call first.
78
- * **CRITICAL** When answering questions about positioning or layout, ALWAYS inspect \`position\`, \`display\` and ALL related properties.
78
+ * **CRITICAL** When answering questions about positioning or layout, ALWAYS inspect \`position\`, \`display\` and all other related properties. You MUST provide a specific list of CSS property names when calling functions to get styles. Do not use generic values like "all" or "*".
79
79
  * **CRITICAL** You are a CSS/DOM/HTML debugging assistant. NEVER provide answers to questions of unrelated topics such as legal advice, financial advice, personal opinions, medical advice, religion, race, politics, sexuality, gender, or any other non web-development topics. Answer "Sorry, I can't answer that. I'm best at questions about debugging web pages." to such questions.
80
80
 
81
81
  ## Response Structure
@@ -308,7 +308,8 @@ export class StylingAgent extends AiAgent<SDK.DOMModel.DOMNode> {
308
308
 
309
309
  **CRITICAL** An element uid is a number, not a selector.
310
310
  **CRITICAL** Use selectors to refer to elements in the text output. Do not use uids.
311
- **CRITICAL** Always provide the explanation argument to explain what and why you query.`,
311
+ **CRITICAL** Always provide the explanation argument to explain what and why you query.
312
+ **CRITICAL** You MUST provide a specific list of CSS property names. Do not use generic values like "all" or "*".`,
312
313
  parameters: {
313
314
  type: Host.AidaClient.ParametersTypes.OBJECT,
314
315
  description: '',
@@ -327,7 +328,8 @@ export class StylingAgent extends AiAgent<SDK.DOMModel.DOMNode> {
327
328
  },
328
329
  styleProperties: {
329
330
  type: Host.AidaClient.ParametersTypes.ARRAY,
330
- description: 'One or more CSS style property names to fetch.',
331
+ description:
332
+ 'One or more specific CSS style property names to fetch. Generic values like "all" or "*" are not supported.',
331
333
  nullable: false,
332
334
  items: {
333
335
  type: Host.AidaClient.ParametersTypes.STRING,
@@ -474,7 +474,7 @@ Here are all the insights that contain some related request from the given range
474
474
  Title: PerformanceTraceFormatter formatTraceSummary web-dev.json.gz
475
475
  Content:
476
476
  URL: https://web.dev/cls/
477
- Trace bounds: {min: 1020034823047, max: 1020036087961}
477
+ Trace bounds: {min: 1020034823047µs, max: 1020036087961µs}
478
478
  CPU throttling: none
479
479
  Network throttling: none
480
480
 
@@ -485,42 +485,42 @@ The following is a list of insight sets. An insight set covers a specific part o
485
485
  ## insight set id: NAVIGATION_0
486
486
 
487
487
  URL: https://web.dev/cls/
488
- Bounds: {min: 1020034834921, max: 1020036087961}
488
+ Bounds: {min: 1020034834921µs, max: 1020036087961µs}
489
489
  Metrics (lab / observed):
490
490
  - LCP: 118 ms, event: (eventKey: r-1802, ts: 1020034953358), nodeId: 209
491
491
  - LCP breakdown:
492
- - TTFB: 31 ms, bounds: {min: 1020034834921, max: 1020034866264}
493
- - Render delay: 87 ms, bounds: {min: 1020034866264, max: 1020034953358}
492
+ - TTFB: 31 ms, bounds: {min: 1020034834921µs, max: 1020034866264µs}
493
+ - Render delay: 87 ms, bounds: {min: 1020034866264µs, max: 1020034953358µs}
494
494
  - CLS: 0.00
495
495
  Metrics (field / real users): n/a – no data for this page in CrUX
496
496
  Available insights:
497
497
  - insight name: LCPBreakdown
498
498
  description: Each [subpart has specific improvement strategies](https://developer.chrome.com/docs/performance/insights/lcp-breakdown). Ideally, most of the LCP time should be spent on loading the resources, not within delays.
499
- relevant trace bounds: {min: 1020034834921, max: 1020034953358}
499
+ relevant trace bounds: {min: 1020034834921µs, max: 1020034953358µs}
500
500
  example question: Help me optimize my LCP score
501
501
  example question: Which LCP phase was most problematic?
502
502
  example question: What can I do to reduce the LCP time for this page load?
503
503
  - insight name: DocumentLatency
504
504
  description: Your first network request is the most important. [Reduce its latency](https://developer.chrome.com/docs/performance/insights/document-latency) by avoiding redirects, ensuring a fast server response, and enabling text compression.
505
- relevant trace bounds: {min: 1020034836013, max: 1020034892491}
505
+ relevant trace bounds: {min: 1020034836013µs, max: 1020034892491µs}
506
506
  estimated metric savings: FCP 0 ms, LCP 0 ms
507
507
  estimated wasted bytes: 52.1 kB
508
508
  example question: How do I decrease the initial loading time of my page?
509
509
  example question: Did anything slow down the request for this document?
510
510
  - insight name: ThirdParties
511
511
  description: 3rd party code can significantly impact load performance. [Reduce and defer loading of 3rd party code](https://developer.chrome.com/docs/performance/insights/third-parties) to prioritize your page's content.
512
- relevant trace bounds: {min: 1020034871372, max: 1020035171789}
512
+ relevant trace bounds: {min: 1020034871372µs, max: 1020035171789µs}
513
513
  example question: Which third parties are having the largest impact on my page performance?
514
514
  - insight name: CharacterSet
515
515
  description: A character encoding declaration is required. It can be done with a meta charset tag in the first 1024 bytes of the HTML or in the Content-Type HTTP response header. [Learn more about declaring the character encoding](https://developer.chrome.com/docs/insights/charset/).
516
- relevant trace bounds: {min: 1020034836013, max: 1020034892491}
516
+ relevant trace bounds: {min: 1020034836013µs, max: 1020034892491µs}
517
517
  example question: How do I declare a character encoding for my page?
518
518
  === end content
519
519
 
520
520
  Title: PerformanceTraceFormatter formatTraceSummary yahoo-news.json.gz
521
521
  Content:
522
522
  URL: https://news.yahoo.com/
523
- Trace bounds: {min: 157423484442, max: 157427277166}
523
+ Trace bounds: {min: 157423484442µs, max: 157427277166µs}
524
524
  CPU throttling: none
525
525
  Network throttling: none
526
526
 
@@ -531,57 +531,57 @@ The following is a list of insight sets. An insight set covers a specific part o
531
531
  ## insight set id: NAVIGATION_0
532
532
 
533
533
  URL: https://news.yahoo.com/
534
- Bounds: {min: 157423488682, max: 157427277166}
534
+ Bounds: {min: 157423488682µs, max: 157427277166µs}
535
535
  Metrics (lab / observed):
536
536
  - LCP: 464 ms, event: (eventKey: r-33210, ts: 157423953162), nodeId: 8
537
537
  - LCP breakdown:
538
- - TTFB: 216 ms, bounds: {min: 157423488682, max: 157423704371}
539
- - Load delay: 90 ms, bounds: {min: 157423704371, max: 157423794709}
540
- - Load duration: 64 ms, bounds: {min: 157423794709, max: 157423858674}
541
- - Render delay: 94 ms, bounds: {min: 157423858674, max: 157423953162}
538
+ - TTFB: 216 ms, bounds: {min: 157423488682µs, max: 157423704371µs}
539
+ - Load delay: 90 ms, bounds: {min: 157423704371µs, max: 157423794709µs}
540
+ - Load duration: 64 ms, bounds: {min: 157423794709µs, max: 157423858674µs}
541
+ - Render delay: 94 ms, bounds: {min: 157423858674µs, max: 157423953162µs}
542
542
  - CLS: 0.04, event: (eventKey: s-166266, ts: 157425604232)
543
543
  Metrics (field / real users): n/a – no data for this page in CrUX
544
544
  Available insights:
545
545
  - insight name: LCPBreakdown
546
546
  description: Each [subpart has specific improvement strategies](https://developer.chrome.com/docs/performance/insights/lcp-breakdown). Ideally, most of the LCP time should be spent on loading the resources, not within delays.
547
- relevant trace bounds: {min: 157423488682, max: 157423953162}
547
+ relevant trace bounds: {min: 157423488682µs, max: 157423953162µs}
548
548
  example question: Help me optimize my LCP score
549
549
  example question: Which LCP phase was most problematic?
550
550
  example question: What can I do to reduce the LCP time for this page load?
551
551
  - insight name: CLSCulprits
552
552
  description: Layout shifts occur when elements move absent any user interaction. [Investigate the causes of layout shifts](https://developer.chrome.com/docs/performance/insights/cls-culprit), such as elements being added, removed, or their fonts changing as the page loads.
553
- relevant trace bounds: {min: 157425604232, max: 157426760958}
553
+ relevant trace bounds: {min: 157425604232µs, max: 157426760958µs}
554
554
  example question: Help me optimize my CLS score
555
555
  example question: How can I prevent layout shifts on this page?
556
556
  - insight name: NetworkDependencyTree
557
557
  description: [Avoid chaining critical requests](https://developer.chrome.com/docs/performance/insights/network-dependency-tree) by reducing the length of chains, reducing the download size of resources, or deferring the download of unnecessary resources to improve page load.
558
- relevant trace bounds: {min: 157423489126, max: 157426527569}
558
+ relevant trace bounds: {min: 157423489126µs, max: 157426527569µs}
559
559
  example question: How do I optimize my network dependency tree?
560
560
  - insight name: ImageDelivery
561
561
  description: Reducing the download time of images can improve the perceived load time of the page and LCP. [Learn more about optimizing image size](https://developer.chrome.com/docs/performance/insights/image-delivery)
562
- relevant trace bounds: {min: 157423794709, max: 157424082831}
562
+ relevant trace bounds: {min: 157423794709µs, max: 157424082831µs}
563
563
  estimated metric savings: FCP 0 ms, LCP 0 ms
564
564
  estimated wasted bytes: 97.8 kB
565
565
  example question: What should I do to improve and optimize the time taken to fetch and display images on the page?
566
566
  example question: Are all images on my site optimized?
567
567
  - insight name: FontDisplay
568
568
  description: Consider setting [font-display](https://developer.chrome.com/docs/performance/insights/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).
569
- relevant trace bounds: {min: 157425661196, max: 157425696387}
569
+ relevant trace bounds: {min: 157425661196µs, max: 157425696387µs}
570
570
  estimated metric savings: FCP 20 ms
571
571
  example question: How can I update my CSS to avoid layout shifts caused by incorrect `font-display` properties?
572
572
  - insight name: ThirdParties
573
573
  description: 3rd party code can significantly impact load performance. [Reduce and defer loading of 3rd party code](https://developer.chrome.com/docs/performance/insights/third-parties) to prioritize your page's content.
574
- relevant trace bounds: {min: 157423742399, max: 157427277086}
574
+ relevant trace bounds: {min: 157423742399µs, max: 157427277086µs}
575
575
  example question: Which third parties are having the largest impact on my page performance?
576
576
  - insight name: Cache
577
577
  description: A long cache lifetime can speed up repeat visits to your page. [Learn more about caching](https://developer.chrome.com/docs/performance/insights/cache).
578
- relevant trace bounds: {min: 157423742399, max: 157426980482}
578
+ relevant trace bounds: {min: 157423742399µs, max: 157426980482µs}
579
579
  estimated metric savings: FCP 0 ms, LCP 0 ms
580
580
  estimated wasted bytes: 847.4 kB
581
581
  example question: What caching strategies can I apply to improve my page performance?
582
582
  - insight name: LegacyJavaScript
583
583
  description: Polyfills and transforms enable older browsers to use new JavaScript features. However, many aren't necessary for modern browsers. Consider modifying your JavaScript build process to not transpile [Baseline](https://web.dev/articles/baseline-and-polyfills) features, unless you know you must support older browsers. [Learn why most sites can deploy ES6+ code without transpiling](https://developer.chrome.com/docs/performance/insights/legacy-javascript)
584
- relevant trace bounds: {min: 157423489126, max: 157426132225}
584
+ relevant trace bounds: {min: 157423489126µs, max: 157426132225µs}
585
585
  estimated metric savings: FCP 0 ms, LCP 0 ms
586
586
  estimated wasted bytes: 126.9 kB
587
587
  example question: Is my site polyfilling modern JavaScript features?
@@ -591,7 +591,7 @@ Available insights:
591
591
  Title: PerformanceTraceFormatter formatTraceSummary multiple-navigations-render-blocking.json.gz
592
592
  Content:
593
593
  URL: http://localhost:8080/render-blocking
594
- Trace bounds: {min: 171605647473, max: 171616667355}
594
+ Trace bounds: {min: 171605647473µs, max: 171616667355µs}
595
595
  CPU throttling: 1x
596
596
  Network throttling: Fast 3G
597
597
 
@@ -602,64 +602,64 @@ The following is a list of insight sets. An insight set covers a specific part o
602
602
  ## insight set id: NAVIGATION_0
603
603
 
604
604
  URL: http://localhost:8080/render-blocking
605
- Bounds: {min: 171607579779, max: 171613750571}
605
+ Bounds: {min: 171607579779µs, max: 171613750571µs}
606
606
  Metrics (lab / observed):
607
607
  - LCP: 1317 ms, event: (eventKey: r-6686, ts: 171608897210), nodeId: 10
608
608
  - LCP breakdown:
609
- - TTFB: 10 ms, bounds: {min: 171607579779, max: 171607589981.99997}
610
- - Render delay: 1,307 ms, bounds: {min: 171607589981.99997, max: 171608897210}
609
+ - TTFB: 10 ms, bounds: {min: 171607579779µs, max: 171607589981.99997µs}
610
+ - Render delay: 1,307 ms, bounds: {min: 171607589981.99997µs, max: 171608897210µs}
611
611
  - CLS: 0.00
612
612
  Metrics (field / real users): n/a – no data for this page in CrUX
613
613
  Available insights:
614
614
  - insight name: LCPBreakdown
615
615
  description: Each [subpart has specific improvement strategies](https://developer.chrome.com/docs/performance/insights/lcp-breakdown). Ideally, most of the LCP time should be spent on loading the resources, not within delays.
616
- relevant trace bounds: {min: 171607579779, max: 171608897210}
616
+ relevant trace bounds: {min: 171607579779µs, max: 171608897210µs}
617
617
  example question: Help me optimize my LCP score
618
618
  example question: Which LCP phase was most problematic?
619
619
  example question: What can I do to reduce the LCP time for this page load?
620
620
  - insight name: RenderBlocking
621
621
  description: Requests are blocking the page's initial render, which may delay LCP. [Deferring or inlining](https://developer.chrome.com/docs/performance/insights/render-blocking) can move these network requests out of the critical path.
622
- relevant trace bounds: {min: 171608170438, max: 171608877165}
622
+ relevant trace bounds: {min: 171608170438µs, max: 171608877165µs}
623
623
  example question: Show me the most impactful render-blocking requests that I should focus on
624
624
  example question: How can I reduce the number of render-blocking requests?
625
625
  - insight name: CharacterSet
626
626
  description: A character encoding declaration is required. It can be done with a meta charset tag in the first 1024 bytes of the HTML or in the Content-Type HTTP response header. [Learn more about declaring the character encoding](https://developer.chrome.com/docs/insights/charset/).
627
- relevant trace bounds: {min: 171607584346, max: 171608171143}
627
+ relevant trace bounds: {min: 171607584346µs, max: 171608171143µs}
628
628
  example question: How do I declare a character encoding for my page?
629
629
 
630
630
  ## insight set id: NAVIGATION_1
631
631
 
632
632
  URL: http://localhost:8080/render-blocking
633
- Bounds: {min: 171613750571, max: 171616667355}
633
+ Bounds: {min: 171613750571µs, max: 171616667355µs}
634
634
  Metrics (lab / observed):
635
635
  - LCP: 1310 ms, event: (eventKey: r-15639, ts: 171615060776), nodeId: 18
636
636
  - LCP breakdown:
637
- - TTFB: 3 ms, bounds: {min: 171613750571, max: 171613753188}
638
- - Render delay: 1,308 ms, bounds: {min: 171613753188, max: 171615060776}
637
+ - TTFB: 3 ms, bounds: {min: 171613750571µs, max: 171613753188µs}
638
+ - Render delay: 1,308 ms, bounds: {min: 171613753188µs, max: 171615060776µs}
639
639
  - CLS: 0.00
640
640
  Metrics (field / real users): n/a – no data for this page in CrUX
641
641
  Available insights:
642
642
  - insight name: LCPBreakdown
643
643
  description: Each [subpart has specific improvement strategies](https://developer.chrome.com/docs/performance/insights/lcp-breakdown). Ideally, most of the LCP time should be spent on loading the resources, not within delays.
644
- relevant trace bounds: {min: 171613750571, max: 171615060776}
644
+ relevant trace bounds: {min: 171613750571µs, max: 171615060776µs}
645
645
  example question: Help me optimize my LCP score
646
646
  example question: Which LCP phase was most problematic?
647
647
  example question: What can I do to reduce the LCP time for this page load?
648
648
  - insight name: RenderBlocking
649
649
  description: Requests are blocking the page's initial render, which may delay LCP. [Deferring or inlining](https://developer.chrome.com/docs/performance/insights/render-blocking) can move these network requests out of the critical path.
650
- relevant trace bounds: {min: 171614330544, max: 171615043224}
650
+ relevant trace bounds: {min: 171614330544µs, max: 171615043224µs}
651
651
  example question: Show me the most impactful render-blocking requests that I should focus on
652
652
  example question: How can I reduce the number of render-blocking requests?
653
653
  - insight name: CharacterSet
654
654
  description: A character encoding declaration is required. It can be done with a meta charset tag in the first 1024 bytes of the HTML or in the Content-Type HTTP response header. [Learn more about declaring the character encoding](https://developer.chrome.com/docs/insights/charset/).
655
- relevant trace bounds: {min: 171613750986, max: 171614330870}
655
+ relevant trace bounds: {min: 171613750986µs, max: 171614330870µs}
656
656
  example question: How do I declare a character encoding for my page?
657
657
  === end content
658
658
 
659
659
  Title: PerformanceTraceFormatter formatTraceSummary deals with CrUX manager errors
660
660
  Content:
661
661
  URL: http://localhost/image-delivery-cases.html
662
- Trace bounds: {min: 59728641874, max: 59734400108}
662
+ Trace bounds: {min: 59728641874µs, max: 59734400108µs}
663
663
  CPU throttling: 1x
664
664
  Network throttling: No throttling
665
665
 
@@ -670,73 +670,73 @@ The following is a list of insight sets. An insight set covers a specific part o
670
670
  ## insight set id: NAVIGATION_0
671
671
 
672
672
  URL: http://localhost/image-delivery-cases.html
673
- Bounds: {min: 59728649746, max: 59734400108}
673
+ Bounds: {min: 59728649746µs, max: 59734400108µs}
674
674
  Metrics (lab / observed):
675
675
  - LCP: 663 ms, event: (eventKey: r-14753, ts: 59729312744), nodeId: 12
676
676
  - LCP breakdown:
677
- - TTFB: 7 ms, bounds: {min: 59728649746, max: 59728656735}
678
- - Load delay: 46 ms, bounds: {min: 59728656735, max: 59728702313}
679
- - Load duration: 506 ms, bounds: {min: 59728702313, max: 59729208600}
680
- - Render delay: 104 ms, bounds: {min: 59729208600, max: 59729312744}
677
+ - TTFB: 7 ms, bounds: {min: 59728649746µs, max: 59728656735µs}
678
+ - Load delay: 46 ms, bounds: {min: 59728656735µs, max: 59728702313µs}
679
+ - Load duration: 506 ms, bounds: {min: 59728702313µs, max: 59729208600µs}
680
+ - Render delay: 104 ms, bounds: {min: 59729208600µs, max: 59729312744µs}
681
681
  - CLS: 0.31, event: (eventKey: s-14787, ts: 59729100192)
682
682
  Metrics (field / real users): n/a – no data for this page in CrUX
683
683
  Available insights:
684
684
  - insight name: Cache
685
685
  description: A long cache lifetime can speed up repeat visits to your page. [Learn more about caching](https://developer.chrome.com/docs/performance/insights/cache).
686
- relevant trace bounds: {min: 59728702014, max: 59728867430}
686
+ relevant trace bounds: {min: 59728702014µs, max: 59728867430µs}
687
687
  estimated metric savings: FCP 0 ms, LCP 150 ms
688
688
  estimated wasted bytes: 971.5 kB
689
689
  example question: What caching strategies can I apply to improve my page performance?
690
690
  - insight name: ImageDelivery
691
691
  description: Reducing the download time of images can improve the perceived load time of the page and LCP. [Learn more about optimizing image size](https://developer.chrome.com/docs/performance/insights/image-delivery)
692
- relevant trace bounds: {min: 59728701403, max: 59729395208}
692
+ relevant trace bounds: {min: 59728701403µs, max: 59729395208µs}
693
693
  estimated metric savings: FCP 0 ms, LCP 100 ms
694
694
  estimated wasted bytes: 2 MB
695
695
  example question: What should I do to improve and optimize the time taken to fetch and display images on the page?
696
696
  example question: Are all images on my site optimized?
697
697
  - insight name: LCPBreakdown
698
698
  description: Each [subpart has specific improvement strategies](https://developer.chrome.com/docs/performance/insights/lcp-breakdown). Ideally, most of the LCP time should be spent on loading the resources, not within delays.
699
- relevant trace bounds: {min: 59728649746, max: 59729312744}
699
+ relevant trace bounds: {min: 59728649746µs, max: 59729312744µs}
700
700
  example question: Help me optimize my LCP score
701
701
  example question: Which LCP phase was most problematic?
702
702
  example question: What can I do to reduce the LCP time for this page load?
703
703
  - insight name: LCPDiscovery
704
704
  description: [Optimize LCP](https://developer.chrome.com/docs/performance/insights/lcp-discovery) by making the LCP image discoverable from the HTML immediately, and avoiding lazy-loading
705
- relevant trace bounds: {min: 59728656735, max: 59729209036}
705
+ relevant trace bounds: {min: 59728656735µs, max: 59729209036µs}
706
706
  example question: Suggest fixes to reduce my LCP
707
707
  example question: What can I do to reduce my LCP discovery time?
708
708
  example question: Why is LCP discovery time important?
709
709
  - insight name: CLSCulprits
710
710
  description: Layout shifts occur when elements move absent any user interaction. [Investigate the causes of layout shifts](https://developer.chrome.com/docs/performance/insights/cls-culprit), such as elements being added, removed, or their fonts changing as the page loads.
711
- relevant trace bounds: {min: 59729100192, max: 59730317334}
711
+ relevant trace bounds: {min: 59729100192µs, max: 59730317334µs}
712
712
  example question: Help me optimize my CLS score
713
713
  example question: How can I prevent layout shifts on this page?
714
714
  - insight name: DocumentLatency
715
715
  description: Your first network request is the most important. [Reduce its latency](https://developer.chrome.com/docs/performance/insights/document-latency) by avoiding redirects, ensuring a fast server response, and enabling text compression.
716
- relevant trace bounds: {min: 59728651057, max: 59728790724}
716
+ relevant trace bounds: {min: 59728651057µs, max: 59728790724µs}
717
717
  estimated metric savings: FCP 0 ms, LCP 0 ms
718
718
  estimated wasted bytes: 1.6 kB
719
719
  example question: How do I decrease the initial loading time of my page?
720
720
  example question: Did anything slow down the request for this document?
721
721
  - insight name: Viewport
722
722
  description: Tap interactions may be [delayed by up to 300 ms](https://developer.chrome.com/docs/performance/insights/viewport) if the viewport is not optimized for mobile.
723
- relevant trace bounds: {min: 59728649746, max: 59734400108}
723
+ relevant trace bounds: {min: 59728649746µs, max: 59734400108µs}
724
724
  estimated metric savings: INP 0 ms
725
725
  example question: How do I make sure my page is optimized for mobile viewing?
726
726
  - insight name: ThirdParties
727
727
  description: 3rd party code can significantly impact load performance. [Reduce and defer loading of 3rd party code](https://developer.chrome.com/docs/performance/insights/third-parties) to prioritize your page's content.
728
- relevant trace bounds: {min: 59728701403, max: 59729465969}
728
+ relevant trace bounds: {min: 59728701403µs, max: 59729465969µs}
729
729
  example question: Which third parties are having the largest impact on my page performance?
730
730
  - insight name: CharacterSet
731
731
  description: A character encoding declaration is required. It can be done with a meta charset tag in the first 1024 bytes of the HTML or in the Content-Type HTTP response header. [Learn more about declaring the character encoding](https://developer.chrome.com/docs/insights/charset/).
732
- relevant trace bounds: {min: 59728651057, max: 59728790724}
732
+ relevant trace bounds: {min: 59728651057µs, max: 59728790724µs}
733
733
  example question: How do I declare a character encoding for my page?
734
734
  === end content
735
735
 
736
736
  Title: PerformanceTraceFormatter formatTraceSummary image-delivery.json.gz
737
737
  Content:
738
738
  URL: http://localhost/image-delivery-cases.html
739
- Trace bounds: {min: 59728641874, max: 59734400108}
739
+ Trace bounds: {min: 59728641874µs, max: 59734400108µs}
740
740
  CPU throttling: 1x
741
741
  Network throttling: No throttling
742
742
 
@@ -747,14 +747,14 @@ The following is a list of insight sets. An insight set covers a specific part o
747
747
  ## insight set id: NAVIGATION_0
748
748
 
749
749
  URL: http://localhost/image-delivery-cases.html
750
- Bounds: {min: 59728649746, max: 59734400108}
750
+ Bounds: {min: 59728649746µs, max: 59734400108µs}
751
751
  Metrics (lab / observed):
752
752
  - LCP: 663 ms, event: (eventKey: r-14753, ts: 59729312744), nodeId: 12
753
753
  - LCP breakdown:
754
- - TTFB: 7 ms, bounds: {min: 59728649746, max: 59728656735}
755
- - Load delay: 46 ms, bounds: {min: 59728656735, max: 59728702313}
756
- - Load duration: 506 ms, bounds: {min: 59728702313, max: 59729208600}
757
- - Render delay: 104 ms, bounds: {min: 59729208600, max: 59729312744}
754
+ - TTFB: 7 ms, bounds: {min: 59728649746µs, max: 59728656735µs}
755
+ - Load delay: 46 ms, bounds: {min: 59728656735µs, max: 59728702313µs}
756
+ - Load duration: 506 ms, bounds: {min: 59728702313µs, max: 59729208600µs}
757
+ - Render delay: 104 ms, bounds: {min: 59729208600µs, max: 59729312744µs}
758
758
  - CLS: 0.31, event: (eventKey: s-14787, ts: 59729100192)
759
759
  Metrics (field / real users):
760
760
  - LCP: 1740 ms (scope: url)
@@ -767,60 +767,60 @@ Metrics (field / real users):
767
767
  Available insights:
768
768
  - insight name: Cache
769
769
  description: A long cache lifetime can speed up repeat visits to your page. [Learn more about caching](https://developer.chrome.com/docs/performance/insights/cache).
770
- relevant trace bounds: {min: 59728702014, max: 59728867430}
770
+ relevant trace bounds: {min: 59728702014µs, max: 59728867430µs}
771
771
  estimated metric savings: FCP 0 ms, LCP 150 ms
772
772
  estimated wasted bytes: 971.5 kB
773
773
  example question: What caching strategies can I apply to improve my page performance?
774
774
  - insight name: ImageDelivery
775
775
  description: Reducing the download time of images can improve the perceived load time of the page and LCP. [Learn more about optimizing image size](https://developer.chrome.com/docs/performance/insights/image-delivery)
776
- relevant trace bounds: {min: 59728701403, max: 59729395208}
776
+ relevant trace bounds: {min: 59728701403µs, max: 59729395208µs}
777
777
  estimated metric savings: FCP 0 ms, LCP 100 ms
778
778
  estimated wasted bytes: 2 MB
779
779
  example question: What should I do to improve and optimize the time taken to fetch and display images on the page?
780
780
  example question: Are all images on my site optimized?
781
781
  - insight name: LCPBreakdown
782
782
  description: Each [subpart has specific improvement strategies](https://developer.chrome.com/docs/performance/insights/lcp-breakdown). Ideally, most of the LCP time should be spent on loading the resources, not within delays.
783
- relevant trace bounds: {min: 59728649746, max: 59729312744}
783
+ relevant trace bounds: {min: 59728649746µs, max: 59729312744µs}
784
784
  example question: Help me optimize my LCP score
785
785
  example question: Which LCP phase was most problematic?
786
786
  example question: What can I do to reduce the LCP time for this page load?
787
787
  - insight name: LCPDiscovery
788
788
  description: [Optimize LCP](https://developer.chrome.com/docs/performance/insights/lcp-discovery) by making the LCP image discoverable from the HTML immediately, and avoiding lazy-loading
789
- relevant trace bounds: {min: 59728656735, max: 59729209036}
789
+ relevant trace bounds: {min: 59728656735µs, max: 59729209036µs}
790
790
  example question: Suggest fixes to reduce my LCP
791
791
  example question: What can I do to reduce my LCP discovery time?
792
792
  example question: Why is LCP discovery time important?
793
793
  - insight name: CLSCulprits
794
794
  description: Layout shifts occur when elements move absent any user interaction. [Investigate the causes of layout shifts](https://developer.chrome.com/docs/performance/insights/cls-culprit), such as elements being added, removed, or their fonts changing as the page loads.
795
- relevant trace bounds: {min: 59729100192, max: 59730317334}
795
+ relevant trace bounds: {min: 59729100192µs, max: 59730317334µs}
796
796
  example question: Help me optimize my CLS score
797
797
  example question: How can I prevent layout shifts on this page?
798
798
  - insight name: DocumentLatency
799
799
  description: Your first network request is the most important. [Reduce its latency](https://developer.chrome.com/docs/performance/insights/document-latency) by avoiding redirects, ensuring a fast server response, and enabling text compression.
800
- relevant trace bounds: {min: 59728651057, max: 59728790724}
800
+ relevant trace bounds: {min: 59728651057µs, max: 59728790724µs}
801
801
  estimated metric savings: FCP 0 ms, LCP 0 ms
802
802
  estimated wasted bytes: 1.6 kB
803
803
  example question: How do I decrease the initial loading time of my page?
804
804
  example question: Did anything slow down the request for this document?
805
805
  - insight name: Viewport
806
806
  description: Tap interactions may be [delayed by up to 300 ms](https://developer.chrome.com/docs/performance/insights/viewport) if the viewport is not optimized for mobile.
807
- relevant trace bounds: {min: 59728649746, max: 59734400108}
807
+ relevant trace bounds: {min: 59728649746µs, max: 59734400108µs}
808
808
  estimated metric savings: INP 0 ms
809
809
  example question: How do I make sure my page is optimized for mobile viewing?
810
810
  - insight name: ThirdParties
811
811
  description: 3rd party code can significantly impact load performance. [Reduce and defer loading of 3rd party code](https://developer.chrome.com/docs/performance/insights/third-parties) to prioritize your page's content.
812
- relevant trace bounds: {min: 59728701403, max: 59729465969}
812
+ relevant trace bounds: {min: 59728701403µs, max: 59729465969µs}
813
813
  example question: Which third parties are having the largest impact on my page performance?
814
814
  - insight name: CharacterSet
815
815
  description: A character encoding declaration is required. It can be done with a meta charset tag in the first 1024 bytes of the HTML or in the Content-Type HTTP response header. [Learn more about declaring the character encoding](https://developer.chrome.com/docs/insights/charset/).
816
- relevant trace bounds: {min: 59728651057, max: 59728790724}
816
+ relevant trace bounds: {min: 59728651057µs, max: 59728790724µs}
817
817
  example question: How do I declare a character encoding for my page?
818
818
  === end content
819
819
 
820
820
  Title: PerformanceTraceFormatter formatTraceSummary includes INP insight when there is no navigation
821
821
  Content:
822
822
  URL: https://b2607f8b04800100000289cb1c0a82ba72253000000000000000001.proxy.googlers.com/long-interaction/index.html?x=35
823
- Trace bounds: {min: 337943614456, max: 337947260898}
823
+ Trace bounds: {min: 337943614456µs, max: 337947260898µs}
824
824
  CPU throttling: none
825
825
  Network throttling: none
826
826
 
@@ -831,7 +831,7 @@ The following is a list of insight sets. An insight set covers a specific part o
831
831
  ## insight set id: NO_NAVIGATION
832
832
 
833
833
  URL: https://b2607f8b04800100000289cb1c0a82ba72253000000000000000001.proxy.googlers.com/long-interaction/index.html?x=35
834
- Bounds: {min: 337943614456, max: 337947260898}
834
+ Bounds: {min: 337943614456µs, max: 337947260898µs}
835
835
  Metrics (lab / observed):
836
836
  - INP: 139 ms, event: (eventKey: s-3347, ts: 337944870984)
837
837
  - CLS: 0.00
@@ -839,13 +839,13 @@ Metrics (field / real users): n/a – no data for this page in CrUX
839
839
  Available insights:
840
840
  - insight name: INPBreakdown
841
841
  description: Start investigating [how to improve INP](https://developer.chrome.com/docs/performance/insights/inp-breakdown) by looking at the longest subpart.
842
- relevant trace bounds: {min: 337944870984, max: 337945010222}
842
+ relevant trace bounds: {min: 337944870984µs, max: 337945010222µs}
843
843
  example question: Suggest fixes for my longest interaction
844
844
  example question: Why is a large INP score problematic?
845
845
  example question: What's the biggest contributor to my longest interaction?
846
846
  - insight name: ThirdParties
847
847
  description: 3rd party code can significantly impact load performance. [Reduce and defer loading of 3rd party code](https://developer.chrome.com/docs/performance/insights/third-parties) to prioritize your page's content.
848
- relevant trace bounds: {min: 337944792445, max: 337944809570}
848
+ relevant trace bounds: {min: 337944792445µs, max: 337944809570µs}
849
849
  example question: Which third parties are having the largest impact on my page performance?
850
850
  === end content
851
851
 
@@ -52,7 +52,7 @@ export class PerformanceTraceFormatter {
52
52
  }
53
53
 
54
54
  serializeBounds(bounds: Trace.Types.Timing.TraceWindowMicro): string {
55
- return `{min: ${bounds.min}, max: ${bounds.max}}`;
55
+ return `{min: ${bounds.min}µs, max: ${bounds.max}µs}`;
56
56
  }
57
57
 
58
58
  /**
@@ -62,7 +62,29 @@ export class LiveMetrics extends Common.ObjectWrapper.ObjectWrapper<EventTypes>
62
62
 
63
63
  private constructor() {
64
64
  super();
65
- SDK.TargetManager.TargetManager.instance().observeTargets(this);
65
+ const targetManager = SDK.TargetManager.TargetManager.instance();
66
+ targetManager.observeTargets(this, {scoped: true});
67
+ // Listen for target info changes to detect prerender activation.
68
+ // Scoped observers don't receive events when a prerendered target becomes
69
+ // primary because setScopeTarget() isn't called during that transition.
70
+ targetManager.addEventListener(
71
+ SDK.TargetManager.Events.AVAILABLE_TARGETS_CHANGED, this.#onAvailableTargetsChanged, this);
72
+ }
73
+
74
+ #onAvailableTargetsChanged(): void {
75
+ const primaryTarget = SDK.TargetManager.TargetManager.instance().primaryPageTarget();
76
+ if (primaryTarget && primaryTarget !== this.#target) {
77
+ // Primary target changed (e.g., prerender activation). Switch to it.
78
+ void this.#switchToTarget(primaryTarget);
79
+ }
80
+ }
81
+
82
+ async #switchToTarget(newTarget: SDK.Target.Target): Promise<void> {
83
+ if (this.#target) {
84
+ await this.disable();
85
+ }
86
+ this.#target = newTarget;
87
+ await this.enable();
66
88
  }
67
89
 
68
90
  static instance(opts: {forceNew?: boolean} = {forceNew: false}): LiveMetrics {
@@ -371,29 +393,20 @@ export class LiveMetrics extends Common.ObjectWrapper.ObjectWrapper<EventTypes>
371
393
  this.#sendStatusUpdate();
372
394
  }
373
395
 
374
- async #getFrameForExecutionContextId(executionContextId: Protocol.Runtime.ExecutionContextId):
375
- Promise<SDK.ResourceTreeModel.ResourceTreeFrame|null> {
396
+ #isPrimaryFrameExecutionContext(executionContextId: Protocol.Runtime.ExecutionContextId): boolean {
376
397
  if (!this.#target) {
377
- return null;
398
+ return false;
378
399
  }
379
400
 
380
401
  const runtimeModel = this.#target.model(SDK.RuntimeModel.RuntimeModel);
381
- if (!runtimeModel) {
382
- return null;
383
- }
384
-
385
- const executionContext = runtimeModel.executionContext(executionContextId);
386
- if (!executionContext) {
387
- return null;
388
- }
389
-
390
- const frameId = executionContext.frameId;
391
- if (!frameId) {
392
- return null;
402
+ const executionContext = runtimeModel?.executionContext(executionContextId);
403
+ if (!executionContext?.frameId) {
404
+ return false;
393
405
  }
394
406
 
395
- const frameManager = SDK.FrameManager.FrameManager.instance();
396
- return await frameManager.getOrWaitForFrame(frameId);
407
+ const resourceTreeModel = this.#target.model(SDK.ResourceTreeModel.ResourceTreeModel);
408
+ const primaryFrameId = resourceTreeModel?.mainFrame?.id;
409
+ return Boolean(primaryFrameId && executionContext.frameId === primaryFrameId);
397
410
  }
398
411
 
399
412
  async #onBindingCalled(event: {data: Protocol.Runtime.BindingCalledEvent}): Promise<void> {
@@ -407,25 +420,17 @@ export class LiveMetrics extends Common.ObjectWrapper.ObjectWrapper<EventTypes>
407
420
  await this.#mutex.run(async () => {
408
421
  const webVitalsEvent = JSON.parse(data.payload) as Spec.WebVitalsEvent;
409
422
 
410
- // This ensures that `#lastResetContextId` will always be an execution context on the
411
- // primary frame. If we receive events from this execution context then we automatically
412
- // know that they are for the primary frame.
413
- if (this.#lastResetContextId !== data.executionContextId) {
414
- if (webVitalsEvent.name !== 'reset') {
415
- return;
416
- }
417
-
418
- // We should avoid calling this function for every event.
419
- // If an interaction triggers a pre-rendered navigation then the old primary frame could
420
- // be removed before we reach this point, and then it will hang forever.
421
- const frame = await this.#getFrameForExecutionContextId(data.executionContextId);
422
- if (!frame?.isPrimaryFrame()) {
423
+ if (webVitalsEvent.name === 'reset') {
424
+ if (!this.#isPrimaryFrameExecutionContext(data.executionContextId)) {
423
425
  return;
424
426
  }
425
-
426
427
  this.#lastResetContextId = data.executionContextId;
427
428
  }
428
429
 
430
+ if (this.#lastResetContextId !== data.executionContextId) {
431
+ return;
432
+ }
433
+
429
434
  await this.#handleWebVitalsEvent(webVitalsEvent, data.executionContextId);
430
435
  });
431
436
  }
@@ -464,6 +469,7 @@ export class LiveMetrics extends Common.ObjectWrapper.ObjectWrapper<EventTypes>
464
469
  }
465
470
 
466
471
  async targetAdded(target: SDK.Target.Target): Promise<void> {
472
+ // Scoped observers can also receive events for OOPIFs and workers.
467
473
  if (target !== SDK.TargetManager.TargetManager.instance().primaryPageTarget()) {
468
474
  return;
469
475
  }
@@ -472,20 +478,12 @@ export class LiveMetrics extends Common.ObjectWrapper.ObjectWrapper<EventTypes>
472
478
  }
473
479
 
474
480
  async targetRemoved(target: SDK.Target.Target): Promise<void> {
481
+ // Scoped observers can also receive events for OOPIFs and workers.
475
482
  if (target !== this.#target) {
476
483
  return;
477
484
  }
478
485
  await this.disable();
479
486
  this.#target = undefined;
480
-
481
- // If the user navigates to a page that was pre-rendered then the primary page target
482
- // will be swapped and the old target will be removed. We should ensure live metrics
483
- // remain enabled on the new primary page target.
484
- const primaryPageTarget = SDK.TargetManager.TargetManager.instance().primaryPageTarget();
485
- if (primaryPageTarget) {
486
- this.#target = primaryPageTarget;
487
- await this.enable();
488
- }
489
487
  }
490
488
 
491
489
  async enable(): Promise<void> {
@@ -555,6 +553,10 @@ export class LiveMetrics extends Common.ObjectWrapper.ObjectWrapper<EventTypes>
555
553
  return;
556
554
  }
557
555
 
556
+ // Reset to ensure clean state when re-enabling on a new target.
557
+ // See crbug.com/478832430.
558
+ this.#lastResetContextId = undefined;
559
+
558
560
  await this.#killAllLiveMetricContexts();
559
561
 
560
562
  const runtimeModel = this.#target.model(SDK.RuntimeModel.RuntimeModel);
@@ -10,6 +10,8 @@ import * as Helpers from './helpers/helpers.js';
10
10
  import type {ParsedTrace} from './ModelImpl.js';
11
11
  import type * as Types from './types/types.js';
12
12
 
13
+ const mapperCache = new WeakMap<ParsedTrace, EntityMapper>();
14
+
13
15
  export class EntityMapper {
14
16
  #parsedTrace: ParsedTrace;
15
17
  #entityMappings: Handlers.Helpers.EntityMappings;
@@ -30,6 +32,16 @@ export class EntityMapper {
30
32
  this.#thirdPartyEvents = this.#getThirdPartyEvents();
31
33
  }
32
34
 
35
+ static getOrCreate(parsedTrace: ParsedTrace): EntityMapper {
36
+ const cached = mapperCache.get(parsedTrace);
37
+ if (cached) {
38
+ return cached;
39
+ }
40
+ const instance = new EntityMapper(parsedTrace);
41
+ mapperCache.set(parsedTrace, instance);
42
+ return instance;
43
+ }
44
+
33
45
  #findFirstPartyEntity(): Handlers.Helpers.Entity|null {
34
46
  // As a starting point, we consider the first navigation as the 1P.
35
47
  const nav =