chrome-devtools-mcp 1.6.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 (277) hide show
  1. package/README.md +26 -9
  2. package/build/src/HeapSnapshotManager.js +62 -23
  3. package/build/src/McpContext.js +64 -23
  4. package/build/src/McpPage.js +225 -11
  5. package/build/src/McpResponse.js +188 -280
  6. package/build/src/PageCollector.js +8 -3
  7. package/build/src/SlimMcpResponse.js +1 -1
  8. package/build/src/TextSnapshot.js +80 -19
  9. package/build/src/ToolHandler.js +19 -8
  10. package/build/src/WaitForHelper.js +142 -68
  11. package/build/src/bin/chrome-devtools-cli-options.js +38 -2
  12. package/build/src/bin/chrome-devtools-mcp-cli-options.js +1 -1
  13. package/build/src/bin/chrome-devtools-mcp-main.js +1 -1
  14. package/build/src/bin/chrome-devtools.js +19 -3
  15. package/build/src/daemon/client.js +22 -0
  16. package/build/src/daemon/daemon.js +15 -11
  17. package/build/src/daemon/utils.js +18 -3
  18. package/build/src/devtools/DevtoolsUtils.js +7 -2
  19. package/build/src/formatters/HeapSnapshotFormatter.js +48 -11
  20. package/build/src/index.js +2 -1
  21. package/build/src/telemetry/ClearcutLogger.js +3 -0
  22. package/build/src/telemetry/transformation.js +30 -0
  23. package/build/src/third_party/THIRD_PARTY_NOTICES +231 -52
  24. package/build/src/third_party/bundled-packages.json +3 -4
  25. package/build/src/third_party/devtools-formatter-worker.js +60 -19
  26. package/build/src/third_party/devtools-heap-snapshot-worker.js +383 -182
  27. package/build/src/third_party/index.js +28280 -9450
  28. package/build/src/third_party/issue-descriptions/CoepCorpNotSameOrigin.md +2 -2
  29. package/build/src/third_party/issue-descriptions/CoepCorpNotSameOriginAfterDefaultedToSameOriginByCoep.md +3 -3
  30. package/build/src/third_party/issue-descriptions/CoepCorpNotSameSite.md +2 -2
  31. package/build/src/third_party/issue-descriptions/CoepFrameResourceNeedsCoepHeader.md +1 -1
  32. package/build/src/third_party/issue-descriptions/CompatibilityModeQuirks.md +1 -1
  33. package/build/src/third_party/issue-descriptions/CookieAttributeValueExceedsMaxSize.md +2 -2
  34. package/build/src/third_party/issue-descriptions/LowTextContrast.md +1 -1
  35. package/build/src/third_party/issue-descriptions/SameSiteNoneInsecureErrorRead.md +1 -1
  36. package/build/src/third_party/issue-descriptions/SameSiteNoneInsecureErrorSet.md +1 -1
  37. package/build/src/third_party/issue-descriptions/SameSiteNoneInsecureWarnRead.md +1 -1
  38. package/build/src/third_party/issue-descriptions/SameSiteNoneInsecureWarnSet.md +1 -1
  39. package/build/src/third_party/issue-descriptions/SameSiteUnspecifiedLaxAllowUnsafeRead.md +3 -3
  40. package/build/src/third_party/issue-descriptions/SameSiteUnspecifiedLaxAllowUnsafeSet.md +3 -3
  41. package/build/src/third_party/issue-descriptions/bounceTrackingMitigations.md +1 -1
  42. package/build/src/third_party/issue-descriptions/connectionAllowlistInvalidAllowlistItemType.md +2 -2
  43. package/build/src/third_party/issue-descriptions/connectionAllowlistInvalidHeader.md +2 -2
  44. package/build/src/third_party/issue-descriptions/connectionAllowlistInvalidUrlPattern.md +3 -3
  45. package/build/src/third_party/issue-descriptions/connectionAllowlistItemNotInnerList.md +2 -2
  46. package/build/src/third_party/issue-descriptions/connectionAllowlistMoreThanOneList.md +2 -2
  47. package/build/src/third_party/issue-descriptions/connectionAllowlistReportingEndpointNotToken.md +1 -1
  48. package/build/src/third_party/issue-descriptions/cookieCrossSiteRedirectDowngrade.md +3 -3
  49. package/build/src/third_party/issue-descriptions/cookieExcludeBlockedWithinRelatedWebsiteSet.md +1 -1
  50. package/build/src/third_party/issue-descriptions/cookieExcludePortMismatch.md +1 -1
  51. package/build/src/third_party/issue-descriptions/cookieExcludeSchemeMismatch.md +1 -1
  52. package/build/src/third_party/issue-descriptions/cookieExcludeThirdPartyPhaseoutSet.md +1 -1
  53. package/build/src/third_party/issue-descriptions/cookieWarnThirdPartyPhaseoutRead.md +1 -1
  54. package/build/src/third_party/issue-descriptions/corsAllowCredentialsRequired.md +1 -1
  55. package/build/src/third_party/issue-descriptions/corsDisabledScheme.md +2 -2
  56. package/build/src/third_party/issue-descriptions/corsDisallowedByMode.md +2 -2
  57. package/build/src/third_party/issue-descriptions/corsHeaderDisallowedByPreflightResponse.md +1 -1
  58. package/build/src/third_party/issue-descriptions/corsInvalidHeaderValues.md +3 -3
  59. package/build/src/third_party/issue-descriptions/corsLocalNetworkAccessPermissionDenied.md +1 -1
  60. package/build/src/third_party/issue-descriptions/corsMethodDisallowedByPreflightResponse.md +1 -1
  61. package/build/src/third_party/issue-descriptions/corsNoCorsRedirectModeNotFollow.md +1 -1
  62. package/build/src/third_party/issue-descriptions/corsOriginMismatch.md +3 -3
  63. package/build/src/third_party/issue-descriptions/corsPreflightResponseInvalid.md +2 -2
  64. package/build/src/third_party/issue-descriptions/corsRedirectContainsCredentials.md +3 -3
  65. package/build/src/third_party/issue-descriptions/corsWildcardOriginNotAllowed.md +4 -3
  66. package/build/src/third_party/issue-descriptions/cspEvalViolation.md +4 -4
  67. package/build/src/third_party/issue-descriptions/cspInlineViolation.md +2 -2
  68. package/build/src/third_party/issue-descriptions/cspTrustedTypesPolicyViolation.md +2 -2
  69. package/build/src/third_party/issue-descriptions/cspTrustedTypesSinkViolation.md +4 -4
  70. package/build/src/third_party/issue-descriptions/cspURLViolation.md +4 -4
  71. package/build/src/third_party/issue-descriptions/emailVerificationRequestAccountsEmptyList.md +1 -1
  72. package/build/src/third_party/issue-descriptions/emailVerificationRequestAccountsHttpNotFound.md +1 -1
  73. package/build/src/third_party/issue-descriptions/emailVerificationRequestAccountsInvalidContentType.md +1 -1
  74. package/build/src/third_party/issue-descriptions/emailVerificationRequestAccountsInvalidResponse.md +1 -1
  75. package/build/src/third_party/issue-descriptions/emailVerificationRequestAccountsNoResponse.md +1 -1
  76. package/build/src/third_party/issue-descriptions/emailVerificationRequestDnsFetchFailed.md +1 -1
  77. package/build/src/third_party/issue-descriptions/emailVerificationRequestDnsInvalidRecord.md +1 -1
  78. package/build/src/third_party/issue-descriptions/emailVerificationRequestEmailVerificationWellKnownHttpNotFound.md +1 -1
  79. package/build/src/third_party/issue-descriptions/emailVerificationRequestEmailVerificationWellKnownInvalidContentType.md +1 -1
  80. package/build/src/third_party/issue-descriptions/emailVerificationRequestEmailVerificationWellKnownInvalidResponse.md +1 -1
  81. package/build/src/third_party/issue-descriptions/emailVerificationRequestEmailVerificationWellKnownNoResponse.md +1 -1
  82. package/build/src/third_party/issue-descriptions/emailVerificationRequestInvalidEmail.md +1 -1
  83. package/build/src/third_party/issue-descriptions/emailVerificationRequestJwksHttpNotFound.md +1 -1
  84. package/build/src/third_party/issue-descriptions/emailVerificationRequestJwksInvalidResponse.md +1 -1
  85. package/build/src/third_party/issue-descriptions/emailVerificationRequestKeyBindingSigningFailed.md +1 -1
  86. package/build/src/third_party/issue-descriptions/emailVerificationRequestRpOriginIsOpaque.md +1 -1
  87. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenHttpNotFound.md +1 -1
  88. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenInvalidContentType.md +1 -1
  89. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenInvalidResponse.md +1 -1
  90. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenInvalidSdJwt.md +1 -1
  91. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenMalformedSdJwt.md +1 -1
  92. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenNoResponse.md +1 -1
  93. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidAudience.md +1 -1
  94. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidIssuedAt.md +1 -1
  95. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidNonce.md +1 -1
  96. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidSdHash.md +1 -1
  97. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidTyp.md +1 -1
  98. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingAud.md +1 -1
  99. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingCnf.md +1 -1
  100. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingIat.md +1 -1
  101. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingNonce.md +1 -1
  102. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingSdHash.md +1 -1
  103. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbSignatureFailed.md +1 -1
  104. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidEmail.md +1 -1
  105. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidEmailVerified.md +1 -1
  106. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidHolderKey.md +1 -1
  107. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidIssuedAt.md +1 -1
  108. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidIssuer.md +1 -1
  109. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtJwksMissingKeys.md +1 -1
  110. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtMissingCnf.md +1 -1
  111. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtMissingEmail.md +1 -1
  112. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtMissingIat.md +1 -1
  113. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtMissingIss.md +1 -1
  114. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtSignatureFailed.md +1 -1
  115. package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtUnsupportedHeaderAlg.md +1 -1
  116. package/build/src/third_party/issue-descriptions/emailVerificationRequestUserLoggedOut.md +1 -1
  117. package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownAccountsEndpointCrossOrigin.md +1 -1
  118. package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownHttpNotFound.md +1 -1
  119. package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownInvalidContentType.md +1 -1
  120. package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownInvalidResponse.md +1 -1
  121. package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownIssuanceEndpointCrossOrigin.md +1 -1
  122. package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownListEmpty.md +1 -1
  123. package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownMissingAccountsEndpoint.md +1 -1
  124. package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownMissingIssuanceEndpoint.md +1 -1
  125. package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownNoResponse.md +1 -1
  126. package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownUnsupportedSigningAlgorithm.md +1 -1
  127. package/build/src/third_party/issue-descriptions/federatedAuthRequestAccountsHttpNotFound.md +1 -1
  128. package/build/src/third_party/issue-descriptions/federatedAuthRequestAccountsInvalidResponse.md +1 -1
  129. package/build/src/third_party/issue-descriptions/federatedAuthRequestAccountsNoResponse.md +1 -1
  130. package/build/src/third_party/issue-descriptions/federatedAuthRequestApprovalDeclined.md +1 -1
  131. package/build/src/third_party/issue-descriptions/federatedAuthRequestCanceled.md +1 -1
  132. package/build/src/third_party/issue-descriptions/federatedAuthRequestErrorFetchingSignin.md +1 -1
  133. package/build/src/third_party/issue-descriptions/federatedAuthRequestErrorIdToken.md +1 -1
  134. package/build/src/third_party/issue-descriptions/federatedAuthRequestIdTokenHttpNotFound.md +1 -1
  135. package/build/src/third_party/issue-descriptions/federatedAuthRequestIdTokenInvalidRequest.md +1 -1
  136. package/build/src/third_party/issue-descriptions/federatedAuthRequestIdTokenInvalidResponse.md +1 -1
  137. package/build/src/third_party/issue-descriptions/federatedAuthRequestIdTokenNoResponse.md +1 -1
  138. package/build/src/third_party/issue-descriptions/federatedAuthRequestInvalidSigninResponse.md +1 -1
  139. package/build/src/third_party/issue-descriptions/federatedAuthRequestManifestHttpNotFound.md +1 -1
  140. package/build/src/third_party/issue-descriptions/federatedAuthRequestManifestInvalidResponse.md +1 -1
  141. package/build/src/third_party/issue-descriptions/federatedAuthRequestManifestNoResponse.md +1 -1
  142. package/build/src/third_party/issue-descriptions/federatedAuthRequestTooManyRequests.md +1 -1
  143. package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestInvalidAccountsResponse.md +1 -1
  144. package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestInvalidConfigOrWellKnown.md +1 -1
  145. package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNoAccountSharingPermission.md +1 -1
  146. package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNoApiPermission.md +1 -1
  147. package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNoReturningUserFromFetchedAccounts.md +1 -1
  148. package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotIframe.md +1 -1
  149. package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotPotentiallyTrustworthy.md +1 -1
  150. package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotSameOrigin.md +1 -1
  151. package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotSignedInWithIdp.md +1 -1
  152. package/build/src/third_party/issue-descriptions/fetchingPartitionedBlobURL.md +2 -2
  153. package/build/src/third_party/issue-descriptions/genericFormAriaLabelledByToNonExistingIdError.md +2 -2
  154. package/build/src/third_party/issue-descriptions/genericFormAutocompleteAttributeEmptyError.md +1 -1
  155. package/build/src/third_party/issue-descriptions/genericFormDuplicateIdForInputError.md +1 -1
  156. package/build/src/third_party/issue-descriptions/genericFormEmptyIdAndNameAttributesForInputError.md +2 -2
  157. package/build/src/third_party/issue-descriptions/genericFormInputAssignedAutocompleteValueToIdOrNameAttributeError.md +2 -2
  158. package/build/src/third_party/issue-descriptions/genericFormInputHasWrongButWellIntendedAutocompleteValueError.md +1 -1
  159. package/build/src/third_party/issue-descriptions/genericFormInputWithNoLabelError.md +1 -1
  160. package/build/src/third_party/issue-descriptions/genericFormLabelForMatchesNonExistingIdError.md +2 -2
  161. package/build/src/third_party/issue-descriptions/genericFormLabelForNameError.md +1 -1
  162. package/build/src/third_party/issue-descriptions/genericFormLabelHasNeitherForNorNestedInputError.md +1 -1
  163. package/build/src/third_party/issue-descriptions/genericFormModelContextMissingToolName.md +1 -1
  164. package/build/src/third_party/issue-descriptions/genericFormModelContextParameterMissingName.md +1 -1
  165. package/build/src/third_party/issue-descriptions/genericFormModelContextRequiredParameterMissingName.md +1 -1
  166. package/build/src/third_party/issue-descriptions/genericNavigationEntryMarkedSkippable.md +2 -2
  167. package/build/src/third_party/issue-descriptions/heavyAd.md +1 -1
  168. package/build/src/third_party/issue-descriptions/lazyLoadImageZeroSize.md +7 -0
  169. package/build/src/third_party/issue-descriptions/navigatingPartitionedBlobURL.md +3 -3
  170. package/build/src/third_party/issue-descriptions/permissionElementActivationDisabled.md +1 -1
  171. package/build/src/third_party/issue-descriptions/permissionElementActivationDisabledWithOccluder.md +1 -1
  172. package/build/src/third_party/issue-descriptions/permissionElementActivationDisabledWithOccluderParent.md +1 -1
  173. package/build/src/third_party/issue-descriptions/permissionElementFencedFrameDisallowed.md +2 -2
  174. package/build/src/third_party/issue-descriptions/permissionElementFontSizeTooLarge.md +2 -2
  175. package/build/src/third_party/issue-descriptions/permissionElementFontSizeTooSmall.md +2 -2
  176. package/build/src/third_party/issue-descriptions/permissionElementInsetBoxShadowUnsupported.md +1 -1
  177. package/build/src/third_party/issue-descriptions/permissionElementInvalidDisplayStyle.md +2 -2
  178. package/build/src/third_party/issue-descriptions/permissionElementInvalidSizeValue.md +2 -2
  179. package/build/src/third_party/issue-descriptions/permissionElementInvalidType.md +2 -2
  180. package/build/src/third_party/issue-descriptions/permissionElementInvalidTypeActivation.md +2 -2
  181. package/build/src/third_party/issue-descriptions/permissionElementNonOpaqueColor.md +1 -1
  182. package/build/src/third_party/issue-descriptions/permissionElementPaddingBottomUnsupported.md +2 -2
  183. package/build/src/third_party/issue-descriptions/permissionElementPaddingRightUnsupported.md +2 -2
  184. package/build/src/third_party/issue-descriptions/permissionElementRequestInProgress.md +2 -2
  185. package/build/src/third_party/issue-descriptions/permissionElementSecurityChecksFailed.md +1 -1
  186. package/build/src/third_party/issue-descriptions/permissionElementTypeNotSupported.md +2 -2
  187. package/build/src/third_party/issue-descriptions/permissionElementUntrustedEvent.md +1 -1
  188. package/build/src/third_party/issue-descriptions/placeholderDescriptionForInvisibleIssues.md +1 -1
  189. package/build/src/third_party/issue-descriptions/selectElementAccessibilityDisallowedOptGroupChild.md +1 -1
  190. package/build/src/third_party/issue-descriptions/selectElementAccessibilityDisallowedSelectChild.md +1 -1
  191. package/build/src/third_party/issue-descriptions/selectElementAccessibilityInteractiveContentAttributesSelectDescendant.md +1 -1
  192. package/build/src/third_party/issue-descriptions/selectElementAccessibilityInteractiveContentLegendChild.md +1 -1
  193. package/build/src/third_party/issue-descriptions/selectElementAccessibilityInteractiveContentOptionChild.md +1 -1
  194. package/build/src/third_party/issue-descriptions/selectElementAccessibilityNonPhrasingContentOptionChild.md +1 -1
  195. package/build/src/third_party/issue-descriptions/selectivePermissionsIntervention.md +3 -3
  196. package/build/src/third_party/issue-descriptions/sharedArrayBuffer.md +1 -1
  197. package/build/src/third_party/issue-descriptions/sharedDictionaryUseErrorCrossOriginNoCorsRequest.md +1 -1
  198. package/build/src/third_party/issue-descriptions/sharedDictionaryUseErrorMatchingDictionaryNotUsed.md +1 -1
  199. package/build/src/third_party/issue-descriptions/sharedDictionaryUseErrorUnexpectedContentDictionaryHeader.md +1 -1
  200. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorCossOriginNoCorsRequest.md +1 -1
  201. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorDisallowedBySettings.md +1 -1
  202. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorExpiredResponse.md +1 -1
  203. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorFeatureDisabled.md +2 -2
  204. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorInvalidStructuredHeader.md +1 -1
  205. package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNavigationRequest.md +2 -2
  206. package/build/src/third_party/issue-descriptions/sriInvalidSignatureHeader.md +4 -4
  207. package/build/src/third_party/issue-descriptions/sriInvalidSignatureInputHeader.md +4 -4
  208. package/build/src/third_party/issue-descriptions/sriMissingSignatureHeader.md +1 -1
  209. package/build/src/third_party/issue-descriptions/sriMissingSignatureInputHeader.md +2 -2
  210. package/build/src/third_party/issue-descriptions/sriSignatureHeaderValueIsIncorrectLength.md +2 -2
  211. package/build/src/third_party/issue-descriptions/sriSignatureHeaderValueIsNotByteSequence.md +4 -4
  212. package/build/src/third_party/issue-descriptions/sriSignatureHeaderValueIsParameterized.md +4 -4
  213. package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidComponentName.md +1 -1
  214. package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidComponentType.md +2 -2
  215. package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidDerivedComponentParameter.md +1 -1
  216. package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidHeaderComponentParameter.md +1 -1
  217. package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidParameter.md +2 -2
  218. package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderKeyIdLength.md +5 -5
  219. package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderMissingLabel.md +3 -3
  220. package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderMissingRequiredParameters.md +2 -2
  221. package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderValueMissingComponents.md +2 -2
  222. package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderValueNotInnerList.md +2 -2
  223. package/build/src/third_party/issue-descriptions/sriValidationFailedIntegrityMismatch.md +4 -4
  224. package/build/src/third_party/issue-descriptions/sriValidationFailedInvalidLength.md +3 -3
  225. package/build/src/third_party/issue-descriptions/sriValidationFailedSignatureExpired.md +2 -2
  226. package/build/src/third_party/issue-descriptions/sriValidationFailedSignatureMismatch.md +2 -2
  227. package/build/src/third_party/issue-descriptions/stylesheetLateImport.md +1 -1
  228. package/build/src/third_party/issue-descriptions/summaryElementAccessibilityInteractiveContentSummaryDescendant.md +1 -1
  229. package/build/src/third_party/issue-descriptions/unencodedDigestIncorrectDigestLength.md +2 -2
  230. package/build/src/third_party/issue-descriptions/unencodedDigestIncorrectDigestType.md +3 -3
  231. package/build/src/third_party/issue-descriptions/unencodedDigestMalformedDictionary.md +2 -2
  232. package/build/src/third_party/issue-descriptions/unencodedDigestUnknownAlgorithm.md +1 -1
  233. package/build/src/third_party/lighthouse-devtools-mcp-bundle.js +1125 -1027
  234. package/build/src/tools/input.js +197 -105
  235. package/build/src/tools/memory.js +35 -4
  236. package/build/src/tools/network.js +1 -1
  237. package/build/src/tools/pages.js +1 -0
  238. package/build/src/tools/performance.js +60 -39
  239. package/build/src/tools/screenshot.js +152 -77
  240. package/build/src/tools/script.js +95 -31
  241. package/build/src/utils/polyfill.js +6 -3
  242. package/build/src/utils/url.js +43 -0
  243. package/build/src/version.js +1 -1
  244. package/package.json +20 -16
  245. package/skills/memory-leak-debugging/SKILL.md +12 -16
  246. package/skills/memory-leak-debugging/references/common-leaks.md +1 -1
  247. package/build/src/devtools/DevToolsConnectionAdapter.js +0 -70
  248. package/build/src/third_party/issue-descriptions/SameSiteExcludeContextDowngradeRead.md +0 -8
  249. package/build/src/third_party/issue-descriptions/SameSiteExcludeContextDowngradeSet.md +0 -8
  250. package/build/src/third_party/issue-descriptions/SameSiteExcludeNavigationContextDowngrade.md +0 -8
  251. package/build/src/third_party/issue-descriptions/SameSiteWarnCrossDowngradeRead.md +0 -8
  252. package/build/src/third_party/issue-descriptions/SameSiteWarnCrossDowngradeSet.md +0 -8
  253. package/build/src/third_party/issue-descriptions/SameSiteWarnStrictLaxDowngradeStrict.md +0 -8
  254. package/build/src/third_party/issue-descriptions/arInsecureContext.md +0 -7
  255. package/build/src/third_party/issue-descriptions/arInvalidInfoHeader.md +0 -5
  256. package/build/src/third_party/issue-descriptions/arInvalidRegisterOsSourceHeader.md +0 -5
  257. package/build/src/third_party/issue-descriptions/arInvalidRegisterOsTriggerHeader.md +0 -5
  258. package/build/src/third_party/issue-descriptions/arInvalidRegisterSourceHeader.md +0 -5
  259. package/build/src/third_party/issue-descriptions/arInvalidRegisterTriggerHeader.md +0 -5
  260. package/build/src/third_party/issue-descriptions/arNavigationRegistrationUniqueScopeAlreadySet.md +0 -5
  261. package/build/src/third_party/issue-descriptions/arNavigationRegistrationWithoutTransientUserActivation.md +0 -6
  262. package/build/src/third_party/issue-descriptions/arNoRegisterOsSourceHeader.md +0 -5
  263. package/build/src/third_party/issue-descriptions/arNoRegisterOsTriggerHeader.md +0 -5
  264. package/build/src/third_party/issue-descriptions/arNoRegisterSourceHeader.md +0 -5
  265. package/build/src/third_party/issue-descriptions/arNoRegisterTriggerHeader.md +0 -5
  266. package/build/src/third_party/issue-descriptions/arNoWebOrOsSupport.md +0 -4
  267. package/build/src/third_party/issue-descriptions/arOsSourceIgnored.md +0 -18
  268. package/build/src/third_party/issue-descriptions/arOsTriggerIgnored.md +0 -19
  269. package/build/src/third_party/issue-descriptions/arPermissionPolicyDisabled.md +0 -8
  270. package/build/src/third_party/issue-descriptions/arSourceAndTriggerHeaders.md +0 -9
  271. package/build/src/third_party/issue-descriptions/arSourceIgnored.md +0 -13
  272. package/build/src/third_party/issue-descriptions/arTriggerIgnored.md +0 -12
  273. package/build/src/third_party/issue-descriptions/arUntrustworthyReportingOrigin.md +0 -10
  274. package/build/src/third_party/issue-descriptions/arWebAndOsHeaders.md +0 -11
  275. package/build/src/utils/Mutex.js +0 -38
  276. package/skills/memory-leak-debugging/references/compare_snapshots.js +0 -109
  277. package/skills/memory-leak-debugging/references/memlab.md +0 -29
