chrome-devtools-mcp 1.5.0 → 1.7.0

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 (295) hide show
  1. package/README.md +41 -9
  2. package/build/src/HeapSnapshotManager.js +77 -28
  3. package/build/src/McpContext.js +233 -383
  4. package/build/src/McpPage.js +466 -41
  5. package/build/src/McpResponse.js +285 -331
  6. package/build/src/PageCollector.js +53 -122
  7. package/build/src/SlimMcpResponse.js +1 -1
  8. package/build/src/TextSnapshot.js +100 -21
  9. package/build/src/ToolHandler.js +31 -10
  10. package/build/src/WaitForHelper.js +140 -56
  11. package/build/src/bin/chrome-devtools-cli-options.js +63 -3
  12. package/build/src/bin/chrome-devtools-mcp-cli-options.js +16 -7
  13. package/build/src/bin/chrome-devtools-mcp-main.js +3 -3
  14. package/build/src/bin/chrome-devtools.js +19 -3
  15. package/build/src/browser.js +1 -1
  16. package/build/src/daemon/client.js +55 -3
  17. package/build/src/daemon/daemon.js +17 -12
  18. package/build/src/daemon/utils.js +19 -4
  19. package/build/src/devtools/DevtoolsUtils.js +9 -65
  20. package/build/src/{issue-descriptions.js → devtools/issueDescriptions.js} +2 -2
  21. package/build/src/formatters/HeapSnapshotFormatter.js +48 -11
  22. package/build/src/formatters/IssueFormatter.js +2 -2
  23. package/build/src/index.js +13 -3
  24. package/build/src/telemetry/ClearcutLogger.js +4 -1
  25. package/build/src/telemetry/WatchdogClient.js +1 -1
  26. package/build/src/telemetry/metricsRegistry.js +2 -9
  27. package/build/src/telemetry/persistence.js +1 -1
  28. package/build/src/telemetry/transformation.js +50 -0
  29. package/build/src/telemetry/watchdog/ClearcutSender.js +1 -1
  30. package/build/src/telemetry/watchdog/main.js +1 -1
  31. package/build/src/third_party/THIRD_PARTY_NOTICES +230 -287
  32. package/build/src/third_party/bundled-packages.json +4 -6
  33. package/build/src/third_party/devtools-formatter-worker.js +60 -19
  34. package/build/src/third_party/devtools-heap-snapshot-worker.js +383 -182
  35. package/build/src/third_party/index.js +30171 -11328
  36. package/build/src/third_party/issue-descriptions/CoepCorpNotSameOrigin.md +2 -2
  37. package/build/src/third_party/issue-descriptions/CoepCorpNotSameOriginAfterDefaultedToSameOriginByCoep.md +3 -3
  38. package/build/src/third_party/issue-descriptions/CoepCorpNotSameSite.md +2 -2
  39. package/build/src/third_party/issue-descriptions/CoepFrameResourceNeedsCoepHeader.md +1 -1
  40. package/build/src/third_party/issue-descriptions/CompatibilityModeQuirks.md +1 -1
  41. package/build/src/third_party/issue-descriptions/CookieAttributeValueExceedsMaxSize.md +2 -2
  42. package/build/src/third_party/issue-descriptions/LowTextContrast.md +1 -1
  43. package/build/src/third_party/issue-descriptions/SameSiteNoneInsecureErrorRead.md +1 -1
  44. package/build/src/third_party/issue-descriptions/SameSiteNoneInsecureErrorSet.md +1 -1
  45. package/build/src/third_party/issue-descriptions/SameSiteNoneInsecureWarnRead.md +1 -1
  46. package/build/src/third_party/issue-descriptions/SameSiteNoneInsecureWarnSet.md +1 -1
  47. package/build/src/third_party/issue-descriptions/SameSiteUnspecifiedLaxAllowUnsafeRead.md +3 -3
  48. package/build/src/third_party/issue-descriptions/SameSiteUnspecifiedLaxAllowUnsafeSet.md +3 -3
  49. package/build/src/third_party/issue-descriptions/bounceTrackingMitigations.md +1 -1
  50. package/build/src/third_party/issue-descriptions/connectionAllowlistInvalidAllowlistItemType.md +2 -2
  51. package/build/src/third_party/issue-descriptions/connectionAllowlistInvalidHeader.md +2 -2
  52. package/build/src/third_party/issue-descriptions/connectionAllowlistInvalidUrlPattern.md +3 -3
  53. package/build/src/third_party/issue-descriptions/connectionAllowlistItemNotInnerList.md +2 -2
  54. package/build/src/third_party/issue-descriptions/connectionAllowlistMoreThanOneList.md +2 -2
  55. package/build/src/third_party/issue-descriptions/connectionAllowlistReportingEndpointNotToken.md +1 -1
  56. package/build/src/third_party/issue-descriptions/cookieCrossSiteRedirectDowngrade.md +3 -3
  57. package/build/src/third_party/issue-descriptions/cookieExcludeBlockedWithinRelatedWebsiteSet.md +1 -1
  58. package/build/src/third_party/issue-descriptions/cookieExcludePortMismatch.md +1 -1
  59. package/build/src/third_party/issue-descriptions/cookieExcludeSchemeMismatch.md +1 -1
  60. package/build/src/third_party/issue-descriptions/cookieExcludeThirdPartyPhaseoutSet.md +1 -1
  61. package/build/src/third_party/issue-descriptions/cookieWarnThirdPartyPhaseoutRead.md +1 -1
  62. package/build/src/third_party/issue-descriptions/corsAllowCredentialsRequired.md +1 -1
  63. package/build/src/third_party/issue-descriptions/corsDisabledScheme.md +2 -2
  64. package/build/src/third_party/issue-descriptions/corsDisallowedByMode.md +2 -2
  65. package/build/src/third_party/issue-descriptions/corsHeaderDisallowedByPreflightResponse.md +1 -1
  66. package/build/src/third_party/issue-descriptions/corsInvalidHeaderValues.md +3 -3
  67. package/build/src/third_party/issue-descriptions/corsLocalNetworkAccessPermissionDenied.md +1 -1
  68. package/build/src/third_party/issue-descriptions/corsMethodDisallowedByPreflightResponse.md +1 -1
  69. package/build/src/third_party/issue-descriptions/corsNoCorsRedirectModeNotFollow.md +1 -1
  70. package/build/src/third_party/issue-descriptions/corsOriginMismatch.md +3 -3
  71. package/build/src/third_party/issue-descriptions/corsPreflightResponseInvalid.md +2 -2
  72. package/build/src/third_party/issue-descriptions/corsRedirectContainsCredentials.md +3 -3
  73. package/build/src/third_party/issue-descriptions/corsWildcardOriginNotAllowed.md +4 -3
  74. package/build/src/third_party/issue-descriptions/cspEvalViolation.md +4 -4
  75. package/build/src/third_party/issue-descriptions/cspInlineViolation.md +2 -2
  76. package/build/src/third_party/issue-descriptions/cspTrustedTypesPolicyViolation.md +2 -2
  77. package/build/src/third_party/issue-descriptions/cspTrustedTypesSinkViolation.md +4 -4
  78. package/build/src/third_party/issue-descriptions/cspURLViolation.md +4 -4
  79. package/build/src/third_party/issue-descriptions/emailVerificationRequestAccountsEmptyList.md +1 -1
  80. package/build/src/third_party/issue-descriptions/emailVerificationRequestAccountsHttpNotFound.md +1 -1
  81. package/build/src/third_party/issue-descriptions/emailVerificationRequestAccountsInvalidContentType.md +1 -1
  82. package/build/src/third_party/issue-descriptions/emailVerificationRequestAccountsInvalidResponse.md +1 -1
  83. package/build/src/third_party/issue-descriptions/emailVerificationRequestAccountsNoResponse.md +1 -1
  84. package/build/src/third_party/issue-descriptions/emailVerificationRequestDnsFetchFailed.md +1 -1
  85. package/build/src/third_party/issue-descriptions/emailVerificationRequestDnsInvalidRecord.md +1 -1
  86. package/build/src/third_party/issue-descriptions/emailVerificationRequestEmailVerificationWellKnownHttpNotFound.md +1 -1
  87. package/build/src/third_party/issue-descriptions/emailVerificationRequestEmailVerificationWellKnownInvalidContentType.md +1 -1
  88. package/build/src/third_party/issue-descriptions/emailVerificationRequestEmailVerificationWellKnownInvalidResponse.md +1 -1
  89. package/build/src/third_party/issue-descriptions/emailVerificationRequestEmailVerificationWellKnownNoResponse.md +1 -1
  90. package/build/src/third_party/issue-descriptions/emailVerificationRequestInvalidEmail.md +1 -1
  91. package/build/src/third_party/issue-descriptions/emailVerificationRequestJwksHttpNotFound.md +1 -1
  92. package/build/src/third_party/issue-descriptions/emailVerificationRequestJwksInvalidResponse.md +1 -1
  93. package/build/src/third_party/issue-descriptions/emailVerificationRequestKeyBindingSigningFailed.md +1 -1
  94. package/build/src/third_party/issue-descriptions/emailVerificationRequestRpOriginIsOpaque.md +1 -1
  95. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenHttpNotFound.md +1 -1
  96. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenInvalidContentType.md +1 -1
  97. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenInvalidResponse.md +1 -1
  98. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenInvalidSdJwt.md +1 -1
  99. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenMalformedSdJwt.md +1 -1
  100. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenNoResponse.md +1 -1
  101. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidAudience.md +1 -1
  102. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidIssuedAt.md +1 -1
  103. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidNonce.md +1 -1
  104. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidSdHash.md +1 -1
  105. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidTyp.md +1 -1
  106. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingAud.md +1 -1
  107. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingCnf.md +1 -1
  108. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingIat.md +1 -1
  109. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingNonce.md +1 -1
  110. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingSdHash.md +1 -1
  111. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbSignatureFailed.md +1 -1
  112. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidEmail.md +1 -1
  113. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidEmailVerified.md +1 -1
  114. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidHolderKey.md +1 -1
  115. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidIssuedAt.md +1 -1
  116. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidIssuer.md +1 -1
  117. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtJwksMissingKeys.md +1 -1
  118. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtMissingCnf.md +1 -1
  119. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtMissingEmail.md +1 -1
  120. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtMissingIat.md +1 -1
  121. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtMissingIss.md +1 -1
  122. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtSignatureFailed.md +1 -1
  123. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtUnsupportedHeaderAlg.md +1 -1
  124. package/build/src/third_party/issue-descriptions/emailVerificationRequestUserLoggedOut.md +1 -1
  125. package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownAccountsEndpointCrossOrigin.md +1 -1
  126. package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownHttpNotFound.md +1 -1
  127. package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownInvalidContentType.md +1 -1
  128. package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownInvalidResponse.md +1 -1
  129. package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownIssuanceEndpointCrossOrigin.md +1 -1
  130. package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownListEmpty.md +1 -1
  131. package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownMissingAccountsEndpoint.md +1 -1
  132. package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownMissingIssuanceEndpoint.md +1 -1
  133. package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownNoResponse.md +1 -1
  134. package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownUnsupportedSigningAlgorithm.md +1 -1
  135. package/build/src/third_party/issue-descriptions/federatedAuthRequestAccountsHttpNotFound.md +1 -1
  136. package/build/src/third_party/issue-descriptions/federatedAuthRequestAccountsInvalidResponse.md +1 -1
  137. package/build/src/third_party/issue-descriptions/federatedAuthRequestAccountsNoResponse.md +1 -1
  138. package/build/src/third_party/issue-descriptions/federatedAuthRequestApprovalDeclined.md +1 -1
  139. package/build/src/third_party/issue-descriptions/federatedAuthRequestCanceled.md +1 -1
  140. package/build/src/third_party/issue-descriptions/federatedAuthRequestErrorFetchingSignin.md +1 -1
  141. package/build/src/third_party/issue-descriptions/federatedAuthRequestErrorIdToken.md +1 -1
  142. package/build/src/third_party/issue-descriptions/federatedAuthRequestIdTokenHttpNotFound.md +1 -1
  143. package/build/src/third_party/issue-descriptions/federatedAuthRequestIdTokenInvalidRequest.md +1 -1
  144. package/build/src/third_party/issue-descriptions/federatedAuthRequestIdTokenInvalidResponse.md +1 -1
  145. package/build/src/third_party/issue-descriptions/federatedAuthRequestIdTokenNoResponse.md +1 -1
  146. package/build/src/third_party/issue-descriptions/federatedAuthRequestInvalidSigninResponse.md +1 -1
  147. package/build/src/third_party/issue-descriptions/federatedAuthRequestManifestHttpNotFound.md +1 -1
  148. package/build/src/third_party/issue-descriptions/federatedAuthRequestManifestInvalidResponse.md +1 -1
  149. package/build/src/third_party/issue-descriptions/federatedAuthRequestManifestNoResponse.md +1 -1
  150. package/build/src/third_party/issue-descriptions/federatedAuthRequestTooManyRequests.md +1 -1
  151. package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestInvalidAccountsResponse.md +1 -1
  152. package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestInvalidConfigOrWellKnown.md +1 -1
  153. package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNoAccountSharingPermission.md +1 -1
  154. package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNoApiPermission.md +1 -1
  155. package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNoReturningUserFromFetchedAccounts.md +1 -1
  156. package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotIframe.md +1 -1
  157. package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotPotentiallyTrustworthy.md +1 -1
  158. package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotSameOrigin.md +1 -1
  159. package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotSignedInWithIdp.md +1 -1
  160. package/build/src/third_party/issue-descriptions/fetchingPartitionedBlobURL.md +2 -2
  161. package/build/src/third_party/issue-descriptions/genericFormAriaLabelledByToNonExistingIdError.md +2 -2
  162. package/build/src/third_party/issue-descriptions/genericFormAutocompleteAttributeEmptyError.md +1 -1
  163. package/build/src/third_party/issue-descriptions/genericFormDuplicateIdForInputError.md +1 -1
  164. package/build/src/third_party/issue-descriptions/genericFormEmptyIdAndNameAttributesForInputError.md +2 -2
  165. package/build/src/third_party/issue-descriptions/genericFormInputAssignedAutocompleteValueToIdOrNameAttributeError.md +2 -2
  166. package/build/src/third_party/issue-descriptions/genericFormInputHasWrongButWellIntendedAutocompleteValueError.md +1 -1
  167. package/build/src/third_party/issue-descriptions/genericFormInputWithNoLabelError.md +1 -1
  168. package/build/src/third_party/issue-descriptions/genericFormLabelForMatchesNonExistingIdError.md +2 -2
  169. package/build/src/third_party/issue-descriptions/genericFormLabelForNameError.md +1 -1
  170. package/build/src/third_party/issue-descriptions/genericFormLabelHasNeitherForNorNestedInputError.md +1 -1
  171. package/build/src/third_party/issue-descriptions/genericFormModelContextMissingToolName.md +1 -1
  172. package/build/src/third_party/issue-descriptions/genericFormModelContextParameterMissingName.md +1 -1
  173. package/build/src/third_party/issue-descriptions/genericFormModelContextRequiredParameterMissingName.md +1 -1
  174. package/build/src/third_party/issue-descriptions/genericNavigationEntryMarkedSkippable.md +2 -2
  175. package/build/src/third_party/issue-descriptions/heavyAd.md +1 -1
  176. package/build/src/third_party/issue-descriptions/lazyLoadImageZeroSize.md +7 -0
  177. package/build/src/third_party/issue-descriptions/navigatingPartitionedBlobURL.md +3 -3
  178. package/build/src/third_party/issue-descriptions/permissionElementActivationDisabled.md +1 -1
  179. package/build/src/third_party/issue-descriptions/permissionElementActivationDisabledWithOccluder.md +1 -1
  180. package/build/src/third_party/issue-descriptions/permissionElementActivationDisabledWithOccluderParent.md +1 -1
  181. package/build/src/third_party/issue-descriptions/permissionElementFencedFrameDisallowed.md +2 -2
  182. package/build/src/third_party/issue-descriptions/permissionElementFontSizeTooLarge.md +2 -2
  183. package/build/src/third_party/issue-descriptions/permissionElementFontSizeTooSmall.md +2 -2
  184. package/build/src/third_party/issue-descriptions/permissionElementInsetBoxShadowUnsupported.md +1 -1
  185. package/build/src/third_party/issue-descriptions/permissionElementInvalidDisplayStyle.md +2 -2
  186. package/build/src/third_party/issue-descriptions/permissionElementInvalidSizeValue.md +2 -2
  187. package/build/src/third_party/issue-descriptions/permissionElementInvalidType.md +2 -2
  188. package/build/src/third_party/issue-descriptions/permissionElementInvalidTypeActivation.md +2 -2
  189. package/build/src/third_party/issue-descriptions/permissionElementNonOpaqueColor.md +1 -1
  190. package/build/src/third_party/issue-descriptions/permissionElementPaddingBottomUnsupported.md +2 -2
  191. package/build/src/third_party/issue-descriptions/permissionElementPaddingRightUnsupported.md +2 -2
  192. package/build/src/third_party/issue-descriptions/permissionElementRequestInProgress.md +2 -2
  193. package/build/src/third_party/issue-descriptions/permissionElementSecurityChecksFailed.md +1 -1
  194. package/build/src/third_party/issue-descriptions/permissionElementTypeNotSupported.md +2 -2
  195. package/build/src/third_party/issue-descriptions/permissionElementUntrustedEvent.md +1 -1
  196. package/build/src/third_party/issue-descriptions/placeholderDescriptionForInvisibleIssues.md +1 -1
  197. package/build/src/third_party/issue-descriptions/selectElementAccessibilityDisallowedOptGroupChild.md +1 -1
  198. package/build/src/third_party/issue-descriptions/selectElementAccessibilityDisallowedSelectChild.md +1 -1
  199. package/build/src/third_party/issue-descriptions/selectElementAccessibilityInteractiveContentAttributesSelectDescendant.md +1 -1
  200. package/build/src/third_party/issue-descriptions/selectElementAccessibilityInteractiveContentLegendChild.md +1 -1
  201. package/build/src/third_party/issue-descriptions/selectElementAccessibilityInteractiveContentOptionChild.md +1 -1
  202. package/build/src/third_party/issue-descriptions/selectElementAccessibilityNonPhrasingContentOptionChild.md +1 -1
  203. package/build/src/third_party/issue-descriptions/selectivePermissionsIntervention.md +3 -3
  204. package/build/src/third_party/issue-descriptions/sharedArrayBuffer.md +1 -1
  205. package/build/src/third_party/issue-descriptions/sharedDictionaryUseErrorCrossOriginNoCorsRequest.md +1 -1
  206. package/build/src/third_party/issue-descriptions/sharedDictionaryUseErrorMatchingDictionaryNotUsed.md +1 -1
  207. package/build/src/third_party/issue-descriptions/sharedDictionaryUseErrorUnexpectedContentDictionaryHeader.md +1 -1
  208. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorCossOriginNoCorsRequest.md +1 -1
  209. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorDisallowedBySettings.md +1 -1
  210. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorExpiredResponse.md +1 -1
  211. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorFeatureDisabled.md +2 -2
  212. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorInvalidStructuredHeader.md +1 -1
  213. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNavigationRequest.md +2 -2
  214. package/build/src/third_party/issue-descriptions/sriInvalidSignatureHeader.md +4 -4
  215. package/build/src/third_party/issue-descriptions/sriInvalidSignatureInputHeader.md +4 -4
  216. package/build/src/third_party/issue-descriptions/sriMissingSignatureHeader.md +1 -1
  217. package/build/src/third_party/issue-descriptions/sriMissingSignatureInputHeader.md +2 -2
  218. package/build/src/third_party/issue-descriptions/sriSignatureHeaderValueIsIncorrectLength.md +2 -2
  219. package/build/src/third_party/issue-descriptions/sriSignatureHeaderValueIsNotByteSequence.md +4 -4
  220. package/build/src/third_party/issue-descriptions/sriSignatureHeaderValueIsParameterized.md +4 -4
  221. package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidComponentName.md +1 -1
  222. package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidComponentType.md +2 -2
  223. package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidDerivedComponentParameter.md +1 -1
  224. package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidHeaderComponentParameter.md +1 -1
  225. package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidParameter.md +2 -2
  226. package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderKeyIdLength.md +5 -5
  227. package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderMissingLabel.md +3 -3
  228. package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderMissingRequiredParameters.md +2 -2
  229. package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderValueMissingComponents.md +2 -2
  230. package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderValueNotInnerList.md +2 -2
  231. package/build/src/third_party/issue-descriptions/sriValidationFailedIntegrityMismatch.md +4 -4
  232. package/build/src/third_party/issue-descriptions/sriValidationFailedInvalidLength.md +3 -3
  233. package/build/src/third_party/issue-descriptions/sriValidationFailedSignatureExpired.md +2 -2
  234. package/build/src/third_party/issue-descriptions/sriValidationFailedSignatureMismatch.md +2 -2
  235. package/build/src/third_party/issue-descriptions/stylesheetLateImport.md +1 -1
  236. package/build/src/third_party/issue-descriptions/summaryElementAccessibilityInteractiveContentSummaryDescendant.md +1 -1
  237. package/build/src/third_party/issue-descriptions/unencodedDigestIncorrectDigestLength.md +2 -2
  238. package/build/src/third_party/issue-descriptions/unencodedDigestIncorrectDigestType.md +3 -3
  239. package/build/src/third_party/issue-descriptions/unencodedDigestMalformedDictionary.md +2 -2
  240. package/build/src/third_party/issue-descriptions/unencodedDigestUnknownAlgorithm.md +1 -1
  241. package/build/src/third_party/lighthouse-devtools-mcp-bundle.js +3177 -6340
  242. package/build/src/tools/emulation.js +2 -2
  243. package/build/src/tools/extensions.js +1 -1
  244. package/build/src/tools/input.js +213 -112
  245. package/build/src/tools/lighthouse.js +1 -1
  246. package/build/src/tools/memory.js +49 -4
  247. package/build/src/tools/network.js +5 -5
  248. package/build/src/tools/pages.js +22 -89
  249. package/build/src/tools/performance.js +62 -41
  250. package/build/src/tools/screenshot.js +152 -77
  251. package/build/src/tools/script.js +95 -28
  252. package/build/src/tools/snapshot.js +2 -2
  253. package/build/src/tools/thirdPartyDeveloper.js +1 -1
  254. package/build/src/tools/webmcp.js +1 -1
  255. package/build/src/trace-processing/parse.js +1 -1
  256. package/build/src/{logger.js → utils/logger.js} +1 -1
  257. package/build/src/utils/polyfill.js +11 -0
  258. package/build/src/utils/url.js +43 -0
  259. package/build/src/version.js +1 -1
  260. package/package.json +23 -15
  261. package/skills/memory-leak-debugging/SKILL.md +23 -19
  262. package/skills/memory-leak-debugging/references/common-leaks.md +1 -1
  263. package/build/src/Mutex.js +0 -38
  264. package/build/src/devtools/DevToolsConnectionAdapter.js +0 -70
  265. package/build/src/polyfill.js +0 -8
  266. package/build/src/third_party/issue-descriptions/SameSiteExcludeContextDowngradeRead.md +0 -8
  267. package/build/src/third_party/issue-descriptions/SameSiteExcludeContextDowngradeSet.md +0 -8
  268. package/build/src/third_party/issue-descriptions/SameSiteExcludeNavigationContextDowngrade.md +0 -8
  269. package/build/src/third_party/issue-descriptions/SameSiteWarnCrossDowngradeRead.md +0 -8
  270. package/build/src/third_party/issue-descriptions/SameSiteWarnCrossDowngradeSet.md +0 -8
  271. package/build/src/third_party/issue-descriptions/SameSiteWarnStrictLaxDowngradeStrict.md +0 -8
  272. package/build/src/third_party/issue-descriptions/arInsecureContext.md +0 -7
  273. package/build/src/third_party/issue-descriptions/arInvalidInfoHeader.md +0 -5
  274. package/build/src/third_party/issue-descriptions/arInvalidRegisterOsSourceHeader.md +0 -5
  275. package/build/src/third_party/issue-descriptions/arInvalidRegisterOsTriggerHeader.md +0 -5
  276. package/build/src/third_party/issue-descriptions/arInvalidRegisterSourceHeader.md +0 -5
  277. package/build/src/third_party/issue-descriptions/arInvalidRegisterTriggerHeader.md +0 -5
  278. package/build/src/third_party/issue-descriptions/arNavigationRegistrationUniqueScopeAlreadySet.md +0 -5
  279. package/build/src/third_party/issue-descriptions/arNavigationRegistrationWithoutTransientUserActivation.md +0 -6
  280. package/build/src/third_party/issue-descriptions/arNoRegisterOsSourceHeader.md +0 -5
  281. package/build/src/third_party/issue-descriptions/arNoRegisterOsTriggerHeader.md +0 -5
  282. package/build/src/third_party/issue-descriptions/arNoRegisterSourceHeader.md +0 -5
  283. package/build/src/third_party/issue-descriptions/arNoRegisterTriggerHeader.md +0 -5
  284. package/build/src/third_party/issue-descriptions/arNoWebOrOsSupport.md +0 -4
  285. package/build/src/third_party/issue-descriptions/arOsSourceIgnored.md +0 -18
  286. package/build/src/third_party/issue-descriptions/arOsTriggerIgnored.md +0 -19
  287. package/build/src/third_party/issue-descriptions/arPermissionPolicyDisabled.md +0 -8
  288. package/build/src/third_party/issue-descriptions/arSourceAndTriggerHeaders.md +0 -9
  289. package/build/src/third_party/issue-descriptions/arSourceIgnored.md +0 -13
  290. package/build/src/third_party/issue-descriptions/arTriggerIgnored.md +0 -12
  291. package/build/src/third_party/issue-descriptions/arUntrustworthyReportingOrigin.md +0 -10
  292. package/build/src/third_party/issue-descriptions/arWebAndOsHeaders.md +0 -11
  293. package/build/src/utils/types.js +0 -7
  294. package/skills/memory-leak-debugging/references/compare_snapshots.js +0 -109
  295. package/skills/memory-leak-debugging/references/memlab.md +0 -29
