chrome-devtools-frontend 1.0.1564932 → 1.0.1566234

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 (64) hide show
  1. package/AUTHORS +1 -0
  2. package/front_end/Images/src/lock-person.svg +1 -0
  3. package/front_end/core/root/Runtime.ts +5 -0
  4. package/front_end/core/sdk/DOMModel.ts +32 -2
  5. package/front_end/core/sdk/NetworkManager.ts +16 -0
  6. package/front_end/core/sdk/ResourceTreeModel.ts +11 -6
  7. package/front_end/generated/InspectorBackendCommands.ts +18 -0
  8. package/front_end/generated/SupportedCSSProperties.js +65 -23
  9. package/front_end/generated/protocol-mapping.d.ts +22 -0
  10. package/front_end/generated/protocol-proxy-api.d.ts +20 -0
  11. package/front_end/generated/protocol.ts +351 -0
  12. package/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.snapshot.txt +2 -2
  13. package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.ts +2 -2
  14. package/front_end/models/emulation/EmulatedDevices.ts +28 -0
  15. package/front_end/models/javascript_metadata/NativeFunctions.js +4 -0
  16. package/front_end/models/trace/extras/Initiators.ts +59 -0
  17. package/front_end/models/trace/extras/extras.ts +1 -0
  18. package/front_end/models/trace/handlers/NetworkRequestsHandler.ts +19 -2
  19. package/front_end/models/trace/insights/NetworkDependencyTree.ts +3 -1
  20. package/front_end/panels/ai_assistance/AiAssistancePanel.ts +10 -10
  21. package/front_end/panels/ai_assistance/ai_assistance.ts +1 -1
  22. package/front_end/panels/ai_assistance/components/{UserActionRow.ts → ChatMessage.ts} +10 -10
  23. package/front_end/panels/ai_assistance/components/ChatView.ts +5 -5
  24. package/front_end/panels/application/ApplicationPanelSidebar.ts +28 -0
  25. package/front_end/panels/application/ApplicationPanelTreeElement.ts +12 -0
  26. package/front_end/panels/application/DeviceBoundSessionsModel.ts +127 -0
  27. package/front_end/panels/application/DeviceBoundSessionsTreeElement.ts +170 -0
  28. package/front_end/panels/application/DeviceBoundSessionsView.ts +252 -0
  29. package/front_end/panels/application/ResourcesPanel.ts +12 -0
  30. package/front_end/panels/application/application.ts +6 -0
  31. package/front_end/panels/application/deviceBoundSessionsView.css +18 -0
  32. package/front_end/panels/common/ExtensionServer.ts +6 -1
  33. package/front_end/panels/console/ConsoleInsightTeaser.ts +24 -5
  34. package/front_end/panels/console/ConsolePinPane.ts +1 -2
  35. package/front_end/panels/console/ConsoleView.ts +6 -9
  36. package/front_end/panels/console/ConsoleViewMessage.ts +20 -13
  37. package/front_end/panels/elements/CSSValueTraceView.ts +1 -1
  38. package/front_end/panels/elements/ElementsTreeElement.ts +1 -1
  39. package/front_end/panels/elements/ElementsTreeOutline.ts +13 -0
  40. package/front_end/panels/elements/LayersWidget.ts +1 -1
  41. package/front_end/panels/elements/MetricsSidebarPane.ts +3 -1
  42. package/front_end/panels/emulation/MediaQueryInspector.ts +1 -2
  43. package/front_end/panels/network/RequestResponseView.ts +1 -1
  44. package/front_end/panels/recorder/RecorderController.ts +16 -0
  45. package/front_end/panels/security/SecurityPanelSidebar.ts +0 -1
  46. package/front_end/panels/sources/AiCodeCompletionPlugin.ts +6 -9
  47. package/front_end/panels/timeline/Initiators.ts +7 -5
  48. package/front_end/panels/timeline/components/NetworkRequestDetails.ts +5 -3
  49. package/front_end/third_party/chromium/README.chromium +1 -1
  50. package/front_end/third_party/codemirror.next/rebuild.sh +1 -1
  51. package/front_end/third_party/lit/rebuild.sh +1 -1
  52. package/front_end/ui/components/buttons/button.css +6 -0
  53. package/front_end/ui/components/text_editor/{AiCodeCompletionTeaserPlaceholder.ts → AccessiblePlaceholder.ts} +3 -22
  54. package/front_end/ui/components/text_editor/AiCodeCompletionProvider.ts +16 -13
  55. package/front_end/ui/components/text_editor/AiCodeGenerationProvider.ts +11 -10
  56. package/front_end/ui/components/text_editor/TextEditor.ts +3 -0
  57. package/front_end/ui/components/text_editor/text_editor.ts +1 -1
  58. package/front_end/ui/legacy/PopoverHelper.ts +10 -0
  59. package/front_end/ui/legacy/components/color_picker/FormatPickerContextMenu.ts +8 -1
  60. package/front_end/ui/legacy/softContextMenu.css +2 -0
  61. package/front_end/ui/lit/lit.ts +1 -0
  62. package/front_end/ui/visual_logging/KnownContextValues.ts +8 -0
  63. package/package.json +1 -1
  64. /package/front_end/panels/ai_assistance/components/{userActionRow.css → chatMessage.css} +0 -0