@@ -3,6 +3,58 @@
3
3
  * Copyright 2025 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
+ var __addDisposableResource = (this && this.__addDisposableResource) || function (env, value, async) {
7
+ if (value !== null && value !== void 0) {
8
+ if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
9
+ var dispose, inner;
10
+ if (async) {
11
+ if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
12
+ dispose = value[Symbol.asyncDispose];
13
+ }
14
+ if (dispose === void 0) {
15
+ if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
16
+ dispose = value[Symbol.dispose];
17
+ if (async) inner = dispose;
18
+ }
19
+ if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
20
+ if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };
21
+ env.stack.push({ value: value, dispose: dispose, async: async });
22
+ }
23
+ else if (async) {
24
+ env.stack.push({ async: true });
25
+ }
26
+ return value;
27
+ };
28
+ var __disposeResources = (this && this.__disposeResources) || (function (SuppressedError) {
29
+ return function (env) {
30
+ function fail(e) {
31
+ env.error = env.hasError ? new SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
32
+ env.hasError = true;
33
+ }
34
+ var r, s = 0;
35
+ function next() {
36
+ while (r = env.stack.pop()) {
37
+ try {
38
+ if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
39
+ if (r.dispose) {
40
+ var result = r.dispose.call(r.value);
41
+ if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
42
+ }
43
+ else s |= 1;
44
+ }
45
+ catch (e) {
46
+ fail(e);
47
+ }
48
+ }
49
+ if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
50
+ if (env.hasError) throw env.error;
51
+ }
52
+ return next();
53
+ };
54
+ })(typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
55
+ var e = new Error(message);
56
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
57
+ });
6
58
  import { zod } from '../third_party/index.js';