@@ -2810,34 +2810,6 @@ const LAYOUT_LINES_HIGHLIGHT_COLOR = [127, 32, 210];
2810
2810
  Mask: Legacy.fromRGBA([248, 249, 249, 1]),
2811
2811
  });
2812
2812
 
2813
- // Copyright 2025 The Chromium Authors
2814
- class WritableDevToolsContext {
2815
- #instances = new Map();
2816
- get(ctor) {
2817
- const instance = this.#instances.get(ctor);
2818
- if (!instance) {
2819
- throw new Error(`No instance for ${ctor.name}. Ensure the bootstrapper creates it.`);
2820
- }
2821
- return instance;
2822
- }
2823
- has(ctor) {
2824
- return this.#instances.has(ctor);
2825
- }
2826
- set(ctor, instance) {
2827
- this.#instances.set(ctor, instance);
2828
- }
2829
- delete(ctor) {
2830
- this.#instances.delete(ctor);
2831
- }
2832
- }
2833
- let gInstance = null;
2834
- function globalInstance() {
2835
- if (!gInstance) {
2836
- gInstance = new WritableDevToolsContext();
2837
- }
2838
- return gInstance;
2839
- }
2840
-
2841
2813
  // Copyright 2026 The Chromium Authors
2842
2814
  var ExperimentName;