@@ -11362,6 +11362,296 @@ export namespace Network {
11362
11362
  groupName: string;
11363
11363
  }
11364
11364
 
11365
+ /**
11366
+ * Unique identifier for a device bound session.
11367
+ */
11368
+ export interface DeviceBoundSessionKey {
11369
+ /**
11370
+ * The site the session is set up for.
11371
+ */
11372
+ site: string;
11373
+ /**
11374
+ * The id of the session.
11375
+ */
11376
+ id: string;
11377
+ }
11378
+
11379
+ /**
11380
+ * A device bound session's cookie craving.
11381
+ */
11382
+ export interface DeviceBoundSessionCookieCraving {
11383
+ /**
11384
+ * The name of the craving.
11385
+ */
11386
+ name: string;
11387
+ /**
11388
+ * The domain of the craving.
11389
+ */
11390
+ domain: string;
11391
+ /**
11392
+ * The path of the craving.
11393
+ */
11394
+ path: string;
11395
+ /**
11396
+ * The `Secure` attribute of the craving attributes.
11397
+ */
11398
+ secure: boolean;
11399
+ /**
11400
+ * The `HttpOnly` attribute of the craving attributes.
11401
+ */
11402
+ httpOnly: boolean;
11403
+ /**
11404
+ * The `SameSite` attribute of the craving attributes.
11405
+ */
11406
+ sameSite?: CookieSameSite;
11407
+ }
11408
+
11409
+ export const enum DeviceBoundSessionUrlRuleRuleType {
11410
+ Exclude = 'Exclude',
11411
+ Include = 'Include',
11412
+ }
11413
+
11414
+ /**
11415
+ * A device bound session's inclusion URL rule.
11416
+ */
11417
+ export interface DeviceBoundSessionUrlRule {
11418
+ /**
11419
+ * See comments on `net::device_bound_sessions::SessionInclusionRules::UrlRule::rule_type`.
11420
+ */
11421
+ ruleType: DeviceBoundSessionUrlRuleRuleType;
11422
+ /**
11423
+ * See comments on `net::device_bound_sessions::SessionInclusionRules::UrlRule::host_pattern`.
11424
+ */
11425
+ hostPattern: string;
11426
+ /**
11427
+ * See comments on `net::device_bound_sessions::SessionInclusionRules::UrlRule::path_prefix`.
11428
+ */
11429
+ pathPrefix: string;
11430
+ }
11431
+
11432
+ /**
11433
+ * A device bound session's inclusion rules.
11434
+ */
11435
+ export interface DeviceBoundSessionInclusionRules {
11436
+ /**
11437
+ * See comments on `net::device_bound_sessions::SessionInclusionRules::origin_`.
11438
+ */
11439
+ origin: string;
11440
+ /**
11441
+ * Whether the whole site is included. See comments on
11442
+ * `net::device_bound_sessions::SessionInclusionRules::include_site_` for more
11443
+ * details; this boolean is true if that value is populated.
11444
+ */
11445
+ includeSite: boolean;
11446
+ /**
11447
+ * See comments on `net::device_bound_sessions::SessionInclusionRules::url_rules_`.
11448
+ */
11449
+ urlRules: DeviceBoundSessionUrlRule[];
11450
+ }
11451
+
11452
+ /**
11453
+ * A device bound session.
11454
+ */
11455
+ export interface DeviceBoundSession {
11456
+ /**
11457
+ * The site and session ID of the session.
11458
+ */
11459
+ key: DeviceBoundSessionKey;
11460
+ /**
11461
+ * See comments on `net::device_bound_sessions::Session::refresh_url_`.
11462
+ */
11463
+ refreshUrl: string;
11464
+ /**
11465
+ * See comments on `net::device_bound_sessions::Session::inclusion_rules_`.
11466
+ */
11467
+ inclusionRules: DeviceBoundSessionInclusionRules;
11468
+ /**
11469
+ * See comments on `net::device_bound_sessions::Session::cookie_cravings_`.
11470
+ */
11471
+ cookieCravings: DeviceBoundSessionCookieCraving[];
11472
+ /**
11473
+ * See comments on `net::device_bound_sessions::Session::expiry_date_`.
11474
+ */
11475
+ expiryDate: Network.TimeSinceEpoch;
11476
+ /**
11477
+ * See comments on `net::device_bound_sessions::Session::cached_challenge__`.
11478
+ */
11479
+ cachedChallenge?: string;
11480
+ /**
11481
+ * See comments on `net::device_bound_sessions::Session::allowed_refresh_initiators_`.
11482
+ */
11483
+ allowedRefreshInitiators: string[];
11484
+ }
11485
+
11486
+ /**
11487
+ * A unique identifier for a device bound session event.
11488
+ */
11489
+ export type DeviceBoundSessionEventId = OpaqueIdentifier<string, 'Protocol.Network.DeviceBoundSessionEventId'>;
11490
+
11491
+ /**
11492
+ * A fetch result for a device bound session creation or refresh.
11493
+ */
11494
+ export const enum DeviceBoundSessionFetchResult {
11495
+ Success = 'Success',
11496
+ KeyError = 'KeyError',
11497
+ SigningError = 'SigningError',
11498
+ ServerRequestedTermination = 'ServerRequestedTermination',
11499
+ InvalidSessionId = 'InvalidSessionId',
11500
+ InvalidChallenge = 'InvalidChallenge',
11501
+ TooManyChallenges = 'TooManyChallenges',
11502
+ InvalidFetcherUrl = 'InvalidFetcherUrl',
11503
+ InvalidRefreshUrl = 'InvalidRefreshUrl',
11504
+ TransientHttpError = 'TransientHttpError',
11505
+ ScopeOriginSameSiteMismatch = 'ScopeOriginSameSiteMismatch',
11506
+ RefreshUrlSameSiteMismatch = 'RefreshUrlSameSiteMismatch',
11507
+ MismatchedSessionId = 'MismatchedSessionId',
11508
+ MissingScope = 'MissingScope',
11509
+ NoCredentials = 'NoCredentials',
11510
+ SubdomainRegistrationWellKnownUnavailable = 'SubdomainRegistrationWellKnownUnavailable',
11511
+ SubdomainRegistrationUnauthorized = 'SubdomainRegistrationUnauthorized',
11512
+ SubdomainRegistrationWellKnownMalformed = 'SubdomainRegistrationWellKnownMalformed',
11513
+ SessionProviderWellKnownUnavailable = 'SessionProviderWellKnownUnavailable',
11514
+ RelyingPartyWellKnownUnavailable = 'RelyingPartyWellKnownUnavailable',
11515
+ FederatedKeyThumbprintMismatch = 'FederatedKeyThumbprintMismatch',
11516
+ InvalidFederatedSessionUrl = 'InvalidFederatedSessionUrl',
11517
+ InvalidFederatedKey = 'InvalidFederatedKey',
11518
+ TooManyRelyingOriginLabels = 'TooManyRelyingOriginLabels',
11519
+ BoundCookieSetForbidden = 'BoundCookieSetForbidden',
11520
+ NetError = 'NetError',
11521
+ ProxyError = 'ProxyError',
11522
+ EmptySessionConfig = 'EmptySessionConfig',
11523
+ InvalidCredentialsConfig = 'InvalidCredentialsConfig',
11524
+ InvalidCredentialsType = 'InvalidCredentialsType',
11525
+ InvalidCredentialsEmptyName = 'InvalidCredentialsEmptyName',
11526
+ InvalidCredentialsCookie = 'InvalidCredentialsCookie',
11527
+ PersistentHttpError = 'PersistentHttpError',
11528
+ RegistrationAttemptedChallenge = 'RegistrationAttemptedChallenge',
11529
+ InvalidScopeOrigin = 'InvalidScopeOrigin',
11530
+ ScopeOriginContainsPath = 'ScopeOriginContainsPath',
11531
+ RefreshInitiatorNotString = 'RefreshInitiatorNotString',
11532
+ RefreshInitiatorInvalidHostPattern = 'RefreshInitiatorInvalidHostPattern',
11533
+ InvalidScopeSpecification = 'InvalidScopeSpecification',
11534
+ MissingScopeSpecificationType = 'MissingScopeSpecificationType',
11535
+ EmptyScopeSpecificationDomain = 'EmptyScopeSpecificationDomain',
11536
+ EmptyScopeSpecificationPath = 'EmptyScopeSpecificationPath',
11537
+ InvalidScopeSpecificationType = 'InvalidScopeSpecificationType',
11538
+ InvalidScopeIncludeSite = 'InvalidScopeIncludeSite',
11539
+ MissingScopeIncludeSite = 'MissingScopeIncludeSite',
11540
+ FederatedNotAuthorizedByProvider = 'FederatedNotAuthorizedByProvider',
11541
+ FederatedNotAuthorizedByRelyingParty = 'FederatedNotAuthorizedByRelyingParty',
11542
+ SessionProviderWellKnownMalformed = 'SessionProviderWellKnownMalformed',
11543
+ SessionProviderWellKnownHasProviderOrigin = 'SessionProviderWellKnownHasProviderOrigin',
11544
+ RelyingPartyWellKnownMalformed = 'RelyingPartyWellKnownMalformed',
11545
+ RelyingPartyWellKnownHasRelyingOrigins = 'RelyingPartyWellKnownHasRelyingOrigins',
11546
+ InvalidFederatedSessionProviderSessionMissing = 'InvalidFederatedSessionProviderSessionMissing',
11547
+ InvalidFederatedSessionWrongProviderOrigin = 'InvalidFederatedSessionWrongProviderOrigin',
11548
+ InvalidCredentialsCookieCreationTime = 'InvalidCredentialsCookieCreationTime',
11549
+ InvalidCredentialsCookieName = 'InvalidCredentialsCookieName',
11550
+ InvalidCredentialsCookieParsing = 'InvalidCredentialsCookieParsing',
11551
+ InvalidCredentialsCookieUnpermittedAttribute = 'InvalidCredentialsCookieUnpermittedAttribute',
11552
+ InvalidCredentialsCookieInvalidDomain = 'InvalidCredentialsCookieInvalidDomain',
11553
+ InvalidCredentialsCookiePrefix = 'InvalidCredentialsCookiePrefix',
11554
+ InvalidScopeRulePath = 'InvalidScopeRulePath',
11555
+ InvalidScopeRuleHostPattern = 'InvalidScopeRuleHostPattern',
11556
+ ScopeRuleOriginScopedHostPatternMismatch = 'ScopeRuleOriginScopedHostPatternMismatch',
11557
+ ScopeRuleSiteScopedHostPatternMismatch = 'ScopeRuleSiteScopedHostPatternMismatch',
11558
+ SigningQuotaExceeded = 'SigningQuotaExceeded',
11559
+ InvalidConfigJson = 'InvalidConfigJson',
11560
+ InvalidFederatedSessionProviderFailedToRestoreKey = 'InvalidFederatedSessionProviderFailedToRestoreKey',
11561
+ FailedToUnwrapKey = 'FailedToUnwrapKey',
11562
+ SessionDeletedDuringRefresh = 'SessionDeletedDuringRefresh',
11563
+ }
11564
+
11565
+ /**
11566
+ * Session event details specific to creation.
11567
+ */
11568
+ export interface CreationEventDetails {
11569
+ /**
11570
+ * The result of the fetch attempt.
11571
+ */
11572
+ fetchResult: DeviceBoundSessionFetchResult;
11573
+ /**
11574
+ * The session if there was a newly created session. This is populated for
11575
+ * all successful creation events.
11576
+ */
11577
+ newSession?: DeviceBoundSession;
11578
+ }
11579
+
11580
+ export const enum RefreshEventDetailsRefreshResult {
11581
+ Refreshed = 'Refreshed',
11582
+ InitializedService = 'InitializedService',
11583
+ Unreachable = 'Unreachable',
11584
+ ServerError = 'ServerError',
11585
+ RefreshQuotaExceeded = 'RefreshQuotaExceeded',
11586
+ FatalError = 'FatalError',
11587
+ SigningQuotaExceeded = 'SigningQuotaExceeded',
11588
+ }
11589
+
11590
+ /**
11591
+ * Session event details specific to refresh.
11592
+ */
11593
+ export interface RefreshEventDetails {
11594
+ /**
11595
+ * The result of a refresh.
11596
+ */
11597
+ refreshResult: RefreshEventDetailsRefreshResult;
11598
+ /**
11599
+ * If there was a fetch attempt, the result of that.
11600
+ */
11601
+ fetchResult?: DeviceBoundSessionFetchResult;
11602
+ /**
11603
+ * The session display if there was a newly created session. This is populated
11604
+ * for any refresh event that modifies the session config.
11605
+ */
11606
+ newSession?: DeviceBoundSession;
11607
+ /**
11608
+ * See comments on `net::device_bound_sessions::RefreshEventResult::was_fully_proactive_refresh`.
11609
+ */
11610
+ wasFullyProactiveRefresh: boolean;
11611
+ }
11612
+
11613
+ export const enum TerminationEventDetailsDeletionReason {
11614
+ Expired = 'Expired',
11615
+ FailedToRestoreKey = 'FailedToRestoreKey',
11616
+ FailedToUnwrapKey = 'FailedToUnwrapKey',
11617
+ StoragePartitionCleared = 'StoragePartitionCleared',
11618
+ ClearBrowsingData = 'ClearBrowsingData',
11619
+ ServerRequested = 'ServerRequested',
11620
+ InvalidSessionParams = 'InvalidSessionParams',
11621
+ RefreshFatalError = 'RefreshFatalError',
11622
+ }
11623
+
11624
+ /**
11625
+ * Session event details specific to termination.
11626
+ */
11627
+ export interface TerminationEventDetails {
11628
+ /**
11629
+ * The reason for a session being deleted.
11630
+ */
11631
+ deletionReason: TerminationEventDetailsDeletionReason;
11632
+ }
11633
+
11634
+ export const enum ChallengeEventDetailsChallengeResult {
11635
+ Success = 'Success',
11636
+ NoSessionId = 'NoSessionId',
11637
+ NoSessionMatch = 'NoSessionMatch',
11638
+ CantSetBoundCookie = 'CantSetBoundCookie',
11639
+ }
11640
+
11641
+ /**
11642
+ * Session event details specific to challenges.
11643
+ */
11644
+ export interface ChallengeEventDetails {
11645
+ /**
11646
+ * The result of a challenge.
11647
+ */
11648
+ challengeResult: ChallengeEventDetailsChallengeResult;
11649
+ /**
11650
+ * The challenge set.
11651
+ */
11652
+ challenge: string;
11653
+ }
11654
+
11365
11655
  /**
11366
11656
  * An object providing the result of a network resource load.
11367
11657
  */
