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.
- package/README.md +41 -9
- package/build/src/HeapSnapshotManager.js +77 -28
- package/build/src/McpContext.js +233 -383
- package/build/src/McpPage.js +466 -41
- package/build/src/McpResponse.js +285 -331
- package/build/src/PageCollector.js +53 -122
- package/build/src/SlimMcpResponse.js +1 -1
- package/build/src/TextSnapshot.js +100 -21
- package/build/src/ToolHandler.js +31 -10
- package/build/src/WaitForHelper.js +140 -56
- package/build/src/bin/chrome-devtools-cli-options.js +63 -3
- package/build/src/bin/chrome-devtools-mcp-cli-options.js +16 -7
- package/build/src/bin/chrome-devtools-mcp-main.js +3 -3
- package/build/src/bin/chrome-devtools.js +19 -3
- package/build/src/browser.js +1 -1
- package/build/src/daemon/client.js +55 -3
- package/build/src/daemon/daemon.js +17 -12
- package/build/src/daemon/utils.js +19 -4
- package/build/src/devtools/DevtoolsUtils.js +9 -65
- package/build/src/{issue-descriptions.js → devtools/issueDescriptions.js} +2 -2
- package/build/src/formatters/HeapSnapshotFormatter.js +48 -11
- package/build/src/formatters/IssueFormatter.js +2 -2
- package/build/src/index.js +13 -3
- package/build/src/telemetry/ClearcutLogger.js +4 -1
- package/build/src/telemetry/WatchdogClient.js +1 -1
- package/build/src/telemetry/metricsRegistry.js +2 -9
- package/build/src/telemetry/persistence.js +1 -1
- package/build/src/telemetry/transformation.js +50 -0
- package/build/src/telemetry/watchdog/ClearcutSender.js +1 -1
- package/build/src/telemetry/watchdog/main.js +1 -1
- package/build/src/third_party/THIRD_PARTY_NOTICES +230 -287
- package/build/src/third_party/bundled-packages.json +4 -6
- package/build/src/third_party/devtools-formatter-worker.js +60 -19
- package/build/src/third_party/devtools-heap-snapshot-worker.js +383 -182
- package/build/src/third_party/index.js +30171 -11328
- package/build/src/third_party/issue-descriptions/CoepCorpNotSameOrigin.md +2 -2
- package/build/src/third_party/issue-descriptions/CoepCorpNotSameOriginAfterDefaultedToSameOriginByCoep.md +3 -3
- package/build/src/third_party/issue-descriptions/CoepCorpNotSameSite.md +2 -2
- package/build/src/third_party/issue-descriptions/CoepFrameResourceNeedsCoepHeader.md +1 -1
- package/build/src/third_party/issue-descriptions/CompatibilityModeQuirks.md +1 -1
- package/build/src/third_party/issue-descriptions/CookieAttributeValueExceedsMaxSize.md +2 -2
- package/build/src/third_party/issue-descriptions/LowTextContrast.md +1 -1
- package/build/src/third_party/issue-descriptions/SameSiteNoneInsecureErrorRead.md +1 -1
- package/build/src/third_party/issue-descriptions/SameSiteNoneInsecureErrorSet.md +1 -1
- package/build/src/third_party/issue-descriptions/SameSiteNoneInsecureWarnRead.md +1 -1
- package/build/src/third_party/issue-descriptions/SameSiteNoneInsecureWarnSet.md +1 -1
- package/build/src/third_party/issue-descriptions/SameSiteUnspecifiedLaxAllowUnsafeRead.md +3 -3
- package/build/src/third_party/issue-descriptions/SameSiteUnspecifiedLaxAllowUnsafeSet.md +3 -3
- package/build/src/third_party/issue-descriptions/bounceTrackingMitigations.md +1 -1
- package/build/src/third_party/issue-descriptions/connectionAllowlistInvalidAllowlistItemType.md +2 -2
- package/build/src/third_party/issue-descriptions/connectionAllowlistInvalidHeader.md +2 -2
- package/build/src/third_party/issue-descriptions/connectionAllowlistInvalidUrlPattern.md +3 -3
- package/build/src/third_party/issue-descriptions/connectionAllowlistItemNotInnerList.md +2 -2
- package/build/src/third_party/issue-descriptions/connectionAllowlistMoreThanOneList.md +2 -2
- package/build/src/third_party/issue-descriptions/connectionAllowlistReportingEndpointNotToken.md +1 -1
- package/build/src/third_party/issue-descriptions/cookieCrossSiteRedirectDowngrade.md +3 -3
- package/build/src/third_party/issue-descriptions/cookieExcludeBlockedWithinRelatedWebsiteSet.md +1 -1
- package/build/src/third_party/issue-descriptions/cookieExcludePortMismatch.md +1 -1
- package/build/src/third_party/issue-descriptions/cookieExcludeSchemeMismatch.md +1 -1
- package/build/src/third_party/issue-descriptions/cookieExcludeThirdPartyPhaseoutSet.md +1 -1
- package/build/src/third_party/issue-descriptions/cookieWarnThirdPartyPhaseoutRead.md +1 -1
- package/build/src/third_party/issue-descriptions/corsAllowCredentialsRequired.md +1 -1
- package/build/src/third_party/issue-descriptions/corsDisabledScheme.md +2 -2
- package/build/src/third_party/issue-descriptions/corsDisallowedByMode.md +2 -2
- package/build/src/third_party/issue-descriptions/corsHeaderDisallowedByPreflightResponse.md +1 -1
- package/build/src/third_party/issue-descriptions/corsInvalidHeaderValues.md +3 -3
- package/build/src/third_party/issue-descriptions/corsLocalNetworkAccessPermissionDenied.md +1 -1
- package/build/src/third_party/issue-descriptions/corsMethodDisallowedByPreflightResponse.md +1 -1
- package/build/src/third_party/issue-descriptions/corsNoCorsRedirectModeNotFollow.md +1 -1
- package/build/src/third_party/issue-descriptions/corsOriginMismatch.md +3 -3
- package/build/src/third_party/issue-descriptions/corsPreflightResponseInvalid.md +2 -2
- package/build/src/third_party/issue-descriptions/corsRedirectContainsCredentials.md +3 -3
- package/build/src/third_party/issue-descriptions/corsWildcardOriginNotAllowed.md +4 -3
- package/build/src/third_party/issue-descriptions/cspEvalViolation.md +4 -4
- package/build/src/third_party/issue-descriptions/cspInlineViolation.md +2 -2
- package/build/src/third_party/issue-descriptions/cspTrustedTypesPolicyViolation.md +2 -2
- package/build/src/third_party/issue-descriptions/cspTrustedTypesSinkViolation.md +4 -4
- package/build/src/third_party/issue-descriptions/cspURLViolation.md +4 -4
- package/build/src/third_party/issue-descriptions/emailVerificationRequestAccountsEmptyList.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestAccountsHttpNotFound.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestAccountsInvalidContentType.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestAccountsInvalidResponse.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestAccountsNoResponse.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestDnsFetchFailed.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestDnsInvalidRecord.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestEmailVerificationWellKnownHttpNotFound.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestEmailVerificationWellKnownInvalidContentType.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestEmailVerificationWellKnownInvalidResponse.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestEmailVerificationWellKnownNoResponse.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestInvalidEmail.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestJwksHttpNotFound.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestJwksInvalidResponse.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestKeyBindingSigningFailed.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestRpOriginIsOpaque.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenHttpNotFound.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenInvalidContentType.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenInvalidResponse.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenInvalidSdJwt.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenMalformedSdJwt.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenNoResponse.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidAudience.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidIssuedAt.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidNonce.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidSdHash.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidTyp.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingAud.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingCnf.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingIat.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingNonce.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingSdHash.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbSignatureFailed.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidEmail.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidEmailVerified.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidHolderKey.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidIssuedAt.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidIssuer.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtJwksMissingKeys.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtMissingCnf.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtMissingEmail.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtMissingIat.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtMissingIss.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtSignatureFailed.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtUnsupportedHeaderAlg.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestUserLoggedOut.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownAccountsEndpointCrossOrigin.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownHttpNotFound.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownInvalidContentType.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownInvalidResponse.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownIssuanceEndpointCrossOrigin.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownListEmpty.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownMissingAccountsEndpoint.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownMissingIssuanceEndpoint.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownNoResponse.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownUnsupportedSigningAlgorithm.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestAccountsHttpNotFound.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestAccountsInvalidResponse.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestAccountsNoResponse.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestApprovalDeclined.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestCanceled.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestErrorFetchingSignin.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestErrorIdToken.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestIdTokenHttpNotFound.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestIdTokenInvalidRequest.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestIdTokenInvalidResponse.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestIdTokenNoResponse.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestInvalidSigninResponse.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestManifestHttpNotFound.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestManifestInvalidResponse.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestManifestNoResponse.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestTooManyRequests.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestInvalidAccountsResponse.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestInvalidConfigOrWellKnown.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNoAccountSharingPermission.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNoApiPermission.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNoReturningUserFromFetchedAccounts.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotIframe.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotPotentiallyTrustworthy.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotSameOrigin.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotSignedInWithIdp.md +1 -1
- package/build/src/third_party/issue-descriptions/fetchingPartitionedBlobURL.md +2 -2
- package/build/src/third_party/issue-descriptions/genericFormAriaLabelledByToNonExistingIdError.md +2 -2
- package/build/src/third_party/issue-descriptions/genericFormAutocompleteAttributeEmptyError.md +1 -1
- package/build/src/third_party/issue-descriptions/genericFormDuplicateIdForInputError.md +1 -1
- package/build/src/third_party/issue-descriptions/genericFormEmptyIdAndNameAttributesForInputError.md +2 -2
- package/build/src/third_party/issue-descriptions/genericFormInputAssignedAutocompleteValueToIdOrNameAttributeError.md +2 -2
- package/build/src/third_party/issue-descriptions/genericFormInputHasWrongButWellIntendedAutocompleteValueError.md +1 -1
- package/build/src/third_party/issue-descriptions/genericFormInputWithNoLabelError.md +1 -1
- package/build/src/third_party/issue-descriptions/genericFormLabelForMatchesNonExistingIdError.md +2 -2
- package/build/src/third_party/issue-descriptions/genericFormLabelForNameError.md +1 -1
- package/build/src/third_party/issue-descriptions/genericFormLabelHasNeitherForNorNestedInputError.md +1 -1
- package/build/src/third_party/issue-descriptions/genericFormModelContextMissingToolName.md +1 -1
- package/build/src/third_party/issue-descriptions/genericFormModelContextParameterMissingName.md +1 -1
- package/build/src/third_party/issue-descriptions/genericFormModelContextRequiredParameterMissingName.md +1 -1
- package/build/src/third_party/issue-descriptions/genericNavigationEntryMarkedSkippable.md +2 -2
- package/build/src/third_party/issue-descriptions/heavyAd.md +1 -1
- package/build/src/third_party/issue-descriptions/lazyLoadImageZeroSize.md +7 -0
- package/build/src/third_party/issue-descriptions/navigatingPartitionedBlobURL.md +3 -3
- package/build/src/third_party/issue-descriptions/permissionElementActivationDisabled.md +1 -1
- package/build/src/third_party/issue-descriptions/permissionElementActivationDisabledWithOccluder.md +1 -1
- package/build/src/third_party/issue-descriptions/permissionElementActivationDisabledWithOccluderParent.md +1 -1
- package/build/src/third_party/issue-descriptions/permissionElementFencedFrameDisallowed.md +2 -2
- package/build/src/third_party/issue-descriptions/permissionElementFontSizeTooLarge.md +2 -2
- package/build/src/third_party/issue-descriptions/permissionElementFontSizeTooSmall.md +2 -2
- package/build/src/third_party/issue-descriptions/permissionElementInsetBoxShadowUnsupported.md +1 -1
- package/build/src/third_party/issue-descriptions/permissionElementInvalidDisplayStyle.md +2 -2
- package/build/src/third_party/issue-descriptions/permissionElementInvalidSizeValue.md +2 -2
- package/build/src/third_party/issue-descriptions/permissionElementInvalidType.md +2 -2
- package/build/src/third_party/issue-descriptions/permissionElementInvalidTypeActivation.md +2 -2
- package/build/src/third_party/issue-descriptions/permissionElementNonOpaqueColor.md +1 -1
- package/build/src/third_party/issue-descriptions/permissionElementPaddingBottomUnsupported.md +2 -2
- package/build/src/third_party/issue-descriptions/permissionElementPaddingRightUnsupported.md +2 -2
- package/build/src/third_party/issue-descriptions/permissionElementRequestInProgress.md +2 -2
- package/build/src/third_party/issue-descriptions/permissionElementSecurityChecksFailed.md +1 -1
- package/build/src/third_party/issue-descriptions/permissionElementTypeNotSupported.md +2 -2
- package/build/src/third_party/issue-descriptions/permissionElementUntrustedEvent.md +1 -1
- package/build/src/third_party/issue-descriptions/placeholderDescriptionForInvisibleIssues.md +1 -1
- package/build/src/third_party/issue-descriptions/selectElementAccessibilityDisallowedOptGroupChild.md +1 -1
- package/build/src/third_party/issue-descriptions/selectElementAccessibilityDisallowedSelectChild.md +1 -1
- package/build/src/third_party/issue-descriptions/selectElementAccessibilityInteractiveContentAttributesSelectDescendant.md +1 -1
- package/build/src/third_party/issue-descriptions/selectElementAccessibilityInteractiveContentLegendChild.md +1 -1
- package/build/src/third_party/issue-descriptions/selectElementAccessibilityInteractiveContentOptionChild.md +1 -1
- package/build/src/third_party/issue-descriptions/selectElementAccessibilityNonPhrasingContentOptionChild.md +1 -1
- package/build/src/third_party/issue-descriptions/selectivePermissionsIntervention.md +3 -3
- package/build/src/third_party/issue-descriptions/sharedArrayBuffer.md +1 -1
- package/build/src/third_party/issue-descriptions/sharedDictionaryUseErrorCrossOriginNoCorsRequest.md +1 -1
- package/build/src/third_party/issue-descriptions/sharedDictionaryUseErrorMatchingDictionaryNotUsed.md +1 -1
- package/build/src/third_party/issue-descriptions/sharedDictionaryUseErrorUnexpectedContentDictionaryHeader.md +1 -1
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorCossOriginNoCorsRequest.md +1 -1
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorDisallowedBySettings.md +1 -1
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorExpiredResponse.md +1 -1
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorFeatureDisabled.md +2 -2
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorInvalidStructuredHeader.md +1 -1
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNavigationRequest.md +2 -2
- package/build/src/third_party/issue-descriptions/sriInvalidSignatureHeader.md +4 -4
- package/build/src/third_party/issue-descriptions/sriInvalidSignatureInputHeader.md +4 -4
- package/build/src/third_party/issue-descriptions/sriMissingSignatureHeader.md +1 -1
- package/build/src/third_party/issue-descriptions/sriMissingSignatureInputHeader.md +2 -2
- package/build/src/third_party/issue-descriptions/sriSignatureHeaderValueIsIncorrectLength.md +2 -2
- package/build/src/third_party/issue-descriptions/sriSignatureHeaderValueIsNotByteSequence.md +4 -4
- package/build/src/third_party/issue-descriptions/sriSignatureHeaderValueIsParameterized.md +4 -4
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidComponentName.md +1 -1
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidComponentType.md +2 -2
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidDerivedComponentParameter.md +1 -1
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidHeaderComponentParameter.md +1 -1
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidParameter.md +2 -2
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderKeyIdLength.md +5 -5
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderMissingLabel.md +3 -3
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderMissingRequiredParameters.md +2 -2
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderValueMissingComponents.md +2 -2
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderValueNotInnerList.md +2 -2
- package/build/src/third_party/issue-descriptions/sriValidationFailedIntegrityMismatch.md +4 -4
- package/build/src/third_party/issue-descriptions/sriValidationFailedInvalidLength.md +3 -3
- package/build/src/third_party/issue-descriptions/sriValidationFailedSignatureExpired.md +2 -2
- package/build/src/third_party/issue-descriptions/sriValidationFailedSignatureMismatch.md +2 -2
- package/build/src/third_party/issue-descriptions/stylesheetLateImport.md +1 -1
- package/build/src/third_party/issue-descriptions/summaryElementAccessibilityInteractiveContentSummaryDescendant.md +1 -1
- package/build/src/third_party/issue-descriptions/unencodedDigestIncorrectDigestLength.md +2 -2
- package/build/src/third_party/issue-descriptions/unencodedDigestIncorrectDigestType.md +3 -3
- package/build/src/third_party/issue-descriptions/unencodedDigestMalformedDictionary.md +2 -2
- package/build/src/third_party/issue-descriptions/unencodedDigestUnknownAlgorithm.md +1 -1
- package/build/src/third_party/lighthouse-devtools-mcp-bundle.js +3177 -6340
- package/build/src/tools/emulation.js +2 -2
- package/build/src/tools/extensions.js +1 -1
- package/build/src/tools/input.js +213 -112
- package/build/src/tools/lighthouse.js +1 -1
- package/build/src/tools/memory.js +49 -4
- package/build/src/tools/network.js +5 -5
- package/build/src/tools/pages.js +22 -89
- package/build/src/tools/performance.js +62 -41
- package/build/src/tools/screenshot.js +152 -77
- package/build/src/tools/script.js +95 -28
- package/build/src/tools/snapshot.js +2 -2
- package/build/src/tools/thirdPartyDeveloper.js +1 -1
- package/build/src/tools/webmcp.js +1 -1
- package/build/src/trace-processing/parse.js +1 -1
- package/build/src/{logger.js → utils/logger.js} +1 -1
- package/build/src/utils/polyfill.js +11 -0
- package/build/src/utils/url.js +43 -0
- package/build/src/version.js +1 -1
- package/package.json +23 -15
- package/skills/memory-leak-debugging/SKILL.md +23 -19
- package/skills/memory-leak-debugging/references/common-leaks.md +1 -1
- package/build/src/Mutex.js +0 -38
- package/build/src/devtools/DevToolsConnectionAdapter.js +0 -70
- package/build/src/polyfill.js +0 -8
- package/build/src/third_party/issue-descriptions/SameSiteExcludeContextDowngradeRead.md +0 -8
- package/build/src/third_party/issue-descriptions/SameSiteExcludeContextDowngradeSet.md +0 -8
- package/build/src/third_party/issue-descriptions/SameSiteExcludeNavigationContextDowngrade.md +0 -8
- package/build/src/third_party/issue-descriptions/SameSiteWarnCrossDowngradeRead.md +0 -8
- package/build/src/third_party/issue-descriptions/SameSiteWarnCrossDowngradeSet.md +0 -8
- package/build/src/third_party/issue-descriptions/SameSiteWarnStrictLaxDowngradeStrict.md +0 -8
- package/build/src/third_party/issue-descriptions/arInsecureContext.md +0 -7
- package/build/src/third_party/issue-descriptions/arInvalidInfoHeader.md +0 -5
- package/build/src/third_party/issue-descriptions/arInvalidRegisterOsSourceHeader.md +0 -5
- package/build/src/third_party/issue-descriptions/arInvalidRegisterOsTriggerHeader.md +0 -5
- package/build/src/third_party/issue-descriptions/arInvalidRegisterSourceHeader.md +0 -5
- package/build/src/third_party/issue-descriptions/arInvalidRegisterTriggerHeader.md +0 -5
- package/build/src/third_party/issue-descriptions/arNavigationRegistrationUniqueScopeAlreadySet.md +0 -5
- package/build/src/third_party/issue-descriptions/arNavigationRegistrationWithoutTransientUserActivation.md +0 -6
- package/build/src/third_party/issue-descriptions/arNoRegisterOsSourceHeader.md +0 -5
- package/build/src/third_party/issue-descriptions/arNoRegisterOsTriggerHeader.md +0 -5
- package/build/src/third_party/issue-descriptions/arNoRegisterSourceHeader.md +0 -5
- package/build/src/third_party/issue-descriptions/arNoRegisterTriggerHeader.md +0 -5
- package/build/src/third_party/issue-descriptions/arNoWebOrOsSupport.md +0 -4
- package/build/src/third_party/issue-descriptions/arOsSourceIgnored.md +0 -18
- package/build/src/third_party/issue-descriptions/arOsTriggerIgnored.md +0 -19
- package/build/src/third_party/issue-descriptions/arPermissionPolicyDisabled.md +0 -8
- package/build/src/third_party/issue-descriptions/arSourceAndTriggerHeaders.md +0 -9
- package/build/src/third_party/issue-descriptions/arSourceIgnored.md +0 -13
- package/build/src/third_party/issue-descriptions/arTriggerIgnored.md +0 -12
- package/build/src/third_party/issue-descriptions/arUntrustworthyReportingOrigin.md +0 -10
- package/build/src/third_party/issue-descriptions/arWebAndOsHeaders.md +0 -11
- package/build/src/utils/types.js +0 -7
- package/skills/memory-leak-debugging/references/compare_snapshots.js +0 -109
- 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 { defineTool, pageIdSchema } from './ToolDefinition.js';
|
|
@@ -46,36 +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 {
|
|
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
|
-
response.attachWaitForResult(result);
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
const mcpPage = cliArgs?.experimentalPageIdRouting
|
|
70
|
-
? context.getPageById(request.params.pageId)
|
|
71
|
-
: context.getSelectedMcpPage();
|
|
72
|
-
const page = mcpPage.pptrPage;
|
|
73
|
-
const args = [];
|
|
101
|
+
const env_1 = { stack: [], error: void 0, hasError: false };
|
|
74
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);
|
|
75
132
|
const frames = new Set();
|
|
76
133
|
for (const uid of uidArgs ?? []) {
|
|
77
134
|
const handle = await mcpPage.getElementByUid(uid);
|
|
78
135
|
frames.add(handle.frame);
|
|
136
|
+
stack.use(handle);
|
|
79
137
|
args.push(handle);
|
|
80
138
|
}
|
|
81
139
|
const evaluatable = await getPageOrFrame(page, frames);
|
|
@@ -87,15 +145,20 @@ Example with arguments: \`(el) => el.innerText\`
|
|
|
87
145
|
}, { handleDialog: dialogAction ?? 'accept' });
|
|
88
146
|
response.attachWaitForResult(result);
|
|
89
147
|
}
|
|
148
|
+
catch (e_1) {
|
|
149
|
+
env_1.error = e_1;
|
|
150
|
+
env_1.hasError = true;
|
|
151
|
+
}
|
|
90
152
|
finally {
|
|
91
|
-
|
|
153
|
+
__disposeResources(env_1);
|
|
92
154
|
}
|
|
93
155
|
},
|
|
94
156
|
};
|
|
95
157
|
});
|
|
96
158
|
const performEvaluation = async (evaluatable, fnString, args, response, options) => {
|
|
97
|
-
const
|
|
159
|
+
const env_2 = { stack: [], error: void 0, hasError: false };
|
|
98
160
|
try {
|
|
161
|
+
const fn = __addDisposableResource(env_2, await evaluatable.evaluateHandle(`(${fnString})`), false);
|
|
99
162
|
const result = await evaluatable.evaluate(async (fn, ...args) => {
|
|
100
163
|
// @ts-expect-error no types for function fn
|
|
101
164
|
return JSON.stringify(await fn(...args));
|
|
@@ -112,8 +175,12 @@ const performEvaluation = async (evaluatable, fnString, args, response, options)
|
|
|
112
175
|
response.appendResponseLine('```');
|
|
113
176
|
}
|
|
114
177
|
}
|
|
178
|
+
catch (e_2) {
|
|
179
|
+
env_2.error = e_2;
|
|
180
|
+
env_2.hasError = true;
|
|
181
|
+
}
|
|
115
182
|
finally {
|
|
116
|
-
|
|
183
|
+
__disposeResources(env_2);
|
|
117
184
|
}
|
|
118
185
|
};
|
|
119
186
|
const getPageOrFrame = async (page, frames) => {
|
|
@@ -51,9 +51,9 @@ export const waitFor = definePageTool({
|
|
|
51
51
|
},
|
|
52
52
|
blockedByDialog: true,
|
|
53
53
|
verifyFilesSchema: [],
|
|
54
|
-
handler: async (request, response
|
|
54
|
+
handler: async (request, response) => {
|
|
55
55
|
const page = request.page;
|
|
56
|
-
await
|
|
56
|
+
await page.waitForTextOnPage(request.params.text, request.params.timeout);
|
|
57
57
|
response.appendResponseLine(`Element matching one of ${JSON.stringify(request.params.text)} found.`);
|
|
58
58
|
response.includeSnapshot();
|
|
59
59
|
},
|
|
@@ -22,7 +22,7 @@ third-party developer tools with additional functionality.`,
|
|
|
22
22
|
schema: {},
|
|
23
23
|
blockedByDialog: false,
|
|
24
24
|
verifyFilesSchema: [],
|
|
25
|
-
handler: async (_request, response
|
|
25
|
+
handler: async (_request, response) => {
|
|
26
26
|
response.setListThirdPartyDeveloperTools();
|
|
27
27
|
},
|
|
28
28
|
});
|
|
@@ -16,7 +16,7 @@ export const listWebMcpTools = definePageTool({
|
|
|
16
16
|
schema: {},
|
|
17
17
|
blockedByDialog: false,
|
|
18
18
|
verifyFilesSchema: [],
|
|
19
|
-
handler: async (_request, response
|
|
19
|
+
handler: async (_request, response) => {
|
|
20
20
|
response.setListWebMcpTools();
|
|
21
21
|
},
|
|
22
22
|
});
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* Copyright 2025 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import { logger } from '../logger.js';
|
|
7
6
|
import { DevTools } from '../third_party/index.js';
|
|
7
|
+
import { logger } from '../utils/logger.js';
|
|
8
8
|
const engine = DevTools.TraceEngine.TraceModel.Model.createWithAllHandlers();
|
|
9
9
|
export function traceResultIsSuccess(x) {
|
|
10
10
|
return 'parsedTrace' in x;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
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;
|
|
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
|
package/build/src/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "chrome-devtools-mcp",
|
|
3
|
-
"version": "1.
|
|
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.
|
|
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.
|
|
24
|
-
"test:no-build": "node scripts/test.
|
|
25
|
-
"test:
|
|
26
|
-
"test:
|
|
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.
|
|
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,9 +50,10 @@
|
|
|
48
50
|
"homepage": "https://github.com/ChromeDevTools/chrome-devtools-mcp#readme",
|
|
49
51
|
"mcpName": "io.github.ChromeDevTools/chrome-devtools-mcp",
|
|
50
52
|
"devDependencies": {
|
|
51
|
-
"@
|
|
53
|
+
"@blackwell-systems/gcf": "^2.2.2",
|
|
54
|
+
"@eslint/js": "^10.0.1",
|
|
52
55
|
"@google/genai": "^2.0.1",
|
|
53
|
-
"@modelcontextprotocol/sdk": "1.
|
|
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",
|
|
@@ -60,20 +63,19 @@
|
|
|
60
63
|
"@types/filesystem": "^0.0.36",
|
|
61
64
|
"@types/node": "^26.0.0",
|
|
62
65
|
"@types/semver": "^7.7.1",
|
|
63
|
-
"@types/sinon": "^
|
|
66
|
+
"@types/sinon": "^22.0.0",
|
|
64
67
|
"@types/yargs": "^17.0.33",
|
|
65
68
|
"@typescript-eslint/eslint-plugin": "^8.43.0",
|
|
66
69
|
"@typescript-eslint/parser": "^8.43.0",
|
|
67
|
-
"chrome-devtools-frontend": "1.0.1652307",
|
|
68
70
|
"core-js": "3.49.0",
|
|
69
71
|
"debug": "4.4.3",
|
|
70
|
-
"eslint": "^
|
|
72
|
+
"eslint": "^10.7.0",
|
|
71
73
|
"eslint-import-resolver-typescript": "^4.4.4",
|
|
72
74
|
"eslint-plugin-import": "^2.32.0",
|
|
73
75
|
"globals": "^17.0.0",
|
|
74
76
|
"lighthouse": "13.4.0",
|
|
75
77
|
"prettier": "^3.6.2",
|
|
76
|
-
"puppeteer": "25.
|
|
78
|
+
"puppeteer": "25.5.0",
|
|
77
79
|
"rollup": "4.62.2",
|
|
78
80
|
"rollup-plugin-cleanup": "^3.2.1",
|
|
79
81
|
"rollup-plugin-license": "^3.6.0",
|
|
@@ -81,21 +83,27 @@
|
|
|
81
83
|
"sinon": "^22.0.0",
|
|
82
84
|
"typescript": "^6.0.2",
|
|
83
85
|
"typescript-eslint": "^8.43.0",
|
|
84
|
-
"
|
|
85
|
-
"yargs": "18.0.0"
|
|
86
|
+
"yargs": "18.1.0"
|
|
86
87
|
},
|
|
87
88
|
"peerDependencies": {
|
|
89
|
+
"@blackwell-systems/gcf": "^2.2.2",
|
|
88
90
|
"@toon-format/toon": "^2.2.0"
|
|
89
91
|
},
|
|
90
92
|
"peerDependenciesMeta": {
|
|
91
93
|
"@toon-format/toon": {
|
|
92
94
|
"optional": true
|
|
95
|
+
},
|
|
96
|
+
"@blackwell-systems/gcf": {
|
|
97
|
+
"optional": true
|
|
93
98
|
}
|
|
94
99
|
},
|
|
95
100
|
"engines": {
|
|
96
101
|
"node": "^20.19.0 || ^22.12.0 || >=23"
|
|
97
102
|
},
|
|
98
103
|
"overrides": {
|
|
104
|
+
"eslint-plugin-import": {
|
|
105
|
+
"eslint": "$eslint"
|
|
106
|
+
},
|
|
99
107
|
"puppeteer-core": "$puppeteer"
|
|
100
108
|
}
|
|
101
109
|
}
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: memory-leak-debugging
|
|
3
|
-
description: Diagnoses and resolves memory leaks in JavaScript/Node.js applications. Use when a user reports high memory usage, OOM errors, or wants to
|
|
3
|
+
description: Diagnoses and resolves memory leaks in JavaScript/Node.js applications. Use when a user reports high memory usage, OOM errors, or wants to capture, compare, or inspect heap snapshots with Chrome DevTools MCP memory tools.
|
|
4
4
|
---
|
|
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.
|
|
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
|
|
|
12
|
-
- **Prefer
|
|
12
|
+
- **Prefer MCP memory tools:** Do NOT attempt to read raw `.heapsnapshot` files directly, as they are extremely large and will consume too many tokens. Use the Chrome DevTools MCP heap snapshot tools to summarize, compare, and inspect snapshots.
|
|
13
13
|
- **Isolate the Leak:** Determine if the leak is in the browser (client-side) or Node.js (server-side).
|
|
14
14
|
- **Common Culprits:** Look for detached DOM nodes, unhandled closures, global variables, event listeners not being removed, and caches growing unbounded. _Note: Detached DOM nodes are sometimes intentional caches; always ask the user before nulling them._
|
|
15
|
+
- **Close Loaded Snapshots:** Heap snapshots can be large. After completing an investigation, use `close_heapsnapshot` for each loaded snapshot to release memory held by the MCP server.
|
|
15
16
|
|
|
16
17
|
## Workflows
|
|
17
18
|
|
|
@@ -24,27 +25,30 @@ When investigating a frontend web application memory leak, utilize the `chrome-d
|
|
|
24
25
|
- Repeat the same user interactions 10 times to amplify the leak.
|
|
25
26
|
- Use `take_heapsnapshot` to save `.heapsnapshot` files to disk at baseline, target (after actions), and final (after reverting actions) states.
|
|
26
27
|
|
|
27
|
-
### 2.
|
|
28
|
+
### 2. Comparing Snapshots
|
|
28
29
|
|
|
29
|
-
Once you have generated `.heapsnapshot` files using `take_heapsnapshot`,
|
|
30
|
+
Once you have generated `.heapsnapshot` files using `take_heapsnapshot`, compare them with Chrome DevTools MCP memory tools.
|
|
30
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 by specifying `classIndex`.
|
|
34
|
+
- Use the summary output from `compare_heapsnapshots` before drilling into specific node IDs.
|
|
33
35
|
|
|
34
|
-
### 3.
|
|
36
|
+
### 3. Inspecting Retainers and Dominator Chains
|
|
35
37
|
|
|
36
|
-
When
|
|
38
|
+
When a class or object type grows unexpectedly, inspect the retaining chain and dominators with the MCP tools before changing code.
|
|
37
39
|
|
|
38
|
-
-
|
|
40
|
+
- Use `get_heapsnapshot_class_nodes` to list instances of the suspicious class.
|
|
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).
|
|
43
|
+
- Use `get_heapsnapshot_duplicate_strings` when string growth dominates the diff.
|
|
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.
|
|
39
45
|
|
|
40
|
-
### 4.
|
|
46
|
+
### 4. Advanced Analysis and Categorized Filters
|
|
41
47
|
|
|
42
|
-
|
|
48
|
+
Use built-in MCP memory tools and filters to pinpoint specific leak categories directly without external tools.
|
|
43
49
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
The script will analyze and output the top growing objects by size and highlight the 3 most common types of memory leaks (e.g., Detached DOM nodes, closures, 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
|
|
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
|
|
package/build/src/Mutex.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2025 Google Inc.
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
export class Mutex {
|
|
7
|
-
static Guard = class Guard {
|
|
8
|
-
#mutex;
|
|
9
|
-
constructor(mutex) {
|
|
10
|
-
this.#mutex = mutex;
|
|
11
|
-
}
|
|
12
|
-
dispose() {
|
|
13
|
-
return this.#mutex.release();
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
#locked = false;
|
|
17
|
-
#acquirers = [];
|
|
18
|
-
// This is FIFO.
|
|
19
|
-
async acquire() {
|
|
20
|
-
if (!this.#locked) {
|
|
21
|
-
this.#locked = true;
|
|
22
|
-
return new Mutex.Guard(this);
|
|
23
|
-
}
|
|
24
|
-
const { resolve, promise } = Promise.withResolvers();
|
|
25
|
-
this.#acquirers.push(resolve);
|
|
26
|
-
await promise;
|
|
27
|
-
return new Mutex.Guard(this);
|
|
28
|
-
}
|
|
29
|
-
release() {
|
|
30
|
-
const resolve = this.#acquirers.shift();
|
|
31
|
-
if (!resolve) {
|
|
32
|
-
this.#locked = false;
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
resolve();
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
//# sourceMappingURL=Mutex.js.map
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2025 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
import { CDPSessionEvent } from '../third_party/index.js';
|
|
7
|
-
/**
|
|
8
|
-
* This class makes a puppeteer connection look like DevTools CDPConnection.
|
|
9
|
-
*
|
|
10
|
-
* Since we connect "root" DevTools targets to specific pages, we scope everything to a puppeteer CDP session.
|
|
11
|
-
*
|
|
12
|
-
* We don't have to recursively listen for 'sessionattached' as the "root" CDP session sees all child session attached
|
|
13
|
-
* events, regardless how deeply nested they are.
|
|
14
|
-
*/
|
|
15
|
-
export class PuppeteerDevToolsConnection {
|
|
16
|
-
#connection;
|
|
17
|
-
#observers = new Set();
|
|
18
|
-
#sessionEventHandlers = new Map();
|
|
19
|
-
constructor(session) {
|
|
20
|
-
this.#connection = session.connection();
|
|
21
|
-
session.on(CDPSessionEvent.SessionAttached, this.#startForwardingCdpEvents.bind(this));
|
|
22
|
-
session.on(CDPSessionEvent.SessionDetached, this.#stopForwardingCdpEvents.bind(this));
|
|
23
|
-
this.#startForwardingCdpEvents(session);
|
|
24
|
-
}
|
|
25
|
-
send(method, params, sessionId) {
|
|
26
|
-
if (sessionId === undefined) {
|
|
27
|
-
throw new Error('Attempting to send on the root session. This must not happen');
|
|
28
|
-
}
|
|
29
|
-
const session = this.#connection.session(sessionId);
|
|
30
|
-
if (!session) {
|
|
31
|
-
throw new Error('Unknown session ' + sessionId);
|
|
32
|
-
}
|
|
33
|
-
// Rolled protocol version between puppeteer and DevTools doesn't necessarily match
|
|
34
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
35
|
-
return session
|
|
36
|
-
.send(method, params)
|
|
37
|
-
.then(result => ({ result }))
|
|
38
|
-
.catch(error => ({ error }));
|
|
39
|
-
/* eslint-enable @typescript-eslint/no-explicit-any */
|
|
40
|
-
}
|
|
41
|
-
observe(observer) {
|
|
42
|
-
this.#observers.add(observer);
|
|
43
|
-
}
|
|
44
|
-
unobserve(observer) {
|
|
45
|
-
this.#observers.delete(observer);
|
|
46
|
-
}
|
|
47
|
-
#startForwardingCdpEvents(session) {
|
|
48
|
-
const handler = this.#handleEvent.bind(this, session.id());
|
|
49
|
-
this.#sessionEventHandlers.set(session.id(), handler);
|
|
50
|
-
session.on('*', handler);
|
|
51
|
-
}
|
|
52
|
-
#stopForwardingCdpEvents(session) {
|
|
53
|
-
const handler = this.#sessionEventHandlers.get(session.id());
|
|
54
|
-
if (handler) {
|
|
55
|
-
session.off('*', handler);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
#handleEvent(sessionId, type, event) {
|
|
59
|
-
if (typeof type === 'string' &&
|
|
60
|
-
type !== CDPSessionEvent.SessionAttached &&
|
|
61
|
-
type !== CDPSessionEvent.SessionDetached) {
|
|
62
|
-
this.#observers.forEach(observer => observer.onEvent({
|
|
63
|
-
method: type,
|
|
64
|
-
sessionId,
|
|
65
|
-
params: event,
|
|
66
|
-
}));
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
//# sourceMappingURL=DevToolsConnectionAdapter.js.map
|
package/build/src/polyfill.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
# Migrate entirely to HTTPS to have cookies sent to same-site subresources
|
|
2
|
-
|
|
3
|
-
A cookie was not sent to {PLACEHOLDER_destination} origin from {PLACEHOLDER_origin} context.
|
|
4
|
-
Because this cookie would have been sent across schemes on the same site, it was not sent.
|
|
5
|
-
This behavior enhances the `SameSite` attribute’s protection of user data from request forgery by network attackers.
|
|
6
|
-
|
|
7
|
-
Resolve this issue by migrating your site (as defined by the eTLD+1) entirely to HTTPS.
|
|
8
|
-
It is also recommended to mark the cookie with the `Secure` attribute if that is not already the case.
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
# Migrate entirely to HTTPS to allow cookies to be set by same-site subresources
|
|
2
|
-
|
|
3
|
-
A cookie was not set by {PLACEHOLDER_origin} origin in {PLACEHOLDER_destination} context.
|
|
4
|
-
Because this cookie would have been set across schemes on the same site, it was blocked.
|
|
5
|
-
This behavior enhances the `SameSite` attribute’s protection of user data from request forgery by network attackers.
|
|
6
|
-
|
|
7
|
-
Resolve this issue by migrating your site (as defined by the eTLD+1) entirely to HTTPS.
|
|
8
|
-
It is also recommended to mark the cookie with the `Secure` attribute if that is not already the case.
|
package/build/src/third_party/issue-descriptions/SameSiteExcludeNavigationContextDowngrade.md
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
# Migrate entirely to HTTPS to have cookies sent on same-site requests
|
|
2
|
-
|
|
3
|
-
A cookie was not sent to {PLACEHOLDER_destination} origin from {PLACEHOLDER_origin} context on a navigation.
|
|
4
|
-
Because this cookie would have been sent across schemes on the same site, it was not sent.
|
|
5
|
-
This behavior enhances the `SameSite` attribute’s protection of user data from request forgery by network attackers.
|
|
6
|
-
|
|
7
|
-
Resolve this issue by migrating your site (as defined by the eTLD+1) entirely to HTTPS.
|
|
8
|
-
It is also recommended to mark the cookie with the `Secure` attribute if that is not already the case.
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
# Migrate entirely to HTTPS to continue having cookies sent to same-site subresources
|
|
2
|
-
|
|
3
|
-
A cookie is being sent to {PLACEHOLDER_destination} origin from {PLACEHOLDER_origin} context.
|
|
4
|
-
Because this cookie is being sent across schemes on the same site, it will not be sent in a future version of Chrome.
|
|
5
|
-
This behavior enhances the `SameSite` attribute’s protection of user data from request forgery by network attackers.
|
|
6
|
-
|
|
7
|
-
Resolve this issue by migrating your site (as defined by the eTLD+1) entirely to HTTPS.
|
|
8
|
-
It is also recommended to mark the cookie with the `Secure` attribute if that is not already the case.
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
# Migrate entirely to HTTPS to continue allowing cookies to be set by same-site subresources
|
|
2
|
-
|
|
3
|
-
A cookie is being set by {PLACEHOLDER_origin} origin in {PLACEHOLDER_destination} context.
|
|
4
|
-
Because this cookie is being set across schemes on the same site, it will be blocked in a future version of Chrome.
|
|
5
|
-
This behavior enhances the `SameSite` attribute’s protection of user data from request forgery by network attackers.
|
|
6
|
-
|
|
7
|
-
Resolve this issue by migrating your site (as defined by the eTLD+1) entirely to HTTPS.
|
|
8
|
-
It is also recommended to mark the cookie with the `Secure` attribute if that is not already the case.
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
# Migrate entirely to HTTPS to continue having cookies sent on same-site requests
|
|
2
|
-
|
|
3
|
-
A cookie is being sent to {PLACEHOLDER_destination} origin from {PLACEHOLDER_origin} context on a navigation.
|
|
4
|
-
Because this cookie is being sent across schemes on the same site, it will not be sent in a future version of Chrome.
|
|
5
|
-
This behavior enhances the `SameSite` attribute’s protection of user data from request forgery by network attackers.
|
|
6
|
-
|
|
7
|
-
Resolve this issue by migrating your site (as defined by the eTLD+1) entirely to HTTPS.
|
|
8
|
-
It is also recommended to mark the cookie with the `Secure` attribute if that is not already the case.
|