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 { ToolCategory } from './categories.js';
8
60
  import { definePageTool } from './ToolDefinition.js';
@@ -22,10 +74,20 @@ async function getSourceBox(page, element, fullPage) {
22
74
  return { x: 0, y: 0, width: dims.width, height: dims.height };
23
75
  }
24
76
  const viewport = page.viewport();
25
- if (!viewport) {
77
+ if (viewport) {
78
+ return { x: 0, y: 0, width: viewport.width, height: viewport.height };
79
+ }
80
+ // The browser is launched and connected with `defaultViewport: null`, so
81
+ // `page.viewport()` stays null until something emulates one. Fall back to the
82
+ // window's own dimensions, which is the area a viewport screenshot captures.
83
+ const dims = await page.evaluate(() => ({
84
+ width: window.innerWidth,
85
+ height: window.innerHeight,
86
+ }));
87
+ if (dims.width <= 0 || dims.height <= 0) {
26
88
  return undefined;
27
89
  }
28
- return { x: 0, y: 0, width: viewport.width, height: viewport.height };
90
+ return { x: 0, y: 0, width: dims.width, height: dims.height };
29
91
  }
30
92
  function computeDownscaleClip(box, maxWidth, maxHeight) {
31
93
  const widthScale = maxWidth !== undefined ? Math.min(1, maxWidth / box.width) : 1;
@@ -84,84 +146,97 @@ export const screenshot = definePageTool(args => {
84
146
  blockedByDialog: true,
85
147
  verifyFilesSchema: ['filePath'],
86
148
  handler: async (request, response, context) => {
87
- if (request.params.uid && request.params.fullPage) {
88
- throw new Error('Providing both "uid" and "fullPage" is not allowed.');
89
- }
90
- const page = request.page.pptrPage;
91
- const element = request.params.uid
92
- ? await request.page.getElementByUid(request.params.uid)
93
- : undefined;
94
- const format = request.params.format;
95
- const quality = format === 'png'
96
- ? undefined
97
- : (request.params.quality ?? screenshotQuality);
98
- const fullPage = request.params.fullPage ?? false;
99
- // Compute a downscale clip when --screenshot-max-width or
100
- // --screenshot-max-height is set and the source exceeds either bound.
101
- // The smaller scale factor wins so both bounds are respected while
102
- // preserving aspect ratio.
103
- let clip;
104
- if (screenshotMaxWidth !== undefined ||
105
- screenshotMaxHeight !== undefined) {
106
- const box = await getSourceBox(page, element, fullPage);
107
- if (box) {
108
- clip = computeDownscaleClip(box, screenshotMaxWidth, screenshotMaxHeight);
149
+ const env_1 = { stack: [], error: void 0, hasError: false };
150
+ try {
151
+ if (request.params.uid && request.params.fullPage) {
152
+ throw new Error('Providing both "uid" and "fullPage" is not allowed.');
153
+ }
154
+ const page = request.page.pptrPage;
155
+ const element = __addDisposableResource(env_1, request.params.uid
156
+ ? await request.page.getElementByUid(request.params.uid)
157
+ : undefined, false);
158
+ const format = request.params.format;
159
+ const quality = format === 'png'
160
+ ? undefined
161
+ : (request.params.quality ?? screenshotQuality);
162
+ const fullPage = request.params.fullPage ?? false;
163
+ // `getElementByUid` mints a fresh ElementHandle per call, so dispose it
164
+ // once the capture is done to avoid leaking a remote object for the life
165
+ // of the page's execution context.
166
+ let screenshot;
167
+ // Compute a downscale clip when --screenshot-max-width or
168
+ // --screenshot-max-height is set and the source exceeds either bound.
169
+ // The smaller scale factor wins so both bounds are respected while
170
+ // preserving aspect ratio.
171
+ let clip;
172
+ if (screenshotMaxWidth !== undefined ||
173
+ screenshotMaxHeight !== undefined) {
174
+ const box = await getSourceBox(page, element, fullPage);
175
+ if (box) {
176
+ clip = computeDownscaleClip(box, screenshotMaxWidth, screenshotMaxHeight);
177
+ }
178
+ }
179
+ if (clip) {
180
+ // page.screenshot with clip lets the CDP scale param downscale the
181
+ // capture for viewport, full-page and element shots alike. We rely on
182
+ // Puppeteer's default of captureBeyondViewport=true when a clip is
183
+ // present so element/full-page captures below the fold still work.
184
+ screenshot = await page.screenshot({
185
+ type: format,
186
+ quality,
187
+ optimizeForSpeed: true,
188
+ clip,
189
+ });
190
+ }
191
+ else if (element) {
192
+ screenshot = await element.screenshot({
193
+ type: format,
194
+ quality,
195
+ optimizeForSpeed: true,
196
+ });
197
+ }
198
+ else {
199
+ screenshot = await page.screenshot({
200
+ type: format,
201
+ fullPage,
202
+ quality,
203
+ optimizeForSpeed: true,
204
+ });
205
+ }
206
+ if (request.params.uid) {
207
+ response.appendResponseLine(`Took a screenshot of node with uid "${request.params.uid}".`);
208
+ }
209
+ else if (fullPage) {
210
+ response.appendResponseLine('Took a screenshot of the full current page.');
211
+ }
212
+ else {
213
+ response.appendResponseLine("Took a screenshot of the current page's viewport.");
214
+ }
215
+ // Narrow `format` at the point of use: in the factory form of
216
+ // definePageTool TS widens the Schema generic, which loses the literal
217
+ // union from zod.enum on request.params.format.
218
+ const extension = format === 'jpeg' ? '.jpeg' : format === 'webp' ? '.webp' : '.png';
219
+ if (request.params.filePath) {
220
+ const result = await context.saveFile(screenshot, request.params.filePath, extension);
221
+ response.appendResponseLine(`Saved screenshot to ${result.filename}.`);
222
+ }
223
+ else if (screenshot.length >= 2_000_000) {
224
+ const { filepath } = await context.saveTemporaryFile(screenshot, `screenshot${extension}`);
225
+ response.appendResponseLine(`Saved screenshot to ${filepath}.`);
226
+ }
227
+ else {
228
+ response.attachImage({
229
+ mimeType: `image/${format}`,
230
+ data: Buffer.from(screenshot).toString('base64'),
231
+ });
109
232
  }
110
233
  }
111
- let screenshot;
112
- if (clip) {
113
- // page.screenshot with clip lets the CDP scale param downscale the
114
- // capture for viewport, full-page and element shots alike. We rely on
115
- // Puppeteer's default of captureBeyondViewport=true when a clip is
116
- // present so element/full-page captures below the fold still work.
117
- screenshot = await page.screenshot({
118
- type: format,
119
- quality,
120
- optimizeForSpeed: true,
121
- clip,
122
- });
123
- }
124
- else if (element) {
125
- screenshot = await element.screenshot({
126
- type: format,
127
- quality,
128
- optimizeForSpeed: true,
129
- });
130
- }
131
- else {
132
- screenshot = await page.screenshot({
133
- type: format,
134
- fullPage,
135
- quality,
136
- optimizeForSpeed: true,
137
- });
138
- }
139
- if (request.params.uid) {
140
- response.appendResponseLine(`Took a screenshot of node with uid "${request.params.uid}".`);
141
- }
142
- else if (fullPage) {
143
- response.appendResponseLine('Took a screenshot of the full current page.');
144
- }
145
- else {
146
- response.appendResponseLine("Took a screenshot of the current page's viewport.");
147
- }
148
- // Narrow `format` at the point of use: in the factory form of
149
- // definePageTool TS widens the Schema generic, which loses the literal
150
- // union from zod.enum on request.params.format.
151
- const extension = format === 'jpeg' ? '.jpeg' : format === 'webp' ? '.webp' : '.png';
152
- if (request.params.filePath) {
153
- const result = await context.saveFile(screenshot, request.params.filePath, extension);
154
- response.appendResponseLine(`Saved screenshot to ${result.filename}.`);
155
- }
156
- else if (screenshot.length >= 2_000_000) {
157
- const { filepath } = await context.saveTemporaryFile(screenshot, `screenshot${extension}`);
158
- response.appendResponseLine(`Saved screenshot to ${filepath}.`);
234
+ catch (e_1) {
235
+ env_1.error = e_1;
236
+ env_1.hasError = true;
159
237
  }
160
- else {
161
- response.attachImage({
162
- mimeType: `image/${format}`,
163
- data: Buffer.from(screenshot).toString('base64'),
164
- });
238
+ finally {
239
+ __disposeResources(env_1);
165
240
  }
166
241
  },
167
242
  };
@@ -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 { ToolCategory } from './categories.js';
8
60
  import { defineTool, pageIdSchema } from './ToolDefinition.js';
@@ -46,39 +98,42 @@ Example with arguments: \`(el) => el.innerText\`
46
98
  blockedByDialog: true,
47
99
  verifyFilesSchema: ['filePath'],
48
100
  handler: async (request, response, context) => {
49
- const { serviceWorkerId, args: uidArgs, function: fnString, pageId, dialogAction, filePath, } = request.params;
50
- if (cliArgs?.categoryExtensions && serviceWorkerId) {
51
- if (uidArgs && uidArgs.length > 0) {
52
- throw new Error('args (element uids) cannot be used when evaluating in a service worker.');
53
- }
54
- if (pageId) {
55
- throw new Error('specify either a pageId or a serviceWorkerId.');
56
- }
57
- const worker = await getWebWorker(context, serviceWorkerId);
58
- const result = await context
59
- .getSelectedMcpPage()
60
- .waitForEventsAfterAction(async () => {
61
- await performEvaluation(worker, fnString, [], response, {
62
- filePath,
63
- context,
64
- });
65
- }, { handleDialog: dialogAction ?? 'accept' });
66
- if (result.dialogHandled) {
67
- context.getSelectedMcpPage().clearDialog();
68
- }
69
- response.attachWaitForResult(result);
70
- return;
71
- }
72
- const mcpPage = cliArgs?.experimentalPageIdRouting
73
- ? context.getPageById(request.params.pageId)
74
- : context.getSelectedMcpPage();
75
- const page = mcpPage.pptrPage;
76
- const args = [];
101
+ const env_1 = { stack: [], error: void 0, hasError: false };
77
102
  try {
103
+ const { serviceWorkerId, args: uidArgs, function: fnString, pageId, dialogAction, filePath, } = request.params;
104
+ if (cliArgs?.categoryExtensions && serviceWorkerId) {
105
+ if (uidArgs && uidArgs.length > 0) {
106
+ throw new Error('args (element uids) cannot be used when evaluating in a service worker.');
107
+ }
108
+ if (pageId) {
109
+ throw new Error('specify either a pageId or a serviceWorkerId.');
110
+ }
111
+ const worker = await getWebWorker(context, serviceWorkerId);
112
+ const result = await context
113
+ .getSelectedMcpPage()
114
+ .waitForEventsAfterAction(async () => {
115
+ await performEvaluation(worker, fnString, [], response, {
116
+ filePath,
117
+ context,
118
+ });
119
+ }, { handleDialog: dialogAction ?? 'accept' });
120
+ if (result.dialogHandled) {
121
+ context.getSelectedMcpPage().clearDialog();
122
+ }
123
+ response.attachWaitForResult(result);
124
+ return;
125
+ }
126
+ const mcpPage = cliArgs?.experimentalPageIdRouting
127
+ ? context.getPageById(request.params.pageId)
128
+ : context.getSelectedMcpPage();
129
+ const page = mcpPage.pptrPage;
130
+ const args = [];
131
+ const stack = __addDisposableResource(env_1, new DisposableStack(), false);
78
132
  const frames = new Set();
79
133
  for (const uid of uidArgs ?? []) {
80
134
  const handle = await mcpPage.getElementByUid(uid);
81
135
  frames.add(handle.frame);
136
+ stack.use(handle);
82
137
  args.push(handle);
83
138
  }
84
139
  const evaluatable = await getPageOrFrame(page, frames);
@@ -90,15 +145,20 @@ Example with arguments: \`(el) => el.innerText\`
90
145
  }, { handleDialog: dialogAction ?? 'accept' });
91
146
  response.attachWaitForResult(result);
92
147
  }
148
+ catch (e_1) {
149
+ env_1.error = e_1;
150
+ env_1.hasError = true;
151
+ }
93
152
  finally {
94
- void Promise.allSettled(args.map(arg => arg.dispose()));
153
+ __disposeResources(env_1);
95
154
  }
96
155
  },
97
156
  };
98
157
  });
99
158
  const performEvaluation = async (evaluatable, fnString, args, response, options) => {
100
- const fn = await evaluatable.evaluateHandle(`(${fnString})`);
159
+ const env_2 = { stack: [], error: void 0, hasError: false };
101
160
  try {
161
+ const fn = __addDisposableResource(env_2, await evaluatable.evaluateHandle(`(${fnString})`), false);
102
162
  const result = await evaluatable.evaluate(async (fn, ...args) => {
103
163
  // @ts-expect-error no types for function fn
104
164
  return JSON.stringify(await fn(...args));
@@ -115,8 +175,12 @@ const performEvaluation = async (evaluatable, fnString, args, response, options)
115
175
  response.appendResponseLine('```');
116
176
  }
117
177
  }
178
+ catch (e_2) {
179
+ env_2.error = e_2;
180
+ env_2.hasError = true;
181
+ }
118
182
  finally {
119
- void fn.dispose();
183
+ __disposeResources(env_2);
120
184
  }
121
185
  };
122
186
  const getPageOrFrame = async (page, frames) => {
@@ -1,8 +1,11 @@
1
1
  /**
2
2
  * @license
3
- * Copyright 2025 Google Inc.
3
+ * Copyright 2025 Google LLC
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
- // polyfills are now bundled with all other dependencies
7
- import '../third_party/index.js';
6
+ import { DisposableStack, AsyncDisposableStack, SuppressedError, } from '../third_party/index.js';
7
+ globalThis.DisposableStack ??= DisposableStack;
8
+ globalThis.AsyncDisposableStack ??= AsyncDisposableStack;
9
+ // @ts-expect-error Type mismatch between puppeteer-core and node for SuppressedError.
10
+ globalThis.SuppressedError ??= SuppressedError;
8
11
  //# sourceMappingURL=polyfill.js.map
@@ -0,0 +1,43 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+ const ALLOWED_PROTOCOLS = new Set(['http:', 'https:', 'ws:', 'wss:']);
7
+ const IPV4_LOOPBACK_REGEX = /^127(?:\.(?:25[0-5]|2[0-4]\d|[01]?\d\d?)){3}$/;
8
+ /**
9
+ * Determines whether a given URL string points to a localhost / loopback address.
10
+ *
11
+ * @param url The URL string to test.
12
+ * @returns true if the URL is a valid network URL pointing to localhost or a loopback IP.
13
+ */
14
+ export function isLocalhost(url) {
15
+ if (!url || typeof url !== 'string' || url.trim() === '') {
16
+ return false;
17
+ }
18
+ let parsed;
19
+ try {
20
+ parsed = new URL(url);
21
+ }
22
+ catch {
23
+ return false;
24
+ }
25
+ if (!ALLOWED_PROTOCOLS.has(parsed.protocol)) {
26
+ return false;
27
+ }
28
+ const hostname = parsed.hostname.toLowerCase().replace(/\.$/, '');
29
+ // 1. Check localhost and RFC 6761 *.localhost subdomains
30
+ if (hostname === 'localhost' || hostname.endsWith('.localhost')) {
31
+ return true;
32
+ }
33
+ // 2. Check IPv6 loopback ([::1] as returned by URL.hostname, or ::1)
34
+ if (hostname === '[::1]' || hostname === '::1') {
35
+ return true;
36
+ }
37
+ // 3. Check IPv4 loopback (127.0.0.0/8)
38
+ if (IPV4_LOOPBACK_REGEX.test(hostname)) {
39
+ return true;
40
+ }
41
+ return false;
42
+ }
43
+ //# sourceMappingURL=url.js.map
@@ -5,6 +5,6 @@
5
5
  */
6
6
  // If moved update release-please config
7
7
  // x-release-please-start-version
8
- export const VERSION = '1.6.0';
8
+ export const VERSION = '1.7.0';
9
9
  // x-release-please-end
10
10
  //# sourceMappingURL=version.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chrome-devtools-mcp",
3
- "version": "1.6.0",
3
+ "version": "1.7.0",
4
4
  "description": "MCP server for Chrome DevTools",
5
5
  "type": "module",
6
6
  "bin": {
@@ -11,7 +11,7 @@
11
11
  "scripts": {
12
12
  "cli:generate": "node scripts/generate-cli.ts",
13
13
  "clean": "node -e \"require('fs').rmSync('build', {recursive: true, force: true})\"",
14
- "bundle": "npm run clean && npm run build && rollup -c rollup.config.mjs && node -e \"require('fs').rmSync('build/node_modules', {recursive: true, force: true})\" && node scripts/append-lighthouse-notices.ts",
14
+ "bundle": "npm run clean && npm run build && rollup -c rollup.config.js && node -e \"require('fs').rmSync('build/node_modules', {recursive: true, force: true})\" && node scripts/append-lighthouse-notices.ts",
15
15
  "build": "tsc && node scripts/post-build.ts",
16
16
  "typecheck": "tsc --noEmit",
17
17
  "format": "eslint --cache --fix . && prettier --write --cache .",
@@ -20,15 +20,17 @@
20
20
  "docs:generate": "node scripts/generate-docs.ts",
21
21
  "start": "npm run build && node build/src/bin/chrome-devtools-mcp.js",
22
22
  "start-debug": "DEBUG=mcp:* DEBUG_COLORS=false npm run build && node build/src/bin/chrome-devtools-mcp.js",
23
- "test": "npm run build && node scripts/test.mjs",
24
- "test:no-build": "node scripts/test.mjs",
25
- "test:only": "npm run build && node scripts/test.mjs --test-only",
26
- "test:update-snapshots": "npm run build && node scripts/test.mjs --test-update-snapshots",
23
+ "test": "npm run build && node scripts/test.js --test-skip-pattern=THIRD_PARTY_NOTICES",
24
+ "test:no-build": "node scripts/test.js --test-skip-pattern=THIRD_PARTY_NOTICES",
25
+ "test:notices": "npm run bundle && node scripts/test.js tests/third_party_notices.test.ts",
26
+ "test:notices:no-build": "node scripts/test.js tests/third_party_notices.test.ts",
27
+ "test:only": "npm run build && node scripts/test.js --test-only",
28
+ "test:update-snapshots": "npm run build && node scripts/test.js --test-update-snapshots",
27
29
  "prepare": "node scripts/prepare.ts",
28
30
  "verify-server-json-version": "node scripts/verify-server-json-version.ts",
29
31
  "update-lighthouse": "node scripts/update-lighthouse.ts",
30
32
  "update-metrics": "node scripts/update_metrics.ts",
31
- "verify-npm-package": "node scripts/verify-npm-package.mjs",
33
+ "verify-npm-package": "node scripts/verify-npm-package.js",
32
34
  "eval": "npm run build && node scripts/eval_gemini.ts",
33
35
  "count-tokens": "node scripts/count_tokens.ts"
34
36
  },
@@ -48,14 +50,14 @@
48
50
  "homepage": "https://github.com/ChromeDevTools/chrome-devtools-mcp#readme",
49
51
  "mcpName": "io.github.ChromeDevTools/chrome-devtools-mcp",
50
52
  "devDependencies": {
51
- "@eslint/js": "^9.35.0",
53
+ "@blackwell-systems/gcf": "^2.2.2",
54
+ "@eslint/js": "^10.0.1",
52
55
  "@google/genai": "^2.0.1",
53
- "@modelcontextprotocol/sdk": "1.29.0",
56
+ "@modelcontextprotocol/sdk": "1.30.0",
54
57
  "@rollup/plugin-commonjs": "^29.0.0",
55
58
  "@rollup/plugin-json": "^6.1.0",
56
59
  "@rollup/plugin-node-resolve": "^16.0.3",
57
60
  "@stylistic/eslint-plugin": "^5.4.0",
58
- "@blackwell-systems/gcf": "^2.2.2",
59
61
  "@toon-format/toon": "^2.2.0",
60
62
  "@types/debug": "^4.1.12",
61
63
  "@types/filesystem": "^0.0.36",
@@ -65,16 +67,15 @@
65
67
  "@types/yargs": "^17.0.33",
66
68
  "@typescript-eslint/eslint-plugin": "^8.43.0",
67
69
  "@typescript-eslint/parser": "^8.43.0",
68
- "chrome-devtools-frontend": "1.0.1652307",
69
70
  "core-js": "3.49.0",
70
71
  "debug": "4.4.3",
71
- "eslint": "^9.35.0",
72
+ "eslint": "^10.7.0",
72
73
  "eslint-import-resolver-typescript": "^4.4.4",
73
74
  "eslint-plugin-import": "^2.32.0",
74
75
  "globals": "^17.0.0",
75
76
  "lighthouse": "13.4.0",
76
77
  "prettier": "^3.6.2",
77
- "puppeteer": "25.3.0",
78
+ "puppeteer": "25.5.0",
78
79
  "rollup": "4.62.2",
79
80
  "rollup-plugin-cleanup": "^3.2.1",
80
81
  "rollup-plugin-license": "^3.6.0",
@@ -82,11 +83,11 @@
82
83
  "sinon": "^22.0.0",
83
84
  "typescript": "^6.0.2",
84
85
  "typescript-eslint": "^8.43.0",
85
- "yargs": "18.0.0"
86
+ "yargs": "18.1.0"
86
87
  },
87
88
  "peerDependencies": {
88
- "@toon-format/toon": "^2.2.0",
89
- "@blackwell-systems/gcf": "^2.2.2"
89
+ "@blackwell-systems/gcf": "^2.2.2",
90
+ "@toon-format/toon": "^2.2.0"
90
91
  },
91
92
  "peerDependenciesMeta": {
92
93
  "@toon-format/toon": {
@@ -100,6 +101,9 @@
100
101
  "node": "^20.19.0 || ^22.12.0 || >=23"
101
102
  },
102
103
  "overrides": {
104
+ "eslint-plugin-import": {
105
+ "eslint": "$eslint"
106
+ },
103
107
  "puppeteer-core": "$puppeteer"
104
108
  }
105
109
  }
@@ -5,7 +5,7 @@ description: Diagnoses and resolves memory leaks in JavaScript/Node.js applicati
5
5
 
6
6
  # Memory Leak Debugging
7
7
 
8
- This skill provides expert guidance and workflows for finding, diagnosing, and fixing memory leaks in JavaScript and Node.js applications using Chrome DevTools MCP.
8
+ This skill provides expert guidance and workflows for finding, diagnosing, and fixing memory leaks in JavaScript and Node.js applications using Chrome DevTools MCP tools.
9
9
 
10
10
  ## Core Principles
11
11
 
@@ -30,29 +30,25 @@ When investigating a frontend web application memory leak, utilize the `chrome-d
30
30
  Once you have generated `.heapsnapshot` files using `take_heapsnapshot`, compare them with Chrome DevTools MCP memory tools.
31
31
 
32
32
  - Start with `get_heapsnapshot_summary` for each snapshot to confirm that the files load and to compare high-level totals.
33
- - Use `compare_heapsnapshots` to compare baseline and target snapshots. Start without `classIndex` for the summary diff, then request detailed class diffs only for suspicious growth.
33
+ - Use `compare_heapsnapshots` to compare baseline and target snapshots. Start without `classIndex` for the summary diff, then request detailed class diffs only for suspicious growth by specifying `classIndex`.
34
34
  - Use the summary output from `compare_heapsnapshots` before drilling into specific node IDs.
35
35
 
36
- ### 3. Inspecting Retainers
36
+ ### 3. Inspecting Retainers and Dominator Chains
37
37
 
38
- When a class or object type grows unexpectedly, inspect the retaining chain with the MCP tools before changing code.
38
+ When a class or object type grows unexpectedly, inspect the retaining chain and dominators with the MCP tools before changing code.
39
39
 
40
40
  - Use `get_heapsnapshot_class_nodes` to list instances of the suspicious class.
41
41
  - Use `get_heapsnapshot_retainers`, `get_heapsnapshot_retaining_paths`, `get_heapsnapshot_dominators`, and `get_heapsnapshot_edges` to understand why representative nodes are still reachable.
42
+ - Use `get_heapsnapshot_object_details` with a specific `nodeId` to retrieve detailed object metadata (size, type, distance, and DOM detachedness).
42
43
  - Use `get_heapsnapshot_duplicate_strings` when string growth dominates the diff.
43
44
  - Read [references/common-leaks.md](references/common-leaks.md) for examples of common memory leaks and how to fix them after the retaining path points at application code.
44
45
 
45
- ### 4. External Tool Fallback
46
+ ### 4. Advanced Analysis and Categorized Filters
46
47
 
47
- If the built-in MCP memory tools are not enough, use external tools as a fallback rather than reading raw snapshots directly.
48
+ Use built-in MCP memory tools and filters to pinpoint specific leak categories directly without external tools.
48
49
 
49
- - Read [references/memlab.md](references/memlab.md) for how to use `memlab` to analyze generated heap snapshots.
50
- - If `memlab` is not available, use the fallback script in the references directory to compare two `.heapsnapshot` files and identify the top growing objects and common leak types.
51
-
52
- Run the fallback script using Node.js:
53
-
54
- ```bash
55
- node skills/memory-leak-debugging/references/compare_snapshots.js <baseline.heapsnapshot> <target.heapsnapshot>
56
- ```
57
-
58
- The script will analyze and output the top growing objects by size and highlight the 3 most common types of memory leaks (for example, detached DOM nodes, closures, and contexts) if they are present.
50
+ - Use `get_heapsnapshot_details` or `get_heapsnapshot_class_nodes` with `filterName` to target common leak causes:
51
+ - `objectsRetainedByDetachedDomNodes`: Identifies detached DOM elements retained in memory.
52
+ - `objectsRetainedByEventHandlers`: Identifies objects kept alive by unremoved event listeners.
53
+ - `objectsRetainedByContexts`: Identifies objects trapped in closures or execution contexts.
54
+ - `objectsRetainedByConsole`: Identifies objects retained by console logging.
@@ -1,6 +1,6 @@
1
1
  # Common Memory Leaks
2
2
 
3
- When analyzing a retainer trace from `memlab`, look for these common patterns in the codebase:
3
+ When analyzing retaining paths, dominator chains, or class diffs with Chrome DevTools MCP memory tools, look for these common patterns in the codebase:
4
4
 
5
5
  ## 1. Uncleared Event Listeners
6
6