@@ -11902,6 +12192,27 @@ export namespace Network {
11902
12192
  enable: boolean;
11903
12193
  }
11904
12194
 
12195
+ export interface EnableDeviceBoundSessionsRequest {
12196
+ /**
12197
+ * Whether to enable or disable events.
12198
+ */
12199
+ enable: boolean;
12200
+ }
12201
+
12202
+ export interface FetchSchemefulSiteRequest {
12203
+ /**
12204
+ * The URL origin.
12205
+ */
12206
+ origin: string;
12207
+ }
12208
+
12209
+ export interface FetchSchemefulSiteResponse extends ProtocolResponseWithError {
12210
+ /**
12211
+ * The corresponding schemeful site.
12212
+ */
12213
+ schemefulSite: string;
12214
+ }
12215
+
11905
12216
  export interface LoadNetworkResourceRequest {
11906
12217
  /**
11907
12218
  * Frame id to get the resource for. Mandatory for frame targets, and
@@ -12735,6 +13046,46 @@ export namespace Network {
12735
13046
  origin: string;
12736
13047
  endpoints: ReportingApiEndpoint[];
12737
13048
  }
13049
+
13050
+ /**
13051
+ * Triggered when the initial set of device bound sessions is added.
13052
+ */
13053
+ export interface DeviceBoundSessionsAddedEvent {
13054
+ /**
13055
+ * The device bound sessions.
13056
+ */
13057
+ sessions: DeviceBoundSession[];
13058
+ }
13059
+
13060
+ /**
13061
+ * Triggered when a device bound session event occurs.
13062
+ */
13063
+ export interface DeviceBoundSessionEventOccurredEvent {
13064
+ /**
13065
+ * A unique identifier for this session event.
13066
+ */
13067
+ eventId: DeviceBoundSessionEventId;
13068
+ /**
13069
+ * The site this session event is associated with.
13070
+ */
13071
+ site: string;
13072
+ /**
13073
+ * Whether this event was considered successful.
13074
+ */
13075
+ succeeded: boolean;
13076
+ /**
13077
+ * The session ID this event is associated with. May not be populated for
13078
+ * failed events.
13079
+ */
13080
+ sessionId?: string;
13081
+ /**
13082
+ * The below are the different session event type details. Exactly one is populated.
13083
+ */
13084
+ creationEventDetails?: CreationEventDetails;
13085
+ refreshEventDetails?: RefreshEventDetails;
13086
+ terminationEventDetails?: TerminationEventDetails;
13087
+ challengeEventDetails?: ChallengeEventDetails;
13088
+ }
12738
13089
  }