2843
2815
  (function (ExperimentName) {
@@ -4801,7 +4773,7 @@ function lockedLazyString(str) {
4801
4773
  // Copyright 2014 The Chromium Authors
4802
4774
  const UIStrings$2 = {
4803
4775
  elementsPanel: 'Elements panel',
4804
- stylesSidebar: 'styles sidebar',
4776
+ stylesSidebar: 'Styles sidebar',
4805
4777
  changesDrawer: 'Changes drawer',
4806
4778
  issuesView: 'Issues view',
4807
4779
  networkPanel: 'Network panel',
@@ -4810,51 +4782,12 @@ const UIStrings$2 = {
4810
4782
  sourcesPanel: 'Sources panel',
4811
4783
  timelinePanel: 'Performance panel',
4812
4784
  memoryInspectorPanel: 'Memory inspector panel',
4813
- developerResourcesPanel: 'Developer Resources panel',
4785
+ developerResourcesPanel: 'Developer resources panel',
4814
4786
  animationsPanel: 'Animations panel',
4815
4787
  lighthousePanel: 'Lighthouse panel',
4816
4788
  };
4817
4789
  const str_$2 = registerUIStrings('core/common/Revealer.ts', UIStrings$2);
4818
4790
  const i18nLazyString$1 = getLazilyComputedLocalizedString.bind(undefined, str_$2);
4819
- let revealerRegistry;
4820
- class RevealerRegistry {
4821
- registeredRevealers = [];
4822
- static instance() {
4823
- if (revealerRegistry === undefined) {
4824
- revealerRegistry = new RevealerRegistry();
4825
- }
4826
- return revealerRegistry;
4827
- }
4828
- static removeInstance() {
4829
- revealerRegistry = undefined;
4830
- }
4831
- register(registration) {
4832
- this.registeredRevealers.push(registration);
4833
- }
4834
- async reveal(revealable, omitFocus) {
4835
- const revealers = await Promise.all(this.getApplicableRegisteredRevealers(revealable).map(registration => registration.loadRevealer()));
4836
- if (revealers.length < 1) {
4837
- throw new Error(`No revealers found for ${revealable}`);
4838
- }
4839
- if (revealers.length > 1) {
4840
- throw new Error(`Conflicting reveals found for ${revealable}`);
4841
- }
4842
- return await revealers[0].reveal(revealable, omitFocus);
4843
- }
4844
- getApplicableRegisteredRevealers(revealable) {
4845
- return this.registeredRevealers.filter(registration => {
4846
- for (const contextType of registration.contextTypes()) {
4847
- if (revealable instanceof contextType) {
4848
- return true;
4849
- }
4850
- }
4851
- return false;
4852
- });
4853
- }
4854
- }
4855
- async function reveal(revealable, omitFocus = false) {
4856
- await RevealerRegistry.instance().reveal(revealable, omitFocus);
4857
- }
4858
4791
  ({
4859
4792
  DEVELOPER_RESOURCES_PANEL: i18nLazyString$1(UIStrings$2.developerResourcesPanel),
4860
4793
  ELEMENTS_PANEL: i18nLazyString$1(UIStrings$2.elementsPanel),
@@ -4872,41 +4805,6 @@ async function reveal(revealable, omitFocus = false) {
4872
4805
  });
4873
4806
 
4874
4807
  // Copyright 2014 The Chromium Authors
4875
- class Console extends ObjectWrapper {
4876
- #messages = [];
4877
- static instance(opts) {
4878
- if (!globalInstance().has(Console) || opts?.forceNew) {
4879
- globalInstance().set(Console, new Console());
4880
- }
4881
- return globalInstance().get(Console);
4882
- }
4883
- static removeInstance() {
4884
- globalInstance().delete(Console);
4885
- }
4886
- addMessage(text, level = "info" , show = false, source) {
4887
- const message = new Message(text, level, Date.now(), show, source);
4888
- this.#messages.push(message);
4889
- this.dispatchEventToListeners("messageAdded" , message);
4890
- }
4891
- log(text) {
4892
- this.addMessage(text, "info" );
4893
- }
4894
- warn(text, source) {
4895
- this.addMessage(text, "warning" , undefined, source);
4896
- }
4897
- error(text, show = true) {
4898
- this.addMessage(text, "error" , show);
4899
- }
4900
- messages() {
4901
- return this.#messages;
4902
- }
4903
- show() {
4904
- void this.showPromise();
4905
- }
4906
- showPromise() {
4907
- return reveal(this);
4908
- }
4909
- }
4910
4808
  var FrontendMessageSource;
4911
4809
  (function (FrontendMessageSource) {
4912
4810
  FrontendMessageSource["CSS"] = "css";
@@ -4914,22 +4812,6 @@ var FrontendMessageSource;
4914
4812
  FrontendMessageSource["ISSUE_PANEL"] = "issue-panel";
4915
4813
  FrontendMessageSource["SELF_XSS"] = "self-xss";
4916
4814
  })(FrontendMessageSource || (FrontendMessageSource = {}));
4917
- class Message {
4918
- text;
4919
- level;
4920
- timestamp;
4921
- show;
4922
- source;
4923
- constructor(text, level, timestamp, show, source) {
4924
- this.text = text;
4925
- this.level = level;
4926
- this.timestamp = (typeof timestamp === 'number') ? timestamp : Date.now();
4927
- this.show = show;
4928
- if (source) {
4929
- this.source = source;
4930
- }
4931
- }
4932
- }
4933
4815
 
4934
4816
  // Copyright 2012 The Chromium Authors
4935
4817
  function normalizePath(path) {
@@ -5333,7 +5215,11 @@ class ParsedURL {
5333
5215
  return 'data:';
5334
5216
  }
5335
5217
  const scheme = this.isBlobURL() ? this.blobInnerScheme : this.scheme;
5336
- return scheme + '://' + this.domain();
5218
+ const domain = this.domain();
5219
+ if (!scheme && !domain) {
5220
+ return '';
5221
+ }
5222
+ return scheme + '://' + domain;
5337
5223
  }
5338
5224
  urlWithoutScheme() {
5339
5225
  if (this.scheme && this.url.startsWith(this.scheme + '://')) {
@@ -5730,7 +5616,6 @@ const UIStrings = {
5730
5616
  extension: 'Extension',
5731
5617
  adorner: 'Adorner',
5732
5618
  account: 'Account',
5733
- privacy: 'Privacy',
5734
5619
  };
5735
5620
  const str_ = registerUIStrings('core/common/SettingRegistration.ts', UIStrings);
5736
5621
  getLocalizedString.bind(undefined, str_);
@@ -5738,6 +5623,7 @@ getLocalizedString.bind(undefined, str_);
5738
5623
  // Copyright 2011 The Chromium Authors
5739
5624
  class HeapSnapshotWorkerProxy extends ObjectWrapper {
5740
5625
  eventHandler;
5626
+ #console;
5741
5627
  nextObjectId = 1;
5742
5628
  nextCallId = 1;
5743
5629
  callbacks = new Map();
@@ -5745,13 +5631,17 @@ class HeapSnapshotWorkerProxy extends ObjectWrapper {
5745
5631
  worker;
5746
5632
  interval;
5747
5633
  workerUrl;
5748
- constructor(eventHandler, workerUrl) {
5634
+ constructor(eventHandler, console, workerUrl) {
5749
5635
  super();
5750
5636
  this.eventHandler = eventHandler;
5637
+ this.#console = console;
5751
5638
  this.workerUrl = workerUrl;
5752
5639
  this.worker = HOST_RUNTIME.createWorker(workerUrl ?? import.meta.resolve('../../entrypoints/heap_snapshot_worker/heap_snapshot_worker-entrypoint.js'));
5753
5640
  this.worker.onmessage = this.messageReceived.bind(this);
5754
5641
  }
5642
+ get console() {
5643
+ return this.#console;
5644
+ }
5755
5645
  createLoader(profileUid, snapshotReceivedCallback) {
5756
5646
  const objectId = this.nextObjectId++;
5757
5647
  const proxy = new HeapSnapshotLoaderProxy(this, objectId, profileUid, snapshotReceivedCallback);
@@ -5819,7 +5709,7 @@ class HeapSnapshotWorkerProxy extends ObjectWrapper {
5819
5709
  return;
5820
5710
  }
5821
5711
  this.checkLongRunningCalls();
5822
- this.interval = window.setInterval(this.checkLongRunningCalls.bind(this), 300);
5712
+ this.interval = globalThis.setInterval(this.checkLongRunningCalls.bind(this), 300);
5823
5713
  }
5824
5714
  checkLongRunningCalls() {
5825
5715
  for (const callId of this.previousCallbacks) {
@@ -5854,8 +5744,8 @@ class HeapSnapshotWorkerProxy extends ObjectWrapper {
5854
5744
  return;
5855
5745
  }
5856
5746
  if (data.error) {
5857
- Console.instance().error(`An error occurred when a call to method '${data.errorMethodName}' was requested`);
5858
- Console.instance().error(data['errorCallStack']);
5747
+ this.#console.error(`An error occurred when a call to method '${data.errorMethodName}' was requested`);
5748
+ this.#console.error(data['errorCallStack']);
5859
5749
  this.callbacks.delete(data.callId);
5860
5750
  return;
5861
5751
  }
@@ -5903,7 +5793,7 @@ class HeapSnapshotLoaderProxy extends HeapSnapshotProxyObject {
5903
5793
  }
5904
5794
  async close() {
5905
5795
  await this.callMethodPromise('close');
5906
- const secondWorker = new HeapSnapshotWorkerProxy(() => { }, this.worker.workerUrl);
5796
+ const secondWorker = new HeapSnapshotWorkerProxy(() => { }, this.worker.console, this.worker.workerUrl);
5907
5797
  const channel = new MessageChannel();
5908
5798
  await secondWorker.setupForSecondaryInit(channel.port2);
5909
5799
  const snapshotProxy = await this.callFactoryMethodPromise('buildSnapshot', HeapSnapshotProxy, [channel.port1]);
@@ -5927,6 +5817,9 @@ class HeapSnapshotProxy extends HeapSnapshotProxyObject {
5927
5817
  interfaceDefinitions() {
5928
5818
  return this.callMethodPromise('interfaceDefinitions');
5929
5819
  }
5820
+ getNativeContextSizes() {
5821
+ return this.callMethodPromise('getNativeContextSizes');
5822
+ }
5930
5823
  aggregatesWithFilter(filter) {
5931
5824
  return this.callMethodPromise('aggregatesWithFilter', filter);
5932
5825
  }
@@ -5945,6 +5838,9 @@ class HeapSnapshotProxy extends HeapSnapshotProxyObject {
5945
5838
  nodeIndexForId(nodeId) {
5946
5839
  return this.callMethodPromise('nodeIndexForId', nodeId);
5947
5840
  }
5841
+ getObjectInfo(nodeIndex) {
5842
+ return this.callMethodPromise('getObjectInfo', nodeIndex);
5843
+ }
5948
5844
  createEdgesProvider(nodeIndex) {
5949
5845
  return this.callFactoryMethod('createEdgesProvider', HeapSnapshotProviderProxy, nodeIndex);
5950
5846
  }
@@ -6747,6 +6643,28 @@ class HeapSnapshotNode {
6747
6643
  }
6748
6644
  return undefined;
6749
6645
  }
6646
+ nodeValueAsInt() {
6647
+ if (this.rawType() !== this.snapshot.nodeNumberType) {
6648
+ return undefined;
6649
+ }
6650
+ if (this.rawName() !== 'int') {
6651
+ return undefined;
6652
+ }
6653
+ const valNode = this.findInternalEdgeTarget('value');
6654
+ if (!valNode) {
6655
+ return undefined;
6656
+ }
6657
+ const value = parseInt(valNode.rawName(), 10);
6658
+ return isNaN(value) ? undefined : value;
6659
+ }
6660
+ nodeStringLength() {
6661
+ const lengthNode = this.findInternalEdgeTarget('length');
6662
+ return lengthNode ? lengthNode.nodeValueAsInt() : undefined;
6663
+ }
6664
+ nodeStringHash() {
6665
+ const hashNode = this.findInternalEdgeTarget('hash');
6666
+ return hashNode ? hashNode.nodeValueAsInt() : undefined;
6667
+ }
6750
6668
  nodeIsTruncatedString() {
6751
6669
  const truncNode = this.findInternalEdgeTarget('truncated');
6752
6670
  if (!truncNode) {
@@ -6904,7 +6822,7 @@ class SecondaryInitManager {
6904
6822
  ...retainers,
6905
6823
  essentialEdges: createBitVector(argsStep2.essentialEdgesBuffer),
6906
6824
  port,
6907
- nodeSelfSizesPromise: this.getNodeSelfSizes()
6825
+ nodeSelfSizesPromise: this.getNodeSelfSizes(),
6908
6826
  };
6909
6827
  const dominatorsAndRetainedSizes = await HeapSnapshot.calculateDominatorsAndRetainedSizes(args);
6910
6828
  const dominatedNodesOutputs = HeapSnapshot.buildDominatedNodes({ ...args, ...dominatorsAndRetainedSizes });
@@ -6934,6 +6852,8 @@ const MIN_INTERFACE_PROPERTY_COUNT = 1;
6934
6852
  const MAX_INTERFACE_NAME_LENGTH = 120;
6935
6853
  const MIN_OBJECT_COUNT_PER_INTERFACE = 2;
6936
6854
  const MIN_OBJECT_PROPORTION_PER_INTERFACE = 1000;
6855
+ const NO_NATIVE_CONTEXT = -1;
6856
+ const SHARED_NATIVE_CONTEXT = -2;
6937
6857
  class HeapSnapshot {
6938
6858
  nodes;
6939
6859
  containmentEdges;
@@ -7006,6 +6926,9 @@ class HeapSnapshot {
7006
6926
  #nodeDistancesForRetainersView;
7007
6927
  #edgeNamesThatAreNotWeakMaps;
7008
6928
  detachednessAndClassIndexArray;
6929
+ nodeNativeContextAttribution;
6930
+ #nativeContextSizes;
6931
+ #nativeContextOrdinals;
7009
6932
  #interfaceNames = new Map();
7010
6933
  #interfaceDefinitions;
7011
6934
  constructor(profile, progress) {
@@ -7091,8 +7014,11 @@ class HeapSnapshot {
7091
7014
  this.buildSamples();
7092
7015
  this.#progress.updateStatus('Building locations…');
7093
7016
  this.buildLocationMap();
7017
+ this.#progress.updateStatus('Calculating native context attribution…');
7018
+ this.calculateNativeContextAttribution();
7094
7019
  this.#progress.updateStatus('Calculating retained sizes…');
7095
7020
  await this.installResultsFromSecondThread(resultsFromSecondWorker);
7021
+ this.calculateNativeContextSizes();
7096
7022
  this.#progress.updateStatus('Calculating statistics…');
7097
7023
  this.calculateStatistics();
7098
7024
  if (this.profile.snapshot.trace_function_count) {
@@ -7127,6 +7053,26 @@ class HeapSnapshot {
7127
7053
  }
7128
7054
  return undefined;
7129
7055
  }
7056
+ getObjectInfo(nodeIndex) {
7057
+ const nodesLength = this.nodes.length;
7058
+ const nodeFieldCount = this.nodeFieldCount;
7059
+ if (!Number.isInteger(nodeIndex) || nodeIndex < 0 || nodeIndex >= nodesLength || nodeIndex % nodeFieldCount !== 0) {
7060
+ throw new Error('Invalid nodeIndex ' + nodeIndex);
7061
+ }
7062
+ const node = this.createNode(nodeIndex);
7063
+ return {
7064
+ id: node.id(),
7065
+ name: node.name(),
7066
+ type: node.type(),
7067
+ nodeIndex,
7068
+ detachedness: node.detachedness(),
7069
+ selfSize: node.selfSize(),
7070
+ retainedSize: node.retainedSize(),
7071
+ distance: node.distance(),
7072
+ edgeCount: node.edgesCount(),
7073
+ retainerCount: node.retainersCount(),
7074
+ };
7075
+ }
7130
7076
  startInitStep1InSecondThread(secondWorker) {
7131
7077
  const resultsFromSecondWorker = new Promise((resolve, reject) => {
7132
7078
  const listener = (e) => {
@@ -7326,40 +7272,76 @@ class HeapSnapshot {
7326
7272
  }
7327
7273
  getDuplicateStrings() {
7328
7274
  const filter = this.createNamedFilter('duplicatedStrings');
7329
- const groupsMap = new Map();
7275
+ const untruncatedGroups = new Map();
7276
+ const truncatedGroups = new Map();
7330
7277
  const node = this.createNode(0);
7331
7278
  for (let i = 0; i < this.nodeCount; ++i) {
7332
7279
  node.nodeIndex = i * this.nodeFieldCount;
7333
7280
  if (filter(node)) {
7334
7281
  const name = node.name();
7335
7282
  const truncated = node.nodeIsTruncatedString();
7336
- let group = groupsMap.get(name);
7337
- if (!group) {
7338
- group = {
7339
- value: name,
7340
- count: 0,
7341
- totalSelfSize: 0,
7342
- totalRetainedSize: 0,
7343
- nodes: [],
7344
- truncated,
7345
- };
7346
- groupsMap.set(name, group);
7347
- }
7348
- else if (truncated) {
7349
- group.truncated = true;
7350
- }
7351
- group.count++;
7352
- group.totalSelfSize += node.selfSize();
7353
- group.totalRetainedSize += node.retainedSize();
7354
- group.nodes.push({
7355
- id: node.id(),
7356
- selfSize: node.selfSize(),
7357
- retainedSize: node.retainedSize(),
7358
- distance: node.distance(),
7359
- });
7283
+ if (truncated) {
7284
+ const length = node.nodeStringLength();
7285
+ const hash = node.nodeStringHash();
7286
+ let groups = truncatedGroups.get(name);
7287
+ if (!groups) {
7288
+ groups = [];
7289
+ truncatedGroups.set(name, groups);
7290
+ }
7291
+ let group = groups.find(g => g.length === length && g.hash === hash);
7292
+ if (!group) {
7293
+ group = {
7294
+ value: name,
7295
+ count: 0,
7296
+ totalSelfSize: 0,
7297
+ totalRetainedSize: 0,
7298
+ nodes: [],
7299
+ truncated: true,
7300
+ length,
7301
+ hash,
7302
+ };
7303
+ groups.push(group);
7304
+ }
7305
+ group.count++;
7306
+ group.totalSelfSize += node.selfSize();
7307
+ group.totalRetainedSize += node.retainedSize();
7308
+ group.nodes.push({
7309
+ id: node.id(),
7310
+ selfSize: node.selfSize(),
7311
+ retainedSize: node.retainedSize(),
7312
+ distance: node.distance(),
7313
+ });
7314
+ }
7315
+ else {
7316
+ let group = untruncatedGroups.get(name);
7317
+ if (!group) {
7318
+ group = {
7319
+ value: name,
7320
+ count: 0,
7321
+ totalSelfSize: 0,
7322
+ totalRetainedSize: 0,
7323
+ nodes: [],
7324
+ truncated: false,
7325
+ };
7326
+ untruncatedGroups.set(name, group);
7327
+ }
7328
+ group.count++;
7329
+ group.totalSelfSize += node.selfSize();
7330
+ group.totalRetainedSize += node.retainedSize();
7331
+ group.nodes.push({
7332
+ id: node.id(),
7333
+ selfSize: node.selfSize(),
7334
+ retainedSize: node.retainedSize(),
7335
+ distance: node.distance(),
7336
+ });
7337
+ }
7360
7338
  }
7361
7339
  }
7362
- return Array.from(groupsMap.values()).sort((a, b) => b.totalRetainedSize - a.totalRetainedSize);
7340
+ const allGroups = [
7341
+ ...untruncatedGroups.values(),
7342
+ ...Array.from(truncatedGroups.values()).flat(),
7343
+ ];
7344
+ return allGroups.sort((a, b) => b.totalRetainedSize - a.totalRetainedSize);
7363
7345
  }
7364
7346
  createNodeIdFilter(minNodeId, maxNodeId) {
7365
7347
  function nodeIdFilter(node) {
@@ -7433,29 +7415,8 @@ class HeapSnapshot {
7433
7415
  });
7434
7416
  markUnreachableNodes();
7435
7417
  return (node) => !getBit(node);
7436
- case 'duplicatedStrings': {
7437
- const stringToNodeIndexMap = new Map();
7438
- const node = this.createNode(0);
7439
- for (let i = 0; i < this.nodeCount; ++i) {
7440
- node.nodeIndex = i * this.nodeFieldCount;
7441
- const rawType = node.rawType();
7442
- if (rawType === this.nodeStringType || rawType === this.nodeConsStringType) {
7443
- if (node.isFlatConsString()) {
7444
- continue;
7445
- }
7446
- const name = node.name();
7447
- const alreadyVisitedNodeIndex = stringToNodeIndexMap.get(name);
7448
- if (alreadyVisitedNodeIndex === undefined) {
7449
- stringToNodeIndexMap.set(name, node.nodeIndex);
7450
- }
7451
- else {
7452
- bitmap.setBit(alreadyVisitedNodeIndex / this.nodeFieldCount);
7453
- bitmap.setBit(node.nodeIndex / this.nodeFieldCount);
7454
- }
7455
- }
7456
- }
7457
- return getBit;
7458
- }
7418
+ case 'duplicatedStrings':
7419
+ return this.createDuplicatedStringsFilter(bitmap);
7459
7420
  case 'objectsRetainedByEventHandlers': {
7460
7421
  const node = this.createNode(0);
7461
7422
  const nodeFieldCount = this.nodeFieldCount;
@@ -7494,9 +7455,79 @@ class HeapSnapshot {
7494
7455
  markUnreachableNodes();
7495
7456
  return (node) => !getBit(node);
7496
7457
  }
7458
+ case 'sharedNativeContext':
7459
+ return (node) => {
7460
+ const ordinal = node.nodeIndex / this.nodeFieldCount;
7461
+ return this.nodeNativeContextAttribution[ordinal] === SHARED_NATIVE_CONTEXT;
7462
+ };
7463
+ case 'noNativeContext':
7464
+ return (node) => {
7465
+ const ordinal = node.nodeIndex / this.nodeFieldCount;
7466
+ return this.nodeNativeContextAttribution[ordinal] === NO_NATIVE_CONTEXT;
7467
+ };
7468
+ default:
7469
+ if (filterName.startsWith('nativeContext_')) {
7470
+ const targetNodeIndex = Number(filterName.substring('nativeContext_'.length));
7471
+ const targetOrdinal = targetNodeIndex / this.nodeFieldCount;
7472
+ return (node) => {
7473
+ const ordinal = node.nodeIndex / this.nodeFieldCount;
7474
+ return this.nodeNativeContextAttribution[ordinal] === targetOrdinal;
7475
+ };
7476
+ }
7497
7477
  }
7498
7478
  throw new Error('Invalid filter name');
7499
7479
  }
7480
+ createDuplicatedStringsFilter(bitmap) {
7481
+ const untruncatedStringToNodeIndexMap = new Map();
7482
+ const truncatedStringToNodeIndexesMap = new Map();
7483
+ const node = this.createNode(0);
7484
+ for (let i = 0; i < this.nodeCount; ++i) {
7485
+ node.nodeIndex = i * this.nodeFieldCount;
7486
+ const rawType = node.rawType();
7487
+ if (rawType !== this.nodeStringType && rawType !== this.nodeConsStringType) {
7488
+ continue;
7489
+ }
7490
+ if (node.isFlatConsString()) {
7491
+ continue;
7492
+ }
7493
+ if (node.selfSize() === 0) {
7494
+ continue;
7495
+ }
7496
+ const name = node.name();
7497
+ const truncated = node.nodeIsTruncatedString();
7498
+ if (truncated) {
7499
+ const length = node.nodeStringLength();
7500
+ const hash = node.nodeStringHash();
7501
+ let entries = truncatedStringToNodeIndexesMap.get(name);
7502
+ if (!entries) {
7503
+ entries = [];
7504
+ truncatedStringToNodeIndexesMap.set(name, entries);
7505
+ }
7506
+ const match = entries.find(e => e.length === length && e.hash === hash);
7507
+ if (match) {
7508
+ bitmap.setBit(match.nodeIndex / this.nodeFieldCount);
7509
+ bitmap.setBit(node.nodeIndex / this.nodeFieldCount);
7510
+ }
7511
+ else {
7512
+ entries.push({ nodeIndex: node.nodeIndex, length, hash });
7513
+ }
7514
+ }
7515
+ else {
7516
+ const alreadyVisitedNodeIndex = untruncatedStringToNodeIndexMap.get(name);
7517
+ if (alreadyVisitedNodeIndex === undefined) {
7518
+ untruncatedStringToNodeIndexMap.set(name, node.nodeIndex);
7519
+ }
7520
+ else {
7521
+ bitmap.setBit(alreadyVisitedNodeIndex / this.nodeFieldCount);
7522
+ bitmap.setBit(node.nodeIndex / this.nodeFieldCount);
7523
+ }
7524
+ }
7525
+ }
7526
+ return (node) => {
7527
+ const ordinal = node.nodeIndex / this.nodeFieldCount;
7528
+ return bitmap.getBit(ordinal);
7529
+ };
7530
+ }
7500
7531
  getAggregatesByClassKey(sortedIndexes, key, filter) {
7501
7532
  let aggregates;
7502
7533
  if (key && this.#aggregates[key]) {
@@ -7815,7 +7846,7 @@ class HeapSnapshot {
7815
7846
  return true;
7816
7847
  }
7817
7848
  static async calculateDominatorsAndRetainedSizes(inputs) {
7818
- const { nodeCount, firstEdgeIndexes, edgeFieldsCount, nodeFieldCount, firstRetainerIndex, retainingEdges, retainingNodes, edgeToNodeOrdinals, rootNodeOrdinal, essentialEdges, nodeSelfSizesPromise, port } = inputs;
7849
+ const { nodeCount, firstEdgeIndexes, edgeFieldsCount, nodeFieldCount, firstRetainerIndex, retainingEdges, retainingNodes, edgeToNodeOrdinals, rootNodeOrdinal, essentialEdges, nodeSelfSizesPromise, port, } = inputs;
7819
7850
  function isEssentialEdge(edgeIndex) {
7820
7851
  return essentialEdges.getBit(edgeIndex / edgeFieldsCount);
7821
7852
  }
@@ -8054,6 +8085,178 @@ class HeapSnapshot {
8054
8085
  node.nodeIndex = node.nextNodeIndex();
8055
8086
  }
8056
8087
  }
8088
+ calculateNativeContextAttribution() {
8089
+ const attribution = new Int32Array(this.nodeCount).fill(NO_NATIVE_CONTEXT);
8090
+ const isFixed = createBitVector(this.nodeCount);
8091
+ const edgeTargets = this.buildInitEdgeTargets();
8092
+ this.#nativeContextOrdinals = [];
8093
+ for (let ordinal = 0; ordinal < this.nodeCount; ordinal++) {
8094
+ if (this.isNativeContext(ordinal)) {
8095
+ this.#nativeContextOrdinals.push(ordinal);
8096
+ attribution[ordinal] = ordinal;
8097
+ isFixed.setBit(ordinal);
8098
+ }
8099
+ else {
8100
+ const owner = this.inferFixedNativeContextForOrdinal(ordinal, edgeTargets);
8101
+ if (owner >= 0) {
8102
+ attribution[ordinal] = owner;
8103
+ isFixed.setBit(ordinal);
8104
+ }
8105
+ }
8106
+ }
8107
+ this.propagateNativeContextAttribution(attribution, isFixed);
8108
+ this.nodeNativeContextAttribution = attribution;
8109
+ }
8110
+ calculateNativeContextSizes() {
8111
+ const nodeFieldCount = this.nodeFieldCount;
8112
+ const node = this.createNode(0);
8113
+ const nativeContexts = [];
8114
+ const ordinalToInfo = new Map();
8115
+ for (const ordinal of this.#nativeContextOrdinals) {
8116
+ node.nodeIndex = ordinal * nodeFieldCount;
8117
+ const info = {
8118
+ nodeId: node.id(),
8119
+ nodeIndex: node.nodeIndex,
8120
+ nodeName: node.name(),
8121
+ attributedSize: 0,
8122
+ retainedSize: node.retainedSize(),
8123
+ selfSize: node.selfSize(),
8124
+ };
8125
+ nativeContexts.push(info);
8126
+ ordinalToInfo.set(ordinal, info);
8127
+ }
8128
+ let sharedSize = 0;
8129
+ let noAttributionSize = 0;
8130
+ const selfSizeOffset = this.nodeSelfSizeOffset;
8131
+ const nodes = this.nodes;
8132
+ for (let i = 0; i < this.nodeCount; ++i) {
8133
+ const ownerOrdinal = this.nodeNativeContextAttribution[i];
8134
+ const selfSize = nodes.getValue(i * nodeFieldCount + selfSizeOffset);
8135
+ if (ownerOrdinal === SHARED_NATIVE_CONTEXT) {
8136
+ sharedSize += selfSize;
8137
+ }
8138
+ else if (ownerOrdinal === NO_NATIVE_CONTEXT) {
8139
+ noAttributionSize += selfSize;
8140
+ }
8141
+ else {
8142
+ console.assert(ownerOrdinal >= 0, 'ownerOrdinal should be >= 0');
8143
+ const info = ordinalToInfo.get(ownerOrdinal);
8144
+ console.assert(info !== undefined, 'info should exist');
8145
+ if (info) {
8146
+ info.attributedSize += selfSize;
8147
+ }
8148
+ }
8149
+ }
8150
+ this.#nativeContextSizes = {
8151
+ nativeContexts,
8152
+ sharedSize,
8153
+ noAttributionSize,
8154
+ };
8155
+ }
8156
+ buildInitEdgeTargets() {
8157
+ const { nodeCount, nodeFieldCount, containmentEdges, edgeFieldsCount, edgeTypeOffset, edgeNameOffset, edgeToNodeOffset, edgeInternalType, firstEdgeIndexes, strings, } = this;
8158
+ const nativeContext = new Int32Array(nodeCount).fill(-1);
8159
+ const map = new Int32Array(nodeCount).fill(-1);
8160
+ const nativeContextIdx = strings.indexOf('native_context');
8161
+ const mapIdx = strings.indexOf('map');
8162
+ for (let ordinal = 0; ordinal < nodeCount; ordinal++) {
8163
+ const first = firstEdgeIndexes[ordinal];
8164
+ const last = firstEdgeIndexes[ordinal + 1];
8165
+ for (let edgeIndex = first; edgeIndex < last; edgeIndex += edgeFieldsCount) {
8166
+ const edgeType = containmentEdges.getValue(edgeIndex + edgeTypeOffset);
8167
+ if (edgeType !== edgeInternalType) {
8168
+ continue;
8169
+ }
8170
+ const nameIdx = containmentEdges.getValue(edgeIndex + edgeNameOffset);
8171
+ const childNodeIndex = containmentEdges.getValue(edgeIndex + edgeToNodeOffset);
8172
+ const childOrdinal = childNodeIndex / nodeFieldCount;
8173
+ if (nameIdx === nativeContextIdx && nativeContext[ordinal] === -1 && this.isNativeContext(childOrdinal)) {
8174
+ nativeContext[ordinal] = childOrdinal;
8175
+ }
8176
+ else if (nameIdx === mapIdx && map[ordinal] === -1) {
8177
+ map[ordinal] = childOrdinal;
8178
+ }
8179
+ }
8180
+ }
8181
+ return { nativeContext, map };
8182
+ }
8183
+ inferFixedNativeContextForOrdinal(ordinal, edgeTargets) {
8184
+ const mapOrdinal = edgeTargets.map[ordinal];
8185
+ if (mapOrdinal >= 0) {
8186
+ const metaMapOrdinal = edgeTargets.map[mapOrdinal];
8187
+ if (metaMapOrdinal >= 0) {
8188
+ const mapNativeContextOrdinal = edgeTargets.nativeContext[metaMapOrdinal];
8189
+ if (mapNativeContextOrdinal >= 0) {
8190
+ return mapNativeContextOrdinal;
8191
+ }
8192
+ }
8193
+ }
8194
+ return NO_NATIVE_CONTEXT;
8195
+ }
8196
+ mergeNativeContextOwner(current, incoming) {
8197
+ console.assert(incoming !== NO_NATIVE_CONTEXT, 'Incoming owner should not be NO_NATIVE_CONTEXT');
8198
+ if (current === SHARED_NATIVE_CONTEXT || incoming === SHARED_NATIVE_CONTEXT) {
8199
+ return SHARED_NATIVE_CONTEXT;
8200
+ }
8201
+ if (current === NO_NATIVE_CONTEXT) {
8202
+ return incoming;
8203
+ }
8204
+ if (current === incoming) {
8205
+ return current;
8206
+ }
8207
+ return SHARED_NATIVE_CONTEXT;
8208
+ }
8209
+ propagateNativeContextAttribution(attribution, isFixed) {
8210
+ const { nodeCount, containmentEdges, edgeFieldsCount, edgeTypeOffset, edgeToNodeOffset, edgeShortcutType, edgeWeakType, nodeFieldCount, firstEdgeIndexes, } = this;
8211
+ const queue = [];
8212
+ for (let ordinal = 0; ordinal < nodeCount; ordinal++) {
8213
+ if (isFixed.getBit(ordinal)) {
8214
+ queue.push(ordinal);
8215
+ }
8216
+ }
8217
+ let queueIndex = 0;
8218
+ while (queueIndex < queue.length) {
8219
+ const ordinal = queue[queueIndex];
8220
+ queueIndex++;
8221
+ const current = attribution[ordinal];
8222
+ console.assert(current !== NO_NATIVE_CONTEXT, 'Queue should not contain unattributed nodes');
8223
+ const first = firstEdgeIndexes[ordinal];
8224
+ const last = firstEdgeIndexes[ordinal + 1];
8225
+ for (let edgeIndex = first; edgeIndex < last; edgeIndex += edgeFieldsCount) {
8226
+ const edgeType = containmentEdges.getValue(edgeIndex + edgeTypeOffset);
8227
+ if (edgeType === edgeShortcutType || edgeType === edgeWeakType) {
8228
+ continue;
8229
+ }
8230
+ const childNodeIndex = containmentEdges.getValue(edgeIndex + edgeToNodeOffset);
8231
+ const childOrdinal = childNodeIndex / nodeFieldCount;
8232
+ if (childOrdinal === ordinal || isFixed.getBit(childOrdinal)) {
8233
+ continue;
8234
+ }
8235
+ const merged = this.mergeNativeContextOwner(attribution[childOrdinal], current);
8236
+ if (merged !== attribution[childOrdinal]) {
8237
+ attribution[childOrdinal] = merged;
8238
+ queue.push(childOrdinal);
8239
+ }
8240
+ }
8241
+ }
8242
+ }
8243
+ getNativeContextSizes() {
8244
+ return this.#nativeContextSizes;
8245
+ }
8246
+ nodeNativeContext(nodeIndex) {
8247
+ const ordinal = nodeIndex / this.nodeFieldCount;
8248
+ const nativeContextOrdinal = this.nodeNativeContextAttribution[ordinal];
8249
+ if (nativeContextOrdinal < 0) {
8250
+ return nativeContextOrdinal;
8251
+ }
8252
+ return nativeContextOrdinal * this.nodeFieldCount;
8253
+ }
8254
+ isNativeContext(nodeOrdinal) {
8255
+ const nameIdx = this.nodes.getValue(nodeOrdinal * this.nodeFieldCount + this.nodeNameOffset);
8256
+ const name = this.strings[nameIdx];
8257
+ return name === 'system / NativeContext' || name.startsWith('system / NativeContext / ') ||
8258
+ name === 'Detached system / NativeContext' || name.startsWith('Detached system / NativeContext / ');
8259
+ }
8057
8260
  interfaceDefinitions() {
8058
8261
  return JSON.stringify(this.#interfaceDefinitions ?? []);
8059
8262
  }
@@ -8232,7 +8435,6 @@ class HeapSnapshot {
8232
8435
  if (this.nodeDetachednessAndClassIndexOffset === -1) {
8233
8436
  return;
8234
8437
  }
8235
- console.time('propagateDOMState');
8236
8438
  const visited = new Uint8Array(this.nodeCount);
8237
8439
  const attached = [];
8238
8440
  const detached = [];
@@ -8291,7 +8493,6 @@ class HeapSnapshot {
8291
8493
  }
8292
8494
  propagateState(this, nodeOrdinal, 2 );
8293
8495
  }
8294
- console.timeEnd('propagateDOMState');
8295
8496
  }
8296
8497
  buildSamples() {
8297
8498
  const samples = this.#rawSamples;
@@ -8481,7 +8682,7 @@ class HeapSnapshot {
8481
8682
  return new HeapSnapshotEdgesProvider(this, filter, node.retainers(), indexProvider);
8482
8683
  }
8483
8684
  getRetainingPaths(nodeIndex, maxDepth = 30, maxNodes = 5000, maxSiblings = 100) {
8484
- const { nodeFieldCount, firstRetainerIndex, retainingNodes, retainingEdges, edgeTypeOffset, edgeWeakType, containmentEdges } = this;
8685
+ const { nodeFieldCount, firstRetainerIndex, retainingNodes, retainingEdges, edgeTypeOffset, edgeWeakType, containmentEdges, } = this;
8485
8686
  const distances = this.#nodeDistancesForRetainersView ?? this.nodeDistances;
8486
8687
  let traversedNodesCount = 0;
8487
8688
  const visiting = new Set();
@@ -9279,7 +9480,7 @@ class JSHeapSnapshot extends HeapSnapshot {
9279
9480
  jsArrays: sizeJSArrays,
9280
9481
  strings: sizeStrings,
9281
9482
  system: sizeSystem,
9282
- }
9483
+ },
9283
9484
  };
9284
9485
  }
9285
9486
  calculateArraySize(node) {