chrome-devtools-mcp 0.17.1 → 0.17.2
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 +4 -1
- package/package.json +3 -3
- package/build/src/DevToolsConnectionAdapter.js +0 -69
- package/build/src/DevtoolsUtils.js +0 -340
- package/build/src/McpContext.js +0 -603
- package/build/src/McpResponse.js +0 -490
- package/build/src/Mutex.js +0 -37
- package/build/src/PageCollector.js +0 -309
- package/build/src/WaitForHelper.js +0 -139
- package/build/src/browser.js +0 -182
- package/build/src/cli.js +0 -295
- package/build/src/formatters/ConsoleFormatter.js +0 -240
- package/build/src/formatters/IssueFormatter.js +0 -190
- package/build/src/formatters/NetworkFormatter.js +0 -226
- package/build/src/formatters/SnapshotFormatter.js +0 -134
- package/build/src/index.js +0 -21
- package/build/src/issue-descriptions.js +0 -39
- package/build/src/logger.js +0 -36
- package/build/src/main.js +0 -196
- package/build/src/polyfill.js +0 -7
- package/build/src/telemetry/ClearcutLogger.js +0 -102
- package/build/src/telemetry/WatchdogClient.js +0 -60
- package/build/src/telemetry/flagUtils.js +0 -45
- package/build/src/telemetry/metricUtils.js +0 -14
- package/build/src/telemetry/persistence.js +0 -53
- package/build/src/telemetry/types.js +0 -33
- package/build/src/telemetry/watchdog/ClearcutSender.js +0 -201
- package/build/src/telemetry/watchdog/main.js +0 -127
- package/build/src/third_party/THIRD_PARTY_NOTICES +0 -2011
- package/build/src/third_party/bundled-packages.json +0 -8
- package/build/src/third_party/devtools-formatter-worker.js +0 -15449
- package/build/src/third_party/index.js +0 -172791
- package/build/src/third_party/issue-descriptions/CoepCoopSandboxedIframeCannotNavigateToCoopPage.md +0 -4
- package/build/src/third_party/issue-descriptions/CoepCorpNotSameOrigin.md +0 -8
- package/build/src/third_party/issue-descriptions/CoepCorpNotSameOriginAfterDefaultedToSameOriginByCoep.md +0 -18
- package/build/src/third_party/issue-descriptions/CoepCorpNotSameSite.md +0 -7
- package/build/src/third_party/issue-descriptions/CoepFrameResourceNeedsCoepHeader.md +0 -10
- package/build/src/third_party/issue-descriptions/CompatibilityModeQuirks.md +0 -5
- package/build/src/third_party/issue-descriptions/CookieAttributeValueExceedsMaxSize.md +0 -5
- package/build/src/third_party/issue-descriptions/LowTextContrast.md +0 -5
- 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/SameSiteNoneInsecureErrorRead.md +0 -8
- package/build/src/third_party/issue-descriptions/SameSiteNoneInsecureErrorSet.md +0 -8
- package/build/src/third_party/issue-descriptions/SameSiteNoneInsecureWarnRead.md +0 -8
- package/build/src/third_party/issue-descriptions/SameSiteNoneInsecureWarnSet.md +0 -8
- package/build/src/third_party/issue-descriptions/SameSiteUnspecifiedLaxAllowUnsafeRead.md +0 -9
- package/build/src/third_party/issue-descriptions/SameSiteUnspecifiedLaxAllowUnsafeSet.md +0 -9
- 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/third_party/issue-descriptions/bounceTrackingMitigations.md +0 -3
- package/build/src/third_party/issue-descriptions/clientHintMetaTagAllowListInvalidOrigin.md +0 -4
- package/build/src/third_party/issue-descriptions/clientHintMetaTagModifiedHTML.md +0 -4
- package/build/src/third_party/issue-descriptions/connectionAllowlistInvalidAllowlistItemType.md +0 -12
- package/build/src/third_party/issue-descriptions/connectionAllowlistInvalidHeader.md +0 -12
- package/build/src/third_party/issue-descriptions/connectionAllowlistInvalidUrlPattern.md +0 -8
- package/build/src/third_party/issue-descriptions/connectionAllowlistItemNotInnerList.md +0 -12
- package/build/src/third_party/issue-descriptions/connectionAllowlistMoreThanOneList.md +0 -7
- package/build/src/third_party/issue-descriptions/connectionAllowlistReportingEndpointNotToken.md +0 -10
- package/build/src/third_party/issue-descriptions/cookieCrossSiteRedirectDowngrade.md +0 -12
- package/build/src/third_party/issue-descriptions/cookieExcludeBlockedWithinRelatedWebsiteSet.md +0 -4
- package/build/src/third_party/issue-descriptions/cookieExcludeDomainNonAscii.md +0 -11
- package/build/src/third_party/issue-descriptions/cookieExcludePortMismatch.md +0 -8
- package/build/src/third_party/issue-descriptions/cookieExcludeSchemeMismatch.md +0 -7
- package/build/src/third_party/issue-descriptions/cookieExcludeThirdPartyPhaseoutRead.md +0 -6
- package/build/src/third_party/issue-descriptions/cookieExcludeThirdPartyPhaseoutSet.md +0 -6
- package/build/src/third_party/issue-descriptions/cookieWarnDomainNonAscii.md +0 -11
- package/build/src/third_party/issue-descriptions/cookieWarnMetadataGrantRead.md +0 -4
- package/build/src/third_party/issue-descriptions/cookieWarnMetadataGrantSet.md +0 -4
- package/build/src/third_party/issue-descriptions/cookieWarnThirdPartyPhaseoutRead.md +0 -6
- package/build/src/third_party/issue-descriptions/cookieWarnThirdPartyPhaseoutSet.md +0 -6
- package/build/src/third_party/issue-descriptions/corsAllowCredentialsRequired.md +0 -6
- package/build/src/third_party/issue-descriptions/corsDisabledScheme.md +0 -7
- package/build/src/third_party/issue-descriptions/corsDisallowedByMode.md +0 -7
- package/build/src/third_party/issue-descriptions/corsHeaderDisallowedByPreflightResponse.md +0 -5
- package/build/src/third_party/issue-descriptions/corsInsecurePrivateNetwork.md +0 -10
- package/build/src/third_party/issue-descriptions/corsInvalidHeaderValues.md +0 -7
- package/build/src/third_party/issue-descriptions/corsLocalNetworkAccessPermissionDenied.md +0 -19
- package/build/src/third_party/issue-descriptions/corsMethodDisallowedByPreflightResponse.md +0 -5
- package/build/src/third_party/issue-descriptions/corsNoCorsRedirectModeNotFollow.md +0 -5
- package/build/src/third_party/issue-descriptions/corsOriginMismatch.md +0 -6
- package/build/src/third_party/issue-descriptions/corsPreflightAllowPrivateNetworkError.md +0 -10
- package/build/src/third_party/issue-descriptions/corsPreflightResponseInvalid.md +0 -5
- package/build/src/third_party/issue-descriptions/corsPrivateNetworkPermissionDenied.md +0 -10
- package/build/src/third_party/issue-descriptions/corsRedirectContainsCredentials.md +0 -5
- package/build/src/third_party/issue-descriptions/corsWildcardOriginNotAllowed.md +0 -8
- package/build/src/third_party/issue-descriptions/cspEvalViolation.md +0 -9
- package/build/src/third_party/issue-descriptions/cspInlineViolation.md +0 -10
- package/build/src/third_party/issue-descriptions/cspTrustedTypesPolicyViolation.md +0 -5
- package/build/src/third_party/issue-descriptions/cspTrustedTypesSinkViolation.md +0 -8
- package/build/src/third_party/issue-descriptions/cspURLViolation.md +0 -10
- package/build/src/third_party/issue-descriptions/deprecation.md +0 -3
- package/build/src/third_party/issue-descriptions/federatedAuthRequestAccountsHttpNotFound.md +0 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestAccountsInvalidResponse.md +0 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestAccountsNoResponse.md +0 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestApprovalDeclined.md +0 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestCanceled.md +0 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestErrorFetchingSignin.md +0 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestErrorIdToken.md +0 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestIdTokenHttpNotFound.md +0 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestIdTokenInvalidRequest.md +0 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestIdTokenInvalidResponse.md +0 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestIdTokenNoResponse.md +0 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestInvalidSigninResponse.md +0 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestManifestHttpNotFound.md +0 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestManifestInvalidResponse.md +0 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestManifestNoResponse.md +0 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestTooManyRequests.md +0 -1
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestInvalidAccountsResponse.md +0 -1
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestInvalidConfigOrWellKnown.md +0 -1
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNoAccountSharingPermission.md +0 -1
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNoApiPermission.md +0 -1
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNoReturningUserFromFetchedAccounts.md +0 -1
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotIframe.md +0 -1
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotPotentiallyTrustworthy.md +0 -1
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotSameOrigin.md +0 -1
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotSignedInWithIdp.md +0 -1
- package/build/src/third_party/issue-descriptions/fetchingPartitionedBlobURL.md +0 -7
- package/build/src/third_party/issue-descriptions/genericFormAriaLabelledByToNonExistingIdError.md +0 -8
- package/build/src/third_party/issue-descriptions/genericFormAutocompleteAttributeEmptyError.md +0 -5
- package/build/src/third_party/issue-descriptions/genericFormDuplicateIdForInputError.md +0 -5
- package/build/src/third_party/issue-descriptions/genericFormEmptyIdAndNameAttributesForInputError.md +0 -5
- package/build/src/third_party/issue-descriptions/genericFormInputAssignedAutocompleteValueToIdOrNameAttributeError.md +0 -5
- package/build/src/third_party/issue-descriptions/genericFormInputHasWrongButWellIntendedAutocompleteValueError.md +0 -5
- package/build/src/third_party/issue-descriptions/genericFormInputWithNoLabelError.md +0 -5
- package/build/src/third_party/issue-descriptions/genericFormLabelForMatchesNonExistingIdError.md +0 -5
- package/build/src/third_party/issue-descriptions/genericFormLabelForNameError.md +0 -5
- package/build/src/third_party/issue-descriptions/genericFormLabelHasNeitherForNorNestedInputError.md +0 -5
- package/build/src/third_party/issue-descriptions/genericNavigationEntryMarkedSkippable.md +0 -7
- package/build/src/third_party/issue-descriptions/genericResponseWasBlockedByORB.md +0 -4
- package/build/src/third_party/issue-descriptions/heavyAd.md +0 -10
- package/build/src/third_party/issue-descriptions/mixedContent.md +0 -5
- package/build/src/third_party/issue-descriptions/navigatingPartitionedBlobURL.md +0 -5
- package/build/src/third_party/issue-descriptions/permissionElementActivationDisabled.md +0 -7
- package/build/src/third_party/issue-descriptions/permissionElementActivationDisabledWithOccluder.md +0 -9
- package/build/src/third_party/issue-descriptions/permissionElementActivationDisabledWithOccluderParent.md +0 -9
- package/build/src/third_party/issue-descriptions/permissionElementCspFrameAncestorsMissing.md +0 -5
- package/build/src/third_party/issue-descriptions/permissionElementFencedFrameDisallowed.md +0 -5
- package/build/src/third_party/issue-descriptions/permissionElementFontSizeTooLarge.md +0 -5
- package/build/src/third_party/issue-descriptions/permissionElementFontSizeTooSmall.md +0 -5
- package/build/src/third_party/issue-descriptions/permissionElementGeolocationDeprecated.md +0 -5
- package/build/src/third_party/issue-descriptions/permissionElementInsetBoxShadowUnsupported.md +0 -5
- package/build/src/third_party/issue-descriptions/permissionElementInvalidDisplayStyle.md +0 -5
- package/build/src/third_party/issue-descriptions/permissionElementInvalidSizeValue.md +0 -5
- package/build/src/third_party/issue-descriptions/permissionElementInvalidType.md +0 -5
- package/build/src/third_party/issue-descriptions/permissionElementInvalidTypeActivation.md +0 -5
- package/build/src/third_party/issue-descriptions/permissionElementLowContrast.md +0 -5
- package/build/src/third_party/issue-descriptions/permissionElementNonOpaqueColor.md +0 -5
- package/build/src/third_party/issue-descriptions/permissionElementPaddingBottomUnsupported.md +0 -6
- package/build/src/third_party/issue-descriptions/permissionElementPaddingRightUnsupported.md +0 -6
- package/build/src/third_party/issue-descriptions/permissionElementPermissionsPolicyBlocked.md +0 -5
- package/build/src/third_party/issue-descriptions/permissionElementRegistrationFailed.md +0 -5
- package/build/src/third_party/issue-descriptions/permissionElementRequestInProgress.md +0 -5
- package/build/src/third_party/issue-descriptions/permissionElementSecurityChecksFailed.md +0 -5
- package/build/src/third_party/issue-descriptions/permissionElementTypeNotSupported.md +0 -5
- package/build/src/third_party/issue-descriptions/permissionElementUntrustedEvent.md +0 -7
- package/build/src/third_party/issue-descriptions/placeholderDescriptionForInvisibleIssues.md +0 -3
- package/build/src/third_party/issue-descriptions/propertyRuleInvalidNameIssue.md +0 -3
- package/build/src/third_party/issue-descriptions/propertyRuleIssue.md +0 -7
- package/build/src/third_party/issue-descriptions/selectElementAccessibilityDisallowedOptGroupChild.md +0 -7
- package/build/src/third_party/issue-descriptions/selectElementAccessibilityDisallowedSelectChild.md +0 -7
- package/build/src/third_party/issue-descriptions/selectElementAccessibilityInteractiveContentAttributesSelectDescendant.md +0 -3
- package/build/src/third_party/issue-descriptions/selectElementAccessibilityInteractiveContentLegendChild.md +0 -3
- package/build/src/third_party/issue-descriptions/selectElementAccessibilityInteractiveContentOptionChild.md +0 -3
- package/build/src/third_party/issue-descriptions/selectElementAccessibilityNonPhrasingContentOptionChild.md +0 -3
- package/build/src/third_party/issue-descriptions/sharedArrayBuffer.md +0 -7
- package/build/src/third_party/issue-descriptions/sharedDictionaryUseErrorCrossOriginNoCorsRequest.md +0 -1
- package/build/src/third_party/issue-descriptions/sharedDictionaryUseErrorDictionaryLoadFailure.md +0 -3
- package/build/src/third_party/issue-descriptions/sharedDictionaryUseErrorMatchingDictionaryNotUsed.md +0 -3
- package/build/src/third_party/issue-descriptions/sharedDictionaryUseErrorUnexpectedContentDictionaryHeader.md +0 -1
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorCossOriginNoCorsRequest.md +0 -1
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorDisallowedBySettings.md +0 -1
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorExpiredResponse.md +0 -3
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorFeatureDisabled.md +0 -3
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorInsufficientResources.md +0 -1
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorInvalidMatchField.md +0 -1
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorInvalidStructuredHeader.md +0 -1
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorInvalidTTLField.md +0 -1
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNavigationRequest.md +0 -3
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNoMatchField.md +0 -1
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonIntegerTTLField.md +0 -1
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonListMatchDestField.md +0 -1
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonSecureContext.md +0 -3
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonStringIdField.md +0 -1
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonStringInMatchDestList.md +0 -1
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonStringMatchField.md +0 -1
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonTokenTypeField.md +0 -1
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorRequestAborted.md +0 -1
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorShuttingDown.md +0 -1
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorTooLongIdField.md +0 -3
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorUnsupportedType.md +0 -3
- package/build/src/third_party/issue-descriptions/sriInvalidSignatureHeader.md +0 -14
- package/build/src/third_party/issue-descriptions/sriInvalidSignatureInputHeader.md +0 -15
- package/build/src/third_party/issue-descriptions/sriMissingSignatureHeader.md +0 -8
- package/build/src/third_party/issue-descriptions/sriMissingSignatureInputHeader.md +0 -7
- package/build/src/third_party/issue-descriptions/sriSignatureHeaderValueIsIncorrectLength.md +0 -11
- package/build/src/third_party/issue-descriptions/sriSignatureHeaderValueIsNotByteSequence.md +0 -14
- package/build/src/third_party/issue-descriptions/sriSignatureHeaderValueIsParameterized.md +0 -15
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidComponentName.md +0 -8
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidComponentType.md +0 -13
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidDerivedComponentParameter.md +0 -4
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidHeaderComponentParameter.md +0 -5
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidParameter.md +0 -11
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderKeyIdLength.md +0 -12
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderMissingLabel.md +0 -6
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderMissingRequiredParameters.md +0 -8
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderValueMissingComponents.md +0 -11
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderValueNotInnerList.md +0 -11
- package/build/src/third_party/issue-descriptions/sriValidationFailedIntegrityMismatch.md +0 -10
- package/build/src/third_party/issue-descriptions/sriValidationFailedInvalidLength.md +0 -5
- package/build/src/third_party/issue-descriptions/sriValidationFailedSignatureExpired.md +0 -6
- package/build/src/third_party/issue-descriptions/sriValidationFailedSignatureMismatch.md +0 -11
- package/build/src/third_party/issue-descriptions/stylesheetLateImport.md +0 -4
- package/build/src/third_party/issue-descriptions/stylesheetRequestFailed.md +0 -3
- package/build/src/third_party/issue-descriptions/summaryElementAccessibilityInteractiveContentSummaryDescendant.md +0 -3
- package/build/src/third_party/issue-descriptions/unencodedDigestIncorrectDigestLength.md +0 -12
- package/build/src/third_party/issue-descriptions/unencodedDigestIncorrectDigestType.md +0 -17
- package/build/src/third_party/issue-descriptions/unencodedDigestMalformedDictionary.md +0 -14
- package/build/src/third_party/issue-descriptions/unencodedDigestUnknownAlgorithm.md +0 -15
- package/build/src/tools/ToolDefinition.js +0 -20
- package/build/src/tools/categories.js +0 -24
- package/build/src/tools/console.js +0 -85
- package/build/src/tools/emulation.js +0 -169
- package/build/src/tools/extensions.js +0 -79
- package/build/src/tools/input.js +0 -343
- package/build/src/tools/network.js +0 -120
- package/build/src/tools/pages.js +0 -323
- package/build/src/tools/performance.js +0 -188
- package/build/src/tools/screenshot.js +0 -84
- package/build/src/tools/script.js +0 -71
- package/build/src/tools/snapshot.js +0 -52
- package/build/src/tools/tools.js +0 -31
- package/build/src/trace-processing/parse.js +0 -84
- package/build/src/utils/ExtensionRegistry.js +0 -35
- package/build/src/utils/keyboard.js +0 -296
- package/build/src/utils/pagination.js +0 -49
- package/build/src/utils/string.js +0 -36
- package/build/src/utils/types.js +0 -6
package/README.md
CHANGED
|
@@ -124,6 +124,9 @@ claude mcp add chrome-devtools --scope user npx chrome-devtools-mcp@latest
|
|
|
124
124
|
|
|
125
125
|
**Install as a Plugin (MCP + Skills)**
|
|
126
126
|
|
|
127
|
+
> [!NOTE]
|
|
128
|
+
> If you already had Chrome DevTools MCP installed previously for Claude Code, make sure to remove it first from your installation and configuration files.
|
|
129
|
+
|
|
127
130
|
To install Chrome DevTools MCP with skills, add the marketplace registry in Claude Code:
|
|
128
131
|
|
|
129
132
|
```sh
|
|
@@ -147,7 +150,7 @@ Restart Claude Code to have the MCP server and skills load (check with `/skills`
|
|
|
147
150
|
|
|
148
151
|
<details>
|
|
149
152
|
<summary>Codex</summary>
|
|
150
|
-
Follow the <a href="https://
|
|
153
|
+
Follow the <a href="https://developers.openai.com/codex/mcp/#configure-with-the-cli">configure MCP guide</a>
|
|
151
154
|
using the standard config from above. You can also install the Chrome DevTools MCP server using the Codex CLI:
|
|
152
155
|
|
|
153
156
|
```bash
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "chrome-devtools-mcp",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.2",
|
|
4
4
|
"description": "MCP server for Chrome DevTools",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": "./build/src/index.js",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"test:no-build": "node scripts/test.mjs",
|
|
21
21
|
"test:only": "npm run build && node scripts/test.mjs --test-only",
|
|
22
22
|
"test:update-snapshots": "npm run build && node scripts/test.mjs --test-update-snapshots",
|
|
23
|
-
"prepare": "node --experimental-strip-types scripts/prepare.ts",
|
|
23
|
+
"prepare": "npm run clean && node --experimental-strip-types scripts/prepare.ts",
|
|
24
24
|
"verify-server-json-version": "node --experimental-strip-types scripts/verify-server-json-version.ts",
|
|
25
25
|
"eval": "npm run build && CHROME_DEVTOOLS_MCP_NO_USAGE_STATISTICS=true node --experimental-strip-types scripts/eval_gemini.ts",
|
|
26
26
|
"count-tokens": "node --experimental-strip-types scripts/count_tokens.ts"
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"eslint-plugin-import": "^2.32.0",
|
|
63
63
|
"globals": "^17.0.0",
|
|
64
64
|
"prettier": "^3.6.2",
|
|
65
|
-
"puppeteer": "24.37.
|
|
65
|
+
"puppeteer": "24.37.4",
|
|
66
66
|
"rollup": "4.57.1",
|
|
67
67
|
"rollup-plugin-cleanup": "^3.2.1",
|
|
68
68
|
"rollup-plugin-license": "^3.6.0",
|
|
@@ -1,69 +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
|
-
}
|
|
@@ -1,340 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2025 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
import { PuppeteerDevToolsConnection } from './DevToolsConnectionAdapter.js';
|
|
7
|
-
import { Mutex } from './Mutex.js';
|
|
8
|
-
import { DevTools } from './third_party/index.js';
|
|
9
|
-
export function extractUrlLikeFromDevToolsTitle(title) {
|
|
10
|
-
const match = title.match(new RegExp(`DevTools - (.*)`));
|
|
11
|
-
return match?.[1] ?? undefined;
|
|
12
|
-
}
|
|
13
|
-
export function urlsEqual(url1, url2) {
|
|
14
|
-
const normalizedUrl1 = normalizeUrl(url1);
|
|
15
|
-
const normalizedUrl2 = normalizeUrl(url2);
|
|
16
|
-
return normalizedUrl1 === normalizedUrl2;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* For the sake of the MCP server, when we determine if two URLs are equal we
|
|
20
|
-
* remove some parts:
|
|
21
|
-
*
|
|
22
|
-
* 1. We do not care about the protocol.
|
|
23
|
-
* 2. We do not care about trailing slashes.
|
|
24
|
-
* 3. We do not care about "www".
|
|
25
|
-
* 4. We ignore the hash parts.
|
|
26
|
-
*
|
|
27
|
-
* For example, if the user types "record a trace on foo.com", we would want to
|
|
28
|
-
* match a tab in the connected Chrome instance that is showing "www.foo.com/"
|
|
29
|
-
*/
|
|
30
|
-
function normalizeUrl(url) {
|
|
31
|
-
let result = url.trim();
|
|
32
|
-
// Remove protocols
|
|
33
|
-
if (result.startsWith('https://')) {
|
|
34
|
-
result = result.slice(8);
|
|
35
|
-
}
|
|
36
|
-
else if (result.startsWith('http://')) {
|
|
37
|
-
result = result.slice(7);
|
|
38
|
-
}
|
|
39
|
-
// Remove 'www.'. This ensures that we find the right URL regardless of if the user adds `www` or not.
|
|
40
|
-
if (result.startsWith('www.')) {
|
|
41
|
-
result = result.slice(4);
|
|
42
|
-
}
|
|
43
|
-
// We use target URLs to locate DevTools but those often do
|
|
44
|
-
// no include hash.
|
|
45
|
-
const hashIdx = result.lastIndexOf('#');
|
|
46
|
-
if (hashIdx !== -1) {
|
|
47
|
-
result = result.slice(0, hashIdx);
|
|
48
|
-
}
|
|
49
|
-
// Remove trailing slash
|
|
50
|
-
if (result.endsWith('/')) {
|
|
51
|
-
result = result.slice(0, -1);
|
|
52
|
-
}
|
|
53
|
-
return result;
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* A mock implementation of an issues manager that only implements the methods
|
|
57
|
-
* that are actually used by the IssuesAggregator
|
|
58
|
-
*/
|
|
59
|
-
export class FakeIssuesManager extends DevTools.Common.ObjectWrapper
|
|
60
|
-
.ObjectWrapper {
|
|
61
|
-
issues() {
|
|
62
|
-
return [];
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
// DevTools CDP errors can get noisy.
|
|
66
|
-
DevTools.ProtocolClient.InspectorBackend.test.suppressRequestErrors = true;
|
|
67
|
-
DevTools.I18n.DevToolsLocale.DevToolsLocale.instance({
|
|
68
|
-
create: true,
|
|
69
|
-
data: {
|
|
70
|
-
navigatorLanguage: 'en-US',
|
|
71
|
-
settingLanguage: 'en-US',
|
|
72
|
-
lookupClosestDevToolsLocale: l => l,
|
|
73
|
-
},
|
|
74
|
-
});
|
|
75
|
-
DevTools.I18n.i18n.registerLocaleDataForTest('en-US', {});
|
|
76
|
-
DevTools.Formatter.FormatterWorkerPool.FormatterWorkerPool.instance({
|
|
77
|
-
forceNew: true,
|
|
78
|
-
entrypointURL: import.meta
|
|
79
|
-
.resolve('./third_party/devtools-formatter-worker.js'),
|
|
80
|
-
});
|
|
81
|
-
export class UniverseManager {
|
|
82
|
-
#browser;
|
|
83
|
-
#createUniverseFor;
|
|
84
|
-
#universes = new WeakMap();
|
|
85
|
-
/** Guard access to #universes so we don't create unnecessary universes */
|
|
86
|
-
#mutex = new Mutex();
|
|
87
|
-
constructor(browser, factory = DEFAULT_FACTORY) {
|
|
88
|
-
this.#browser = browser;
|
|
89
|
-
this.#createUniverseFor = factory;
|
|
90
|
-
}
|
|
91
|
-
async init(pages) {
|
|
92
|
-
try {
|
|
93
|
-
await this.#mutex.acquire();
|
|
94
|
-
const promises = [];
|
|
95
|
-
for (const page of pages) {
|
|
96
|
-
promises.push(this.#createUniverseFor(page).then(targetUniverse => this.#universes.set(page, targetUniverse)));
|
|
97
|
-
}
|
|
98
|
-
this.#browser.on('targetcreated', this.#onTargetCreated);
|
|
99
|
-
this.#browser.on('targetdestroyed', this.#onTargetDestroyed);
|
|
100
|
-
await Promise.all(promises);
|
|
101
|
-
}
|
|
102
|
-
finally {
|
|
103
|
-
this.#mutex.release();
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
get(page) {
|
|
107
|
-
return this.#universes.get(page) ?? null;
|
|
108
|
-
}
|
|
109
|
-
dispose() {
|
|
110
|
-
this.#browser.off('targetcreated', this.#onTargetCreated);
|
|
111
|
-
this.#browser.off('targetdestroyed', this.#onTargetDestroyed);
|
|
112
|
-
}
|
|
113
|
-
#onTargetCreated = async (target) => {
|
|
114
|
-
const page = await target.page();
|
|
115
|
-
try {
|
|
116
|
-
await this.#mutex.acquire();
|
|
117
|
-
if (!page || this.#universes.has(page)) {
|
|
118
|
-
return;
|
|
119
|
-
}
|
|
120
|
-
this.#universes.set(page, await this.#createUniverseFor(page));
|
|
121
|
-
}
|
|
122
|
-
finally {
|
|
123
|
-
this.#mutex.release();
|
|
124
|
-
}
|
|
125
|
-
};
|
|
126
|
-
#onTargetDestroyed = async (target) => {
|
|
127
|
-
const page = await target.page();
|
|
128
|
-
try {
|
|
129
|
-
await this.#mutex.acquire();
|
|
130
|
-
if (!page || !this.#universes.has(page)) {
|
|
131
|
-
return;
|
|
132
|
-
}
|
|
133
|
-
this.#universes.delete(page);
|
|
134
|
-
}
|
|
135
|
-
finally {
|
|
136
|
-
this.#mutex.release();
|
|
137
|
-
}
|
|
138
|
-
};
|
|
139
|
-
}
|
|
140
|
-
const DEFAULT_FACTORY = async (page) => {
|
|
141
|
-
const settingStorage = new DevTools.Common.Settings.SettingsStorage({});
|
|
142
|
-
const universe = new DevTools.Foundation.Universe.Universe({
|
|
143
|
-
settingsCreationOptions: {
|
|
144
|
-
syncedStorage: settingStorage,
|
|
145
|
-
globalStorage: settingStorage,
|
|
146
|
-
localStorage: settingStorage,
|
|
147
|
-
settingRegistrations: DevTools.Common.SettingRegistration.getRegisteredSettings(),
|
|
148
|
-
},
|
|
149
|
-
overrideAutoStartModels: new Set([DevTools.DebuggerModel]),
|
|
150
|
-
});
|
|
151
|
-
const session = await page.createCDPSession();
|
|
152
|
-
const connection = new PuppeteerDevToolsConnection(session);
|
|
153
|
-
const targetManager = universe.context.get(DevTools.TargetManager);
|
|
154
|
-
targetManager.observeModels(DevTools.DebuggerModel, SKIP_ALL_PAUSES);
|
|
155
|
-
const target = targetManager.createTarget('main', '', 'frame', // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
156
|
-
/* parentTarget */ null, session.id(), undefined, connection);
|
|
157
|
-
return { target, universe };
|
|
158
|
-
};
|
|
159
|
-
// We don't want to pause any DevTools universe session ever on the MCP side.
|
|
160
|
-
//
|
|
161
|
-
// Note that calling `setSkipAllPauses` only affects the session on which it was
|
|
162
|
-
// sent. This means DevTools can still pause, step and do whatever. We just won't
|
|
163
|
-
// see the `Debugger.paused`/`Debugger.resumed` events on the MCP side.
|
|
164
|
-
const SKIP_ALL_PAUSES = {
|
|
165
|
-
modelAdded(model) {
|
|
166
|
-
void model.agent.invoke_setSkipAllPauses({ skip: true });
|
|
167
|
-
},
|
|
168
|
-
modelRemoved() {
|
|
169
|
-
// Do nothing.
|
|
170
|
-
},
|
|
171
|
-
};
|
|
172
|
-
/**
|
|
173
|
-
* Constructed from Runtime.ExceptionDetails of an uncaught error.
|
|
174
|
-
*
|
|
175
|
-
* TODO: Also construct from a RemoteObject of subtype 'error'.
|
|
176
|
-
*
|
|
177
|
-
* Consists of the message, a fully resolved stack trace and a fully resolved 'cause' chain.
|
|
178
|
-
*/
|
|
179
|
-
export class SymbolizedError {
|
|
180
|
-
message;
|
|
181
|
-
stackTrace;
|
|
182
|
-
cause;
|
|
183
|
-
constructor(message, stackTrace, cause) {
|
|
184
|
-
this.message = message;
|
|
185
|
-
this.stackTrace = stackTrace;
|
|
186
|
-
this.cause = cause;
|
|
187
|
-
}
|
|
188
|
-
static async fromDetails(opts) {
|
|
189
|
-
const message = SymbolizedError.#getMessage(opts.details);
|
|
190
|
-
if (!opts.includeStackAndCause || !opts.devTools) {
|
|
191
|
-
return new SymbolizedError(message, opts.resolvedStackTraceForTesting, opts.resolvedCauseForTesting);
|
|
192
|
-
}
|
|
193
|
-
let stackTrace;
|
|
194
|
-
if (opts.resolvedStackTraceForTesting) {
|
|
195
|
-
stackTrace = opts.resolvedStackTraceForTesting;
|
|
196
|
-
}
|
|
197
|
-
else if (opts.details.stackTrace) {
|
|
198
|
-
try {
|
|
199
|
-
stackTrace = await createStackTrace(opts.devTools, opts.details.stackTrace, opts.targetId);
|
|
200
|
-
}
|
|
201
|
-
catch {
|
|
202
|
-
// ignore
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
// TODO: Turn opts.details.exception into a JSHandle and retrieve the 'cause' property.
|
|
206
|
-
// If its an Error, recursively create a SymbolizedError.
|
|
207
|
-
let cause;
|
|
208
|
-
if (opts.resolvedCauseForTesting) {
|
|
209
|
-
cause = opts.resolvedCauseForTesting;
|
|
210
|
-
}
|
|
211
|
-
else if (opts.details.exception) {
|
|
212
|
-
try {
|
|
213
|
-
const causeRemoteObj = await SymbolizedError.#lookupCause(opts.devTools, opts.details.exception, opts.targetId);
|
|
214
|
-
if (causeRemoteObj) {
|
|
215
|
-
cause = await SymbolizedError.fromError({
|
|
216
|
-
devTools: opts.devTools,
|
|
217
|
-
error: causeRemoteObj,
|
|
218
|
-
targetId: opts.targetId,
|
|
219
|
-
});
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
catch {
|
|
223
|
-
// Ignore
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
return new SymbolizedError(message, stackTrace, cause);
|
|
227
|
-
}
|
|
228
|
-
static async fromError(opts) {
|
|
229
|
-
const details = await SymbolizedError.#getExceptionDetails(opts.devTools, opts.error, opts.targetId);
|
|
230
|
-
if (details) {
|
|
231
|
-
return SymbolizedError.fromDetails({
|
|
232
|
-
details,
|
|
233
|
-
devTools: opts.devTools,
|
|
234
|
-
targetId: opts.targetId,
|
|
235
|
-
includeStackAndCause: true,
|
|
236
|
-
});
|
|
237
|
-
}
|
|
238
|
-
return new SymbolizedError(SymbolizedError.#getMessageFromException(opts.error));
|
|
239
|
-
}
|
|
240
|
-
static #getMessage(details) {
|
|
241
|
-
// For Runtime.exceptionThrown with a present exception object, `details.text` will be "Uncaught" and
|
|
242
|
-
// we have to manually parse out the error text from the exception description.
|
|
243
|
-
// In the case of Runtime.getExceptionDetails, `details.text` has the Error.message.
|
|
244
|
-
if (details.text === 'Uncaught' && details.exception) {
|
|
245
|
-
return ('Uncaught ' +
|
|
246
|
-
SymbolizedError.#getMessageFromException(details.exception));
|
|
247
|
-
}
|
|
248
|
-
return details.text;
|
|
249
|
-
}
|
|
250
|
-
static #getMessageFromException(error) {
|
|
251
|
-
const messageWithRest = error.description?.split('\n at ', 2) ?? [];
|
|
252
|
-
return messageWithRest[0] ?? '';
|
|
253
|
-
}
|
|
254
|
-
static async #getExceptionDetails(devTools, error, targetId) {
|
|
255
|
-
if (!devTools || (error.type !== 'object' && error.subtype !== 'error')) {
|
|
256
|
-
return null;
|
|
257
|
-
}
|
|
258
|
-
const targetManager = devTools.universe.context.get(DevTools.TargetManager);
|
|
259
|
-
const target = targetId
|
|
260
|
-
? targetManager.targetById(targetId) || devTools.target
|
|
261
|
-
: devTools.target;
|
|
262
|
-
const model = target.model(DevTools.RuntimeModel);
|
|
263
|
-
return ((await model.getExceptionDetails(error.objectId)) ?? null);
|
|
264
|
-
}
|
|
265
|
-
static async #lookupCause(devTools, error, targetId) {
|
|
266
|
-
if (!devTools || (error.type !== 'object' && error.subtype !== 'error')) {
|
|
267
|
-
return null;
|
|
268
|
-
}
|
|
269
|
-
const targetManager = devTools.universe.context.get(DevTools.TargetManager);
|
|
270
|
-
const target = targetId
|
|
271
|
-
? targetManager.targetById(targetId) || devTools.target
|
|
272
|
-
: devTools.target;
|
|
273
|
-
const properties = await target.runtimeAgent().invoke_getProperties({
|
|
274
|
-
objectId: error.objectId,
|
|
275
|
-
});
|
|
276
|
-
if (properties.getError()) {
|
|
277
|
-
return null;
|
|
278
|
-
}
|
|
279
|
-
return properties.result.find(prop => prop.name === 'cause')?.value ?? null;
|
|
280
|
-
}
|
|
281
|
-
static createForTesting(message, stackTrace, cause) {
|
|
282
|
-
return new SymbolizedError(message, stackTrace, cause);
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
export async function createStackTraceForConsoleMessage(devTools, consoleMessage) {
|
|
286
|
-
const message = consoleMessage;
|
|
287
|
-
const rawStackTrace = message._rawStackTrace();
|
|
288
|
-
if (rawStackTrace) {
|
|
289
|
-
return createStackTrace(devTools, rawStackTrace, message._targetId());
|
|
290
|
-
}
|
|
291
|
-
return undefined;
|
|
292
|
-
}
|
|
293
|
-
export async function createStackTrace(devTools, rawStackTrace, targetId) {
|
|
294
|
-
const targetManager = devTools.universe.context.get(DevTools.TargetManager);
|
|
295
|
-
const target = targetId
|
|
296
|
-
? targetManager.targetById(targetId) || devTools.target
|
|
297
|
-
: devTools.target;
|
|
298
|
-
const model = target.model(DevTools.DebuggerModel);
|
|
299
|
-
// DevTools doesn't wait for source maps to attach before building a stack trace, rather it'll send
|
|
300
|
-
// an update event once a source map was attached and the stack trace retranslated. This doesn't
|
|
301
|
-
// work in the MCP case, so we'll collect all script IDs upfront and wait for any pending source map
|
|
302
|
-
// loads before creating the stack trace. We might also have to wait for Debugger.ScriptParsed events if
|
|
303
|
-
// the stack trace is created particularly early.
|
|
304
|
-
const scriptIds = new Set();
|
|
305
|
-
for (const frame of rawStackTrace.callFrames) {
|
|
306
|
-
scriptIds.add(frame.scriptId);
|
|
307
|
-
}
|
|
308
|
-
for (let asyncStack = rawStackTrace.parent; asyncStack; asyncStack = asyncStack.parent) {
|
|
309
|
-
for (const frame of asyncStack.callFrames) {
|
|
310
|
-
scriptIds.add(frame.scriptId);
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
const signal = AbortSignal.timeout(1_000);
|
|
314
|
-
await Promise.all([...scriptIds].map(id => waitForScript(model, id, signal)
|
|
315
|
-
.then(script => model.sourceMapManager().sourceMapForClientPromise(script))
|
|
316
|
-
.catch()));
|
|
317
|
-
const binding = devTools.universe.context.get(DevTools.DebuggerWorkspaceBinding);
|
|
318
|
-
// DevTools uses branded types for ScriptId and others. Casting the puppeteer protocol type to the DevTools protocol type is safe.
|
|
319
|
-
return binding.createStackTraceFromProtocolRuntime(rawStackTrace, target);
|
|
320
|
-
}
|
|
321
|
-
// Waits indefinitely for the script so pair it with Promise.race.
|
|
322
|
-
async function waitForScript(model, scriptId, signal) {
|
|
323
|
-
while (true) {
|
|
324
|
-
if (signal.aborted) {
|
|
325
|
-
throw signal.reason;
|
|
326
|
-
}
|
|
327
|
-
const script = model.scriptForId(scriptId);
|
|
328
|
-
if (script) {
|
|
329
|
-
return script;
|
|
330
|
-
}
|
|
331
|
-
await new Promise((resolve, reject) => {
|
|
332
|
-
signal.addEventListener('abort', () => reject(signal.reason), {
|
|
333
|
-
once: true,
|
|
334
|
-
});
|
|
335
|
-
void model
|
|
336
|
-
.once('ParsedScriptSource')
|
|
337
|
-
.then(resolve);
|
|
338
|
-
});
|
|
339
|
-
}
|
|
340
|
-
}
|