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
@@ -75,9 +75,9 @@ export const emulate = definePageTool({
75
75
  },
76
76
  blockedByDialog: true,
77
77
  verifyFilesSchema: [],
78
- handler: async (request, response, context) => {
78
+ handler: async (request, response) => {
79
79
  const page = request.page;
80
- await context.emulate(request.params, page.pptrPage);
80
+ await page.emulate(request.params);
81
81
  response.appendResponseLine('Emulation configured successfully');
82
82
  },
83
83
  });
@@ -54,7 +54,7 @@ export const listExtensions = defineTool({
54
54
  schema: {},
55
55
  blockedByDialog: false,
56
56
  verifyFilesSchema: [],
57
- handler: async (_request, response, _context) => {
57
+ handler: async (_request, response) => {
58
58
  response.setListExtensions();
59
59
  },
60
60
  });
@@ -3,9 +3,61 @@
3
3
  * Copyright 2025 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
- import { logger } from '../logger.js';
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
+ });
7
58
  import { zod } from '../third_party/index.js';
8
59
  import { parseKey } from '../utils/keyboard.js';
60
+ import { logger } from '../utils/logger.js';
9
61
  import { ToolCategory } from './categories.js';
10
62
  import { definePageTool } from './ToolDefinition.js';
11
63
  const dblClickSchema = zod
@@ -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 = context.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
  });
