@chenpx976/chrome-devtools-mcp 0.0.0-stage → 1.13.1
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/LICENSE +202 -0
- package/README.md +223 -2
- package/out/Default/gen/src/ArcBrowser.js +128 -0
- package/out/Default/gen/src/BrowserManager.js +562 -0
- package/out/Default/gen/src/LogpointManager.js +287 -0
- package/out/Default/gen/src/McpContext.js +1031 -0
- package/out/Default/gen/src/McpPage.js +1427 -0
- package/out/Default/gen/src/McpResponse.js +1350 -0
- package/out/Default/gen/src/McpWorker.js +66 -0
- package/out/Default/gen/src/NetworkOverrideManager.js +447 -0
- package/out/Default/gen/src/SlimMcpResponse.js +23 -0
- package/out/Default/gen/src/TextSnapshot.js +336 -0
- package/out/Default/gen/src/ToolHandler.js +531 -0
- package/out/Default/gen/src/bin/check-latest-version.js +53 -0
- package/out/Default/gen/src/bin/chrome-devtools-mcp-main.js +80 -0
- package/out/Default/gen/src/bin/chrome-devtools-mcp.js +23 -0
- package/out/Default/gen/src/bin/chrome-devtools.js +213 -0
- package/out/Default/gen/src/collectors/PageCollector.js +325 -0
- package/out/Default/gen/src/collectors/ServiceWorkerCollector.js +198 -0
- package/out/Default/gen/src/collectors/constants.js +7 -0
- package/out/Default/gen/src/config/ConfigLocator.js +70 -0
- package/out/Default/gen/src/config/ConfigParser.js +163 -0
- package/out/Default/gen/src/config/ConfigWatcher.js +94 -0
- package/out/Default/gen/src/config/ServerConfig.js +284 -0
- package/out/Default/gen/src/config/browser-options.js +135 -0
- package/out/Default/gen/src/config/category-options.js +84 -0
- package/out/Default/gen/src/config/cli-commands.js +208 -0
- package/out/Default/gen/src/config/cli-options.js +2090 -0
- package/out/Default/gen/src/config/mcp-options.js +371 -0
- package/out/Default/gen/src/config/puppeteer-options.js +69 -0
- package/out/Default/gen/src/config/tool-options.js +60 -0
- package/out/Default/gen/src/daemon/client.js +281 -0
- package/out/Default/gen/src/daemon/daemon.js +280 -0
- package/out/Default/gen/src/daemon/types.js +7 -0
- package/out/Default/gen/src/daemon/utils.js +173 -0
- package/out/Default/gen/src/devtools/DevToolsCommentBridge.js +151 -0
- package/out/Default/gen/src/devtools/DevtoolsUtils.js +413 -0
- package/out/Default/gen/src/devtools/McpHostBindingAdapter.js +164 -0
- package/out/Default/gen/src/devtools/issueDescriptions.js +42 -0
- package/out/Default/gen/src/formatters/CommentFormatter.js +73 -0
- package/out/Default/gen/src/formatters/ConsoleFormatter.js +363 -0
- package/out/Default/gen/src/formatters/CssFormatter.js +883 -0
- package/out/Default/gen/src/formatters/HeapSnapshotFormatter.js +239 -0
- package/out/Default/gen/src/formatters/IssueFormatter.js +194 -0
- package/out/Default/gen/src/formatters/LogpointFormatter.js +62 -0
- package/out/Default/gen/src/formatters/NetworkFormatter.js +295 -0
- package/out/Default/gen/src/formatters/NetworkOverridesFormatter.js +57 -0
- package/out/Default/gen/src/formatters/RemoteObjectFormatter.js +231 -0
- package/out/Default/gen/src/formatters/SnapshotFormatter.js +172 -0
- package/out/Default/gen/src/formatters/WebAuthnFormatter.js +56 -0
- package/out/Default/gen/src/formatters/constants.js +8 -0
- package/out/Default/gen/src/index.js +434 -0
- package/out/Default/gen/src/processors/ChunkedTraceParser.js +361 -0
- package/out/Default/gen/src/processors/HeapSnapshotManager.js +595 -0
- package/out/Default/gen/src/processors/PerformanceTrace.js +132 -0
- package/out/Default/gen/src/telemetry/ClearcutLogger.js +271 -0
- package/out/Default/gen/src/telemetry/WatchdogClient.js +60 -0
- package/out/Default/gen/src/telemetry/errors.js +18 -0
- package/out/Default/gen/src/telemetry/flagUtils.js +89 -0
- package/out/Default/gen/src/telemetry/metricsRegistry.js +85 -0
- package/out/Default/gen/src/telemetry/persistence.js +82 -0
- package/out/Default/gen/src/telemetry/transformation.js +229 -0
- package/out/Default/gen/src/telemetry/types.js +36 -0
- package/out/Default/gen/src/telemetry/watchdog/ClearcutSender.js +213 -0
- package/out/Default/gen/src/telemetry/watchdog/main.js +142 -0
- package/out/Default/gen/src/third_party/THIRD_PARTY_NOTICES +3774 -0
- package/out/Default/gen/src/third_party/browser.js +808 -0
- package/out/Default/gen/src/third_party/bundled-packages.json +11 -0
- package/out/Default/gen/src/third_party/cli.js +139 -0
- package/out/Default/gen/src/third_party/devtools-formatter-worker.js +125 -0
- package/out/Default/gen/src/third_party/devtools-heap-snapshot-worker.js +111 -0
- package/out/Default/gen/src/third_party/index.js +128 -0
- package/out/Default/gen/src/third_party/issue-descriptions/CoepCoopSandboxedIframeCannotNavigateToCoopPage.md +4 -0
- package/out/Default/gen/src/third_party/issue-descriptions/CoepCorpNotSameOrigin.md +8 -0
- package/out/Default/gen/src/third_party/issue-descriptions/CoepCorpNotSameOriginAfterDefaultedToSameOriginByCoep.md +18 -0
- package/out/Default/gen/src/third_party/issue-descriptions/CoepCorpNotSameSite.md +7 -0
- package/out/Default/gen/src/third_party/issue-descriptions/CoepFrameResourceNeedsCoepHeader.md +10 -0
- package/out/Default/gen/src/third_party/issue-descriptions/CompatibilityModeQuirks.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/CookieAttributeValueExceedsMaxSize.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/LowTextContrast.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/SameSiteNoneInsecureErrorRead.md +8 -0
- package/out/Default/gen/src/third_party/issue-descriptions/SameSiteNoneInsecureErrorSet.md +8 -0
- package/out/Default/gen/src/third_party/issue-descriptions/SameSiteNoneInsecureWarnRead.md +8 -0
- package/out/Default/gen/src/third_party/issue-descriptions/SameSiteNoneInsecureWarnSet.md +8 -0
- package/out/Default/gen/src/third_party/issue-descriptions/SameSiteUnspecifiedLaxAllowUnsafeRead.md +9 -0
- package/out/Default/gen/src/third_party/issue-descriptions/SameSiteUnspecifiedLaxAllowUnsafeSet.md +9 -0
- package/out/Default/gen/src/third_party/issue-descriptions/bounceTrackingMitigations.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/clientHintMetaTagAllowListInvalidOrigin.md +4 -0
- package/out/Default/gen/src/third_party/issue-descriptions/clientHintMetaTagModifiedHTML.md +4 -0
- package/out/Default/gen/src/third_party/issue-descriptions/connectionAllowlistEmbeddingRequirementNotSatisfied.md +26 -0
- package/out/Default/gen/src/third_party/issue-descriptions/connectionAllowlistIFrameAttributeLoosensEmbeddingRequirement.md +19 -0
- package/out/Default/gen/src/third_party/issue-descriptions/connectionAllowlistInvalidAllowConnectionAllowlistFrom.md +21 -0
- package/out/Default/gen/src/third_party/issue-descriptions/connectionAllowlistInvalidAllowlistItemType.md +12 -0
- package/out/Default/gen/src/third_party/issue-descriptions/connectionAllowlistInvalidHeader.md +12 -0
- package/out/Default/gen/src/third_party/issue-descriptions/connectionAllowlistInvalidUrlPattern.md +8 -0
- package/out/Default/gen/src/third_party/issue-descriptions/connectionAllowlistItemNotInnerList.md +12 -0
- package/out/Default/gen/src/third_party/issue-descriptions/connectionAllowlistMoreThanOneList.md +7 -0
- package/out/Default/gen/src/third_party/issue-descriptions/connectionAllowlistReportingEndpointNotToken.md +10 -0
- package/out/Default/gen/src/third_party/issue-descriptions/cookieCrossSiteRedirectDowngrade.md +12 -0
- package/out/Default/gen/src/third_party/issue-descriptions/cookieExcludeDomainNonAscii.md +11 -0
- package/out/Default/gen/src/third_party/issue-descriptions/cookieExcludePortMismatch.md +8 -0
- package/out/Default/gen/src/third_party/issue-descriptions/cookieExcludeSchemeMismatch.md +7 -0
- package/out/Default/gen/src/third_party/issue-descriptions/cookieExcludeThirdPartyPhaseoutRead.md +6 -0
- package/out/Default/gen/src/third_party/issue-descriptions/cookieExcludeThirdPartyPhaseoutSet.md +6 -0
- package/out/Default/gen/src/third_party/issue-descriptions/cookieWarnDomainNonAscii.md +11 -0
- package/out/Default/gen/src/third_party/issue-descriptions/cookieWarnMetadataGrantRead.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/cookieWarnMetadataGrantReadOptOut.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/cookieWarnMetadataGrantSet.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/cookieWarnMetadataGrantSetOptOut.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/cookieWarnThirdPartyPhaseoutRead.md +6 -0
- package/out/Default/gen/src/third_party/issue-descriptions/cookieWarnThirdPartyPhaseoutSet.md +6 -0
- package/out/Default/gen/src/third_party/issue-descriptions/corsAllowCredentialsRequired.md +6 -0
- package/out/Default/gen/src/third_party/issue-descriptions/corsDisabledScheme.md +7 -0
- package/out/Default/gen/src/third_party/issue-descriptions/corsDisallowedByMode.md +7 -0
- package/out/Default/gen/src/third_party/issue-descriptions/corsHeaderDisallowedByPreflightResponse.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/corsInvalidHeaderValues.md +7 -0
- package/out/Default/gen/src/third_party/issue-descriptions/corsLocalNetworkAccessPermissionDenied.md +19 -0
- package/out/Default/gen/src/third_party/issue-descriptions/corsMethodDisallowedByPreflightResponse.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/corsNoCorsRedirectModeNotFollow.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/corsOriginMismatch.md +6 -0
- package/out/Default/gen/src/third_party/issue-descriptions/corsPreflightResponseInvalid.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/corsRedirectContainsCredentials.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/corsWildcardOriginNotAllowed.md +9 -0
- package/out/Default/gen/src/third_party/issue-descriptions/cspEvalViolation.md +9 -0
- package/out/Default/gen/src/third_party/issue-descriptions/cspInlineViolation.md +10 -0
- package/out/Default/gen/src/third_party/issue-descriptions/cspTrustedTypesPolicyViolation.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/cspTrustedTypesSinkViolation.md +8 -0
- package/out/Default/gen/src/third_party/issue-descriptions/cspURLViolation.md +10 -0
- package/out/Default/gen/src/third_party/issue-descriptions/deprecation.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestAccountsEmptyList.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestAccountsHttpNotFound.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestAccountsInvalidContentType.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestAccountsInvalidResponse.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestAccountsNoResponse.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestDnsFetchFailed.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestDnsInvalidRecord.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestEmailVerificationWellKnownHttpNotFound.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestEmailVerificationWellKnownInvalidContentType.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestEmailVerificationWellKnownInvalidResponse.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestEmailVerificationWellKnownNoResponse.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestInvalidEmail.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestJwksHttpNotFound.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestJwksInvalidResponse.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestKeyBindingSigningFailed.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestRpOriginIsOpaque.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenHttpNotFound.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenInvalidContentType.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenInvalidResponse.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenInvalidSdJwt.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenMalformedSdJwt.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenNoResponse.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidAudience.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidIssuedAt.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidNonce.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidSdHash.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidTyp.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingAud.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingCnf.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingIat.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingNonce.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingSdHash.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbSignatureFailed.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidEmail.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidEmailVerified.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidHolderKey.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidIssuedAt.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidIssuer.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtJwksMissingKeys.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtMissingCnf.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtMissingEmail.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtMissingIat.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtMissingIss.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtSignatureFailed.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtUnsupportedHeaderAlg.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestUserLoggedOut.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestWellKnownAccountsEndpointCrossOrigin.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestWellKnownHttpNotFound.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestWellKnownInvalidContentType.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestWellKnownInvalidResponse.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestWellKnownIssuanceEndpointCrossOrigin.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestWellKnownListEmpty.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestWellKnownMissingAccountsEndpoint.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestWellKnownMissingIssuanceEndpoint.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestWellKnownNoResponse.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/emailVerificationRequestWellKnownUnsupportedSigningAlgorithm.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestAccountsBlockedByConnectionAllowlist.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestAccountsHttpNotFound.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestAccountsInvalidResponse.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestAccountsNoResponse.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestApprovalDeclined.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestCanceled.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestConfigBlockedByConnectionAllowlist.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestErrorFetchingSignin.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestErrorIdToken.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestIdTokenBlockedByConnectionAllowlist.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestIdTokenHttpNotFound.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestIdTokenInvalidRequest.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestIdTokenInvalidResponse.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestIdTokenNoResponse.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestInvalidSigninResponse.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestManifestHttpNotFound.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestManifestInvalidResponse.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestManifestNoResponse.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestTooManyRequests.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthRequestWellKnownBlockedByConnectionAllowlist.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthUserInfoRequestInvalidAccountsResponse.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthUserInfoRequestInvalidConfigOrWellKnown.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNoAccountSharingPermission.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNoApiPermission.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNoReturningUserFromFetchedAccounts.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotIframe.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotPotentiallyTrustworthy.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotSameOrigin.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotSignedInWithIdp.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/fetchingPartitionedBlobURL.md +7 -0
- package/out/Default/gen/src/third_party/issue-descriptions/genericBackUINavigationWouldSkipAd.md +4 -0
- package/out/Default/gen/src/third_party/issue-descriptions/genericFormAriaLabelledByToNonExistingIdError.md +8 -0
- package/out/Default/gen/src/third_party/issue-descriptions/genericFormAutocompleteAttributeEmptyError.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/genericFormDuplicateIdForInputError.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/genericFormEmptyIdAndNameAttributesForInputError.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/genericFormInputAssignedAutocompleteValueToIdOrNameAttributeError.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/genericFormInputHasWrongButWellIntendedAutocompleteValueError.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/genericFormInputWithNoLabelError.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/genericFormLabelForMatchesNonExistingIdError.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/genericFormLabelForNameError.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/genericFormLabelHasNeitherForNorNestedInputError.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/genericFormModelContextMissingToolDescription.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/genericFormModelContextMissingToolName.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/genericFormModelContextParameterMissingName.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/genericFormModelContextParameterMissingTitleAndDescription.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/genericFormModelContextRequiredParameterMissingName.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/genericGeolocationPromptWithoutUserGesture.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/genericNavigationEntryMarkedSkippable.md +7 -0
- package/out/Default/gen/src/third_party/issue-descriptions/genericResponseWasBlockedByORB.md +4 -0
- package/out/Default/gen/src/third_party/issue-descriptions/heavyAd.md +10 -0
- package/out/Default/gen/src/third_party/issue-descriptions/lazyLoadImageZeroSize.md +7 -0
- package/out/Default/gen/src/third_party/issue-descriptions/mixedContent.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/navigatingPartitionedBlobURL.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementActivationDisabled.md +7 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementActivationDisabledWithOccluder.md +9 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementActivationDisabledWithOccluderParent.md +9 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementCspFrameAncestorsMissing.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementFencedFrameDisallowed.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementFontSizeTooLarge.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementFontSizeTooSmall.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementGeolocationDeprecated.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementInsetBoxShadowUnsupported.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementInvalidDisplayStyle.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementInvalidSizeValue.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementInvalidType.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementInvalidTypeActivation.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementLowContrast.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementNonOpaqueColor.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementPaddingBottomUnsupported.md +6 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementPaddingRightUnsupported.md +6 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementPermissionsPolicyBlocked.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementRegistrationFailed.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementRequestInProgress.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementSecurityChecksFailed.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementTypeNotSupported.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/permissionElementUntrustedEvent.md +7 -0
- package/out/Default/gen/src/third_party/issue-descriptions/placeholderDescriptionForInvisibleIssues.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/propertyRuleInvalidNameIssue.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/propertyRuleIssue.md +7 -0
- package/out/Default/gen/src/third_party/issue-descriptions/selectElementAccessibilityDisallowedOptGroupChild.md +7 -0
- package/out/Default/gen/src/third_party/issue-descriptions/selectElementAccessibilityDisallowedSelectChild.md +7 -0
- package/out/Default/gen/src/third_party/issue-descriptions/selectElementAccessibilityInteractiveContentAttributesSelectDescendant.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/selectElementAccessibilityInteractiveContentLegendChild.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/selectElementAccessibilityInteractiveContentOptionChild.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/selectElementAccessibilityNonPhrasingContentOptionChild.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/selectivePermissionsIntervention.md +7 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedArrayBuffer.md +7 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryUseErrorCrossOriginNoCorsRequest.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryUseErrorDictionaryLoadFailure.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryUseErrorMatchingDictionaryNotUsed.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryUseErrorUnexpectedContentDictionaryHeader.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorCossOriginNoCorsRequest.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorDisallowedBySettings.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorExpiredResponse.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorFeatureDisabled.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorInsufficientResources.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorInvalidMatchField.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorInvalidStructuredHeader.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorInvalidTTLField.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNavigationRequest.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNoMatchField.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonIntegerTTLField.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonListMatchDestField.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonSecureContext.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonStringIdField.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonStringInMatchDestList.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonStringMatchField.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonTokenTypeField.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorRequestAborted.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorShuttingDown.md +1 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorTooLongIdField.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sharedDictionaryWriteErrorUnsupportedType.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sriInvalidSignatureHeader.md +14 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sriInvalidSignatureInputHeader.md +15 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sriMissingSignatureHeader.md +8 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sriMissingSignatureInputHeader.md +7 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sriSignatureHeaderValueIsIncorrectLength.md +11 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sriSignatureHeaderValueIsNotByteSequence.md +14 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sriSignatureHeaderValueIsParameterized.md +15 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidComponentName.md +8 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidComponentType.md +13 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidDerivedComponentParameter.md +4 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidHeaderComponentParameter.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidParameter.md +11 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sriSignatureInputHeaderKeyIdLength.md +12 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sriSignatureInputHeaderMissingLabel.md +6 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sriSignatureInputHeaderMissingRequiredParameters.md +8 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sriSignatureInputHeaderValueMissingComponents.md +11 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sriSignatureInputHeaderValueNotInnerList.md +11 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sriValidationFailedIntegrityMismatch.md +12 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sriValidationFailedInvalidLength.md +5 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sriValidationFailedSignatureExpired.md +6 -0
- package/out/Default/gen/src/third_party/issue-descriptions/sriValidationFailedSignatureMismatch.md +11 -0
- package/out/Default/gen/src/third_party/issue-descriptions/stylesheetLateImport.md +4 -0
- package/out/Default/gen/src/third_party/issue-descriptions/stylesheetRequestFailed.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/summaryElementAccessibilityInteractiveContentSummaryDescendant.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/unencodedDigestIncorrectDigestLength.md +12 -0
- package/out/Default/gen/src/third_party/issue-descriptions/unencodedDigestIncorrectDigestType.md +17 -0
- package/out/Default/gen/src/third_party/issue-descriptions/unencodedDigestMalformedDictionary.md +14 -0
- package/out/Default/gen/src/third_party/issue-descriptions/unencodedDigestUnknownAlgorithm.md +15 -0
- package/out/Default/gen/src/third_party/issue-descriptions/webInstallManifestMissingId.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/webInstallManifestMissingNameOrShortName.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/webInstallManifestParsingOrNetworkError.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/webInstallNoManifest.md +3 -0
- package/out/Default/gen/src/third_party/issue-descriptions/webInstallStartUrlInvalid.md +3 -0
- package/out/Default/gen/src/third_party/lighthouse-devtools-mcp-bundle.js +60395 -0
- package/out/Default/gen/src/tools/ToolDefinition.js +180 -0
- package/out/Default/gen/src/tools/categories.js +37 -0
- package/out/Default/gen/src/tools/comments.js +230 -0
- package/out/Default/gen/src/tools/console.js +122 -0
- package/out/Default/gen/src/tools/css.js +54 -0
- package/out/Default/gen/src/tools/emulation.js +98 -0
- package/out/Default/gen/src/tools/extensions.js +108 -0
- package/out/Default/gen/src/tools/input.js +658 -0
- package/out/Default/gen/src/tools/lighthouse.js +279 -0
- package/out/Default/gen/src/tools/logpoints.js +51 -0
- package/out/Default/gen/src/tools/memory.js +531 -0
- package/out/Default/gen/src/tools/network.js +325 -0
- package/out/Default/gen/src/tools/pages.js +420 -0
- package/out/Default/gen/src/tools/performance.js +258 -0
- package/out/Default/gen/src/tools/pwa.js +152 -0
- package/out/Default/gen/src/tools/screencast.js +160 -0
- package/out/Default/gen/src/tools/screenshot.js +315 -0
- package/out/Default/gen/src/tools/script.js +319 -0
- package/out/Default/gen/src/tools/slim/tools.js +110 -0
- package/out/Default/gen/src/tools/snapshot.js +88 -0
- package/out/Default/gen/src/tools/thirdPartyDeveloper.js +73 -0
- package/out/Default/gen/src/tools/toolNames.js +10 -0
- package/out/Default/gen/src/tools/tools.js +72 -0
- package/out/Default/gen/src/tools/webauthn.js +51 -0
- package/out/Default/gen/src/tools/webmcp.js +55 -0
- package/out/Default/gen/src/types.js +21 -0
- package/out/Default/gen/src/utils/TaskRunner.js +151 -0
- package/out/Default/gen/src/utils/WaitForHelper.js +343 -0
- package/out/Default/gen/src/utils/bytes.js +95 -0
- package/out/Default/gen/src/utils/check-for-updates.js +81 -0
- package/out/Default/gen/src/utils/disclaimers.js +27 -0
- package/out/Default/gen/src/utils/errorHandling.js +23 -0
- package/out/Default/gen/src/utils/files.js +81 -0
- package/out/Default/gen/src/utils/id.js +16 -0
- package/out/Default/gen/src/utils/keyboard.js +307 -0
- package/out/Default/gen/src/utils/logger.js +145 -0
- package/out/Default/gen/src/utils/logpoint.js +44 -0
- package/out/Default/gen/src/utils/network.js +81 -0
- package/out/Default/gen/src/utils/pagination.js +50 -0
- package/out/Default/gen/src/utils/polyfill.js +11 -0
- package/out/Default/gen/src/utils/raceWithSignal.js +26 -0
- package/out/Default/gen/src/utils/resourceType.js +27 -0
- package/out/Default/gen/src/utils/text.js +43 -0
- package/out/Default/gen/src/utils/timeout.js +14 -0
- package/out/Default/gen/src/utils/url.js +311 -0
- package/out/Default/gen/src/version.js +11 -0
- package/package.json +125 -4
- package/skills/a11y-debugging/SKILL.md +86 -0
- package/skills/a11y-debugging/references/a11y-snippets.md +92 -0
- package/skills/arc-compatibility/SKILL.md +174 -0
- package/skills/arc-compatibility/SOURCES.md +238 -0
- package/skills/arc-compatibility/references/compatibility.md +115 -0
- package/skills/arc-compatibility/references/output-contract.md +62 -0
- package/skills/arc-compatibility/references/workflows.md +108 -0
- package/skills/chrome-devtools/SKILL.md +80 -0
- package/skills/chrome-devtools-cli/SKILL.md +208 -0
- package/skills/chrome-devtools-cli/references/installation.md +24 -0
- package/skills/cookie-debugging/SKILL.md +152 -0
- package/skills/debug-optimize-lcp/SKILL.md +121 -0
- package/skills/debug-optimize-lcp/references/elements-and-size.md +27 -0
- package/skills/debug-optimize-lcp/references/lcp-breakdown.md +23 -0
- package/skills/debug-optimize-lcp/references/lcp-snippets.md +79 -0
- package/skills/debug-optimize-lcp/references/optimization-strategies.md +38 -0
- package/skills/inspect-in-devtools/SKILL.md +82 -0
- package/skills/memory-leak-debugging/SKILL.md +58 -0
- package/skills/memory-leak-debugging/references/common-leaks.md +33 -0
- package/skills/troubleshooting/SKILL.md +107 -0
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import os from 'node:os';
|
|
7
|
+
// Node 22 has no global URLPattern. The CLI bundle exports Puppeteer's
|
|
8
|
+
// polyfill, so this module does not need the full third-party bundle.
|
|
9
|
+
import { URLPattern } from '../third_party/cli.js';
|
|
10
|
+
const ALLOWED_PROTOCOLS = new Set(['http:', 'https:', 'ws:', 'wss:']);
|
|
11
|
+
const IPV4_LOOPBACK_REGEX = /^127(?:\.(?:25[0-5]|2[0-4]\d|[01]?\d\d?)){3}$/;
|
|
12
|
+
const IPV4_MAPPED_LOOPBACK_REGEX = /^\[::ffff:7f[0-9a-f]{2}:[0-9a-f]{1,4}\]$/;
|
|
13
|
+
/**
|
|
14
|
+
* Determines whether a given URL string points to a localhost / loopback address.
|
|
15
|
+
*
|
|
16
|
+
* @param url The URL string to test.
|
|
17
|
+
* @returns true if the URL is a valid network URL pointing to localhost or a loopback IP.
|
|
18
|
+
*/
|
|
19
|
+
export function isLocalhost(url) {
|
|
20
|
+
if (!url || typeof url !== 'string' || url.trim() === '') {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
let parsed;
|
|
24
|
+
try {
|
|
25
|
+
parsed = new URL(url);
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
if (!ALLOWED_PROTOCOLS.has(parsed.protocol)) {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
const hostname = parsed.hostname.toLowerCase().replace(/\.$/, '');
|
|
34
|
+
// 1. Check localhost and RFC 6761 *.localhost subdomains
|
|
35
|
+
if (hostname === 'localhost' || hostname.endsWith('.localhost')) {
|
|
36
|
+
return true;
|
|
37
|
+
}
|
|
38
|
+
// 2. Check IPv6 loopback ([::1] as returned by URL.hostname, or ::1)
|
|
39
|
+
if (hostname === '[::1]' || hostname === '::1') {
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
42
|
+
// 3. Check IPv4 loopback (127.0.0.0/8)
|
|
43
|
+
if (IPV4_LOOPBACK_REGEX.test(hostname)) {
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
// 4. Check IPv4-mapped IPv6 loopback. URL serializes [::ffff:127.0.0.1]
|
|
47
|
+
// as [::ffff:7f00:1].
|
|
48
|
+
if (IPV4_MAPPED_LOOPBACK_REGEX.test(hostname)) {
|
|
49
|
+
return true;
|
|
50
|
+
}
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
// URL serializes `0`, `0x0` and `0.0` as 0.0.0.0, `[::0]` as [::], and
|
|
54
|
+
// [::ffff:0.0.0.0] as [::ffff:0:0].
|
|
55
|
+
const UNSPECIFIED_HOSTNAMES = new Set(['0.0.0.0', '[::]', '[::ffff:0:0]']);
|
|
56
|
+
/**
|
|
57
|
+
* Serializes a host name or IP address the way `URL#hostname` does, or returns
|
|
58
|
+
* undefined if it is not a valid host.
|
|
59
|
+
*/
|
|
60
|
+
function toUrlHostname(host) {
|
|
61
|
+
try {
|
|
62
|
+
return new URL(`http://${host.includes(':') ? `[${host}]` : host}`)
|
|
63
|
+
.hostname;
|
|
64
|
+
}
|
|
65
|
+
catch {
|
|
66
|
+
return undefined;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Checks whether a `URL#hostname` is the host name of the local machine or an
|
|
71
|
+
* address of one of its network interfaces.
|
|
72
|
+
*/
|
|
73
|
+
function isLocalMachineHostname(hostname) {
|
|
74
|
+
const normalized = hostname.replace(/\.$/, '');
|
|
75
|
+
if (normalized === toUrlHostname(os.hostname())) {
|
|
76
|
+
return true;
|
|
77
|
+
}
|
|
78
|
+
let interfaces;
|
|
79
|
+
try {
|
|
80
|
+
interfaces = os.networkInterfaces();
|
|
81
|
+
}
|
|
82
|
+
catch {
|
|
83
|
+
// Some platforms cannot enumerate interfaces; keep the loopback checks.
|
|
84
|
+
return false;
|
|
85
|
+
}
|
|
86
|
+
for (const addresses of Object.values(interfaces)) {
|
|
87
|
+
for (const { address } of addresses ?? []) {
|
|
88
|
+
if (toUrlHostname(address) === normalized) {
|
|
89
|
+
return true;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Determines whether a browser endpoint URL points to the local machine.
|
|
97
|
+
*
|
|
98
|
+
* In addition to {@link isLocalhost}, this accepts the unspecified addresses
|
|
99
|
+
* 0.0.0.0 and [::], the local host name, and the addresses of the local
|
|
100
|
+
* network interfaces (for example a LAN or Docker bridge IP). A connection to
|
|
101
|
+
* any of these reaches the local machine.
|
|
102
|
+
*
|
|
103
|
+
* @param url The browser endpoint URL (for example, a WebSocket endpoint).
|
|
104
|
+
* @returns true if the endpoint is on the local machine.
|
|
105
|
+
*/
|
|
106
|
+
export function isLocalBrowserEndpoint(url) {
|
|
107
|
+
if (isLocalhost(url)) {
|
|
108
|
+
return true;
|
|
109
|
+
}
|
|
110
|
+
let parsed;
|
|
111
|
+
try {
|
|
112
|
+
parsed = new URL(url);
|
|
113
|
+
}
|
|
114
|
+
catch {
|
|
115
|
+
return false;
|
|
116
|
+
}
|
|
117
|
+
if (!ALLOWED_PROTOCOLS.has(parsed.protocol)) {
|
|
118
|
+
return false;
|
|
119
|
+
}
|
|
120
|
+
return (UNSPECIFIED_HOSTNAMES.has(parsed.hostname) ||
|
|
121
|
+
isLocalMachineHostname(parsed.hostname));
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Determines whether a URL is allowed for navigation and page tracking.
|
|
125
|
+
*
|
|
126
|
+
* Disallowed schemes:
|
|
127
|
+
* - chrome: (except chrome://newtab/ and chrome://inspect*)
|
|
128
|
+
* - chrome-untrusted:
|
|
129
|
+
* - chrome-extension: (unless categoryExtensions is true)
|
|
130
|
+
*
|
|
131
|
+
* @param url The URL string to test.
|
|
132
|
+
* @param options Configuration specifying whether extensions are enabled.
|
|
133
|
+
* @returns true if the URL is allowed.
|
|
134
|
+
*/
|
|
135
|
+
export function isAllowedUrl(url, options) {
|
|
136
|
+
let parsed;
|
|
137
|
+
try {
|
|
138
|
+
parsed = new URL(url);
|
|
139
|
+
}
|
|
140
|
+
catch {
|
|
141
|
+
return false;
|
|
142
|
+
}
|
|
143
|
+
if (parsed.protocol === 'chrome:' || parsed.protocol === 'arc:') {
|
|
144
|
+
const host = parsed.hostname.toLowerCase();
|
|
145
|
+
const path = parsed.pathname.toLowerCase();
|
|
146
|
+
if (host === 'newtab' || host === 'new-tab-page' || host === 'inspect') {
|
|
147
|
+
return true;
|
|
148
|
+
}
|
|
149
|
+
if (host === '' &&
|
|
150
|
+
(path === 'newtab' ||
|
|
151
|
+
path === 'new-tab-page' ||
|
|
152
|
+
path.startsWith('inspect'))) {
|
|
153
|
+
return true;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
if (parsed.protocol === 'chrome:' ||
|
|
157
|
+
parsed.protocol === 'arc:' ||
|
|
158
|
+
parsed.protocol === 'chrome-untrusted:') {
|
|
159
|
+
return false;
|
|
160
|
+
}
|
|
161
|
+
if (!options.categoryExtensions && parsed.protocol === 'chrome-extension:') {
|
|
162
|
+
return false;
|
|
163
|
+
}
|
|
164
|
+
return true;
|
|
165
|
+
}
|
|
166
|
+
const DISALLOWED_PROTOCOLS = new Set(['javascript:', 'data:', 'vbscript:']);
|
|
167
|
+
/**
|
|
168
|
+
* Checks whether a compiled URLPattern component contains an unescaped `:`
|
|
169
|
+
* (which always represents a `:name` group in URLPattern syntax).
|
|
170
|
+
*/
|
|
171
|
+
function hasNamedGroup(component) {
|
|
172
|
+
return component.replaceAll('\\\\', '').replaceAll('\\:', '').includes(':');
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Checks whether a URLPattern string has a partial IPv4 wildcard in the
|
|
176
|
+
* hostname (for example `127.0.0.*`, `*.0.0.1`, `*1*`, or `{127.0.0.*}`),
|
|
177
|
+
* which Chrome cannot enforce on redirects or subresources.
|
|
178
|
+
*/
|
|
179
|
+
function hasPartialIpv4Hostname(pattern) {
|
|
180
|
+
const authority = /:\/\/([^/?#]+)/.exec(pattern)?.[1] ?? '';
|
|
181
|
+
const hostPort = authority.slice(authority.lastIndexOf('@') + 1);
|
|
182
|
+
if (hostPort.startsWith('[')) {
|
|
183
|
+
return false;
|
|
184
|
+
}
|
|
185
|
+
const hostname = hostPort.replace(/:.*$/, '');
|
|
186
|
+
if (!hostname.includes('*')) {
|
|
187
|
+
return false;
|
|
188
|
+
}
|
|
189
|
+
const stripped = hostname.replaceAll(/[{}*\\]/g, '').replace(/\.+$/, '');
|
|
190
|
+
const lastLabel = stripped.split('.').at(-1) ?? '';
|
|
191
|
+
return /^(?:\d+|0[xX][0-9a-fA-F]*)$/.test(lastLabel);
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Validates that every pattern can be enforced by Chrome on redirects and subresources:
|
|
195
|
+
* - Rejects patterns with a partial IPv4 wildcard in the hostname (for example `127.0.0.*`).
|
|
196
|
+
* - Rejects patterns containing a regexp group (for example `(foo|bar)`).
|
|
197
|
+
* - Rejects patterns containing a named group (`:name`, for example `*://127.0.0.1::port/path`).
|
|
198
|
+
*
|
|
199
|
+
* @param patterns The `--blockedUrlPattern`/`--allowedUrlPattern` values to check.
|
|
200
|
+
* @param flagName The CLI flag name used in error messages.
|
|
201
|
+
* @throws Error if a pattern's syntax is invalid (via `new URLPattern`) or uses an unenforceable construct.
|
|
202
|
+
*/
|
|
203
|
+
export function validateUrlPatterns(patterns, flagName) {
|
|
204
|
+
for (const raw of patterns) {
|
|
205
|
+
if (hasPartialIpv4Hostname(raw)) {
|
|
206
|
+
throw new Error(`Invalid ${flagName} "${raw}": a partial IPv4 wildcard is not enforced on redirects or subresources. Use an exact IPv4 address or a "*" wildcard instead.`);
|
|
207
|
+
}
|
|
208
|
+
let parsed;
|
|
209
|
+
try {
|
|
210
|
+
parsed = new URLPattern(raw);
|
|
211
|
+
}
|
|
212
|
+
catch (error) {
|
|
213
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
214
|
+
throw new Error(`Invalid ${flagName} "${raw}": ${message}`, {
|
|
215
|
+
cause: error,
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
if (parsed.hasRegExpGroups) {
|
|
219
|
+
throw new Error(`Invalid ${flagName} "${raw}": a regexp group is not enforced on redirects or subresources. Use an exact value or a "*" wildcard instead.`);
|
|
220
|
+
}
|
|
221
|
+
const components = [
|
|
222
|
+
parsed.protocol,
|
|
223
|
+
parsed.username,
|
|
224
|
+
parsed.password,
|
|
225
|
+
parsed.hostname,
|
|
226
|
+
parsed.port,
|
|
227
|
+
parsed.pathname,
|
|
228
|
+
parsed.search,
|
|
229
|
+
parsed.hash,
|
|
230
|
+
];
|
|
231
|
+
if (components.some(hasNamedGroup)) {
|
|
232
|
+
throw new Error(`Invalid ${flagName} "${raw}": a ":name" named group is not enforced on redirects or subresources. Use an exact value or a "*" wildcard instead.`);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Unwraps nested `view-source:` prefixes so every scheme check below runs
|
|
238
|
+
* against the URL Chrome will actually resolve and load — not the
|
|
239
|
+
* wrapper. `view-source:` wraps another URL and Chrome resolves the inner
|
|
240
|
+
* target (potentially through multiple levels of wrapping), so
|
|
241
|
+
* `view-source:file:///etc/passwd` reads the file just as
|
|
242
|
+
* `file:///etc/passwd` does, and `view-source:devtools://devtools/...`
|
|
243
|
+
* loads under the `devtools://devtools` origin just as the bare
|
|
244
|
+
* `devtools:` URL would. The inner URL is re-parsed rather than
|
|
245
|
+
* string-matched so that an uppercase inner scheme
|
|
246
|
+
* (`view-source:FILE:///etc/passwd`) is normalised.
|
|
247
|
+
*
|
|
248
|
+
* @param url The already-parsed URL to unwrap.
|
|
249
|
+
* @returns The fully unwrapped URL, or the original URL unchanged if it
|
|
250
|
+
* is not `view-source:`. Returns null if any wrapped layer is not itself
|
|
251
|
+
* a valid URL.
|
|
252
|
+
*/
|
|
253
|
+
function unwrapViewSource(url) {
|
|
254
|
+
let current = url;
|
|
255
|
+
// Bounded in case of a pathologically nested `view-source:` chain.
|
|
256
|
+
for (let i = 0; i < 5 && current.protocol === 'view-source:'; i++) {
|
|
257
|
+
try {
|
|
258
|
+
current = new URL(current.pathname);
|
|
259
|
+
}
|
|
260
|
+
catch {
|
|
261
|
+
return null;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
return current.protocol === 'view-source:' ? null : current;
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* Validates a URL string by parsing it with `new URL` and checking for disallowed protocols and restricted schemes.
|
|
268
|
+
*
|
|
269
|
+
* Any `view-source:` wrapping is unwrapped first (see {@link unwrapViewSource}),
|
|
270
|
+
* since Chrome resolves the wrapper at navigation time and loads the page
|
|
271
|
+
* under the wrapped URL's own origin, so every scheme check below must run
|
|
272
|
+
* against the unwrapped target rather than the outer `view-source:` URL.
|
|
273
|
+
*
|
|
274
|
+
* @param url The URL string to validate.
|
|
275
|
+
* @param options Options object containing javascriptEvaluation, categoryExtensions and fileNavigations.
|
|
276
|
+
* @returns The parsed URL.
|
|
277
|
+
* @throws Error if the URL does not parse with `new URL`, or if JavaScript evaluation is disabled and a disallowed URL is passed,
|
|
278
|
+
* or if file navigations are disabled and a `file:` URL is passed, or if navigating to a restricted scheme.
|
|
279
|
+
*/
|
|
280
|
+
export function validateUrl(url, options) {
|
|
281
|
+
const { javascriptEvaluation, categoryExtensions, fileNavigations } = options;
|
|
282
|
+
let parsed;
|
|
283
|
+
try {
|
|
284
|
+
parsed = new URL(url);
|
|
285
|
+
}
|
|
286
|
+
catch {
|
|
287
|
+
throw new Error(`Invalid URL: "${url}". URLs must be valid according to the URL standard.`);
|
|
288
|
+
}
|
|
289
|
+
const target = unwrapViewSource(parsed);
|
|
290
|
+
if (!target) {
|
|
291
|
+
throw new Error(`Invalid URL: "${url}". The view-source: wrapped content is not a valid URL.`);
|
|
292
|
+
}
|
|
293
|
+
if (javascriptEvaluation === false &&
|
|
294
|
+
DISALLOWED_PROTOCOLS.has(target.protocol)) {
|
|
295
|
+
throw new Error(`Navigating to ${target.protocol} URLs is not allowed when JavaScript evaluation is disabled.`);
|
|
296
|
+
}
|
|
297
|
+
if (fileNavigations === false && target.protocol === 'file:') {
|
|
298
|
+
throw new Error(`Navigating to file: URLs is not allowed when --file-navigations is disabled.`);
|
|
299
|
+
}
|
|
300
|
+
if (target.protocol === 'devtools:') {
|
|
301
|
+
throw new Error(`Navigating to devtools: URLs is not allowed.`);
|
|
302
|
+
}
|
|
303
|
+
if (!isAllowedUrl(target.href, { categoryExtensions })) {
|
|
304
|
+
if (target.protocol === 'chrome-extension:') {
|
|
305
|
+
throw new Error(`Navigating to chrome-extension: URLs is not allowed without --categoryExtensions.`);
|
|
306
|
+
}
|
|
307
|
+
throw new Error(`Navigating to ${target.protocol} URLs is not allowed.`);
|
|
308
|
+
}
|
|
309
|
+
return parsed;
|
|
310
|
+
}
|
|
311
|
+
//# sourceMappingURL=url.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
// If moved update release-please config
|
|
7
|
+
// x-release-please-start-version
|
|
8
|
+
export const VERSION = '1.13.1';
|
|
9
|
+
// x-release-please-end
|
|
10
|
+
export const PACKAGE_NAME = '@chenpx976/chrome-devtools-mcp';
|
|
11
|
+
//# sourceMappingURL=version.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,127 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chenpx976/chrome-devtools-mcp",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "1.13.1",
|
|
4
|
+
"description": "Chrome DevTools MCP with native Arc support on macOS",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"publishConfig": {
|
|
7
|
+
"access": "public",
|
|
8
|
+
"registry": "https://registry.npmjs.org"
|
|
9
|
+
},
|
|
10
|
+
"bin": {
|
|
11
|
+
"chrome-devtools-mcp": "./out/Default/gen/src/bin/chrome-devtools-mcp.js",
|
|
12
|
+
"chrome-devtools": "./out/Default/gen/src/bin/chrome-devtools.js"
|
|
13
|
+
},
|
|
14
|
+
"main": "./out/Default/gen/src/index.js",
|
|
15
|
+
"scripts": {
|
|
16
|
+
"arc:restart": "node scripts/arc-restart.mjs",
|
|
17
|
+
"arc:smoke": "npm run build && node scripts/arc-smoke.mjs",
|
|
18
|
+
"cli:generate": "node scripts/generate-cli.ts",
|
|
19
|
+
"clean": "node scripts/clean.ts",
|
|
20
|
+
"clean:submodules": "node scripts/clean-submodules.ts",
|
|
21
|
+
"build": "node scripts/ninja.ts",
|
|
22
|
+
"build:release": "node scripts/gn-gen.ts --args=is_debug=false && node scripts/ninja.ts",
|
|
23
|
+
"typecheck": "node scripts/ninja.ts",
|
|
24
|
+
"format": "eslint --cache --fix . && prettier --write --cache .",
|
|
25
|
+
"check-format": "eslint --cache . && prettier --check --cache .",
|
|
26
|
+
"gen": "npm run build && npm run cli:generate && npm run docs:generate && npm run update-metrics && npm run format",
|
|
27
|
+
"docs:generate": "node scripts/generate-docs.ts",
|
|
28
|
+
"start": "npm run build && node out/Default/gen/src/bin/chrome-devtools-mcp.js",
|
|
29
|
+
"start-debug": "NODE_DEBUG=mcp:* npm run build && node out/Default/gen/src/bin/chrome-devtools-mcp.js",
|
|
30
|
+
"test": "npm run build && node scripts/test.js",
|
|
31
|
+
"test:no-build": "node scripts/test.js",
|
|
32
|
+
"test:only": "npm run build && node scripts/test.js --test-only",
|
|
33
|
+
"test:update-snapshots": "npm run build && node scripts/test.js --test-update-snapshots",
|
|
34
|
+
"prepare": "node scripts/prepare.ts",
|
|
35
|
+
"gn:gen": "node scripts/gn-gen.ts",
|
|
36
|
+
"sync": "npm ci && git submodule update --init && node scripts/gclient-sync.ts",
|
|
37
|
+
"verify-server-json-version": "node scripts/verify-server-json-version.ts",
|
|
38
|
+
"update-lighthouse": "node scripts/update-lighthouse.ts",
|
|
39
|
+
"update-metrics": "node scripts/update_metrics.ts",
|
|
40
|
+
"verify-npm-package": "node scripts/verify-npm-package.js",
|
|
41
|
+
"eval": "npm run build && node scripts/eval_gemini.ts",
|
|
42
|
+
"count-tokens": "node scripts/count_tokens.ts",
|
|
43
|
+
"profile": "npm run build:release && node scripts/profile/profile_mcp.ts",
|
|
44
|
+
"test:memory": "npm run build:release && node scripts/profile/profile_mcp.ts --threshold-percentage 1",
|
|
45
|
+
"profile:footprint": "npm run build:release && node scripts/profile/footprint_mcp.ts"
|
|
46
|
+
},
|
|
47
|
+
"files": [
|
|
48
|
+
"out/Default/gen/src",
|
|
49
|
+
"LICENSE",
|
|
50
|
+
"skills",
|
|
51
|
+
"!**/*.tsbuildinfo",
|
|
52
|
+
"!**/*.js.map",
|
|
53
|
+
"!**/*.d.ts",
|
|
54
|
+
"!**/*-tsconfig*.json",
|
|
55
|
+
"!**/*.meta.json",
|
|
56
|
+
"!**/*.stamp",
|
|
57
|
+
"!**/*.d"
|
|
58
|
+
],
|
|
59
|
+
"repository": "chenpx976/chrome-devtools-mcp",
|
|
60
|
+
"author": "Google LLC",
|
|
61
|
+
"license": "Apache-2.0",
|
|
62
|
+
"bugs": {
|
|
63
|
+
"url": "https://github.com/chenpx976/chrome-devtools-mcp/issues"
|
|
64
|
+
},
|
|
65
|
+
"homepage": "https://github.com/chenpx976/chrome-devtools-mcp/tree/arc-support#readme",
|
|
66
|
+
"mcpName": "io.github.chenpx976/chrome-devtools-mcp",
|
|
67
|
+
"devDependencies": {
|
|
68
|
+
"@blackwell-systems/gcf": "^2.2.2",
|
|
69
|
+
"@google/genai": "^3.0.0",
|
|
70
|
+
"@modelcontextprotocol/client": "2.4.0",
|
|
71
|
+
"@modelcontextprotocol/core": "2.4.0",
|
|
72
|
+
"@modelcontextprotocol/server": "2.4.0",
|
|
73
|
+
"@stylistic/eslint-plugin": "^6.0.0",
|
|
74
|
+
"@toon-format/toon": "^4.1.0",
|
|
75
|
+
"@types/node": "^26.0.0",
|
|
76
|
+
"@types/semver": "^7.7.1",
|
|
77
|
+
"@types/sinon": "^22.0.0",
|
|
78
|
+
"@types/yargs": "^17.0.33",
|
|
79
|
+
"@typescript-eslint/eslint-plugin": "^8.43.0",
|
|
80
|
+
"@typescript-eslint/parser": "^8.43.0",
|
|
81
|
+
"core-js": "3.51.0",
|
|
82
|
+
"eslint": "^10.7.0",
|
|
83
|
+
"eslint-import-resolver-typescript": "^4.4.4",
|
|
84
|
+
"eslint-plugin-eslint-plugin": "^7.6.2",
|
|
85
|
+
"eslint-plugin-import": "^2.32.0",
|
|
86
|
+
"eslint-plugin-jsdoc": "^65.2.0",
|
|
87
|
+
"eslint-plugin-mocha": "^12.0.2",
|
|
88
|
+
"globals": "^17.0.0",
|
|
89
|
+
"lighthouse": "13.6.0",
|
|
90
|
+
"prettier": "^3.6.2",
|
|
91
|
+
"puppeteer": "25.18.1",
|
|
92
|
+
"semver": "^7.7.4",
|
|
93
|
+
"sinon": "^22.0.0",
|
|
94
|
+
"typescript": "npm:@typescript/typescript6@^6.0.2",
|
|
95
|
+
"typescript-eslint": "^8.43.0",
|
|
96
|
+
"yargs": "18.2.0",
|
|
97
|
+
"zod": "^4.4.3"
|
|
98
|
+
},
|
|
99
|
+
"peerDependencies": {
|
|
100
|
+
"@blackwell-systems/gcf": "^2.2.2",
|
|
101
|
+
"@toon-format/toon": "^4.1.0"
|
|
102
|
+
},
|
|
103
|
+
"peerDependenciesMeta": {
|
|
104
|
+
"@toon-format/toon": {
|
|
105
|
+
"optional": true
|
|
106
|
+
},
|
|
107
|
+
"@blackwell-systems/gcf": {
|
|
108
|
+
"optional": true
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
"engines": {
|
|
112
|
+
"node": "^20.19.0 || ^22.12.0 || >=23"
|
|
113
|
+
},
|
|
114
|
+
"overrides": {
|
|
115
|
+
"eslint-plugin-import": {
|
|
116
|
+
"eslint": "$eslint"
|
|
117
|
+
},
|
|
118
|
+
"puppeteer-core": "$puppeteer"
|
|
119
|
+
},
|
|
120
|
+
"allowScripts": {
|
|
121
|
+
"core-js": false,
|
|
122
|
+
"@google/genai": false,
|
|
123
|
+
"protobufjs": false,
|
|
124
|
+
"unrs-resolver": false,
|
|
125
|
+
"puppeteer": true
|
|
126
|
+
}
|
|
127
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: a11y-debugging
|
|
3
|
+
description: Uses Chrome DevTools MCP for accessibility (a11y) debugging and auditing based on web.dev guidelines. Use when testing semantic HTML, ARIA labels, focus states, keyboard navigation, tap targets, and color contrast.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## Core Concepts
|
|
7
|
+
|
|
8
|
+
**Page Targeting**: Page-scoped tools (`take_snapshot`, `list_console_messages`, `evaluate_script`, `press_key`, `take_screenshot`, `lighthouse_audit`, etc.) require a `pageId` parameter. Retrieve available page IDs using `list_pages` or from `new_page`.
|
|
9
|
+
|
|
10
|
+
**Accessibility Tree vs DOM**: Visually hiding an element (e.g., `CSS opacity: 0`) behaves differently for screen readers than `display: none` or `aria-hidden="true"`. The `take_snapshot` tool returns the accessibility tree of the page, which represents what assistive technologies "see", making it the most reliable source of truth for semantic structure.
|
|
11
|
+
|
|
12
|
+
**Reading web.dev documentation**: If you need to research specific accessibility guidelines (like `https://web.dev/articles/accessible-tap-targets`), you can append `.md.txt` to the URL (e.g., `https://web.dev/articles/accessible-tap-targets.md.txt`) to fetch the clean, raw markdown version. This is much easier to read!
|
|
13
|
+
|
|
14
|
+
## Workflow Patterns
|
|
15
|
+
|
|
16
|
+
### 1. Automated Audit (Lighthouse)
|
|
17
|
+
|
|
18
|
+
Start by running a Lighthouse accessibility audit to get a comprehensive baseline. This tool provides a high-level score and lists specific failing elements with remediation advice.
|
|
19
|
+
|
|
20
|
+
1. Run the audit:
|
|
21
|
+
- Set `mode` to `"navigation"` to refresh the page and capture load issues.
|
|
22
|
+
- Omit `outputDirPath` to save reports to the default temporary directory (the exact path to `report.json` is returned under `Reports`), or set `outputDirPath` to a directory within the workspace.
|
|
23
|
+
2. **Analyze the Summary**:
|
|
24
|
+
- In the default text output, category scores use a 0-100 scale (100 is a perfect score), followed by `Passed: N` and `Failed: N` audit counts.
|
|
25
|
+
- If the server was started with `--experimentalStructuredContent`, inspect `summary.scores[].score` (0-1 scale) and `summary.audits.failed` in the structured content instead.
|
|
26
|
+
3. **Review the Report (CRITICAL)**:
|
|
27
|
+
- **Parsing**: Do not read the entire file line-by-line. Use a CLI tool like `jq` or a Node.js one-liner to filter for failures from the report path returned by `lighthouse_audit`:
|
|
28
|
+
```bash
|
|
29
|
+
# Extract failing audits with their details (replace with report.json path from tool response)
|
|
30
|
+
node -e "const r=require('<path/to/report.json>'); Object.values(r.audits).filter(a=>a.score!==null && a.score<1).forEach(a=>console.log(JSON.stringify({id:a.id, title:a.title, items:a.details?.items})))"
|
|
31
|
+
```
|
|
32
|
+
- This efficiently extracts the `selector` and `snippet` of failing elements without loading the full report into context.
|
|
33
|
+
|
|
34
|
+
### 2. Browser Issues & Audits
|
|
35
|
+
|
|
36
|
+
Chrome automatically checks for common accessibility problems. Use `list_console_messages` to check for these native audits:
|
|
37
|
+
|
|
38
|
+
- `types`: `["issue"]`
|
|
39
|
+
- `includePreservedMessages`: `true` (to catch issues that occurred during page load)
|
|
40
|
+
|
|
41
|
+
This often reveals missing labels, invalid ARIA attributes, and other critical errors without manual investigation.
|
|
42
|
+
|
|
43
|
+
### 3. Semantics & Structure
|
|
44
|
+
|
|
45
|
+
The accessibility tree exposes the heading hierarchy and semantic landmarks.
|
|
46
|
+
|
|
47
|
+
1. Navigate to the page.
|
|
48
|
+
2. Use `take_snapshot` to capture the accessibility tree.
|
|
49
|
+
3. **Check Heading Levels**: Ensure heading levels (`h1`, `h2`, `h3`, etc.) are logical and do not skip levels. The snapshot will include heading roles.
|
|
50
|
+
4. **Content Reordering**: Verify that the DOM order (which drives the accessibility tree) matches the visual reading order. Use `take_screenshot` to inspect the visual layout and compare it against the snapshot structure to catch CSS floats or absolute positioning that jumbles the logical flow.
|
|
51
|
+
|
|
52
|
+
### 4. Labels, Forms & Text Alternatives
|
|
53
|
+
|
|
54
|
+
1. Locate buttons, inputs, and images in the `take_snapshot` output.
|
|
55
|
+
2. Ensure interactive elements have an accessible name (e.g., a button should not just say `""` if it only contains an icon).
|
|
56
|
+
3. **Orphaned Inputs**: Verify that all form inputs have associated labels. Use `evaluate_script` with the **"Find Orphaned Form Inputs" snippet** found in [references/a11y-snippets.md](references/a11y-snippets.md).
|
|
57
|
+
4. Check images for `alt` text.
|
|
58
|
+
|
|
59
|
+
### 5. Focus & Keyboard Navigation
|
|
60
|
+
|
|
61
|
+
Testing "keyboard traps" and proper focus management without visual feedback relies on tracking the focused element.
|
|
62
|
+
|
|
63
|
+
1. Use the `press_key` tool with `"Tab"` or `"Shift+Tab"` to move focus.
|
|
64
|
+
2. Use `take_snapshot` to capture the updated accessibility tree.
|
|
65
|
+
3. Locate the element marked as focused in the snapshot to verify focus moved to the expected interactive element.
|
|
66
|
+
4. If a modal opens, focus must move into the modal and "trap" within it until closed.
|
|
67
|
+
|
|
68
|
+
### 6. Tap Targets and Visuals
|
|
69
|
+
|
|
70
|
+
According to web.dev, tap targets should be at least 48x48 pixels with sufficient spacing. Since the accessibility tree doesn't show sizes, use `evaluate_script` with the **"Measure Tap Target Size" snippet** found in [references/a11y-snippets.md](references/a11y-snippets.md).
|
|
71
|
+
|
|
72
|
+
_Pass the element's `uid` from the snapshot as an argument to `evaluate_script`._
|
|
73
|
+
|
|
74
|
+
### 7. Color Contrast
|
|
75
|
+
|
|
76
|
+
To verify color contrast ratios, use the **"Check Color Contrast" snippet** found in [references/a11y-snippets.md](references/a11y-snippets.md) with `evaluate_script`.
|
|
77
|
+
|
|
78
|
+
### 8. Global Page Checks
|
|
79
|
+
|
|
80
|
+
Verify document-level accessibility settings often missed in component testing using the **"Global Page Checks" snippet** found in [references/a11y-snippets.md](references/a11y-snippets.md).
|
|
81
|
+
|
|
82
|
+
## Troubleshooting
|
|
83
|
+
|
|
84
|
+
If standard a11y queries fail or the `evaluate_script` snippets return unexpected results:
|
|
85
|
+
|
|
86
|
+
- **Visual Inspection**: If automated scripts cannot determine contrast (e.g., text over gradient images or complex backgrounds), use `take_screenshot` to capture the element. While models cannot measure exact contrast ratios from images, they can visually assess legibility and identify obvious issues.
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# Accessibility Debugging Snippets
|
|
2
|
+
|
|
3
|
+
Use these JavaScript snippets with the `evaluate_script` tool.
|
|
4
|
+
|
|
5
|
+
## 1. Find Orphaned Form Inputs
|
|
6
|
+
|
|
7
|
+
Finds form inputs that lack an associated label (no `label[for]`, `aria-label`, `aria-labelledby`, or wrapping `<label>`).
|
|
8
|
+
|
|
9
|
+
```js
|
|
10
|
+
() =>
|
|
11
|
+
Array.from(document.querySelectorAll('input, select, textarea'))
|
|
12
|
+
.filter(i => {
|
|
13
|
+
const hasId = i.id && document.querySelector(`label[for="${i.id}"]`);
|
|
14
|
+
const hasAria =
|
|
15
|
+
i.getAttribute('aria-label') || i.getAttribute('aria-labelledby');
|
|
16
|
+
return !hasId && !hasAria && !i.closest('label');
|
|
17
|
+
})
|
|
18
|
+
.map(i => ({
|
|
19
|
+
tag: i.tagName,
|
|
20
|
+
id: i.id,
|
|
21
|
+
name: i.name,
|
|
22
|
+
placeholder: i.placeholder,
|
|
23
|
+
}));
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## 2. Measure Tap Target Size
|
|
27
|
+
|
|
28
|
+
Returns the bounding box dimensions of an element. Pass the element's `uid` from the snapshot as an argument to `evaluate_script`.
|
|
29
|
+
|
|
30
|
+
```js
|
|
31
|
+
el => {
|
|
32
|
+
const rect = el.getBoundingClientRect();
|
|
33
|
+
return {width: rect.width, height: rect.height};
|
|
34
|
+
};
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## 3. Check Color Contrast
|
|
38
|
+
|
|
39
|
+
Approximates the contrast ratio between an element's text color and background color. Pass the element's `uid` to test against WCAG AA (4.5:1 for normal text, 3:1 for large text).
|
|
40
|
+
|
|
41
|
+
**Note**: This uses a simplified algorithm and may not account for transparency, gradients, or background images. For production-grade auditing, consider injecting `axe-core`.
|
|
42
|
+
|
|
43
|
+
```js
|
|
44
|
+
el => {
|
|
45
|
+
function getRGB(colorStr) {
|
|
46
|
+
const match = colorStr.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/);
|
|
47
|
+
return match
|
|
48
|
+
? [parseInt(match[1]), parseInt(match[2]), parseInt(match[3])]
|
|
49
|
+
: [255, 255, 255];
|
|
50
|
+
}
|
|
51
|
+
function luminance(r, g, b) {
|
|
52
|
+
const a = [r, g, b].map(function (v) {
|
|
53
|
+
v /= 255;
|
|
54
|
+
return v <= 0.03928 ? v / 12.92 : Math.pow((v + 0.055) / 1.055, 2.4);
|
|
55
|
+
});
|
|
56
|
+
return a[0] * 0.2126 + a[1] * 0.7152 + a[2] * 0.0722;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const style = window.getComputedStyle(el);
|
|
60
|
+
const fg = getRGB(style.color);
|
|
61
|
+
let bg = getRGB(style.backgroundColor);
|
|
62
|
+
|
|
63
|
+
const l1 = luminance(fg[0], fg[1], fg[2]);
|
|
64
|
+
const l2 = luminance(bg[0], bg[1], bg[2]);
|
|
65
|
+
const ratio = (Math.max(l1, l2) + 0.05) / (Math.min(l1, l2) + 0.05);
|
|
66
|
+
|
|
67
|
+
return {
|
|
68
|
+
color: style.color,
|
|
69
|
+
bg: style.backgroundColor,
|
|
70
|
+
contrastRatio: ratio.toFixed(2),
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## 4. Global Page Checks
|
|
76
|
+
|
|
77
|
+
Checks document-level accessibility settings often missed in component testing.
|
|
78
|
+
|
|
79
|
+
```js
|
|
80
|
+
() => ({
|
|
81
|
+
lang:
|
|
82
|
+
document.documentElement.lang ||
|
|
83
|
+
'MISSING - Screen readers need this for pronunciation',
|
|
84
|
+
title: document.title || 'MISSING - Required for context',
|
|
85
|
+
viewport:
|
|
86
|
+
document.querySelector('meta[name="viewport"]')?.content ||
|
|
87
|
+
'MISSING - Check for user-scalable=no (bad practice)',
|
|
88
|
+
reducedMotion: window.matchMedia('(prefers-reduced-motion: reduce)').matches
|
|
89
|
+
? 'Enabled'
|
|
90
|
+
: 'Disabled',
|
|
91
|
+
});
|
|
92
|
+
```
|