@paulirish/trace_engine 0.0.11 → 0.0.13

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 (147) hide show
  1. package/core/platform/{array-utilities.js → ArrayUtilities.js} +1 -1
  2. package/core/platform/ArrayUtilities.js.map +1 -0
  3. package/core/platform/{brand.js → Brand.js} +1 -1
  4. package/core/platform/{brand.js.map → Brand.js.map} +1 -1
  5. package/core/platform/{dom-utilities.js → DOMUtilities.js} +1 -1
  6. package/core/platform/DOMUtilities.js.map +1 -0
  7. package/core/platform/{date-utilities.js → DateUtilities.js} +1 -1
  8. package/core/platform/DateUtilities.js.map +1 -0
  9. package/core/platform/DevToolsPath.d.ts +1 -1
  10. package/core/platform/DevToolsPath.js.map +1 -1
  11. package/core/platform/{keyboard-utilities.js → KeyboardUtilities.js} +1 -1
  12. package/core/platform/KeyboardUtilities.js.map +1 -0
  13. package/core/platform/{map-utilities.js → MapUtilities.js} +1 -1
  14. package/core/platform/MapUtilities.js.map +1 -0
  15. package/core/platform/{number-utilities.js → NumberUtilities.js} +1 -1
  16. package/core/platform/NumberUtilities.js.map +1 -0
  17. package/core/platform/{promise-utilities.js → PromiseUtilities.js} +1 -1
  18. package/core/platform/PromiseUtilities.js.map +1 -0
  19. package/core/platform/{set-utilities.js → SetUtilities.js} +1 -1
  20. package/core/platform/SetUtilities.js.map +1 -0
  21. package/core/platform/{string-utilities.js → StringUtilities.js} +4 -4
  22. package/core/platform/StringUtilities.js.map +1 -0
  23. package/core/platform/Timing.d.ts +1 -1
  24. package/core/platform/Timing.js.map +1 -1
  25. package/core/platform/{typescript-utilities.js → TypescriptUtilities.js} +1 -1
  26. package/core/platform/TypescriptUtilities.js.map +1 -0
  27. package/core/platform/UIString.d.ts +1 -1
  28. package/core/platform/UIString.js.map +1 -1
  29. package/core/platform/platform-tsconfig.json +11 -16
  30. package/core/platform/platform.d.ts +12 -13
  31. package/core/platform/platform.js +16 -17
  32. package/core/platform/platform.js.map +1 -1
  33. package/generated/protocol.d.ts +83 -28
  34. package/models/trace/ModelImpl.d.ts +3 -0
  35. package/models/trace/ModelImpl.js +10 -2
  36. package/models/trace/ModelImpl.js.map +1 -1
  37. package/models/trace/Processor.d.ts +3 -1
  38. package/models/trace/Processor.js +43 -4
  39. package/models/trace/Processor.js.map +1 -1
  40. package/models/trace/TracingManager.js.map +1 -1
  41. package/models/trace/extras/FetchNodes.d.ts +10 -3
  42. package/models/trace/extras/FetchNodes.js +14 -1
  43. package/models/trace/extras/FetchNodes.js.map +1 -1
  44. package/models/trace/handlers/NetworkRequestsHandler.js +5 -0
  45. package/models/trace/handlers/NetworkRequestsHandler.js.map +1 -1
  46. package/models/trace/handlers/RendererHandler.js +2 -1
  47. package/models/trace/handlers/RendererHandler.js.map +1 -1
  48. package/models/trace/insights/InsightRunners.d.ts +1 -0
  49. package/models/trace/insights/InsightRunners.js +5 -0
  50. package/models/trace/insights/InsightRunners.js.map +1 -0
  51. package/models/trace/insights/RenderBlocking.d.ts +6 -0
  52. package/models/trace/insights/RenderBlocking.js +27 -0
  53. package/models/trace/insights/RenderBlocking.js.map +1 -0
  54. package/models/trace/insights/bundle-tsconfig.json +1 -0
  55. package/models/trace/{frames → insights}/devtools_entrypoint-bundle-typescript-tsconfig.json +5 -4
  56. package/models/trace/{worker/processor-tsconfig.json → insights/insights-tsconfig.json} +9 -8
  57. package/models/trace/insights/insights.d.ts +2 -0
  58. package/models/trace/insights/insights.js +6 -0
  59. package/models/trace/insights/insights.js.map +1 -0
  60. package/models/trace/insights/types.d.ts +33 -0
  61. package/models/trace/insights/types.js +5 -0
  62. package/models/trace/insights/types.js.map +1 -0
  63. package/models/trace/trace-tsconfig.json +3 -0
  64. package/models/trace/trace.d.ts +2 -1
  65. package/models/trace/trace.js +2 -1
  66. package/models/trace/trace.js.map +1 -1
  67. package/models/trace/types/TraceEvents.d.ts +24 -0
  68. package/models/trace/types/TraceEvents.js.map +1 -1
  69. package/package.json +7 -5
  70. package/LICENSE +0 -27
  71. package/PAUL.readme.md +0 -5
  72. package/README.md +0 -156
  73. package/analyze-trace.mjs +0 -184
  74. package/core/platform/array-utilities.js.map +0 -1
  75. package/core/platform/date-utilities.js.map +0 -1
  76. package/core/platform/dcheck-tsconfig.json +0 -8
  77. package/core/platform/dcheck.d.ts +0 -4
  78. package/core/platform/dcheck.js +0 -5
  79. package/core/platform/devtools_entrypoint-bundle-tsconfig-tsconfig.json +0 -40
  80. package/core/platform/dom-utilities.js.map +0 -1
  81. package/core/platform/keyboard-utilities.js.map +0 -1
  82. package/core/platform/map-utilities.js.map +0 -1
  83. package/core/platform/number-utilities.js.map +0 -1
  84. package/core/platform/platform.js.compressed +0 -0
  85. package/core/platform/platform.js.hash +0 -1
  86. package/core/platform/platform.prebundle.d.ts +0 -15
  87. package/core/platform/platform.prebundle.js +0 -50
  88. package/core/platform/platform.prebundle.js.map +0 -1
  89. package/core/platform/platform.prebundle.ts +0 -64
  90. package/core/platform/promise-utilities.js.map +0 -1
  91. package/core/platform/set-utilities.js.map +0 -1
  92. package/core/platform/string-utilities.js.map +0 -1
  93. package/core/platform/typescript-utilities.js.map +0 -1
  94. package/models/trace/SDKServices.js +0 -104
  95. package/models/trace/SDKServices.js.map +0 -7
  96. package/models/trace/TraceProcessor.js +0 -133
  97. package/models/trace/TraceProcessor.js.map +0 -7
  98. package/models/trace/TreeManipulator.js +0 -85
  99. package/models/trace/TreeManipulator.js.map +0 -7
  100. package/models/trace/devtools_entrypoint-legacy-typescript-tsconfig.json +0 -43
  101. package/models/trace/frames/TimelineFrameModel.js +0 -392
  102. package/models/trace/frames/TimelineFrameModel.js.map +0 -7
  103. package/models/trace/frames/bundle-tsconfig.json +0 -1
  104. package/models/trace/frames/frames-tsconfig.json +0 -58
  105. package/models/trace/frames/frames.js +0 -5
  106. package/models/trace/frames/frames.js.map +0 -7
  107. package/models/trace/handlers/Migration.js +0 -27
  108. package/models/trace/handlers/Migration.js.map +0 -7
  109. package/models/trace/handlers/UberFramesHandler.js +0 -293
  110. package/models/trace/handlers/UberFramesHandler.js.map +0 -7
  111. package/models/trace/legacy-tsconfig.json +0 -1
  112. package/models/trace/sdk_services/DOMNodeLookup.js +0 -41
  113. package/models/trace/sdk_services/DOMNodeLookup.js.map +0 -7
  114. package/models/trace/sdk_services/LayoutShifts.js +0 -68
  115. package/models/trace/sdk_services/LayoutShifts.js.map +0 -7
  116. package/models/trace/sdk_services/bundle-tsconfig.json +0 -1
  117. package/models/trace/sdk_services/devtools_entrypoint-bundle-typescript-tsconfig.json +0 -41
  118. package/models/trace/sdk_services/sdk_services-tsconfig.json +0 -57
  119. package/models/trace/sdk_services/sdk_services.js +0 -7
  120. package/models/trace/sdk_services/sdk_services.js.map +0 -7
  121. package/models/trace/trace-legacy.js +0 -16
  122. package/models/trace/trace-legacy.js.map +0 -7
  123. package/models/trace/worker/Processor.js +0 -143
  124. package/models/trace/worker/Processor.js.map +0 -7
  125. package/models/trace/worker/Types.js +0 -1
  126. package/models/trace/worker/Types.js.map +0 -7
  127. package/models/trace/worker/bundle-tsconfig.json +0 -1
  128. package/models/trace/worker/devtools_entrypoint-bundle-typescript-tsconfig.json +0 -41
  129. package/models/trace/worker/devtools_entrypoint-worker_entrypoint-typescript-tsconfig.json +0 -41
  130. package/models/trace/worker/worker.js +0 -7
  131. package/models/trace/worker/worker.js.map +0 -7
  132. package/models/trace/worker/worker_entrypoint-tsconfig.json +0 -1
  133. package/models/trace/worker/worker_entrypoint.js +0 -36
  134. package/models/trace/worker/worker_entrypoint.js.map +0 -7
  135. package/test/invalid-animation-events.json.gz +0 -0
  136. package/test/test-trace-engine.mjs +0 -52
  137. /package/core/platform/{array-utilities.d.ts → ArrayUtilities.d.ts} +0 -0
  138. /package/core/platform/{brand.d.ts → Brand.d.ts} +0 -0
  139. /package/core/platform/{dom-utilities.d.ts → DOMUtilities.d.ts} +0 -0
  140. /package/core/platform/{date-utilities.d.ts → DateUtilities.d.ts} +0 -0
  141. /package/core/platform/{keyboard-utilities.d.ts → KeyboardUtilities.d.ts} +0 -0
  142. /package/core/platform/{map-utilities.d.ts → MapUtilities.d.ts} +0 -0
  143. /package/core/platform/{number-utilities.d.ts → NumberUtilities.d.ts} +0 -0
  144. /package/core/platform/{promise-utilities.d.ts → PromiseUtilities.d.ts} +0 -0
  145. /package/core/platform/{set-utilities.d.ts → SetUtilities.d.ts} +0 -0
  146. /package/core/platform/{string-utilities.d.ts → StringUtilities.d.ts} +0 -0
  147. /package/core/platform/{typescript-utilities.d.ts → TypescriptUtilities.d.ts} +0 -0