@@ -399,10 +486,11 @@ export const uploadFile = definePageTool({
399
486
  },
400
487
  blockedByDialog: true,
401
488
  verifyFilesSchema: ['filePath'],
402
- handler: async (request, response, _context) => {
403
- const { uid, filePath } = request.params;
404
- const handle = (await request.page.getElementByUid(uid));
489
+ handler: async (request, response) => {
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
  });
@@ -451,12 +543,21 @@ export const pressKey = definePageTool({
451
543
  const tokens = parseKey(request.params.key);
452
544
  const [key, ...modifiers] = tokens;
453
545
  const result = await page.waitForEventsAfterAction(async () => {
454
- for (const modifier of modifiers) {
455
- await page.pptrPage.keyboard.down(modifier);
546
+ const heldModifiers = [];
547
+ try {
548
+ for (const modifier of modifiers) {
549
+ await page.pptrPage.keyboard.down(modifier);
550
+ heldModifiers.push(modifier);
551
+ }
552
+ await page.pptrPage.keyboard.press(key);
456
553
  }
457
- await page.pptrPage.keyboard.press(key);
458
- for (const modifier of modifiers.toReversed()) {
459
- await page.pptrPage.keyboard.up(modifier);
554
+ finally {
555
+ // Release every modifier that was successfully pressed, even if a
556
+ // later key event throws. Otherwise a failed press leaves modifiers
557
+ // logically held down in the browser (see #2309).
558
+ for (const modifier of heldModifiers.toReversed()) {
559
+ await page.pptrPage.keyboard.up(modifier);
560
+ }
460
561
  }
461
562
  });
462
563
  response.appendResponseLine(`Successfully pressed key: ${request.params.key}`);
@@ -84,7 +84,7 @@ export const lighthouseAudit = definePageTool({
84
84
  }
85
85
  }
86
86
  finally {
87
- await context.restoreEmulation(page);
87
+ await page.restoreEmulation();
88
88
  }
89
89
  const lhr = result.lhr;
90
90
  const reportPaths = [];
@@ -6,6 +6,15 @@
6
6
  import { zod } from '../third_party/index.js';
7
7
  import { ToolCategory } from './categories.js';
8
8
  import { definePageTool, defineTool } from './ToolDefinition.js';
9
+ const HEAP_SNAPSHOT_FILTERS = [
10
+ 'objectsRetainedByDetachedDomNodes',
11
+ 'objectsRetainedByConsole',
12
+ 'objectsRetainedByEventHandlers',
13
+ 'objectsRetainedByContexts',
14
+ 'sharedNativeContext',
15
+ 'noNativeContext',
16
+ 'attributedToSpecificNativeContext',
17
+ ];
9
18
  export const takeHeapSnapshot = definePageTool({
10
19
  name: 'take_heapsnapshot',
11
20
  description: `Capture a heap snapshot of the currently selected page. Use to analyze the memory distribution of JavaScript objects and debug memory leaks.`,
@@ -31,7 +40,7 @@ export const takeHeapSnapshot = definePageTool({
31
40
  });
32
41
  export const getHeapSnapshotSummary = defineTool({
33
42
  name: 'get_heapsnapshot_summary',
34
- 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.',
35
44
  annotations: {
36
45
  category: ToolCategory.MEMORY,
37
46
  readOnlyHint: true,
@@ -45,7 +54,8 @@ export const getHeapSnapshotSummary = defineTool({
45
54
  handler: async (request, response, context) => {
46
55
  const stats = await context.getHeapSnapshotStats(request.params.filePath);
47
56
  const staticData = await context.getHeapSnapshotStaticData(request.params.filePath);
48
- response.setHeapSnapshotStats(stats, staticData);
57
+ const nativeContextSizes = await context.getHeapSnapshotNativeContextSizes(request.params.filePath);
58
+ response.setHeapSnapshotStats(stats, staticData, nativeContextSizes);
49
59
  },
50
60
  });
51
61
  export const getHeapSnapshotDetails = defineTool({
@@ -58,6 +68,14 @@ export const getHeapSnapshotDetails = defineTool({
58
68
  },
59
69
  schema: {
60
70
  filePath: zod.string().describe('A path to a .heapsnapshot file to read.'),
71
+ filterName: zod
72
+ .enum(HEAP_SNAPSHOT_FILTERS)
73
+ .optional()
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.'),
61
79
  pageIdx: zod
62
80
  .number()
63
81
  .optional()
@@ -70,7 +88,7 @@ export const getHeapSnapshotDetails = defineTool({
70
88
  blockedByDialog: false,
71
89
  verifyFilesSchema: ['filePath'],
72
90
  handler: async (request, response, context) => {
73
- const aggregates = await context.getHeapSnapshotAggregates(request.params.filePath);
91
+ const aggregates = await context.getHeapSnapshotAggregates(request.params.filePath, request.params.filterName, request.params.objectId);
74
92
  response.setHeapSnapshotAggregates(aggregates, {
75
93
  pageIdx: request.params.pageIdx,
76
94
  pageSize: request.params.pageSize,
@@ -88,13 +106,21 @@ export const getHeapSnapshotClassNodes = defineTool({
88
106
  schema: {
89
107
  filePath: zod.string().describe('A path to a .heapsnapshot file to read.'),
90
108
  id: zod.number().describe('The ID for the class, obtained from details.'),
109
+ filterName: zod
110
+ .enum(HEAP_SNAPSHOT_FILTERS)
111
+ .optional()
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.'),
91
117
  pageIdx: zod.number().optional().describe('The page index for pagination.'),
92
118
  pageSize: zod.number().optional().describe('The page size for pagination.'),
93
119
  },
94
120
  blockedByDialog: false,
95
121
  verifyFilesSchema: ['filePath'],
96
122
  handler: async (request, response, context) => {
97
- const nodes = await context.getHeapSnapshotNodesById(request.params.filePath, request.params.id);
123
+ const nodes = await context.getHeapSnapshotNodesById(request.params.filePath, request.params.id, request.params.filterName, request.params.objectId);
98
124
  response.setHeapSnapshotNodes(nodes, {
99
125
  pageIdx: request.params.pageIdx,
100
126
  pageSize: request.params.pageSize,
@@ -280,4 +306,23 @@ export const getHeapSnapshotDuplicateStrings = defineTool({
280
306
  });
281
307
  },
282
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
+ });
283
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,
@@ -59,11 +59,11 @@ export const listNetworkRequests = definePageTool({
59
59
  },
60
60
  blockedByDialog: false,
61
61
  verifyFilesSchema: [],
62
- handler: async (request, response, context) => {
62
+ handler: async (request, response) => {
63
63
  const data = await request.page.getDevToolsData();
64
64
  response.attachDevToolsData(data);
65
65
  const reqid = data?.cdpRequestId
66
- ? context.resolveCdpRequestId(request.page, data.cdpRequestId)
66
+ ? request.page.resolveCdpRequestId(data.cdpRequestId)
67
67
  : undefined;
68
68
  response.setIncludeNetworkRequests(true, {
69
69
  pageSize: request.params.pageSize,
@@ -97,7 +97,7 @@ export const getNetworkRequest = definePageTool({
97
97
  },
98
98
  blockedByDialog: true,
99
99
  verifyFilesSchema: ['requestFilePath', 'responseFilePath'],
100
- handler: async (request, response, context) => {
100
+ handler: async (request, response) => {
101
101
  if (request.params.reqid) {
102
102
  response.attachNetworkRequest(request.params.reqid, {
103
103
  requestFilePath: request.params.requestFilePath,
@@ -108,7 +108,7 @@ export const getNetworkRequest = definePageTool({
108
108
  const data = await request.page.getDevToolsData();
109
109
  response.attachDevToolsData(data);
110
110
  const reqid = data?.cdpRequestId
111
- ? context.resolveCdpRequestId(request.page, data.cdpRequestId)
111
+ ? request.page.resolveCdpRequestId(data.cdpRequestId)
112
112
  : undefined;
113
113
  if (reqid) {
114
114
  response.attachNetworkRequest(reqid, {