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.
- package/README.md +26 -9
- package/build/src/HeapSnapshotManager.js +62 -23
- package/build/src/McpContext.js +64 -23
- package/build/src/McpPage.js +225 -11
- package/build/src/McpResponse.js +188 -280
- package/build/src/PageCollector.js +8 -3
- package/build/src/SlimMcpResponse.js +1 -1
- package/build/src/TextSnapshot.js +80 -19
- package/build/src/ToolHandler.js +19 -8
- package/build/src/WaitForHelper.js +142 -68
- package/build/src/bin/chrome-devtools-cli-options.js +38 -2
- package/build/src/bin/chrome-devtools-mcp-cli-options.js +1 -1
- package/build/src/bin/chrome-devtools-mcp-main.js +1 -1
- package/build/src/bin/chrome-devtools.js +19 -3
- package/build/src/daemon/client.js +22 -0
- package/build/src/daemon/daemon.js +15 -11
- package/build/src/daemon/utils.js +18 -3
- package/build/src/devtools/DevtoolsUtils.js +7 -2
- package/build/src/formatters/HeapSnapshotFormatter.js +48 -11
- package/build/src/index.js +2 -1
- package/build/src/telemetry/ClearcutLogger.js +3 -0
- package/build/src/telemetry/transformation.js +30 -0
- package/build/src/third_party/THIRD_PARTY_NOTICES +231 -52
- package/build/src/third_party/bundled-packages.json +3 -4
- 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 +28280 -9450
- 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 +1125 -1027
- package/build/src/tools/input.js +197 -105
- package/build/src/tools/memory.js +35 -4
- package/build/src/tools/network.js +1 -1
- package/build/src/tools/pages.js +1 -0
- package/build/src/tools/performance.js +60 -39
- package/build/src/tools/screenshot.js +152 -77
- package/build/src/tools/script.js +95 -31
- package/build/src/utils/polyfill.js +6 -3
- package/build/src/utils/url.js +43 -0
- package/build/src/version.js +1 -1
- package/package.json +20 -16
- package/skills/memory-leak-debugging/SKILL.md +12 -16
- package/skills/memory-leak-debugging/references/common-leaks.md +1 -1
- package/build/src/devtools/DevToolsConnectionAdapter.js +0 -70
- 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/Mutex.js +0 -38
- 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 { 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 (
|
|
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:
|
|
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
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
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
|
-
|
|
112
|
-
|
|
113
|
-
|
|
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
|
-
|
|
161
|
-
|
|
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 {
|
|
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
|
-
|
|
153
|
+
__disposeResources(env_1);
|
|
95
154
|
}
|
|
96
155
|
},
|
|
97
156
|
};
|
|
98
157
|
});
|
|
99
158
|
const performEvaluation = async (evaluatable, fnString, args, response, options) => {
|
|
100
|
-
const
|
|
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
|
-
|
|
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
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
|
|
7
|
-
|
|
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
|
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,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
|
-
"@
|
|
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",
|
|
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": "^
|
|
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.
|
|
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.
|
|
86
|
+
"yargs": "18.1.0"
|
|
86
87
|
},
|
|
87
88
|
"peerDependencies": {
|
|
88
|
-
"@
|
|
89
|
-
"@
|
|
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.
|
|
46
|
+
### 4. Advanced Analysis and Categorized Filters
|
|
46
47
|
|
|
47
|
-
|
|
48
|
+
Use built-in MCP memory tools and filters to pinpoint specific leak categories directly without external tools.
|
|
48
49
|
|
|
49
|
-
-
|
|
50
|
-
-
|
|
51
|
-
|
|
52
|
-
|
|
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
|
|
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
|
|