7
59
  import { parseKey } from '../utils/keyboard.js';
8
60
  import { logger } from '../utils/logger.js';
@@ -27,41 +79,41 @@ function handleActionError(error, uid) {
27
79
  });
28
80
  }
29
81
  async function selectNativeSelectOption(handle) {
30
- const selectHandle = await handle.evaluateHandle(node => {
31
- if (!(node instanceof HTMLOptionElement)) {
32
- return null;
33
- }
34
- const select = node.closest('select');
35
- if (!select || select.multiple || select.disabled || node.disabled) {
36
- return null;
37
- }
38
- const parentElement = node.parentElement;
39
- if (parentElement instanceof HTMLOptGroupElement &&
40
- parentElement.disabled) {
41
- return null;
42
- }
43
- return select;
44
- });
82
+ const env_1 = { stack: [], error: void 0, hasError: false };
45
83
  try {
46
- const select = selectHandle.asElement();
84
+ const selectHandle = __addDisposableResource(env_1, await handle.evaluateHandle(node => {
85
+ if (!(node instanceof HTMLOptionElement)) {
86
+ return null;
87
+ }
88
+ const select = node.closest('select');
89
+ if (!select || select.multiple || select.disabled || node.disabled) {
90
+ return null;
91
+ }
92
+ const parentElement = node.parentElement;
93
+ if (parentElement instanceof HTMLOptGroupElement &&
94
+ parentElement.disabled) {
95
+ return null;
96
+ }
97
+ return select;
98
+ }), false);
99
+ const select = __addDisposableResource(env_1, selectHandle.asElement(), false);
47
100
  if (!select) {
48
101
  return false;
49
102
  }
50
- const valueHandle = await handle.getProperty('value');
51
- try {
52
- const value = await valueHandle.jsonValue();
53
- if (typeof value !== 'string') {
54
- return false;
55
- }
56
- await select.asLocator().fill(value);
57
- }
58
- finally {
59
- void valueHandle.dispose();
103
+ const valueHandle = __addDisposableResource(env_1, await handle.getProperty('value'), false);
104
+ const value = await valueHandle.jsonValue();
105
+ if (typeof value !== 'string') {
106
+ return false;
60
107
  }
108
+ await select.asLocator().fill(value);
61
109
  return true;
62
110
  }
111
+ catch (e_1) {
112
+ env_1.error = e_1;
113
+ env_1.hasError = true;
114
+ }
63
115
  finally {
64
- void selectHandle.dispose();
116
+ __disposeResources(env_1);
65
117
  }
66
118
  }
67
119
  export const click = definePageTool({
@@ -81,33 +133,40 @@ export const click = definePageTool({
81
133
  blockedByDialog: true,
82
134
  verifyFilesSchema: [],
83
135
  handler: async (request, response) => {
84
- const uid = request.params.uid;
85
- const handle = await request.page.getElementByUid(uid);
86
- const aXNode = request.page.getAXNodeByUid(uid);
87
- const shouldSelectNativeOption = !request.params.dblClick && aXNode?.role === 'option';
136
+ const env_2 = { stack: [], error: void 0, hasError: false };
88
137
  try {
89
- const result = await request.page.waitForEventsAfterAction(async () => {
90
- if (shouldSelectNativeOption &&
91
- (await selectNativeSelectOption(handle))) {
92
- return;
93
- }
94
- await handle.asLocator().click({
95
- count: request.params.dblClick ? 2 : 1,
138
+ const uid = request.params.uid;
139
+ const handle = __addDisposableResource(env_2, await request.page.getElementByUid(uid), false);
140
+ const aXNode = request.page.getAXNodeByUid(uid);
141
+ const shouldSelectNativeOption = !request.params.dblClick && aXNode?.role === 'option';
142
+ try {
143
+ const result = await request.page.waitForEventsAfterAction(async () => {
144
+ if (shouldSelectNativeOption &&
145
+ (await selectNativeSelectOption(handle))) {
146
+ return;
147
+ }
148
+ await handle.asLocator().click({
149
+ count: request.params.dblClick ? 2 : 1,
150
+ });
96
151
  });
97
- });
98
- response.appendResponseLine(request.params.dblClick
99
- ? `Successfully double clicked on the element`
100
- : `Successfully clicked on the element`);
101
- response.attachWaitForResult(result);
102
- if (request.params.includeSnapshot) {
103
- response.includeSnapshot();
152
+ response.appendResponseLine(request.params.dblClick
153
+ ? `Successfully double clicked on the element`
154
+ : `Successfully clicked on the element`);
155
+ response.attachWaitForResult(result);
156
+ if (request.params.includeSnapshot) {
157
+ response.includeSnapshot();
158
+ }
159
+ }
160
+ catch (error) {
161
+ handleActionError(error, uid);
104
162
  }
105
163
  }
106
- catch (error) {
107
- handleActionError(error, uid);
164
+ catch (e_2) {
165
+ env_2.error = e_2;
166
+ env_2.hasError = true;
108
167
  }
109
168
  finally {
110
- void handle.dispose();
169
+ __disposeResources(env_2);
111
170
  }
112
171
  },
113
172
  });
@@ -159,23 +218,30 @@ export const hover = definePageTool({
159
218
  blockedByDialog: true,
160
219
  verifyFilesSchema: [],
161
220
  handler: async (request, response) => {
162
- const uid = request.params.uid;
163
- const handle = await request.page.getElementByUid(uid);
221
+ const env_3 = { stack: [], error: void 0, hasError: false };
164
222
  try {
165
- const result = await request.page.waitForEventsAfterAction(async () => {
166
- await handle.asLocator().hover();
167
- });
168
- response.appendResponseLine(`Successfully hovered over the element`);
169
- response.attachWaitForResult(result);
170
- if (request.params.includeSnapshot) {
171
- response.includeSnapshot();
223
+ const uid = request.params.uid;
224
+ const handle = __addDisposableResource(env_3, await request.page.getElementByUid(uid), false);
225
+ try {
226
+ const result = await request.page.waitForEventsAfterAction(async () => {
227
+ await handle.asLocator().hover();
228
+ });
229
+ response.appendResponseLine(`Successfully hovered over the element`);
230
+ response.attachWaitForResult(result);
231
+ if (request.params.includeSnapshot) {
232
+ response.includeSnapshot();
233
+ }
234
+ }
235
+ catch (error) {
236
+ handleActionError(error, uid);
172
237
  }
173
238
  }
174
- catch (error) {
175
- handleActionError(error, uid);
239
+ catch (e_3) {
240
+ env_3.error = e_3;
241
+ env_3.hasError = true;
176
242
  }
177
243
  finally {
178
- void handle.dispose();
244
+ __disposeResources(env_3);
179
245
  }
180
246
  },
181
247
  });
@@ -187,26 +253,36 @@ async function selectOption(handle, aXNode, value) {
187
253
  let optionFound = false;
188
254
  for (const child of aXNode.children) {
189
255
  if (child.role === 'option' && child.name === value && child.value) {
190
- optionFound = true;
191
- const childHandle = await child.elementHandle();
192
- if (childHandle) {
193
- try {
194
- const childValueHandle = await childHandle.getProperty('value');
256
+ const env_4 = { stack: [], error: void 0, hasError: false };
257
+ try {
258
+ optionFound = true;
259
+ const childHandle = __addDisposableResource(env_4, await child.elementHandle(), false);
260
+ if (childHandle) {
261
+ const env_5 = { stack: [], error: void 0, hasError: false };
195
262
  try {
263
+ const childValueHandle = __addDisposableResource(env_5, await childHandle.getProperty('value'), false);
196
264
  const childValue = await childValueHandle.jsonValue();
197
265
  if (childValue) {
198
266
  await handle.asLocator().fill(childValue.toString());
199
267
  }
268
+ break;
269
+ }
270
+ catch (e_4) {
271
+ env_5.error = e_4;
272
+ env_5.hasError = true;
200
273
  }
201
274
  finally {
202
- void childValueHandle.dispose();
275
+ __disposeResources(env_5);
203
276
  }
204
- break;
205
- }
206
- finally {
207
- void childHandle.dispose();
208
277
  }
209
278
  }
279
+ catch (e_5) {
280
+ env_4.error = e_5;
281
+ env_4.hasError = true;
282
+ }
283
+ finally {
284
+ __disposeResources(env_4);
285
+ }
210
286
  }
211
287
  }
212
288
  if (!optionFound) {
@@ -217,43 +293,50 @@ function hasOptionChildren(aXNode) {
217
293
  return aXNode.children.some(child => child.role === 'option');
218
294
  }
219
295
  async function fillFormElement(uid, value, context, page) {
220
- const handle = await page.getElementByUid(uid);
296
+ const env_6 = { stack: [], error: void 0, hasError: false };
221
297
  try {
222
- const aXNode = page.getAXNodeByUid(uid);
223
- // We assume that combobox needs to be handled as select if it has
224
- // role='combobox' and option children.
225
- if (aXNode && aXNode.role === 'combobox' && hasOptionChildren(aXNode)) {
226
- await selectOption(handle, aXNode, value);
227
- }
228
- else {
229
- const isToggle = await handle.evaluate(el => {
230
- if (el instanceof HTMLInputElement) {
231
- return el.type === 'checkbox' || el.type === 'radio';
232
- }
233
- const role = el.getAttribute('role');
234
- return role === 'checkbox' || role === 'radio' || role === 'switch';
235
- });
236
- if (isToggle) {
237
- if (['true', 'false'].includes(value)) {
238
- await handle.asLocator().fill(value === 'true');
298
+ const handle = __addDisposableResource(env_6, await page.getElementByUid(uid), false);
299
+ try {
300
+ const aXNode = page.getAXNodeByUid(uid);
301
+ // We assume that combobox needs to be handled as select if it has
302
+ // role='combobox' and option children.
303
+ if (aXNode && aXNode.role === 'combobox' && hasOptionChildren(aXNode)) {
304
+ await selectOption(handle, aXNode, value);
305
+ }
306
+ else {
307
+ const isToggle = await handle.evaluate(el => {
308
+ if (el instanceof HTMLInputElement) {
309
+ return el.type === 'checkbox' || el.type === 'radio';
310
+ }
311
+ const role = el.getAttribute('role');
312
+ return role === 'checkbox' || role === 'radio' || role === 'switch';
313
+ });
314
+ if (isToggle) {
315
+ if (['true', 'false'].includes(value)) {
316
+ await handle.asLocator().fill(value === 'true');
317
+ }
318
+ else {
319
+ throw new Error(`Checkboxes, radio boxes and toggles require "true" or "false" value, but ${value} was used`);
320
+ }
239
321
  }
240
322
  else {
241
- throw new Error(`Checkboxes, radio boxes and toggles require "true" or "false" value, but ${value} was used`);
323
+ // Increase timeout for longer input values.
324
+ const timeoutPerChar = 10; // ms
325
+ const fillTimeout = page.pptrPage.getDefaultTimeout() + value.length * timeoutPerChar;
326
+ await handle.asLocator().setTimeout(fillTimeout).fill(value);
242
327
  }
243
328
  }
244
- else {
245
- // Increase timeout for longer input values.
246
- const timeoutPerChar = 10; // ms
247
- const fillTimeout = page.pptrPage.getDefaultTimeout() + value.length * timeoutPerChar;
248
- await handle.asLocator().setTimeout(fillTimeout).fill(value);
249
- }
329
+ }
330
+ catch (error) {
331
+ handleActionError(error, uid);
250
332
  }
251
333
  }
252
- catch (error) {
253
- handleActionError(error, uid);
334
+ catch (e_6) {
335
+ env_6.error = e_6;
336
+ env_6.hasError = true;
254
337
  }
255
338
  finally {
256
- void handle.dispose();
339
+ __disposeResources(env_6);
257
340
  }
258
341
  }
259
342
  export const fill = definePageTool({
@@ -326,9 +409,10 @@ export const drag = definePageTool({
326
409
  blockedByDialog: true,
327
410
  verifyFilesSchema: [],
328
411
  handler: async (request, response) => {
329
- const fromHandle = await request.page.getElementByUid(request.params.from_uid);
330
- const toHandle = await request.page.getElementByUid(request.params.to_uid);
412
+ const env_7 = { stack: [], error: void 0, hasError: false };
331
413
  try {
414
+ const fromHandle = __addDisposableResource(env_7, await request.page.getElementByUid(request.params.from_uid), false);
415
+ const toHandle = __addDisposableResource(env_7, await request.page.getElementByUid(request.params.to_uid), false);
332
416
  const result = await request.page.waitForEventsAfterAction(async () => {
333
417
  await fromHandle.drag(toHandle);
334
418
  await new Promise(resolve => setTimeout(resolve, 50));
@@ -340,9 +424,12 @@ export const drag = definePageTool({
340
424
  response.includeSnapshot();
341
425
  }
342
426
  }
427
+ catch (e_7) {
428
+ env_7.error = e_7;
429
+ env_7.hasError = true;
430
+ }
343
431
  finally {
344
- void fromHandle.dispose();
345
- void toHandle.dispose();
432
+ __disposeResources(env_7);
346
433
  }
347
434
  },
348
435
  });
@@ -400,9 +487,10 @@ export const uploadFile = definePageTool({
400
487
  blockedByDialog: true,
401
488
  verifyFilesSchema: ['filePath'],
402
489
  handler: async (request, response) => {
403
- const { uid, filePath } = request.params;
404
- const handle = (await request.page.getElementByUid(uid));
490
+ const env_8 = { stack: [], error: void 0, hasError: false };
405
491
  try {
492
+ const { uid, filePath } = request.params;
493
+ const handle = __addDisposableResource(env_8, (await request.page.getElementByUid(uid)), false);
406
494
  try {
407
495
  await handle.uploadFile(filePath);
408
496
  }
@@ -426,8 +514,12 @@ export const uploadFile = definePageTool({
426
514
  }
427
515
  response.appendResponseLine(`File uploaded from ${filePath}.`);
428
516
  }
517
+ catch (e_8) {
518
+ env_8.error = e_8;
519
+ env_8.hasError = true;
520
+ }
429
521
  finally {
430
- void handle.dispose();
522
+ __disposeResources(env_8);
431
523
  }
432
524
  },
433
525
  });
@@ -11,6 +11,9 @@ const HEAP_SNAPSHOT_FILTERS = [
11
11
  'objectsRetainedByConsole',
12
12
  'objectsRetainedByEventHandlers',
13
13
  'objectsRetainedByContexts',
14
+ 'sharedNativeContext',
15
+ 'noNativeContext',
16
+ 'attributedToSpecificNativeContext',
14
17
  ];
15
18
  export const takeHeapSnapshot = definePageTool({
16
19
  name: 'take_heapsnapshot',
@@ -37,7 +40,7 @@ export const takeHeapSnapshot = definePageTool({
37
40
  });
38
41
  export const getHeapSnapshotSummary = defineTool({
39
42
  name: 'get_heapsnapshot_summary',
40
- description: 'Loads a memory heapsnapshot and returns snapshot summary stats.',
43
+ description: 'Loads a memory heapsnapshot and returns snapshot summary stats, including native contexts and their sizes.',
41
44
  annotations: {
42
45
  category: ToolCategory.MEMORY,
43
46
  readOnlyHint: true,
@@ -51,7 +54,8 @@ export const getHeapSnapshotSummary = defineTool({
51
54
  handler: async (request, response, context) => {
52
55
  const stats = await context.getHeapSnapshotStats(request.params.filePath);
53
56
  const staticData = await context.getHeapSnapshotStaticData(request.params.filePath);
54
- response.setHeapSnapshotStats(stats, staticData);
57
+ const nativeContextSizes = await context.getHeapSnapshotNativeContextSizes(request.params.filePath);
58
+ response.setHeapSnapshotStats(stats, staticData, nativeContextSizes);
55
59
  },
56
60
  });
57
61
  export const getHeapSnapshotDetails = defineTool({
@@ -68,6 +72,10 @@ export const getHeapSnapshotDetails = defineTool({
68
72
  .enum(HEAP_SNAPSHOT_FILTERS)
69
73
  .optional()
70
74
  .describe('An optional filter to apply to the aggregates.'),
75
+ objectId: zod
76
+ .number()
77
+ .optional()
78
+ .describe('The object ID (nodeId) of the specific native context to filter by when filterName is attributedToSpecificNativeContext.'),
71
79
  pageIdx: zod
72
80
  .number()
73
81
  .optional()
@@ -80,7 +88,7 @@ export const getHeapSnapshotDetails = defineTool({
80
88
  blockedByDialog: false,
81
89
  verifyFilesSchema: ['filePath'],
82
90
  handler: async (request, response, context) => {
83
- const aggregates = await context.getHeapSnapshotAggregates(request.params.filePath, request.params.filterName);
91
+ const aggregates = await context.getHeapSnapshotAggregates(request.params.filePath, request.params.filterName, request.params.objectId);
84
92
  response.setHeapSnapshotAggregates(aggregates, {
85
93
  pageIdx: request.params.pageIdx,
86
94
  pageSize: request.params.pageSize,
@@ -102,13 +110,17 @@ export const getHeapSnapshotClassNodes = defineTool({
102
110
  .enum(HEAP_SNAPSHOT_FILTERS)
103
111
  .optional()
104
112
  .describe('An optional filter to apply to the nodes.'),
113
+ objectId: zod
114
+ .number()
115
+ .optional()
116
+ .describe('The object ID (nodeId) of the specific native context to filter by when filterName is attributedToSpecificNativeContext.'),
105
117
  pageIdx: zod.number().optional().describe('The page index for pagination.'),
106
118
  pageSize: zod.number().optional().describe('The page size for pagination.'),
107
119
  },
108
120
  blockedByDialog: false,
109
121
  verifyFilesSchema: ['filePath'],
110
122
  handler: async (request, response, context) => {
111
- const nodes = await context.getHeapSnapshotNodesById(request.params.filePath, request.params.id, request.params.filterName);
123
+ const nodes = await context.getHeapSnapshotNodesById(request.params.filePath, request.params.id, request.params.filterName, request.params.objectId);
112
124
  response.setHeapSnapshotNodes(nodes, {
113
125
  pageIdx: request.params.pageIdx,
114
126
  pageSize: request.params.pageSize,
@@ -294,4 +306,23 @@ export const getHeapSnapshotDuplicateStrings = defineTool({
294
306
  });
295
307
  },
296
308
  });
309
+ export const getHeapSnapshotObjectDetails = defineTool({
310
+ name: 'get_heapsnapshot_object_details',
311
+ description: 'Loads a memory heapsnapshot and returns detailed information about a specific object by its node ID, including size, type, distance, and DOM detachedness.',
312
+ annotations: {
313
+ category: ToolCategory.MEMORY,
314
+ readOnlyHint: true,
315
+ conditions: ['memoryDebugging'],
316
+ },
317
+ blockedByDialog: false,
318
+ verifyFilesSchema: ['filePath'],
319
+ schema: {
320
+ filePath: zod.string().describe('A path to a .heapsnapshot file to read.'),
321
+ nodeId: zod.number().describe('The node ID to get object details for.'),
322
+ },
323
+ handler: async (request, response, context) => {
324
+ const objectInfo = await context.getHeapSnapshotObjectDetails(request.params.filePath, request.params.nodeId);
325
+ response.setHeapSnapshotObjectDetails(objectInfo);
326
+ },
327
+ });
297
328
  //# sourceMappingURL=memory.js.map
@@ -29,7 +29,7 @@ const FILTERABLE_RESOURCE_TYPES = [
29
29
  ];
30
30
  export const listNetworkRequests = definePageTool({
31
31
  name: 'list_network_requests',
32
- description: `List all requests for the currently selected page since the last navigation.`,
32
+ description: `Lists the most recent requests for the currently selected page since the last navigation.`,
33
33
  annotations: {
34
34
  category: ToolCategory.NETWORK,
35
35
  readOnlyHint: true,
@@ -346,6 +346,7 @@ export const getTabId = definePageTool({
346
346
  const page = context.getPageById(request.params.pageId);
347
347
  const tabId = page.pptrPage._tabId;
348
348
  response.setTabId(tabId);
349
+ response.appendResponseLine(`Tab ID: ${tabId}`);
349
350
  },
350
351
  });
351
352
  //# sourceMappingURL=pages.js.map
@@ -41,47 +41,68 @@ export const startTrace = definePageTool({
41
41
  context.setIsRunningPerformanceTrace(true);
42
42
  const page = request.page;
43
43
  const pageUrlForTracing = page.pptrPage.url();
44
- if (request.params.reload) {
45
- // Before starting the recording, navigate to about:blank to clear out any state.
46
- await page.pptrPage.goto('about:blank', {
47
- waitUntil: ['networkidle0'],
48
- });
49
- }
50
- // Keep in sync with the categories arrays in:
51
- // https://source.chromium.org/chromium/chromium/src/+/main:third_party/devtools-frontend/src/front_end/panels/timeline/TimelineController.ts
52
- // https://github.com/GoogleChrome/lighthouse/blob/master/lighthouse-core/gather/gatherers/trace.js
53
- const categories = [
54
- '-*',
55
- 'blink.console',
56
- 'blink.user_timing',
57
- 'devtools.timeline',
58
- 'disabled-by-default-devtools.screenshot',
59
- 'disabled-by-default-devtools.timeline',
60
- 'disabled-by-default-devtools.timeline.invalidationTracking',
61
- 'disabled-by-default-devtools.timeline.frame',
62
- 'disabled-by-default-devtools.timeline.stack',
63
- 'disabled-by-default-v8.cpu_profiler',
64
- 'disabled-by-default-v8.cpu_profiler.hires',
65
- 'latencyInfo',
66
- 'loading',
67
- 'disabled-by-default-lighthouse',
68
- 'v8.execute',
69
- 'v8',
70
- ];
71
- await page.pptrPage.tracing.start({
72
- categories,
73
- });
74
- if (request.params.reload) {
75
- await page.pptrPage.goto(pageUrlForTracing, {
76
- waitUntil: ['load'],
44
+ try {
45
+ if (request.params.reload) {
46
+ // Before starting the recording, navigate to about:blank to clear out any state.
47
+ // We use `load` because `networkidle0` is known to be flaky for about:blank in Puppeteer.
48
+ await page.pptrPage.goto('about:blank', {
49
+ waitUntil: 'load',
50
+ });
51
+ }
52
+ // Keep in sync with the categories arrays in:
53
+ // https://source.chromium.org/chromium/chromium/src/+/main:third_party/devtools-frontend/src/front_end/panels/timeline/TimelineController.ts
54
+ // https://github.com/GoogleChrome/lighthouse/blob/master/lighthouse-core/gather/gatherers/trace.js
55
+ const categories = [
56
+ '-*',
57
+ 'blink.console',
58
+ 'blink.user_timing',
59
+ 'devtools.timeline',
60
+ 'disabled-by-default-devtools.screenshot',
61
+ 'disabled-by-default-devtools.timeline',
62
+ 'disabled-by-default-devtools.timeline.invalidationTracking',
63
+ 'disabled-by-default-devtools.timeline.frame',
64
+ 'disabled-by-default-devtools.timeline.stack',
65
+ 'disabled-by-default-v8.cpu_profiler',
66
+ 'disabled-by-default-v8.cpu_profiler.hires',
67
+ 'latencyInfo',
68
+ 'loading',
69
+ 'disabled-by-default-lighthouse',
70
+ 'v8.execute',
71
+ 'v8',
72
+ ];
73
+ await page.pptrPage.tracing.start({
74
+ categories,
77
75
  });
76
+ if (request.params.reload) {
77
+ await page.pptrPage.goto(pageUrlForTracing, {
78
+ waitUntil: ['load'],
79
+ });
80
+ }
81
+ if (request.params.autoStop) {
82
+ await new Promise(resolve => setTimeout(resolve, 5_000));
83
+ await stopTracingAndAppendOutput(page, response, context, request.params.filePath);
84
+ }
85
+ else {
86
+ response.appendResponseLine(`The performance trace is being recorded. Use performance_stop_trace to stop it.`);
87
+ }
78
88
  }
79
- if (request.params.autoStop) {
80
- await new Promise(resolve => setTimeout(resolve, 5_000));
81
- await stopTracingAndAppendOutput(page, response, context, request.params.filePath);
82
- }
83
- else {
84
- response.appendResponseLine(`The performance trace is being recorded. Use performance_stop_trace to stop it.`);
89
+ catch (error) {
90
+ // If a setup step (navigation, tracing.start) throws before
91
+ // stopTracingAndAppendOutput runs, the running flag would otherwise stay
92
+ // stuck `true` for the rest of the session, blocking all future traces.
93
+ // Unwind here: stop tracing if it was started and clear the flag. When
94
+ // autoStop already ran stopTracingAndAppendOutput the flag is already
95
+ // false and this is a no-op.
96
+ if (context.isRunningPerformanceTrace()) {
97
+ try {
98
+ await page.pptrPage.tracing.stop();
99
+ }
100
+ catch {
101
+ // Tracing may not have started yet; ignore.
102
+ }
103
+ context.setIsRunningPerformanceTrace(false);
104
+ }
105
+ throw error;
85
106
  }
86
107
  },
87
108
  });