12739
13090
 
12740
13091
  /**
@@ -203,7 +203,7 @@ Durations:
203
203
  - Download time: 1 ms
204
204
  - Main thread processing time: 3 ms
205
205
  - Total duration: 7 ms
206
- Initiator: http://localhost:8787/lcp-discovery-delay/index.html
206
+ Initiator: http://localhost:8787/lcp-discovery-delay/app.js
207
207
  Redirects: no redirects
208
208
  Status code: 200
209
209
  MIME Type: image/jpeg
@@ -212,7 +212,7 @@ Initial priority: Low
212
212
  Final priority: High
213
213
  Render blocking: No
214
214
  From a service worker: No
215
- Initiators (root request to the request that directly loaded this one): http://localhost:8787/lcp-discovery-delay/index.html
215
+ Initiators (root request to the request that directly loaded this one): http://localhost:8787/lcp-discovery-delay/index.html, http://localhost:8787/lcp-discovery-delay/app.js
216
216
  Response headers
217
217
  - Cache-Control: public, max-age=0
218
218
  - ETag: <redacted>
@@ -570,7 +570,7 @@ export class PerformanceTraceFormatter {
570
570
 
571
571
  let cur: Trace.Types.Events.SyntheticNetworkRequest|undefined = request;
572
572
  while (cur) {
573
- const initiator = parsedTrace.data.NetworkRequests.eventToInitiator.get(cur);
573
+ const initiator = Trace.Extras.Initiators.getNetworkInitiator(parsedTrace.data, cur);
574
574
  if (initiator) {
575
575
  // Should never happen, but if it did that would be an infinite loop.
576
576
  if (initiators.includes(initiator)) {
@@ -636,7 +636,7 @@ export class PerformanceTraceFormatter {
636
636
  const downloadTime = syntheticData.finishTime - syntheticData.downloadStart;
637
637
 
638
638
  const renderBlocking = Trace.Helpers.Network.isSyntheticNetworkRequestEventRenderBlocking(request);
639
- const initiator = parsedTrace.data.NetworkRequests.eventToInitiator.get(request);
639
+ const initiator = Trace.Extras.Initiators.getNetworkInitiator(parsedTrace.data, request);
640
640
 
641
641
  const priorityLines = [];
642
642
  if (initialPriority === priority) {
@@ -683,6 +683,8 @@ const emulatedDevices = [
683
683
  'capabilities': ['touch', 'mobile'],
684
684
  'user-agent':
685
685
  'Mozilla/5.0 (iPhone; CPU iPhone OS 18_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.5 Mobile/15E148 Safari/604.1',
686
+ 'user-agent-metadata':
687
+ {'platform': 'iOS', 'platformVersion': '18.5', 'architecture': '', 'model': 'iPhone', 'mobile': true},
686
688
  'type': 'phone',
687
689
  },
688
690
  {
@@ -703,6 +705,8 @@ const emulatedDevices = [
703
705
  'capabilities': ['touch', 'mobile'],
704
706
  'user-agent':
705
707
  'Mozilla/5.0 (iPhone; CPU iPhone OS 18_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.5 Mobile/15E148 Safari/604.1',
708
+ 'user-agent-metadata':
709
+ {'platform': 'iOS', 'platformVersion': '18.5', 'architecture': '', 'model': 'iPhone', 'mobile': true},
706
710
  'type': 'phone',
707
711
  },
708
712
  {
@@ -723,6 +727,8 @@ const emulatedDevices = [
723
727
  'capabilities': ['touch', 'mobile'],
724
728
  'user-agent':
725
729
  'Mozilla/5.0 (iPhone; CPU iPhone OS 18_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.5 Mobile/15E148 Safari/604.1',
730
+ 'user-agent-metadata':
731
+ {'platform': 'iOS', 'platformVersion': '18.5', 'architecture': '', 'model': 'iPhone', 'mobile': true},
726
732
  'type': 'phone',
727
733
  },
728
734
  {
@@ -743,6 +749,8 @@ const emulatedDevices = [
743
749
  'capabilities': ['touch', 'mobile'],
744
750
  'user-agent':
745
751
  'Mozilla/5.0 (iPhone; CPU iPhone OS 18_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.5 Mobile/15E148 Safari/604.1',
752
+ 'user-agent-metadata':
753
+ {'platform': 'iOS', 'platformVersion': '18.5', 'architecture': '', 'model': 'iPhone', 'mobile': true},
746
754
  'type': 'phone',
747
755
  },
748
756
  {
@@ -851,6 +859,8 @@ const emulatedDevices = [
851
859
  'capabilities': ['touch', 'mobile'],
852
860
  'user-agent':
853
861
  'Mozilla/5.0 (iPad; CPU OS 18_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.5 Mobile/15E148 Safari/604.1',
862
+ 'user-agent-metadata':
863
+ {'platform': 'iOS', 'platformVersion': '18.5', 'architecture': '', 'model': 'iPad', 'mobile': true},
854
864
  'type': 'tablet',
855
865
  },
856
866
  {
@@ -871,6 +881,8 @@ const emulatedDevices = [
871
881
  'capabilities': ['touch', 'mobile'],
872
882
  'user-agent':
873
883
  'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.5 Safari/605.1.15',
884
+ 'user-agent-metadata':
885
+ {'platform': 'iOS', 'platformVersion': '18.5', 'architecture': '', 'model': 'iPad', 'mobile': true},
874
886
  'type': 'tablet',
875
887
  },
876
888
  {
@@ -891,6 +903,8 @@ const emulatedDevices = [
891
903
  'capabilities': ['touch', 'mobile'],
892
904
  'user-agent':
893
905
  'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.5 Safari/605.1.15',
906
+ 'user-agent-metadata':
907
+ {'platform': 'iOS', 'platformVersion': '18.5', 'architecture': '', 'model': 'iPad', 'mobile': true},
894
908
  'type': 'tablet',
895
909
  },
896
910
  {
@@ -1143,6 +1157,8 @@ const emulatedDevices = [
1143
1157
  'capabilities': ['touch', 'mobile'],
1144
1158
  'user-agent':
1145
1159
  'Mozilla/5.0 (iPhone; CPU iPhone OS 7_1_2 like Mac OS X) AppleWebKit/537.51.2 (KHTML, like Gecko) Version/7.0 Mobile/11D257 Safari/9537.53',
1160
+ 'user-agent-metadata':
1161
+ {'platform': 'iOS', 'platformVersion': '7.1.2', 'architecture': '', 'model': 'iPhone', 'mobile': true},
1146
1162
  'type': 'phone',
1147
1163
  },
1148
1164
  {
@@ -1171,6 +1187,8 @@ const emulatedDevices = [
1171
1187
  'capabilities': ['touch', 'mobile'],
1172
1188
  'user-agent':
1173
1189
  'Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.0 Mobile/14E304 Safari/602.1',
1190
+ 'user-agent-metadata':
1191
+ {'platform': 'iOS', 'platformVersion': '10.3.1', 'architecture': '', 'model': 'iPhone', 'mobile': true},
1174
1192
  'type': 'phone',
1175
1193
  },
1176
1194
  {
@@ -1199,6 +1217,8 @@ const emulatedDevices = [
1199
1217
  'capabilities': ['touch', 'mobile'],
1200
1218
  'user-agent':
1201
1219
  'Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1',
1220
+ 'user-agent-metadata':
1221
+ {'platform': 'iOS', 'platformVersion': '13.2.3', 'architecture': '', 'model': 'iPhone', 'mobile': true},
1202
1222
  'type': 'phone',
1203
1223
  },
1204
1224
  {
@@ -1227,6 +1247,8 @@ const emulatedDevices = [
1227
1247
  'capabilities': ['touch', 'mobile'],
1228
1248
  'user-agent':
1229
1249
  'Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1',
1250
+ 'user-agent-metadata':
1251
+ {'platform': 'iOS', 'platformVersion': '13.2.3', 'architecture': '', 'model': 'iPhone', 'mobile': true},
1230
1252
  'type': 'phone',
1231
1253
  },
1232
1254
  {
@@ -1241,6 +1263,8 @@ const emulatedDevices = [
1241
1263
  'capabilities': ['touch', 'mobile'],
1242
1264
  'user-agent':
1243
1265
  'Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1',
1266
+ 'user-agent-metadata':
1267
+ {'platform': 'iOS', 'platformVersion': '13.2.3', 'architecture': '', 'model': 'iPhone', 'mobile': true},
1244
1268
  'type': 'phone',
1245
1269
  },
1246
1270
  {
@@ -1716,6 +1740,8 @@ const emulatedDevices = [
1716
1740
  'capabilities': ['touch', 'mobile'],
1717
1741
  'user-agent':
1718
1742
  'Mozilla/5.0 (iPad; CPU OS 11_0 like Mac OS X) AppleWebKit/604.1.34 (KHTML, like Gecko) Version/11.0 Mobile/15A5341f Safari/604.1',
1743
+ 'user-agent-metadata':
1744
+ {'platform': 'iOS', 'platformVersion': '11.0', 'architecture': '', 'model': 'iPad', 'mobile': true},
1719
1745
  'type': 'tablet',
1720
1746
  },
1721
1747
  {
@@ -1730,6 +1756,8 @@ const emulatedDevices = [
1730
1756
  'capabilities': ['touch', 'mobile'],
1731
1757
  'user-agent':
1732
1758
  'Mozilla/5.0 (iPad; CPU OS 11_0 like Mac OS X) AppleWebKit/604.1.34 (KHTML, like Gecko) Version/11.0 Mobile/15A5341f Safari/604.1',
1759
+ 'user-agent-metadata':
1760
+ {'platform': 'iOS', 'platformVersion': '11.0', 'architecture': '', 'model': 'iPad', 'mobile': true},
1733
1761
  'type': 'tablet',
1734
1762
  },
1735
1763
  {
@@ -8918,6 +8918,10 @@ export const NativeFunctions = [
8918
8918
  name: "getFramebufferPixelLocalStorageParameterWEBGL",
8919
8919
  signatures: [["plane","pname"]]
8920
8920
  },
8921
+ {
8922
+ name: "mapSync",
8923
+ signatures: [["mode","?offset","?size"]]
8924
+ },
8921
8925
  {
8922
8926
  name: "mapAsync",
8923
8927
  signatures: [["mode","?offset","?size"]]
@@ -0,0 +1,59 @@
1
+ // Copyright 2026 The Chromium Authors
2
+ // Use of this source code is governed by a BSD-style license that can be
3
+ // found in the LICENSE file.
4
+ import type * as Handlers from '../handlers/handlers.js';
5
+ import type * as Types from '../types/types.js';
6
+
7
+ import {get as getStackTrace} from './StackTraceForEvent.js';
8
+
9
+ /**
10
+ * There are bugs in the backend tracing that means that network requests are
11
+ * often incorrectly tied to an initiator. This function exists as a utility to
12
+ * look up an event's initiator regardless of the type of event, but also to
13
+ * provide a post-parsing fix for network initiators.
14
+ * The TL;DR is that images injected by a script will incorrectly have their
15
+ * initiator set to the root document. To fix this, we look at the stack trace
16
+ * when the request was sent, and use that.
17
+ */
18
+ export function getNetworkInitiator(data: Handlers.Types.HandlerData, event: Types.Events.SyntheticNetworkRequest):
19
+ Types.Events.SyntheticNetworkRequest|undefined {
20
+ const networkHandlerInitiator = data.NetworkRequests.incompleteInitiator.get(event);
21
+ if (networkHandlerInitiator?.args.data.mimeType === 'text/css') {
22
+ // The bugs in tracing & initiators apply mostly to scripts; we have not
23
+ // seen a case where the trace events identify a CSS stylesheet as the
24
+ // initiator that is incorrect. Therefore, if a stylesheet is identified as
25
+ // the initiator, we trust that it is accurate and can exit early.
26
+ return networkHandlerInitiator;
27
+ }
28
+
29
+ // For network requests, it is more reliable to calculate the initiator via
30
+ // the stack trace if we have one.
31
+
32
+ // We have to use the raw source event (`ResourceSendRequest`) as that is
33
+ // the event with the `sampleStackId` property which is required to
34
+ // calculate this stacktrace correctly.
35
+ const stack = getStackTrace(event.rawSourceEvent, data);
36
+
37
+ // If the resource was injected by a script, it will have a parent call
38
+ // frame that points to the script. Otherwise, there is no parent and
39
+ // therefore we fallthrough to looking at the initiator directly on the
40
+ // network request.
41
+ const initiatorCallFrame = stack?.parent?.callFrames.at(0);
42
+ if (!initiatorCallFrame) {
43
+ return networkHandlerInitiator;
44
+ }
45
+
46
+ // Find all the requests for the URL we are searching for. Most of the time
47
+ // there is only 1, but there can be multiple requests for the same URL. The
48
+ // filtering by the timestamp ensures that we can never pick an initiator
49
+ // that happened after the initiated event.
50
+ const matchingRequestIds = data.NetworkRequests.requestIdsByURL.get(initiatorCallFrame.url) ?? [];
51
+ const matchingRequests = matchingRequestIds.map(id => data.NetworkRequests.byId.get(id))
52
+ .filter(req => req !== undefined)
53
+ .filter(req => req.ts < event.ts);
54
+
55
+ // Now we have filtered and have a list of requests that are before the
56
+ // event, we take the last one - the one closest to the initiated event.
57
+ // In the case that there are >1 requests, this is an educated guess.
58
+ return matchingRequests.at(-1);
59
+ }
@@ -3,6 +3,7 @@
3
3
  // found in the LICENSE file.