@@ -293,7 +293,7 @@ export declare namespace Accessibility {
293
293
  depth?: integer;
294
294
  /**
295
295
  * The frame for whose document the AX tree should be retrieved.
296
- * If omited, the root frame is used.
296
+ * If omitted, the root frame is used.
297
297
  */
298
298
  frameId?: Page.FrameId;
299
299
  }
@@ -1334,7 +1334,7 @@ export declare namespace Autofill {
1334
1334
  */
1335
1335
  interface AddressUI {
1336
1336
  /**
1337
- * A two dimension array containing the repesentation of values from an address profile.
1337
+ * A two dimension array containing the representation of values from an address profile.
1338
1338
  */
1339
1339
  addressFields: AddressFields[];
1340
1340
  }
@@ -1370,6 +1370,10 @@ export declare namespace Autofill {
1370
1370
  * The filling strategy
1371
1371
  */
1372
1372
  fillingStrategy: FillingStrategy;
1373
+ /**
1374
+ * The frame the field belongs to
1375
+ */
1376
+ frameId: Page.FrameId;
1373
1377
  /**
1374
1378
  * The form field's DOM node
1375
1379
  */
@@ -1556,6 +1560,7 @@ export declare namespace Browser {
1556
1560
  ProtectedMediaIdentifier = "protectedMediaIdentifier",
1557
1561
  Sensors = "sensors",
1558
1562
  StorageAccess = "storageAccess",
1563
+ SpeakerSelection = "speakerSelection",
1559
1564
  TopLevelStorageAccess = "topLevelStorageAccess",
1560
1565
  VideoCapture = "videoCapture",
1561
1566
  VideoCapturePanTiltZoom = "videoCapturePanTiltZoom",
@@ -1686,7 +1691,7 @@ export declare namespace Browser {
1686
1691
  /**
1687
1692
  * Whether to allow all or deny all download requests, or use default Chrome behavior if
1688
1693
  * available (otherwise deny). |allowAndName| allows download and names files according to
1689
- * their dowmload guids.
1694
+ * their download guids.
1690
1695
  */
1691
1696
  behavior: SetDownloadBehaviorRequestBehavior;
1692
1697
  /**
@@ -2013,7 +2018,7 @@ export declare namespace CSS {
2013
2018
  frameId: Page.FrameId;
2014
2019
  /**
2015
2020
  * Stylesheet resource URL. Empty if this is a constructed stylesheet created using
2016
- * new CSSStyleSheet() (but non-empty if this is a constructed sylesheet imported
2021
+ * new CSSStyleSheet() (but non-empty if this is a constructed stylesheet imported
2017
2022
  * as a CSS module script).
2018
2023
  */
2019
2024
  sourceURL: string;
@@ -3720,7 +3725,7 @@ export declare namespace DOM {
3720
3725
  }
3721
3726
  interface GetAttributesRequest {
3722
3727
  /**
3723
- * Id of the node to retrieve attibutes for.
3728
+ * Id of the node to retrieve attributes for.
3724
3729
  */
3725
3730
  nodeId: NodeId;
3726
3731
  }
@@ -5305,14 +5310,14 @@ export declare namespace Emulation {
5305
5310
  PauseIfNetworkFetchesPending = "pauseIfNetworkFetchesPending"
5306
5311
  }
5307
5312
  /**
5308
- * Used to specify User Agent Cient Hints to emulate. See https://wicg.github.io/ua-client-hints
5313
+ * Used to specify User Agent Client Hints to emulate. See https://wicg.github.io/ua-client-hints
5309
5314
  */
5310
5315
  interface UserAgentBrandVersion {
5311
5316
  brand: string;
5312
5317
  version: string;
5313
5318
  }
5314
5319
  /**
5315
- * Used to specify User Agent Cient Hints to emulate. See https://wicg.github.io/ua-client-hints
5320
+ * Used to specify User Agent Client Hints to emulate. See https://wicg.github.io/ua-client-hints
5316
5321
  * Missing optional values will be filled in by the target with what it would normally use.
5317
5322
  */
5318
5323
  interface UserAgentMetadata {
@@ -5624,8 +5629,9 @@ export declare namespace Emulation {
5624
5629
  }
5625
5630
  interface SetTimezoneOverrideRequest {
5626
5631
  /**
5627
- * The timezone identifier. If empty, disables the override and
5628
- * restores default host system timezone.
5632
+ * The timezone identifier. List of supported timezones:
5633
+ * https://source.chromium.org/chromium/chromium/deps/icu.git/+/faee8bc70570192d82d2978a71e2a615788597d1:source/data/misc/metaZones.txt
5634
+ * If empty, disables the override and restores default host system timezone.
5629
5635
  */
5630
5636
  timezoneId: string;
5631
5637
  }
@@ -5759,7 +5765,7 @@ export declare namespace IO {
5759
5765
  */
5760
5766
  handle: StreamHandle;
5761
5767
  /**
5762
- * Seek to the specified offset before reading (if not specificed, proceed with offset
5768
+ * Seek to the specified offset before reading (if not specified, proceed with offset
5763
5769
  * following the last read). Some types of streams may only support sequential reads.
5764
5770
  */
5765
5771
  offset?: integer;
@@ -6903,7 +6909,7 @@ export declare namespace LayerTree {
6903
6909
  }
6904
6910
  interface LayerTreeDidChangeEvent {
6905
6911
  /**
6906
- * Layer tree, absent if not in the comspositing mode.
6912
+ * Layer tree, absent if not in the compositing mode.
6907
6913
  */
6908
6914
  layers?: Layer[];
6909
6915
  }
@@ -7389,7 +7395,7 @@ export declare namespace Network {
7389
7395
  trustTokenParams?: TrustTokenParams;
7390
7396
  /**
7391
7397
  * True if this resource request is considered to be the 'same site' as the
7392
- * request correspondinfg to the main frame.
7398
+ * request corresponding to the main frame.
7393
7399
  */
7394
7400
  isSameSite?: boolean;
7395
7401
  }
@@ -7615,8 +7621,18 @@ export declare namespace Network {
7615
7621
  DnsAlpnH3JobWonRace = "dnsAlpnH3JobWonRace",
7616
7622
  UnspecifiedReason = "unspecifiedReason"
7617
7623
  }
7624
+ /**
7625
+ * Source of service worker router.
7626
+ */
7627
+ const enum ServiceWorkerRouterSource {
7628
+ Network = "network",
7629
+ Cache = "cache",
7630
+ FetchEvent = "fetch-event",
7631
+ RaceNetworkAndFetchHandler = "race-network-and-fetch-handler"
7632
+ }
7618
7633
  interface ServiceWorkerRouterInfo {
7619
7634
  ruleIdMatched: integer;
7635
+ matchedSourceType: ServiceWorkerRouterSource;
7620
7636
  }
7621
7637
  /**
7622
7638
  * HTTP response data.
@@ -7687,7 +7703,7 @@ export declare namespace Network {
7687
7703
  */
7688
7704
  fromPrefetchCache?: boolean;
7689
7705
  /**
7690
- * Infomation about how Service Worker Static Router was used.
7706
+ * Information about how Service Worker Static Router was used.
7691
7707
  */
7692
7708
  serviceWorkerRouterInfo?: ServiceWorkerRouterInfo;
7693
7709
  /**
@@ -8287,7 +8303,7 @@ export declare namespace Network {
8287
8303
  */
8288
8304
  securityDetails?: SecurityDetails;
8289
8305
  /**
8290
- * Errors occurred while handling the signed exchagne.
8306
+ * Errors occurred while handling the signed exchange.
8291
8307
  */
8292
8308
  errors?: SignedExchangeError[];
8293
8309
  }
@@ -8917,7 +8933,7 @@ export declare namespace Network {
8917
8933
  */
8918
8934
  type: ResourceType;
8919
8935
  /**
8920
- * User friendly error message.
8936
+ * Error message. List of network errors: https://cs.chromium.org/chromium/src/net/base/net_error_list.h
8921
8937
  */
8922
8938
  errorText: string;
8923
8939
  /**
@@ -9379,7 +9395,7 @@ export declare namespace Network {
9379
9395
  */
9380
9396
  cookiePartitionKey?: string;
9381
9397
  /**
9382
- * True if partitioned cookies are enabled, but the partition key is not serializeable to string.
9398
+ * True if partitioned cookies are enabled, but the partition key is not serializable to string.
9383
9399
  */
9384
9400
  cookiePartitionKeyOpaque?: boolean;
9385
9401
  /**
@@ -9528,7 +9544,7 @@ export declare namespace Overlay {
9528
9544
  */
9529
9545
  interface SourceOrderConfig {
9530
9546
  /**
9531
- * the color to outline the givent element in.
9547
+ * the color to outline the given element in.
9532
9548
  */
9533
9549
  parentOutlineColor: DOM.RGBA;
9534
9550
  /**
@@ -9874,7 +9890,7 @@ export declare namespace Overlay {
9874
9890
  */
9875
9891
  showCSS: boolean;
9876
9892
  /**
9877
- * Seleted platforms to show the overlay.
9893
+ * Selected platforms to show the overlay.
9878
9894
  */
9879
9895
  selectedPlatform: string;
9880
9896
  /**
@@ -10358,6 +10374,7 @@ export declare namespace Page {
10358
10374
  SharedStorage = "shared-storage",
10359
10375
  SharedStorageSelectUrl = "shared-storage-select-url",
10360
10376
  SmartCard = "smart-card",
10377
+ SpeakerSelection = "speaker-selection",
10361
10378
  StorageAccess = "storage-access",
10362
10379
  SubApps = "sub-apps",
10363
10380
  SyncXhr = "sync-xhr",
@@ -10667,7 +10684,7 @@ export declare namespace Page {
10667
10684
  */
10668
10685
  message: string;
10669
10686
  /**
10670
- * If criticial, this is a non-recoverable parse error.
10687
+ * If critical, this is a non-recoverable parse error.
10671
10688
  */
10672
10689
  critical: integer;
10673
10690
  /**
@@ -10897,7 +10914,7 @@ export declare namespace Page {
10897
10914
  eager?: boolean;
10898
10915
  }
10899
10916
  /**
10900
- * Enum of possible auto-reponse for permisison / prompt dialogs.
10917
+ * Enum of possible auto-response for permission / prompt dialogs.
10901
10918
  */
10902
10919
  const enum AutoResponseMode {
10903
10920
  None = "none",
@@ -10981,7 +10998,6 @@ export declare namespace Page {
10981
10998
  SubresourceHasCacheControlNoCache = "SubresourceHasCacheControlNoCache",
10982
10999
  ContainsPlugins = "ContainsPlugins",
10983
11000
  DocumentLoaded = "DocumentLoaded",
10984
- DedicatedWorkerOrWorklet = "DedicatedWorkerOrWorklet",
10985
11001
  OutstandingNetworkRequestOthers = "OutstandingNetworkRequestOthers",
10986
11002
  RequestedMIDIPermission = "RequestedMIDIPermission",
10987
11003
  RequestedAudioCapturePermission = "RequestedAudioCapturePermission",
@@ -12028,7 +12044,7 @@ export declare namespace Page {
12028
12044
  */
12029
12045
  interface BackForwardCacheNotUsedEvent {
12030
12046
  /**
12031
- * The loader id for the associated navgation.
12047
+ * The loader id for the associated navigation.
12032
12048
  */
12033
12049
  loaderId: Network.LoaderId;
12034
12050
  /**
@@ -12223,7 +12239,7 @@ export declare namespace PerformanceTimeline {
12223
12239
  frameId: Page.FrameId;
12224
12240
  /**
12225
12241
  * The event type, as specified in https://w3c.github.io/performance-timeline/#dom-performanceentry-entrytype
12226
- * This determines which of the optional "details" fiedls is present.
12242
+ * This determines which of the optional "details" fields is present.
12227
12243
  */
12228
12244
  type: string;
12229
12245
  /**
@@ -12335,7 +12351,7 @@ export declare namespace Security {
12335
12351
  */
12336
12352
  certificateNetworkError?: string;
12337
12353
  /**
12338
- * True if the certificate uses a weak signature aglorithm.
12354
+ * True if the certificate uses a weak signature algorithm.
12339
12355
  */
12340
12356
  certificateHasWeakSignature: boolean;
12341
12357
  /**
@@ -12789,9 +12805,23 @@ export declare namespace Storage {
12789
12805
  * Details for an origin's shared storage.
12790
12806
  */
12791
12807
  interface SharedStorageMetadata {
12808
+ /**
12809
+ * Time when the origin's shared storage was last created.
12810
+ */
12792
12811
  creationTime: Network.TimeSinceEpoch;
12812
+ /**
12813
+ * Number of key-value pairs stored in origin's shared storage.
12814
+ */
12793
12815
  length: integer;
12816
+ /**
12817
+ * Current amount of bits of entropy remaining in the navigation budget.
12818
+ */
12794
12819
  remainingBudget: number;
12820
+ /**
12821
+ * Total number of bytes stored as key-value pairs in origin's shared
12822
+ * storage.
12823
+ */
12824
+ bytesUsed: integer;
12795
12825
  }
12796
12826
  /**
12797
12827
  * Pair of reporting metadata details for a candidate URL for `selectURL()`.
@@ -12976,7 +13006,7 @@ export declare namespace Storage {
12976
13006
  Include = "include",
12977
13007
  Exclude = "exclude"
12978
13008
  }
12979
- interface AttributionReportingAggregatableValueEntry {
13009
+ interface AttributionReportingAggregatableValueDictEntry {
12980
13010
  key: string;
12981
13011
  /**
12982
13012
  * number instead of integer because not all uint32 can be represented by
@@ -12984,6 +13014,10 @@ export declare namespace Storage {
12984
13014
  */
12985
13015
  value: number;
12986
13016
  }
13017
+ interface AttributionReportingAggregatableValueEntry {
13018
+ values: AttributionReportingAggregatableValueDictEntry[];
13019
+ filters: AttributionReportingFilterPair;
13020
+ }
12987
13021
  interface AttributionReportingEventTriggerData {
12988
13022
  data: UnsignedInt64AsBase10;
12989
13023
  priority: SignedInt64AsBase10;
@@ -13428,7 +13462,7 @@ export declare namespace Storage {
13428
13462
  */
13429
13463
  ownerOrigin: string;
13430
13464
  /**
13431
- * The sub-parameters warapped by `params` are all optional and their
13465
+ * The sub-parameters wrapped by `params` are all optional and their
13432
13466
  * presence/absence depends on `type`.
13433
13467
  */
13434
13468
  params: SharedStorageAccessParams;
@@ -13676,6 +13710,9 @@ export declare namespace Target {
13676
13710
  type SessionID = OpaqueIdentifier<string, 'Protocol.Target.SessionID'>;
13677
13711
  interface TargetInfo {
13678
13712
  targetId: TargetID;
13713
+ /**
13714
+ * List of types: https://source.chromium.org/chromium/chromium/src/+/main:content/browser/devtools/devtools_agent_host_impl.cc?ss=chromium&q=f:devtools%20-f:out%20%22::kTypeTab%5B%5D%22
13715
+ */
13679
13716
  type: string;
13680
13717
  title: string;
13681
13718
  url: string;
@@ -13707,7 +13744,7 @@ export declare namespace Target {
13707
13744
  */
13708
13745
  interface FilterEntry {
13709
13746
  /**
13710
- * If set, causes exclusion of mathcing targets from the list.
13747
+ * If set, causes exclusion of matching targets from the list.
13711
13748
  */
13712
13749
  exclude?: boolean;
13713
13750
  /**
@@ -14913,6 +14950,18 @@ export declare namespace WebAuthn {
14913
14950
  * See https://w3c.github.io/webauthn/#sctn-large-blob-extension
14914
14951
  */
14915
14952
  largeBlob?: binary;
14953
+ /**
14954
+ * Assertions returned by this credential will have the backup eligibility
14955
+ * (BE) flag set to this value. Defaults to the authenticator's
14956
+ * defaultBackupEligibility value.
14957
+ */
14958
+ backupEligibility?: boolean;
14959
+ /**
14960
+ * Assertions returned by this credential will have the backup state (BS)
14961
+ * flag set to this value. Defaults to the authenticator's
14962
+ * defaultBackupState value.
14963
+ */
14964
+ backupState?: boolean;
14916
14965
  }
14917
14966
  interface EnableRequest {
14918
14967
  /**
@@ -14983,6 +15032,12 @@ export declare namespace WebAuthn {
14983
15032
  authenticatorId: AuthenticatorId;
14984
15033
  enabled: boolean;
14985
15034
  }
15035
+ interface SetCredentialPropertiesRequest {
15036
+ authenticatorId: AuthenticatorId;
15037
+ credentialId: binary;
15038
+ backupEligibility?: boolean;
15039
+ backupState?: boolean;
15040
+ }
14986
15041
  /**
14987
15042
  * Triggered when a credential is added to an authenticator.
14988
15043
  */
@@ -15241,7 +15296,7 @@ export declare namespace Preload {
15241
15296
  * that had a speculation rule that triggered the attempt, and the
15242
15297
  * BackendNodeIds of <a href> or <area href> elements that triggered the
15243
15298
  * attempt (in the case of attempts triggered by a document rule). It is
15244
- * possible for mulitple rule sets and links to trigger a single attempt.
15299
+ * possible for multiple rule sets and links to trigger a single attempt.
15245
15300
  */
15246
15301
  interface PreloadingAttemptSource {
15247
15302
  key: PreloadingAttemptKey;
@@ -1,4 +1,5 @@
1
1
  import * as Handlers from './handlers/handlers.js';
2
+ import type * as Insights from './insights/insights.js';
2
3
  import * as Types from './types/types.js';
3
4
  export interface ParseConfig {
4
5
  metadata?: Types.File.MetaData;
@@ -62,6 +63,7 @@ export declare class Model<EnabledModelHandlers extends {
62
63
  * If no index is given, the last stored parsed data is returned.
63
64
  */
64
65
  traceParsedData(index?: number): Handlers.Types.EnabledHandlerDataWithMeta<EnabledModelHandlers> | null;
66
+ traceInsights(index?: number): Insights.Types.TraceInsightData | null;
65
67
  metadata(index: number): Types.File.MetaData | null;
66
68
  traceEvents(index: number): readonly Types.TraceEvents.TraceEventData[] | null;
67
69
  size(): number;
@@ -78,6 +80,7 @@ export type ParsedTraceFile<Handlers extends {
78
80
  [key: string]: Handlers.Types.TraceEventHandler;
79
81
  }> = Types.File.TraceFile & {
80
82
  traceParsedData: Handlers.Types.EnabledHandlerDataWithMeta<Handlers> | null;
83
+ traceInsights: Insights.Types.TraceInsightData | null;
81
84
  };
82
85
  export declare const enum ModelUpdateType {
83
86
  COMPLETE = "COMPLETE",
@@ -87,12 +87,13 @@ export class Model extends EventTarget {
87
87
  traceEvents,
88
88
  metadata,
89
89
  traceParsedData: null,
90
+ traceInsights: null,
90
91
  };
91
92
  try {
92
93
  // Wait for all outstanding promises before finishing the async execution,
93
94
  // but perform all tasks in parallel.
94
95
  await this.#processor.parse(traceEvents, isFreshRecording);
95
- this.#storeParsedFileData(file, this.#processor.data);
96
+ this.#storeParsedFileData(file, this.#processor.traceParsedData, this.#processor.insights);
96
97
  // We only push the file onto this.#traces here once we know it's valid
97
98
  // and there's been no errors in the parsing.
98
99
  this.#traces.push(file);
@@ -107,8 +108,9 @@ export class Model extends EventTarget {
107
108
  this.dispatchEvent(new ModelUpdateEvent({ type: "COMPLETE" /* ModelUpdateType.COMPLETE */, data: 'done' }));
108
109
  }
109
110
  }
110
- #storeParsedFileData(file, data) {
111
+ #storeParsedFileData(file, data, insights) {
111
112
  file.traceParsedData = data;
113
+ file.traceInsights = insights;
112
114
  this.#lastRecordingIndex++;
113
115
  let recordingName = `Trace ${this.#lastRecordingIndex}`;
114
116
  let origin = null;
@@ -132,6 +134,12 @@ export class Model extends EventTarget {
132
134
  }
133
135
  return this.#traces[index].traceParsedData;
134
136
  }
137
+ traceInsights(index = this.#traces.length - 1) {
138
+ if (!this.#traces[index]) {
139
+ return null;
140
+ }
141
+ return this.#traces[index].traceInsights;
142
+ }
135
143
  metadata(index) {
136
144
  if (!this.#traces[index]) {
137
145
  return null;
@@ -1 +1 @@
1
- {"version":3,"file":"ModelImpl.js","sourceRoot":"","sources":["../../../../../../front_end/models/trace/ModelImpl.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B;AAE7B,OAAO,KAAK,QAAQ,MAAM,iCAAiC,CAAC;AAE5D,OAAO,KAAK,QAAQ,MAAM,wBAAwB,CAAC;AACnD,OAAO,KAAK,OAAO,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAC,uBAAuB,EAAE,cAAc,EAAC,MAAM,gBAAgB,CAAC;AACvE,OAAO,KAAK,KAAK,MAAM,kBAAkB,CAAC;AAY1C;;;;;;;;;;;;IAYI;AACJ,MAAM,OAAO,KAAsF,SAAQ,WAAW;IAC3G,OAAO,GAA4C,EAAE,CAAC;IACtD,mBAAmB,GAAG,IAAI,GAAG,EAAkB,CAAC;IAEhD,oBAAoB,GAAa,EAAE,CAAC;IAC7C,mBAAmB,GAAG,CAAC,CA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AO,gBAAiB,SAAQ,KAAK;IAEtB;IADnB,MAAM,CAAU,SAAS,GAAG,aAAa,CAAC;IAC1C,YAAmB,IAA0B;QAC3C,KAAK,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC;QADjB,SAAI,GAAJ,IAAI,CAAsB;IAE7C,CAAC;;AASH,MAAM,UAAU,yBAAyB,CAAC,SAA+B;IACvE,OAAO,SAAS,CAAC,IAAI,8CAA6B,CAAC;AACrD,CAAC;AAED,MAAM,UAAU,yBAAyB,CAAC,SAA+B;IACvE,OAAO,SAAS,CAAC,IAAI,4DAAoC,CAAC;AAC5D,CAAC","sourcesContent":["// Copyright 2022 The Chromium Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\nimport * as Platform from '../../core/platform/platform.js';\n\nimport * as Handlers from './handlers/handlers.js';\nimport * as Helpers from './helpers/helpers.js';\nimport {TraceParseProgressEvent, TraceProcessor} from './Processor.js';\nimport * as Types from './types/types.js';\n\n// Note: this model is implemented in a way that can support multiple trace\n// processors. Currently there is only one implemented, but you will see\n// references to \"processors\" plural because it can easily be extended in the future.\n\nexport interface ParseConfig {\n metadata?: Types.File.MetaData;\n // Unused but will eventually be consumed by UIUtils Linkifier, etc.\n isFreshRecording?: boolean;\n}\n\n/**\n * The new trace engine model we are migrating to. The Model is responsible for\n * parsing arrays of raw trace events and storing the resulting data. It can\n * store multiple traces at once, and can return the data for any of them.\n * Currently as we migrate from the old engine to this, we are turning on the\n * model handlers incrementally as we need the data, to save performance costs\n * of running handlers that we do not use. Therefore, when the model is\n * constructed we pass through a set of handlers that should be used. Once we\n * have migrated all tracks in the Performance Panel to this model, we can\n * remove this ability to run a subset of handlers, as we will need all handlers\n * to be used at that point. For tests, if you want to construct a model with\n * all handlers, you can use the static `Model.createWithAllHandlers` method.\n **/\nexport class Model<EnabledModelHandlers extends {[key: string]: Handlers.Types.TraceEventHandler}> extends EventTarget {\n readonly #traces: ParsedTraceFile<EnabledModelHandlers>[] = [];\n readonly #nextNumberByDomain = new Map<string, number>();\n\n readonly #recordingsAvailable: string[] = [];\n #lastRecordingIndex = 0;\n #processor: TraceProcessor<Handlers.Types.HandlersWithMeta<EnabledModelHandlers>>;\n #config: Types.Configuration.Configuration = Types.Configuration.DEFAULT;\n\n static createWithAllHandlers(config?: Types.Configuration.Configuration): Model<typeof Handlers.ModelHandlers> {\n return new Model(Handlers.ModelHandlers, config);\n }\n\n constructor(handlers: EnabledModelHandlers, config?: Types.Configuration.Configuration) {\n super();\n if (config) {\n this.#config = config;\n }\n this.#processor = new TraceProcessor(handlers, this.#config);\n }\n\n /**\n * Updates the configuration. Useful if a user changes a setting - this lets\n * us update the model without having to destroy it and recreate it with the\n * new settings.\n */\n updateConfiguration(config: Types.Configuration.Configuration): void {\n this.#config = config;\n this.#processor.updateConfiguration(config);\n }\n\n /**\n * Parses an array of trace events into a structured object containing all the\n * information parsed by the trace handlers.\n * You can `await` this function to pause execution until parsing is complete,\n * or instead rely on the `ModuleUpdateEvent` that is dispatched when the\n * parsing is finished.\n *\n * Once parsed, you then have to call the `traceParsedData` method, providing an\n * index of the trace you want to have the data for. This is because any model\n * can store a number of traces. Each trace is given an index, which starts at 0\n * and increments by one as a new trace is parsed.\n *\n * @example\n * // Awaiting the parse method() to block until parsing complete\n * await this.traceModel.parse(events);\n * const data = this.traceModel.traceParsedData(0)\n *\n * @example\n * // Using an event listener to be notified when tracing is complete.\n * this.traceModel.addEventListener(Trace.ModelUpdateEvent.eventName, (event) => {\n * if(event.data.data === 'done') {\n * // trace complete\n * const data = this.traceModel.traceParsedData(0);\n * }\n * });\n * void this.traceModel.parse(events);\n **/\n async parse(traceEvents: readonly Types.TraceEvents.TraceEventData[], config?: ParseConfig): Promise<void> {\n const metadata = config?.metadata || {};\n const isFreshRecording = config?.isFreshRecording || false;\n // During parsing, periodically update any listeners on each processors'\n // progress (if they have any updates).\n const onTraceUpdate = (event: Event): void => {\n const {data} = event as TraceParseProgressEvent;\n this.dispatchEvent(new ModelUpdateEvent({type: ModelUpdateType.PROGRESS_UPDATE, data: data}));\n };\n\n this.#processor.addEventListener(TraceParseProgressEvent.eventName, onTraceUpdate);\n\n // Create a parsed trace file. It will be populated with data from the processor.\n const file: ParsedTraceFile<EnabledModelHandlers> = {\n traceEvents,\n metadata,\n traceParsedData: null,\n };\n\n try {\n // Wait for all outstanding promises before finishing the async execution,\n // but perform all tasks in parallel.\n await this.#processor.parse(traceEvents, isFreshRecording);\n this.#storeParsedFileData(file, this.#processor.data);\n // We only push the file onto this.#traces here once we know it's valid\n // and there's been no errors in the parsing.\n this.#traces.push(file);\n } catch (e) {\n throw e;\n } finally {\n // All processors have finished parsing, no more updates are expected.\n this.#processor.removeEventListener(TraceParseProgressEvent.eventName, onTraceUpdate);\n // Finally, update any listeners that all processors are 'done'.\n this.dispatchEvent(new ModelUpdateEvent({type: ModelUpdateType.COMPLETE, data: 'done'}));\n }\n }\n\n #storeParsedFileData(\n file: ParsedTraceFile<EnabledModelHandlers>,\n data: Handlers.Types.EnabledHandlerDataWithMeta<EnabledModelHandlers>|null): void {\n file.traceParsedData = data;\n this.#lastRecordingIndex++;\n let recordingName = `Trace ${this.#lastRecordingIndex}`;\n let origin: string|null = null;\n if (file.traceParsedData) {\n origin = Helpers.Trace.extractOriginFromTrace(file.traceParsedData.Meta.mainFrameURL);\n if (origin) {\n const nextSequenceForDomain = Platform.MapUtilities.getWithDefault(this.#nextNumberByDomain, origin, () => 1);\n recordingName = `${origin} (${nextSequenceForDomain})`;\n this.#nextNumberByDomain.set(origin, nextSequenceForDomain + 1);\n }\n }\n this.#recordingsAvailable.push(recordingName);\n }\n\n /**\n * Returns the parsed trace data indexed by the order in which it was stored.\n * If no index is given, the last stored parsed data is returned.\n */\n traceParsedData(index: number = this.#traces.length - 1):\n Handlers.Types.EnabledHandlerDataWithMeta<EnabledModelHandlers>|null {\n if (!this.#traces[index]) {\n return null;\n }\n\n return this.#traces[index].traceParsedData;\n }\n\n metadata(index: number): Types.File.MetaData|null {\n if (!this.#traces[index]) {\n return null;\n }\n\n return this.#traces[index].metadata;\n }\n\n traceEvents(index: number): readonly Types.TraceEvents.TraceEventData[]|null {\n if (!this.#traces[index]) {\n return null;\n }\n\n return this.#traces[index].traceEvents;\n }\n\n size(): number {\n return this.#traces.length;\n }\n\n deleteTraceByIndex(recordingIndex: number): void {\n this.#traces.splice(recordingIndex, 1);\n this.#recordingsAvailable.splice(recordingIndex, 1);\n }\n\n getRecordingsAvailable(): string[] {\n return this.#recordingsAvailable;\n }\n\n resetProcessor(): void {\n this.#processor.reset();\n }\n}\n\n/**\n * This parsed trace file is used by the Model. It keeps multiple instances\n * of these so that the user can swap between them. The key is that it is\n * essentially the TraceFile plus whatever the model has parsed from it.\n */\nexport type ParsedTraceFile<Handlers extends {[key: string]: Handlers.Types.TraceEventHandler}> = Types.File.TraceFile&{\n traceParsedData: Handlers.Types.EnabledHandlerDataWithMeta<Handlers>| null,\n};\n\nexport const enum ModelUpdateType {\n COMPLETE = 'COMPLETE',\n PROGRESS_UPDATE = 'PROGRESS_UPDATE',\n}\n\nexport type ModelUpdateEventData = ModelUpdateEventComplete|ModelUpdateEventProgress;\n\nexport type ModelUpdateEventComplete = {\n type: ModelUpdateType.COMPLETE,\n data: 'done',\n};\nexport type ModelUpdateEventProgress = {\n type: ModelUpdateType.PROGRESS_UPDATE,\n data: TraceParseEventProgressData,\n};\n\nexport type TraceParseEventProgressData = {\n index: number,\n total: number,\n};\n\nexport class ModelUpdateEvent extends Event {\n static readonly eventName = 'modelupdate';\n constructor(public data: ModelUpdateEventData) {\n super(ModelUpdateEvent.eventName);\n }\n}\n\ndeclare global {\n interface HTMLElementEventMap {\n [ModelUpdateEvent.eventName]: ModelUpdateEvent;\n }\n}\n\nexport function isModelUpdateDataComplete(eventData: ModelUpdateEventData): eventData is ModelUpdateEventComplete {\n return eventData.type === ModelUpdateType.COMPLETE;\n}\n\nexport function isModelUpdateDataProgress(eventData: ModelUpdateEventData): eventData is ModelUpdateEventProgress {\n return eventData.type === ModelUpdateType.PROGRESS_UPDATE;\n}\n"]}
1
+ {"version":3,"file":"ModelImpl.js","sourceRoot":"","sources":["../../../../../../front_end/models/trace/ModelImpl.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,yEAAyE;AACzE,6BAA6B;AAE7B,OAAO,KAAK,QAAQ,MAAM,iCAAiC,CAAC;AAE5D,OAAO,KAAK,QAAQ,MAAM,wBAAwB,CAAC;AACnD,OAAO,KAAK,OAAO,MAAM,sBAAsB,CAAC;AAEhD,OAAO,EAAC,uBAAuB,EAAE,cAAc,EAAC,MAAM,gBAAgB,CAAC;AACvE,OAAO,KAAK,KAAK,MAAM,kBAAkB,CAAC;AAY1C;;;;;;;;;;;;IAYI;AACJ,MAAM,OAAO,KAAsF,SAAQ,WAAW;IAC3G,OAAO,GAA4C,EAAE,CAAC;IACtD,mBAAmB,GAAG,IAAI,GAAG,EAAkB,CAAC;IAEhD,oBAAoB,GAAa,EAAE,CAAC;IAC7C,mBAAmB,GAAG,CAAC,CAAC;IACxB,UAAU,CAAwE;IAClF,OAAO,GAAsC,KAAK,CAAC,aAAa,CAAC,OAAO,CAAC;IAEzE,MAAM,CAAC,qBAAqB,CAAC,MAA0C;QACrE,OAAO,IAAI,KAAK,CAAC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;IACnD,CAAC;IAED,YAAY,QAA8B,EAAE,MAA0C;QACpF,KAAK,EAAE,CAAC;QACR,IAAI,MAAM,EAAE;YACV,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;SACvB;QACD,IAAI,CAAC,UAAU,GAAG,IAAI,cAAc,CAAC,QAAQ,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IAC/D,CAAC;IAED;;;;OAIG;IACH,mBAAmB,CAAC,MAAyC;QAC3D,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,UAAU,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC;IAC9C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;IACvE,OAAO,SAAS,CAAC,IAAI,8CAA6B,CAAC;AACrD,CAAC;AAED,MAAM,UAAU,yBAAyB,CAAC,SAA+B;IACvE,OAAO,SAAS,CAAC,IAAI,4DAAoC,CAAC;AAC5D,CAAC","sourcesContent":["// Copyright 2022 The Chromium Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\nimport * as Platform from '../../core/platform/platform.js';\n\nimport * as Handlers from './handlers/handlers.js';\nimport * as Helpers from './helpers/helpers.js';\nimport type * as Insights from './insights/insights.js';\nimport {TraceParseProgressEvent, TraceProcessor} from './Processor.js';\nimport * as Types from './types/types.js';\n\n// Note: this model is implemented in a way that can support multiple trace\n// processors. Currently there is only one implemented, but you will see\n// references to \"processors\" plural because it can easily be extended in the future.\n\nexport interface ParseConfig {\n metadata?: Types.File.MetaData;\n // Unused but will eventually be consumed by UIUtils Linkifier, etc.\n isFreshRecording?: boolean;\n}\n\n/**\n * The new trace engine model we are migrating to. The Model is responsible for\n * parsing arrays of raw trace events and storing the resulting data. It can\n * store multiple traces at once, and can return the data for any of them.\n * Currently as we migrate from the old engine to this, we are turning on the\n * model handlers incrementally as we need the data, to save performance costs\n * of running handlers that we do not use. Therefore, when the model is\n * constructed we pass through a set of handlers that should be used. Once we\n * have migrated all tracks in the Performance Panel to this model, we can\n * remove this ability to run a subset of handlers, as we will need all handlers\n * to be used at that point. For tests, if you want to construct a model with\n * all handlers, you can use the static `Model.createWithAllHandlers` method.\n **/\nexport class Model<EnabledModelHandlers extends {[key: string]: Handlers.Types.TraceEventHandler}> extends EventTarget {\n readonly #traces: ParsedTraceFile<EnabledModelHandlers>[] = [];\n readonly #nextNumberByDomain = new Map<string, number>();\n\n readonly #recordingsAvailable: string[] = [];\n #lastRecordingIndex = 0;\n #processor: TraceProcessor<Handlers.Types.HandlersWithMeta<EnabledModelHandlers>>;\n #config: Types.Configuration.Configuration = Types.Configuration.DEFAULT;\n\n static createWithAllHandlers(config?: Types.Configuration.Configuration): Model<typeof Handlers.ModelHandlers> {\n return new Model(Handlers.ModelHandlers, config);\n }\n\n constructor(handlers: EnabledModelHandlers, config?: Types.Configuration.Configuration) {\n super();\n if (config) {\n this.#config = config;\n }\n this.#processor = new TraceProcessor(handlers, this.#config);\n }\n\n /**\n * Updates the configuration. Useful if a user changes a setting - this lets\n * us update the model without having to destroy it and recreate it with the\n * new settings.\n */\n updateConfiguration(config: Types.Configuration.Configuration): void {\n this.#config = config;\n this.#processor.updateConfiguration(config);\n }\n\n /**\n * Parses an array of trace events into a structured object containing all the\n * information parsed by the trace handlers.\n * You can `await` this function to pause execution until parsing is complete,\n * or instead rely on the `ModuleUpdateEvent` that is dispatched when the\n * parsing is finished.\n *\n * Once parsed, you then have to call the `traceParsedData` method, providing an\n * index of the trace you want to have the data for. This is because any model\n * can store a number of traces. Each trace is given an index, which starts at 0\n * and increments by one as a new trace is parsed.\n *\n * @example\n * // Awaiting the parse method() to block until parsing complete\n * await this.traceModel.parse(events);\n * const data = this.traceModel.traceParsedData(0)\n *\n * @example\n * // Using an event listener to be notified when tracing is complete.\n * this.traceModel.addEventListener(Trace.ModelUpdateEvent.eventName, (event) => {\n * if(event.data.data === 'done') {\n * // trace complete\n * const data = this.traceModel.traceParsedData(0);\n * }\n * });\n * void this.traceModel.parse(events);\n **/\n async parse(traceEvents: readonly Types.TraceEvents.TraceEventData[], config?: ParseConfig): Promise<void> {\n const metadata = config?.metadata || {};\n const isFreshRecording = config?.isFreshRecording || false;\n // During parsing, periodically update any listeners on each processors'\n // progress (if they have any updates).\n const onTraceUpdate = (event: Event): void => {\n const {data} = event as TraceParseProgressEvent;\n this.dispatchEvent(new ModelUpdateEvent({type: ModelUpdateType.PROGRESS_UPDATE, data: data}));\n };\n\n this.#processor.addEventListener(TraceParseProgressEvent.eventName, onTraceUpdate);\n\n // Create a parsed trace file. It will be populated with data from the processor.\n const file: ParsedTraceFile<EnabledModelHandlers> = {\n traceEvents,\n metadata,\n traceParsedData: null,\n traceInsights: null,\n };\n\n try {\n // Wait for all outstanding promises before finishing the async execution,\n // but perform all tasks in parallel.\n await this.#processor.parse(traceEvents, isFreshRecording);\n this.#storeParsedFileData(file, this.#processor.traceParsedData, this.#processor.insights);\n // We only push the file onto this.#traces here once we know it's valid\n // and there's been no errors in the parsing.\n this.#traces.push(file);\n } catch (e) {\n throw e;\n } finally {\n // All processors have finished parsing, no more updates are expected.\n this.#processor.removeEventListener(TraceParseProgressEvent.eventName, onTraceUpdate);\n // Finally, update any listeners that all processors are 'done'.\n this.dispatchEvent(new ModelUpdateEvent({type: ModelUpdateType.COMPLETE, data: 'done'}));\n }\n }\n\n #storeParsedFileData(\n file: ParsedTraceFile<EnabledModelHandlers>,\n data: Handlers.Types.EnabledHandlerDataWithMeta<EnabledModelHandlers>|null,\n insights: Insights.Types.TraceInsightData|null): void {\n file.traceParsedData = data;\n file.traceInsights = insights;\n this.#lastRecordingIndex++;\n let recordingName = `Trace ${this.#lastRecordingIndex}`;\n let origin: string|null = null;\n if (file.traceParsedData) {\n origin = Helpers.Trace.extractOriginFromTrace(file.traceParsedData.Meta.mainFrameURL);\n if (origin) {\n const nextSequenceForDomain = Platform.MapUtilities.getWithDefault(this.#nextNumberByDomain, origin, () => 1);\n recordingName = `${origin} (${nextSequenceForDomain})`;\n this.#nextNumberByDomain.set(origin, nextSequenceForDomain + 1);\n }\n }\n this.#recordingsAvailable.push(recordingName);\n }\n\n /**\n * Returns the parsed trace data indexed by the order in which it was stored.\n * If no index is given, the last stored parsed data is returned.\n */\n traceParsedData(index: number = this.#traces.length - 1):\n Handlers.Types.EnabledHandlerDataWithMeta<EnabledModelHandlers>|null {\n if (!this.#traces[index]) {\n return null;\n }\n\n return this.#traces[index].traceParsedData;\n }\n\n traceInsights(index: number = this.#traces.length - 1): Insights.Types.TraceInsightData|null {\n if (!this.#traces[index]) {\n return null;\n }\n\n return this.#traces[index].traceInsights;\n }\n\n metadata(index: number): Types.File.MetaData|null {\n if (!this.#traces[index]) {\n return null;\n }\n\n return this.#traces[index].metadata;\n }\n\n traceEvents(index: number): readonly Types.TraceEvents.TraceEventData[]|null {\n if (!this.#traces[index]) {\n return null;\n }\n\n return this.#traces[index].traceEvents;\n }\n\n size(): number {\n return this.#traces.length;\n }\n\n deleteTraceByIndex(recordingIndex: number): void {\n this.#traces.splice(recordingIndex, 1);\n this.#recordingsAvailable.splice(recordingIndex, 1);\n }\n\n getRecordingsAvailable(): string[] {\n return this.#recordingsAvailable;\n }\n\n resetProcessor(): void {\n this.#processor.reset();\n }\n}\n\n/**\n * This parsed trace file is used by the Model. It keeps multiple instances\n * of these so that the user can swap between them. The key is that it is\n * essentially the TraceFile plus whatever the model has parsed from it.\n */\nexport type ParsedTraceFile<Handlers extends {[key: string]: Handlers.Types.TraceEventHandler}> = Types.File.TraceFile&{\n traceParsedData: Handlers.Types.EnabledHandlerDataWithMeta<Handlers>| null,\n traceInsights: Insights.Types.TraceInsightData | null,\n};\n\nexport const enum ModelUpdateType {\n COMPLETE = 'COMPLETE',\n PROGRESS_UPDATE = 'PROGRESS_UPDATE',\n}\n\nexport type ModelUpdateEventData = ModelUpdateEventComplete|ModelUpdateEventProgress;\n\nexport type ModelUpdateEventComplete = {\n type: ModelUpdateType.COMPLETE,\n data: 'done',\n};\nexport type ModelUpdateEventProgress = {\n type: ModelUpdateType.PROGRESS_UPDATE,\n data: TraceParseEventProgressData,\n};\n\nexport type TraceParseEventProgressData = {\n index: number,\n total: number,\n};\n\nexport class ModelUpdateEvent extends Event {\n static readonly eventName = 'modelupdate';\n constructor(public data: ModelUpdateEventData) {\n super(ModelUpdateEvent.eventName);\n }\n}\n\ndeclare global {\n interface HTMLElementEventMap {\n [ModelUpdateEvent.eventName]: ModelUpdateEvent;\n }\n}\n\nexport function isModelUpdateDataComplete(eventData: ModelUpdateEventData): eventData is ModelUpdateEventComplete {\n return eventData.type === ModelUpdateType.COMPLETE;\n}\n\nexport function isModelUpdateDataProgress(eventData: ModelUpdateEventData): eventData is ModelUpdateEventProgress {\n return eventData.type === ModelUpdateType.PROGRESS_UPDATE;\n}\n"]}
@@ -1,4 +1,5 @@
1
1
  import * as Handlers from './handlers/handlers.js';
2
+ import * as Insights from './insights/insights.js';
2
3
  import * as Types from './types/types.js';
3
4
  export type TraceParseEventProgressData = {
4
5
  index: number;
@@ -23,7 +24,8 @@ export declare class TraceProcessor<EnabledModelHandlers extends {
23
24
  updateConfiguration(config: Types.Configuration.Configuration): void;
24
25
  reset(): void;
25
26
  parse(traceEvents: readonly Types.TraceEvents.TraceEventData[], freshRecording?: boolean): Promise<void>;
26
- get data(): Handlers.Types.EnabledHandlerDataWithMeta<EnabledModelHandlers> | null;
27
+ get traceParsedData(): Handlers.Types.EnabledHandlerDataWithMeta<EnabledModelHandlers> | null;
28
+ get insights(): Insights.Types.TraceInsightData | null;
27
29
  }
28
30
  /**
29
31
  * Some Handlers need data provided by others. Dependencies of a handler handler are
@@ -2,6 +2,7 @@
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
  import * as Handlers from './handlers/handlers.js';
5
+ import * as Insights from './insights/insights.js';
5
6
  import * as Types from './types/types.js';
6
7
  export class TraceParseProgressEvent extends Event {
7
8
  data;
@@ -18,6 +19,7 @@ export class TraceProcessor extends EventTarget {
18
19
  #traceHandlers;
19
20
  #status = "IDLE" /* Status.IDLE */;
20
21
  #modelConfiguration = Types.Configuration.DEFAULT;
22
+ #insights = null;
21
23
  static createWithAllHandlers() {
22
24
  return new TraceProcessor(Handlers.ModelHandlers, Types.Configuration.DEFAULT);
23
25
  }
@@ -88,6 +90,7 @@ export class TraceProcessor extends EventTarget {
88
90
  for (const handler of handlers) {
89
91
  handler.reset();
90
92
  }
93
+ this.#insights = null;
91
94
  this.#status = "IDLE" /* Status.IDLE */;
92
95
  }
93
96
  async parse(traceEvents, freshRecording = false) {
@@ -136,15 +139,51 @@ export class TraceProcessor extends EventTarget {
136
139
  await handler.finalize?.();
137
140
  }
138
141
  }
139
- get data() {
142
+ get traceParsedData() {
140
143
  if (this.#status !== "FINISHED_PARSING" /* Status.FINISHED_PARSING */) {
141
144
  return null;
142
145
  }
143
- const data = {};
146
+ const traceParsedData = {};
144
147
  for (const [name, handler] of Object.entries(this.#traceHandlers)) {
145
- Object.assign(data, { [name]: handler.data() });
148
+ Object.assign(traceParsedData, { [name]: handler.data() });
146
149
  }
147
- return data;
150
+ return traceParsedData;
151
+ }
152
+ #getEnabledInsightRunners(traceParsedData) {
153
+ const enabledInsights = {};
154
+ for (const [name, insight] of Object.entries(Insights.InsightRunners)) {
155
+ const deps = insight.deps();
156
+ if (deps.some(dep => !traceParsedData[dep])) {
157
+ continue;
158
+ }
159
+ Object.assign(enabledInsights, { [name]: insight.generateInsight });
160
+ }
161
+ return enabledInsights;
162
+ }
163
+ get insights() {
164
+ if (!this.traceParsedData) {
165
+ return null;
166
+ }
167
+ if (this.#insights) {
168
+ return this.#insights;
169
+ }
170
+ this.#insights = new Map();
171
+ const enabledInsightRunners = this.#getEnabledInsightRunners(this.traceParsedData);
172
+ for (const nav of this.traceParsedData.Meta.mainFrameNavigations) {
173
+ if (!nav.args.frame || !nav.args.data?.navigationId) {
174
+ continue;
175
+ }
176
+ const context = {
177
+ frameId: nav.args.frame,
178
+ navigationId: nav.args.data.navigationId,
179
+ };
180
+ const navInsightData = {};
181
+ for (const [name, generateInsight] of Object.entries(enabledInsightRunners)) {
182
+ Object.assign(navInsightData, { [name]: generateInsight(this.traceParsedData, context) });
183
+ }
184
+ this.#insights.set(context.navigationId, navInsightData);
185
+ }
186
+ return this.#insights;
148
187
  }
149
188
  }
150
189
  /**