4
4
 
5
5
  export * as FilmStrip from './FilmStrip.js';
6
+ export * as Initiators from './Initiators.js';
6
7
  export * as MainThreadActivity from './MainThreadActivity.js';
7
8
  export * as ScriptDuplication from './ScriptDuplication.js';
8
9
  export * as StackTraceForEvent from './StackTraceForEvent.js';
@@ -55,7 +55,13 @@ let linkPreconnectEvents: Types.Events.LinkPreconnect[] = [];
55
55
  interface NetworkRequestData {
56
56
  byId: Map<string, Types.Events.SyntheticNetworkRequest>;
57
57
  byTime: Types.Events.SyntheticNetworkRequest[];
58
- eventToInitiator: Map<Types.Events.SyntheticNetworkRequest, Types.Events.SyntheticNetworkRequest>;
58
+ requestIdsByURL: Map<string, string[]>;
59
+ /**
60
+ * IMPORTANT: you should prefer to use `Trace.Extras.Initiator` to find the initiator.
61
+ * This is because backend trace events have some bugs which means the initiators are not always accurate.
62
+ * See crrev.com/c/7032169 for context.
63
+ */
64
+ incompleteInitiator: Map<Types.Events.SyntheticNetworkRequest, Types.Events.SyntheticNetworkRequest>;
59
65
  webSocket: WebSocketTraceData[];
60
66
  entityMappings: HandlerHelpers.EntityMappings;
61
67
  linkPreconnectEvents: Types.Events.LinkPreconnect[];
@@ -65,6 +71,11 @@ let requestMap = new Map<string, TraceEventsForNetworkRequest>();
65
71
  let requestsById = new Map<string, Types.Events.SyntheticNetworkRequest>();
66
72
  let requestsByTime: Types.Events.SyntheticNetworkRequest[] = [];
67
73
 
74
+ /**
75
+ * URL => RequestId[]. There can be multiple requests for a single URL.
76
+ */
77
+ let requestIdsByURL = new Map<string, string[]>();
78
+
68
79
  let networkRequestEventByInitiatorUrl = new Map<string, Types.Events.SyntheticNetworkRequest[]>();
69
80
  let eventToInitiatorMap = new Map<Types.Events.SyntheticNetworkRequest, Types.Events.SyntheticNetworkRequest>();
70
81
 
@@ -120,6 +131,7 @@ export function reset(): void {
120
131
  networkRequestEventByInitiatorUrl = new Map();
121
132
  eventToInitiatorMap = new Map();
122
133
  webSocketData = new Map();
134
+ requestIdsByURL = new Map();
123
135
  entityMappings = {
124
136
  eventsByEntity: new Map<HandlerHelpers.Entity, Types.Events.Event[]>(),
125
137
  entityByEvent: new Map<Types.Events.Event, HandlerHelpers.Entity>(),
@@ -587,6 +599,10 @@ export async function finalize(): Promise<void> {
587
599
  requestsByTime.push(networkEvent);
588
600
  requestsById.set(networkEvent.args.data.requestId, networkEvent);
589
601
 
602
+ const requestsForUrl = requestIdsByURL.get(networkEvent.args.data.url) ?? [];
603
+ requestsForUrl.push(networkEvent.args.data.requestId);
604
+ requestIdsByURL.set(networkEvent.args.data.url, requestsForUrl);
605
+
590
606
  // Update entity relationships for network events
591
607
  HandlerHelpers.addNetworkRequestToEntityMapping(networkEvent, entityMappings, request);
592
608
 
@@ -617,7 +633,8 @@ export function data(): NetworkRequestData {
617
633
  return {
618
634
  byId: requestsById,
619
635
  byTime: requestsByTime,
620
- eventToInitiator: eventToInitiatorMap,
636
+ requestIdsByURL,
637
+ incompleteInitiator: eventToInitiatorMap,
621
638
  webSocket: [...webSocketData.values()],
622
639
  entityMappings: {
623
640
  entityByEvent: entityMappings.entityByEvent,
@@ -550,7 +550,9 @@ function candidateRequestsByOrigin(
550
550
  }
551
551
 
552
552
  // Filter out all resources that are loaded by the document. Connections are already early.
553
- if (data.NetworkRequests.eventToInitiator.get(request) === mainResource) {
553
+ // TODO(jacktfranklin, b/392090449): swap this over to use the initiator
554
+ // lookup that fixes bugs with dynamically injected content.
555
+ if (data.NetworkRequests.incompleteInitiator.get(request) === mainResource) {
554
556
  return;
555
557
  }
556
558