chrome-devtools-mcp 1.12.0 → 1.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/{build → out/Default/gen}/src/BrowserManager.js +22 -0
- package/out/Default/gen/src/LogpointManager.js +307 -0
- package/{build → out/Default/gen}/src/McpContext.js +10 -52
- package/{build → out/Default/gen}/src/McpPage.js +181 -2
- package/{build → out/Default/gen}/src/McpResponse.js +29 -3
- package/out/Default/gen/src/NetworkOverrideManager.js +419 -0
- package/{build → out/Default/gen}/src/ToolHandler.js +53 -22
- package/{build → out/Default/gen}/src/collectors/PageCollector.js +15 -3
- package/{build → out/Default/gen}/src/config/ConfigParser.js +4 -1
- package/{build → out/Default/gen}/src/config/category-options.js +10 -0
- package/{build → out/Default/gen}/src/config/cli-options.js +188 -3
- package/{build → out/Default/gen}/src/config/mcp-options.js +1 -1
- package/{build → out/Default/gen}/src/devtools/DevtoolsUtils.js +45 -8
- package/out/Default/gen/src/formatters/LogpointFormatter.js +62 -0
- package/{build → out/Default/gen}/src/formatters/NetworkFormatter.js +16 -2
- package/out/Default/gen/src/formatters/NetworkOverridesFormatter.js +49 -0
- package/out/Default/gen/src/formatters/WebAuthnFormatter.js +56 -0
- package/{build → out/Default/gen}/src/index.js +2 -1
- package/{build → out/Default/gen}/src/telemetry/transformation.js +1 -1
- package/{build → out/Default/gen}/src/third_party/THIRD_PARTY_NOTICES +354 -367
- package/out/Default/gen/src/third_party/bundled-packages.json +11 -0
- package/out/Default/gen/src/third_party/cli.js +9023 -0
- package/out/Default/gen/src/third_party/devtools-formatter-worker.js +31904 -0
- package/out/Default/gen/src/third_party/devtools-heap-snapshot-worker.js +26467 -0
- package/out/Default/gen/src/third_party/index.js +201574 -0
- package/{build → out/Default/gen}/src/third_party/lighthouse-devtools-mcp-bundle.js +11034 -11476
- package/{build → out/Default/gen}/src/tools/ToolDefinition.js +66 -56
- package/{build → out/Default/gen}/src/tools/categories.js +4 -0
- package/{build → out/Default/gen}/src/tools/comments.js +4 -1
- package/{build → out/Default/gen}/src/tools/console.js +2 -2
- package/{build → out/Default/gen}/src/tools/extensions.js +1 -1
- package/{build → out/Default/gen}/src/tools/input.js +9 -29
- package/{build → out/Default/gen}/src/tools/lighthouse.js +6 -0
- package/out/Default/gen/src/tools/logpoints.js +51 -0
- package/out/Default/gen/src/tools/network.js +260 -0
- package/{build → out/Default/gen}/src/tools/performance.js +26 -3
- package/{build → out/Default/gen}/src/tools/snapshot.js +20 -6
- package/{build → out/Default/gen}/src/tools/thirdPartyDeveloper.js +3 -19
- package/out/Default/gen/src/tools/toolNames.js +10 -0
- package/{build → out/Default/gen}/src/tools/tools.js +4 -0
- package/out/Default/gen/src/tools/webauthn.js +51 -0
- package/{build → out/Default/gen}/src/tools/webmcp.js +3 -19
- package/{build → out/Default/gen}/src/utils/TaskRunner.js +31 -16
- package/{build → out/Default/gen}/src/utils/WaitForHelper.js +15 -1
- package/{build → out/Default/gen}/src/utils/check-for-updates.js +7 -1
- package/{build → out/Default/gen}/src/utils/errorHandling.js +3 -0
- package/{build → out/Default/gen}/src/utils/keyboard.js +5 -7
- package/out/Default/gen/src/utils/network.js +81 -0
- package/out/Default/gen/src/utils/raceWithSignal.js +26 -0
- package/{build → out/Default/gen}/src/utils/url.js +33 -18
- package/{build → out/Default/gen}/src/version.js +1 -1
- package/package.json +25 -32
- package/skills/chrome-devtools/SKILL.md +2 -0
- package/skills/chrome-devtools-cli/SKILL.md +12 -1
- package/build/src/third_party/bundled-packages.json +0 -11
- package/build/src/third_party/cli.js +0 -9239
- package/build/src/third_party/devtools-formatter-worker.js +0 -17276
- package/build/src/third_party/devtools-heap-snapshot-worker.js +0 -12255
- package/build/src/third_party/index.js +0 -186086
- package/build/src/tools/network.js +0 -129
- /package/{build → out/Default/gen}/src/McpWorker.js +0 -0
- /package/{build → out/Default/gen}/src/SlimMcpResponse.js +0 -0
- /package/{build → out/Default/gen}/src/TextSnapshot.js +0 -0
- /package/{build → out/Default/gen}/src/bin/check-latest-version.js +0 -0
- /package/{build → out/Default/gen}/src/bin/chrome-devtools-mcp-main.js +0 -0
- /package/{build → out/Default/gen}/src/bin/chrome-devtools-mcp.js +0 -0
- /package/{build → out/Default/gen}/src/bin/chrome-devtools.js +0 -0
- /package/{build → out/Default/gen}/src/collectors/ServiceWorkerCollector.js +0 -0
- /package/{build → out/Default/gen}/src/collectors/constants.js +0 -0
- /package/{build → out/Default/gen}/src/config/ConfigLocator.js +0 -0
- /package/{build → out/Default/gen}/src/config/ConfigWatcher.js +0 -0
- /package/{build → out/Default/gen}/src/config/ServerConfig.js +0 -0
- /package/{build → out/Default/gen}/src/config/browser-options.js +0 -0
- /package/{build → out/Default/gen}/src/config/cli-commands.js +0 -0
- /package/{build → out/Default/gen}/src/config/puppeteer-options.js +0 -0
- /package/{build → out/Default/gen}/src/config/tool-options.js +0 -0
- /package/{build → out/Default/gen}/src/daemon/client.js +0 -0
- /package/{build → out/Default/gen}/src/daemon/daemon.js +0 -0
- /package/{build → out/Default/gen}/src/daemon/types.js +0 -0
- /package/{build → out/Default/gen}/src/daemon/utils.js +0 -0
- /package/{build → out/Default/gen}/src/devtools/DevToolsCommentBridge.js +0 -0
- /package/{build → out/Default/gen}/src/devtools/McpHostBindingAdapter.js +0 -0
- /package/{build → out/Default/gen}/src/devtools/issueDescriptions.js +0 -0
- /package/{build → out/Default/gen}/src/formatters/CommentFormatter.js +0 -0
- /package/{build → out/Default/gen}/src/formatters/ConsoleFormatter.js +0 -0
- /package/{build → out/Default/gen}/src/formatters/CssFormatter.js +0 -0
- /package/{build → out/Default/gen}/src/formatters/HeapSnapshotFormatter.js +0 -0
- /package/{build → out/Default/gen}/src/formatters/IssueFormatter.js +0 -0
- /package/{build → out/Default/gen}/src/formatters/RemoteObjectFormatter.js +0 -0
- /package/{build → out/Default/gen}/src/formatters/SnapshotFormatter.js +0 -0
- /package/{build → out/Default/gen}/src/processors/ChunkedTraceParser.js +0 -0
- /package/{build → out/Default/gen}/src/processors/HeapSnapshotManager.js +0 -0
- /package/{build → out/Default/gen}/src/processors/PerformanceTrace.js +0 -0
- /package/{build → out/Default/gen}/src/telemetry/ClearcutLogger.js +0 -0
- /package/{build → out/Default/gen}/src/telemetry/WatchdogClient.js +0 -0
- /package/{build → out/Default/gen}/src/telemetry/errors.js +0 -0
- /package/{build → out/Default/gen}/src/telemetry/flagUtils.js +0 -0
- /package/{build → out/Default/gen}/src/telemetry/metricsRegistry.js +0 -0
- /package/{build → out/Default/gen}/src/telemetry/persistence.js +0 -0
- /package/{build → out/Default/gen}/src/telemetry/types.js +0 -0
- /package/{build → out/Default/gen}/src/telemetry/watchdog/ClearcutSender.js +0 -0
- /package/{build → out/Default/gen}/src/telemetry/watchdog/main.js +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/CoepCoopSandboxedIframeCannotNavigateToCoopPage.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/CoepCorpNotSameOrigin.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/CoepCorpNotSameOriginAfterDefaultedToSameOriginByCoep.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/CoepCorpNotSameSite.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/CoepFrameResourceNeedsCoepHeader.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/CompatibilityModeQuirks.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/CookieAttributeValueExceedsMaxSize.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/LowTextContrast.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/SameSiteNoneInsecureErrorRead.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/SameSiteNoneInsecureErrorSet.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/SameSiteNoneInsecureWarnRead.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/SameSiteNoneInsecureWarnSet.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/SameSiteUnspecifiedLaxAllowUnsafeRead.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/SameSiteUnspecifiedLaxAllowUnsafeSet.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/bounceTrackingMitigations.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/clientHintMetaTagAllowListInvalidOrigin.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/clientHintMetaTagModifiedHTML.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/connectionAllowlistEmbeddingRequirementNotSatisfied.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/connectionAllowlistIFrameAttributeLoosensEmbeddingRequirement.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/connectionAllowlistInvalidAllowConnectionAllowlistFrom.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/connectionAllowlistInvalidAllowlistItemType.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/connectionAllowlistInvalidHeader.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/connectionAllowlistInvalidUrlPattern.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/connectionAllowlistItemNotInnerList.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/connectionAllowlistMoreThanOneList.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/connectionAllowlistReportingEndpointNotToken.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/cookieCrossSiteRedirectDowngrade.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/cookieExcludeDomainNonAscii.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/cookieExcludePortMismatch.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/cookieExcludeSchemeMismatch.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/cookieExcludeThirdPartyPhaseoutRead.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/cookieExcludeThirdPartyPhaseoutSet.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/cookieWarnDomainNonAscii.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/cookieWarnMetadataGrantRead.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/cookieWarnMetadataGrantReadOptOut.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/cookieWarnMetadataGrantSet.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/cookieWarnMetadataGrantSetOptOut.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/cookieWarnThirdPartyPhaseoutRead.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/cookieWarnThirdPartyPhaseoutSet.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/corsAllowCredentialsRequired.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/corsDisabledScheme.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/corsDisallowedByMode.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/corsHeaderDisallowedByPreflightResponse.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/corsInvalidHeaderValues.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/corsLocalNetworkAccessPermissionDenied.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/corsMethodDisallowedByPreflightResponse.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/corsNoCorsRedirectModeNotFollow.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/corsOriginMismatch.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/corsPreflightResponseInvalid.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/corsRedirectContainsCredentials.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/corsWildcardOriginNotAllowed.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/cspEvalViolation.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/cspInlineViolation.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/cspTrustedTypesPolicyViolation.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/cspTrustedTypesSinkViolation.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/cspURLViolation.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/deprecation.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestAccountsEmptyList.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestAccountsHttpNotFound.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestAccountsInvalidContentType.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestAccountsInvalidResponse.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestAccountsNoResponse.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestDnsFetchFailed.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestDnsInvalidRecord.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestEmailVerificationWellKnownHttpNotFound.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestEmailVerificationWellKnownInvalidContentType.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestEmailVerificationWellKnownInvalidResponse.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestEmailVerificationWellKnownNoResponse.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestInvalidEmail.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestJwksHttpNotFound.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestJwksInvalidResponse.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestKeyBindingSigningFailed.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestRpOriginIsOpaque.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestTokenHttpNotFound.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestTokenInvalidContentType.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestTokenInvalidResponse.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestTokenInvalidSdJwt.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestTokenMalformedSdJwt.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestTokenNoResponse.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidAudience.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidIssuedAt.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidNonce.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidSdHash.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidTyp.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingAud.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingCnf.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingIat.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingNonce.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingSdHash.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbSignatureFailed.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidEmail.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidEmailVerified.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidHolderKey.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidIssuedAt.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidIssuer.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtJwksMissingKeys.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtMissingCnf.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtMissingEmail.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtMissingIat.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtMissingIss.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtSignatureFailed.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtUnsupportedHeaderAlg.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestUserLoggedOut.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestWellKnownAccountsEndpointCrossOrigin.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestWellKnownHttpNotFound.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestWellKnownInvalidContentType.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestWellKnownInvalidResponse.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestWellKnownIssuanceEndpointCrossOrigin.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestWellKnownListEmpty.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestWellKnownMissingAccountsEndpoint.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestWellKnownMissingIssuanceEndpoint.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestWellKnownNoResponse.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/emailVerificationRequestWellKnownUnsupportedSigningAlgorithm.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/federatedAuthRequestAccountsBlockedByConnectionAllowlist.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/federatedAuthRequestAccountsHttpNotFound.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/federatedAuthRequestAccountsInvalidResponse.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/federatedAuthRequestAccountsNoResponse.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/federatedAuthRequestApprovalDeclined.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/federatedAuthRequestCanceled.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/federatedAuthRequestConfigBlockedByConnectionAllowlist.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/federatedAuthRequestErrorFetchingSignin.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/federatedAuthRequestErrorIdToken.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/federatedAuthRequestIdTokenBlockedByConnectionAllowlist.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/federatedAuthRequestIdTokenHttpNotFound.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/federatedAuthRequestIdTokenInvalidRequest.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/federatedAuthRequestIdTokenInvalidResponse.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/federatedAuthRequestIdTokenNoResponse.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/federatedAuthRequestInvalidSigninResponse.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/federatedAuthRequestManifestHttpNotFound.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/federatedAuthRequestManifestInvalidResponse.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/federatedAuthRequestManifestNoResponse.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/federatedAuthRequestTooManyRequests.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/federatedAuthRequestWellKnownBlockedByConnectionAllowlist.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/federatedAuthUserInfoRequestInvalidAccountsResponse.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/federatedAuthUserInfoRequestInvalidConfigOrWellKnown.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNoAccountSharingPermission.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNoApiPermission.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNoReturningUserFromFetchedAccounts.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotIframe.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotPotentiallyTrustworthy.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotSameOrigin.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotSignedInWithIdp.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/fetchingPartitionedBlobURL.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/genericBackUINavigationWouldSkipAd.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/genericFormAriaLabelledByToNonExistingIdError.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/genericFormAutocompleteAttributeEmptyError.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/genericFormDuplicateIdForInputError.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/genericFormEmptyIdAndNameAttributesForInputError.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/genericFormInputAssignedAutocompleteValueToIdOrNameAttributeError.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/genericFormInputHasWrongButWellIntendedAutocompleteValueError.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/genericFormInputWithNoLabelError.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/genericFormLabelForMatchesNonExistingIdError.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/genericFormLabelForNameError.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/genericFormLabelHasNeitherForNorNestedInputError.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/genericFormModelContextMissingToolDescription.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/genericFormModelContextMissingToolName.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/genericFormModelContextParameterMissingName.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/genericFormModelContextParameterMissingTitleAndDescription.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/genericFormModelContextRequiredParameterMissingName.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/genericGeolocationPromptWithoutUserGesture.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/genericNavigationEntryMarkedSkippable.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/genericResponseWasBlockedByORB.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/heavyAd.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/lazyLoadImageZeroSize.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/mixedContent.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/navigatingPartitionedBlobURL.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/permissionElementActivationDisabled.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/permissionElementActivationDisabledWithOccluder.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/permissionElementActivationDisabledWithOccluderParent.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/permissionElementCspFrameAncestorsMissing.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/permissionElementFencedFrameDisallowed.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/permissionElementFontSizeTooLarge.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/permissionElementFontSizeTooSmall.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/permissionElementGeolocationDeprecated.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/permissionElementInsetBoxShadowUnsupported.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/permissionElementInvalidDisplayStyle.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/permissionElementInvalidSizeValue.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/permissionElementInvalidType.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/permissionElementInvalidTypeActivation.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/permissionElementLowContrast.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/permissionElementNonOpaqueColor.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/permissionElementPaddingBottomUnsupported.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/permissionElementPaddingRightUnsupported.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/permissionElementPermissionsPolicyBlocked.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/permissionElementRegistrationFailed.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/permissionElementRequestInProgress.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/permissionElementSecurityChecksFailed.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/permissionElementTypeNotSupported.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/permissionElementUntrustedEvent.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/placeholderDescriptionForInvisibleIssues.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/propertyRuleInvalidNameIssue.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/propertyRuleIssue.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/selectElementAccessibilityDisallowedOptGroupChild.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/selectElementAccessibilityDisallowedSelectChild.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/selectElementAccessibilityInteractiveContentAttributesSelectDescendant.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/selectElementAccessibilityInteractiveContentLegendChild.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/selectElementAccessibilityInteractiveContentOptionChild.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/selectElementAccessibilityNonPhrasingContentOptionChild.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/selectivePermissionsIntervention.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sharedArrayBuffer.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sharedDictionaryUseErrorCrossOriginNoCorsRequest.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sharedDictionaryUseErrorDictionaryLoadFailure.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sharedDictionaryUseErrorMatchingDictionaryNotUsed.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sharedDictionaryUseErrorUnexpectedContentDictionaryHeader.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sharedDictionaryWriteErrorCossOriginNoCorsRequest.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sharedDictionaryWriteErrorDisallowedBySettings.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sharedDictionaryWriteErrorExpiredResponse.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sharedDictionaryWriteErrorFeatureDisabled.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sharedDictionaryWriteErrorInsufficientResources.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sharedDictionaryWriteErrorInvalidMatchField.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sharedDictionaryWriteErrorInvalidStructuredHeader.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sharedDictionaryWriteErrorInvalidTTLField.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNavigationRequest.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNoMatchField.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonIntegerTTLField.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonListMatchDestField.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonSecureContext.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonStringIdField.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonStringInMatchDestList.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonStringMatchField.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNonTokenTypeField.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sharedDictionaryWriteErrorRequestAborted.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sharedDictionaryWriteErrorShuttingDown.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sharedDictionaryWriteErrorTooLongIdField.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sharedDictionaryWriteErrorUnsupportedType.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sriInvalidSignatureHeader.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sriInvalidSignatureInputHeader.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sriMissingSignatureHeader.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sriMissingSignatureInputHeader.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sriSignatureHeaderValueIsIncorrectLength.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sriSignatureHeaderValueIsNotByteSequence.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sriSignatureHeaderValueIsParameterized.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidComponentName.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidComponentType.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidDerivedComponentParameter.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidHeaderComponentParameter.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidParameter.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sriSignatureInputHeaderKeyIdLength.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sriSignatureInputHeaderMissingLabel.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sriSignatureInputHeaderMissingRequiredParameters.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sriSignatureInputHeaderValueMissingComponents.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sriSignatureInputHeaderValueNotInnerList.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sriValidationFailedIntegrityMismatch.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sriValidationFailedInvalidLength.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sriValidationFailedSignatureExpired.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/sriValidationFailedSignatureMismatch.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/stylesheetLateImport.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/stylesheetRequestFailed.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/summaryElementAccessibilityInteractiveContentSummaryDescendant.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/unencodedDigestIncorrectDigestLength.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/unencodedDigestIncorrectDigestType.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/unencodedDigestMalformedDictionary.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/unencodedDigestUnknownAlgorithm.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/webInstallManifestMissingId.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/webInstallManifestMissingNameOrShortName.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/webInstallManifestParsingOrNetworkError.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/webInstallNoManifest.md +0 -0
- /package/{build → out/Default/gen}/src/third_party/issue-descriptions/webInstallStartUrlInvalid.md +0 -0
- /package/{build → out/Default/gen}/src/tools/css.js +0 -0
- /package/{build → out/Default/gen}/src/tools/emulation.js +0 -0
- /package/{build → out/Default/gen}/src/tools/memory.js +0 -0
- /package/{build → out/Default/gen}/src/tools/pages.js +0 -0
- /package/{build → out/Default/gen}/src/tools/pwa.js +0 -0
- /package/{build → out/Default/gen}/src/tools/screencast.js +0 -0
- /package/{build → out/Default/gen}/src/tools/screenshot.js +0 -0
- /package/{build → out/Default/gen}/src/tools/script.js +0 -0
- /package/{build → out/Default/gen}/src/tools/slim/tools.js +0 -0
- /package/{build → out/Default/gen}/src/types.js +0 -0
- /package/{build → out/Default/gen}/src/utils/bytes.js +0 -0
- /package/{build → out/Default/gen}/src/utils/disclaimers.js +0 -0
- /package/{build → out/Default/gen}/src/utils/files.js +0 -0
- /package/{build → out/Default/gen}/src/utils/id.js +0 -0
- /package/{build → out/Default/gen}/src/utils/logger.js +0 -0
- /package/{build → out/Default/gen}/src/utils/pagination.js +0 -0
- /package/{build → out/Default/gen}/src/utils/polyfill.js +0 -0
- /package/{build → out/Default/gen}/src/utils/resourceType.js +0 -0
- /package/{build → out/Default/gen}/src/utils/text.js +0 -0
- /package/{build → out/Default/gen}/src/utils/timeout.js +0 -0
|
@@ -7,6 +7,7 @@ import zlib from 'node:zlib';
|
|
|
7
7
|
import { zod, DevTools } from '../third_party/index.js';
|
|
8
8
|
import { parseRawTraceBuffer, traceResultIsSuccess, } from '../processors/PerformanceTrace.js';
|
|
9
9
|
import { logger } from '../utils/logger.js';
|
|
10
|
+
import { NetworkOverridesFormatter } from '../formatters/NetworkOverridesFormatter.js';
|
|
10
11
|
import { ToolCategory } from './categories.js';
|
|
11
12
|
import { definePageTool, } from './ToolDefinition.js';
|
|
12
13
|
const filePathSchema = zod
|
|
@@ -32,7 +33,7 @@ export const startTrace = definePageTool(() => ({
|
|
|
32
33
|
ignoreCache: zod
|
|
33
34
|
.boolean()
|
|
34
35
|
.optional()
|
|
35
|
-
.describe('Whether to bypass the HTTP cache when reloading the page, to measure a cold page load. Only applies if reload is true.'),
|
|
36
|
+
.describe('Whether to bypass the HTTP cache when reloading the page, to measure a cold page load. Only applies if reload is true. Active network mocks always disable the page HTTP cache.'),
|
|
36
37
|
filePath: filePathSchema,
|
|
37
38
|
},
|
|
38
39
|
blockedByDialog: true,
|
|
@@ -46,6 +47,11 @@ export const startTrace = definePageTool(() => ({
|
|
|
46
47
|
return;
|
|
47
48
|
}
|
|
48
49
|
const page = request.page;
|
|
50
|
+
const networkOverrides = page.listNetworkMocks();
|
|
51
|
+
const { warning } = new NetworkOverridesFormatter(networkOverrides).toJSON();
|
|
52
|
+
if (warning) {
|
|
53
|
+
response.appendResponseLine(warning);
|
|
54
|
+
}
|
|
49
55
|
page.setIsRunningPerformanceTrace(true);
|
|
50
56
|
const pageUrlForTracing = page.pptrPage.url();
|
|
51
57
|
try {
|
|
@@ -68,7 +74,7 @@ export const startTrace = definePageTool(() => ({
|
|
|
68
74
|
bufferSize: 1200 * 1000,
|
|
69
75
|
});
|
|
70
76
|
if (request.params.reload) {
|
|
71
|
-
const ignoreCache = request.params.ignoreCache
|
|
77
|
+
const ignoreCache = request.params.ignoreCache === true && networkOverrides.length === 0;
|
|
72
78
|
if (ignoreCache) {
|
|
73
79
|
// Disable the HTTP cache so that the main document and all
|
|
74
80
|
// subresources are fetched from the network, like a hard reload.
|
|
@@ -113,7 +119,7 @@ export const startTrace = definePageTool(() => ({
|
|
|
113
119
|
}
|
|
114
120
|
},
|
|
115
121
|
}));
|
|
116
|
-
export const stopTrace = definePageTool(() => ({
|
|
122
|
+
export const stopTrace = definePageTool((args) => ({
|
|
117
123
|
name: 'performance_stop_trace',
|
|
118
124
|
description: 'Stop the active performance trace recording on the target webpage.',
|
|
119
125
|
annotations: {
|
|
@@ -134,6 +140,23 @@ export const stopTrace = definePageTool(() => ({
|
|
|
134
140
|
return;
|
|
135
141
|
}
|
|
136
142
|
const page = request.page;
|
|
143
|
+
if (!page.isRunningPerformanceTrace()) {
|
|
144
|
+
const tracedPage = context
|
|
145
|
+
.getPages()
|
|
146
|
+
.find(p => p.isRunningPerformanceTrace());
|
|
147
|
+
const pageHint = tracedPage ? ` on page ${tracedPage.id}` : '';
|
|
148
|
+
const actionHint = tracedPage
|
|
149
|
+
? args.pageIdRouting
|
|
150
|
+
? `Pass pageId: ${tracedPage.id} to performance_stop_trace to stop it.`
|
|
151
|
+
: `Select page ${tracedPage.id} with select_page first, then call performance_stop_trace.`
|
|
152
|
+
: 'Select the page that started the trace and try again.';
|
|
153
|
+
response.appendResponseLine(`Error: the active performance trace is running${pageHint}, not on page ${page.id}. ${actionHint}`);
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
const { warning } = new NetworkOverridesFormatter(page.listNetworkMocks()).toJSON();
|
|
157
|
+
if (warning) {
|
|
158
|
+
response.appendResponseLine(warning);
|
|
159
|
+
}
|
|
137
160
|
await stopTracingAndAppendOutput(page, response, context, request.params.filePath);
|
|
138
161
|
},
|
|
139
162
|
}));
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright 2025 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import { zod } from '../third_party/index.js';
|
|
6
|
+
import { TimeoutError, zod } from '../third_party/index.js';
|
|
7
7
|
import { ToolCategory } from './categories.js';
|
|
8
8
|
import { definePageTool, timeoutSchema, } from './ToolDefinition.js';
|
|
9
9
|
export const takeSnapshot = definePageTool(() => ({
|
|
@@ -49,7 +49,11 @@ export const waitFor = definePageTool(() => ({
|
|
|
49
49
|
text: zod
|
|
50
50
|
.array(zod.string())
|
|
51
51
|
.min(1)
|
|
52
|
-
.describe('Non-empty list of texts. Resolves when any value
|
|
52
|
+
.describe('Non-empty list of texts. Resolves when any value matches an ' +
|
|
53
|
+
'accessible name exactly or is a substring of DOM text. Matching ' +
|
|
54
|
+
'is case-sensitive. DOM text preserves spaces and newlines, unlike ' +
|
|
55
|
+
'snapshot text which may normalize whitespace. Use the original ' +
|
|
56
|
+
'whitespace or a shorter distinctive substring.'),
|
|
53
57
|
...timeoutSchema,
|
|
54
58
|
visible: zod
|
|
55
59
|
.boolean()
|
|
@@ -62,10 +66,20 @@ export const waitFor = definePageTool(() => ({
|
|
|
62
66
|
verifyFilesSchema: {},
|
|
63
67
|
handler: async (request, response) => {
|
|
64
68
|
const page = request.page;
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
+
try {
|
|
70
|
+
await page.waitForTextOnPage(request.params.text, {
|
|
71
|
+
timeout: request.params.timeout,
|
|
72
|
+
visible: request.params.visible,
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
if (error instanceof TimeoutError) {
|
|
77
|
+
throw new TimeoutError(`${error.message}. Text matching is case-sensitive. DOM text must ` +
|
|
78
|
+
'preserve spaces and newlines, whereas snapshot text may ' +
|
|
79
|
+
'normalize whitespace. Try a shorter distinctive substring.', { cause: error });
|
|
80
|
+
}
|
|
81
|
+
throw error;
|
|
82
|
+
}
|
|
69
83
|
response.appendResponseLine(`Element matching one of ${JSON.stringify(request.params.text)} found.`);
|
|
70
84
|
response.includeSnapshot();
|
|
71
85
|
},
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { zod, ajv } from '../third_party/index.js';
|
|
7
7
|
import { ToolCategory } from './categories.js';
|
|
8
|
-
import { definePageTool } from './ToolDefinition.js';
|
|
8
|
+
import { definePageTool, jsonObjectTransform, zodTransform, } from './ToolDefinition.js';
|
|
9
9
|
export const listThirdPartyDeveloperTools = definePageTool(() => ({
|
|
10
10
|
name: 'list_3p_developer_tools',
|
|
11
11
|
description: `Lists all third-party developer tools the page exposes for providing runtime information (including debugging WebMCP tools and tools exposed via the 'devtoolstooldiscovery' event).
|
|
@@ -38,6 +38,7 @@ export const executeThirdPartyDeveloperTool = definePageTool(() => ({
|
|
|
38
38
|
toolName: zod.string().describe('The name of the tool to execute'),
|
|
39
39
|
params: zod
|
|
40
40
|
.string()
|
|
41
|
+
.transform(zodTransform(jsonObjectTransform))
|
|
41
42
|
.optional()
|
|
42
43
|
.describe('The JSON-stringified parameters to pass to the tool'),
|
|
43
44
|
},
|
|
@@ -46,24 +47,7 @@ export const executeThirdPartyDeveloperTool = definePageTool(() => ({
|
|
|
46
47
|
verifyFilesSchema: {},
|
|
47
48
|
handler: async (request, response) => {
|
|
48
49
|
const toolName = request.params.toolName;
|
|
49
|
-
|
|
50
|
-
if (request.params.params) {
|
|
51
|
-
try {
|
|
52
|
-
const parsed = JSON.parse(request.params.params);
|
|
53
|
-
if (typeof parsed === 'object' &&
|
|
54
|
-
parsed !== null &&
|
|
55
|
-
!Array.isArray(parsed)) {
|
|
56
|
-
params = parsed;
|
|
57
|
-
}
|
|
58
|
-
else {
|
|
59
|
-
throw new Error('Parsed params is not an object');
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
catch (e) {
|
|
63
|
-
const errorMessage = e instanceof Error ? e.message : String(e);
|
|
64
|
-
throw new Error(`Failed to parse params as JSON: ${errorMessage}`);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
50
|
+
const params = request.params.params ?? {};
|
|
67
51
|
const toolGroups = await request.page.discoverThirdPartyDeveloperTools();
|
|
68
52
|
let tool;
|
|
69
53
|
if (toolGroups) {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
// Tool names referenced from other tools' descriptions. Kept out of the tool
|
|
7
|
+
// modules because `createTools()` instantiates every export of those.
|
|
8
|
+
export const LIST_CONSOLE_MESSAGES_TOOL_NAME = 'list_console_messages';
|
|
9
|
+
export const GET_CONSOLE_MESSAGE_TOOL_NAME = 'get_console_message';
|
|
10
|
+
//# sourceMappingURL=toolNames.js.map
|
|
@@ -11,6 +11,7 @@ import * as emulationTools from './emulation.js';
|
|
|
11
11
|
import * as extensionTools from './extensions.js';
|
|
12
12
|
import * as inputTools from './input.js';
|
|
13
13
|
import * as lighthouseTools from './lighthouse.js';
|
|
14
|
+
import * as logpointTools from './logpoints.js';
|
|
14
15
|
import * as memoryTools from './memory.js';
|
|
15
16
|
import * as networkTools from './network.js';
|
|
16
17
|
import * as pagesTools from './pages.js';
|
|
@@ -22,6 +23,7 @@ import * as scriptTools from './script.js';
|
|
|
22
23
|
import * as slimTools from './slim/tools.js';
|
|
23
24
|
import * as snapshotTools from './snapshot.js';
|
|
24
25
|
import * as thirdPartyDeveloperTools from './thirdPartyDeveloper.js';
|
|
26
|
+
import * as webauthnTools from './webauthn.js';
|
|
25
27
|
import * as webmcpTools from './webmcp.js';
|
|
26
28
|
export const createTools = (args) => {
|
|
27
29
|
const rawTools = [
|
|
@@ -32,6 +34,7 @@ export const createTools = (args) => {
|
|
|
32
34
|
...Object.values(extensionTools),
|
|
33
35
|
...Object.values(inputTools),
|
|
34
36
|
...Object.values(lighthouseTools),
|
|
37
|
+
...Object.values(logpointTools),
|
|
35
38
|
...Object.values(memoryTools),
|
|
36
39
|
...Object.values(networkTools),
|
|
37
40
|
...Object.values(pagesTools),
|
|
@@ -43,6 +46,7 @@ export const createTools = (args) => {
|
|
|
43
46
|
...Object.values(slimTools),
|
|
44
47
|
...Object.values(snapshotTools),
|
|
45
48
|
...Object.values(thirdPartyDeveloperTools),
|
|
49
|
+
...Object.values(webauthnTools),
|
|
46
50
|
...Object.values(webmcpTools),
|
|
47
51
|
];
|
|
48
52
|
const tools = [];
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { zod } from '../third_party/index.js';
|
|
7
|
+
import { ToolCategory } from './categories.js';
|
|
8
|
+
import { definePageTool } from './ToolDefinition.js';
|
|
9
|
+
export const configureWebAuthn = definePageTool(() => ({
|
|
10
|
+
name: 'configure_webauthn',
|
|
11
|
+
description: 'Adds a virtual WebAuthn authenticator to the page. Call this before the page calls navigator.credentials. ' +
|
|
12
|
+
'It answers navigator.credentials.create() and get() and is removed when the page closes. ' +
|
|
13
|
+
'Omitted parameters keep their current values. Changing protocol, transport, hasResidentKey or hasUserVerification replaces the authenticator and deletes its credentials. ' +
|
|
14
|
+
'enabled=false ignores other parameters and removes all authenticators on the page.',
|
|
15
|
+
annotations: {
|
|
16
|
+
category: ToolCategory.WEBAUTHN,
|
|
17
|
+
readOnlyHint: false,
|
|
18
|
+
},
|
|
19
|
+
schema: {
|
|
20
|
+
enabled: zod
|
|
21
|
+
.boolean()
|
|
22
|
+
.describe('Set to false to remove all virtual authenticators from the page.'),
|
|
23
|
+
protocol: zod
|
|
24
|
+
.enum(['ctap2', 'u2f'])
|
|
25
|
+
.optional()
|
|
26
|
+
.describe('The authenticator protocol. Default: ctap2.'),
|
|
27
|
+
transport: zod
|
|
28
|
+
.enum(['internal', 'usb', 'nfc', 'ble', 'hybrid'])
|
|
29
|
+
.optional()
|
|
30
|
+
.describe('"internal" is a platform authenticator such as Touch ID or Windows Hello; the others are roaming security keys. Default: internal.'),
|
|
31
|
+
hasResidentKey: zod
|
|
32
|
+
.boolean()
|
|
33
|
+
.optional()
|
|
34
|
+
.describe('Whether the authenticator can store discoverable credentials (passkeys). Default: true. u2f does not support it, so it is false for u2f.'),
|
|
35
|
+
hasUserVerification: zod
|
|
36
|
+
.boolean()
|
|
37
|
+
.optional()
|
|
38
|
+
.describe('Whether the authenticator supports user verification (PIN or biometrics). Default: true. u2f does not support it, so it is false for u2f.'),
|
|
39
|
+
isUserVerified: zod
|
|
40
|
+
.boolean()
|
|
41
|
+
.optional()
|
|
42
|
+
.describe('Whether user verification succeeds. Set to false to test a failed verification. Default: true.'),
|
|
43
|
+
},
|
|
44
|
+
blockedByDialog: false,
|
|
45
|
+
concurrency: 'page',
|
|
46
|
+
verifyFilesSchema: {},
|
|
47
|
+
handler: async (request, response) => {
|
|
48
|
+
response.attachWebAuthnAuthenticator(await request.page.configureWebAuthn(request.params));
|
|
49
|
+
},
|
|
50
|
+
}));
|
|
51
|
+
//# sourceMappingURL=webauthn.js.map
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { zod } from '../third_party/index.js';
|
|
7
7
|
import { ToolCategory } from './categories.js';
|
|
8
|
-
import { definePageTool } from './ToolDefinition.js';
|
|
8
|
+
import { definePageTool, jsonObjectTransform, zodTransform, } from './ToolDefinition.js';
|
|
9
9
|
export const listWebMcpTools = definePageTool(() => ({
|
|
10
10
|
name: 'list_webmcp_tools',
|
|
11
11
|
description: `Lists all WebMCP tools the page exposes (excluding debugging tools, which are exposed via 'list_3p_developer_tools').`,
|
|
@@ -32,6 +32,7 @@ export const executeWebMcpTool = definePageTool(() => ({
|
|
|
32
32
|
toolName: zod.string().describe('The name of the WebMCP tool to execute'),
|
|
33
33
|
input: zod
|
|
34
34
|
.string()
|
|
35
|
+
.transform(zodTransform(jsonObjectTransform))
|
|
35
36
|
.optional()
|
|
36
37
|
.describe('The JSON-stringified parameters to pass to the WebMCP tool'),
|
|
37
38
|
},
|
|
@@ -40,24 +41,7 @@ export const executeWebMcpTool = definePageTool(() => ({
|
|
|
40
41
|
verifyFilesSchema: {},
|
|
41
42
|
handler: async (request, response) => {
|
|
42
43
|
const toolName = request.params.toolName;
|
|
43
|
-
|
|
44
|
-
if (request.params.input) {
|
|
45
|
-
try {
|
|
46
|
-
const parsed = JSON.parse(request.params.input);
|
|
47
|
-
if (typeof parsed === 'object' &&
|
|
48
|
-
parsed !== null &&
|
|
49
|
-
!Array.isArray(parsed)) {
|
|
50
|
-
input = parsed;
|
|
51
|
-
}
|
|
52
|
-
else {
|
|
53
|
-
throw new Error('Parsed input is not an object');
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
catch (e) {
|
|
57
|
-
const errorMessage = e instanceof Error ? e.message : String(e);
|
|
58
|
-
throw new Error(`Failed to parse input as JSON: ${errorMessage}`);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
44
|
+
const input = request.params.input ?? {};
|
|
61
45
|
const tools = request.page.getWebMcpTools();
|
|
62
46
|
const tool = tools.find(t => t.name === toolName);
|
|
63
47
|
if (!tool) {
|
|
@@ -20,13 +20,14 @@ export class TaskQueue {
|
|
|
20
20
|
* Schedules a task on this queue. Resolves when no earlier task on a
|
|
21
21
|
* related queue runs, with a guard that holds the queue until it is
|
|
22
22
|
* disposed. Rejects when the queue is disposed while the task waits. A
|
|
23
|
-
* second dispose of the guard throws.
|
|
23
|
+
* second dispose of the guard throws. Cancellation rejects a waiting task
|
|
24
|
+
* with the signal's reason; after acquisition, the caller owns the guard.
|
|
24
25
|
*/
|
|
25
|
-
async scheduleTask() {
|
|
26
|
+
async scheduleTask(signal) {
|
|
26
27
|
if (this.#disposed) {
|
|
27
28
|
throw this.#disposed;
|
|
28
29
|
}
|
|
29
|
-
return await this.#hooks.scheduleTask(this);
|
|
30
|
+
return await this.#hooks.scheduleTask(this, signal);
|
|
30
31
|
}
|
|
31
32
|
/**
|
|
32
33
|
* Rejects the callers that wait on this queue with `reason`, and rejects
|
|
@@ -58,7 +59,7 @@ export class TaskQueue {
|
|
|
58
59
|
*/
|
|
59
60
|
export class TaskRunner {
|
|
60
61
|
#hooks = {
|
|
61
|
-
scheduleTask: queue => this.#scheduleTask(queue),
|
|
62
|
+
scheduleTask: (queue, signal) => this.#scheduleTask(queue, 'normal', signal),
|
|
62
63
|
cancel: (queue, reason) => this.#cancel(queue, reason),
|
|
63
64
|
};
|
|
64
65
|
#root = new TaskQueue(this.#hooks, undefined);
|
|
@@ -79,19 +80,37 @@ export class TaskRunner {
|
|
|
79
80
|
async pause() {
|
|
80
81
|
return await this.#scheduleTask(this.#root, 'high');
|
|
81
82
|
}
|
|
82
|
-
async #scheduleTask(queue, priority = 'normal') {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
83
|
+
async #scheduleTask(queue, priority = 'normal', signal) {
|
|
84
|
+
signal?.throwIfAborted();
|
|
85
|
+
const { entry, started } = this.#enter(queue, priority);
|
|
86
|
+
const onAbort = () => {
|
|
87
|
+
this.#cancelEntry(entry, signal?.reason);
|
|
88
|
+
};
|
|
89
|
+
signal?.addEventListener('abort', onAbort, { once: true });
|
|
90
|
+
try {
|
|
91
|
+
await started;
|
|
92
|
+
return {
|
|
93
|
+
[Symbol.dispose]: () => this.#leave(entry),
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
finally {
|
|
97
|
+
signal?.removeEventListener('abort', onAbort);
|
|
98
|
+
}
|
|
86
99
|
}
|
|
87
100
|
#cancel(queue, reason) {
|
|
88
101
|
for (const entry of [...this.#entries]) {
|
|
89
|
-
if (entry.queue === queue
|
|
90
|
-
this.#
|
|
91
|
-
entry.reject(reason);
|
|
102
|
+
if (entry.queue === queue) {
|
|
103
|
+
this.#cancelEntry(entry, reason);
|
|
92
104
|
}
|
|
93
105
|
}
|
|
94
106
|
}
|
|
107
|
+
#cancelEntry(entry, reason) {
|
|
108
|
+
if (entry.running || !this.#entries.includes(entry)) {
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
this.#leave(entry);
|
|
112
|
+
entry.reject(reason);
|
|
113
|
+
}
|
|
95
114
|
#enter(queue, priority) {
|
|
96
115
|
const { promise, resolve, reject } = Promise.withResolvers();
|
|
97
116
|
const entry = { queue, priority, running: false, resolve, reject };
|
|
@@ -103,11 +122,7 @@ export class TaskRunner {
|
|
|
103
122
|
this.#schedule();
|
|
104
123
|
return {
|
|
105
124
|
started: promise,
|
|
106
|
-
|
|
107
|
-
[Symbol.dispose]: () => {
|
|
108
|
-
this.#leave(entry);
|
|
109
|
-
},
|
|
110
|
-
},
|
|
125
|
+
entry,
|
|
111
126
|
};
|
|
112
127
|
}
|
|
113
128
|
#leave(entry) {
|
|
@@ -68,6 +68,7 @@ export class WaitForHelper {
|
|
|
68
68
|
/** Track all dialogs as they pause the renderer. */
|
|
69
69
|
#dialogDetected = false;
|
|
70
70
|
#initialUrl;
|
|
71
|
+
#loadedNewDocument = false;
|
|
71
72
|
#openedPages = new Set();
|
|
72
73
|
constructor(page, cpuTimeoutMultiplier, networkTimeoutMultiplier) {
|
|
73
74
|
this.#stableDomTimeout = 3000 * cpuTimeoutMultiplier;
|
|
@@ -200,6 +201,19 @@ export class WaitForHelper {
|
|
|
200
201
|
this.#abortController.signal.addEventListener('abort', () => {
|
|
201
202
|
this.#publicPage.off('popup', popupHandler);
|
|
202
203
|
});
|
|
204
|
+
// CDP reports each new document the main frame commits, a reload or a
|
|
205
|
+
// back/forward cache restore included, with `Page.frameNavigated`, while
|
|
206
|
+
// a same-document navigation comes as `Page.navigatedWithinDocument`.
|
|
207
|
+
const frameNavigatedHandler = (event) => {
|
|
208
|
+
if (!event.frame.parentId) {
|
|
209
|
+
this.#loadedNewDocument = true;
|
|
210
|
+
}
|
|
211
|
+
};
|
|
212
|
+
const client = this.#page._client();
|
|
213
|
+
client.on('Page.frameNavigated', frameNavigatedHandler);
|
|
214
|
+
this.#abortController.signal.addEventListener('abort', () => {
|
|
215
|
+
client.off('Page.frameNavigated', frameNavigatedHandler);
|
|
216
|
+
});
|
|
203
217
|
// A scoped AbortController used to clean up navigation probe listeners.
|
|
204
218
|
// When aborted (either after navigation detection finishes or if this.#abortController
|
|
205
219
|
// aborts), it removes CDP navigation probe listeners and automatically
|
|
@@ -304,7 +318,7 @@ export class WaitForHelper {
|
|
|
304
318
|
#getResult() {
|
|
305
319
|
const urlAfterAction = this.#page.url();
|
|
306
320
|
return {
|
|
307
|
-
...(urlAfterAction !== this.#initialUrl
|
|
321
|
+
...(urlAfterAction !== this.#initialUrl || this.#loadedNewDocument
|
|
308
322
|
? { navigatedToUrl: urlAfterAction }
|
|
309
323
|
: {}),
|
|
310
324
|
dialogHandled: this.#dialogHandled,
|
|
@@ -30,7 +30,13 @@ export async function checkForUpdates(message) {
|
|
|
30
30
|
try {
|
|
31
31
|
stats = await fs.stat(cachePath);
|
|
32
32
|
const data = await fs.readFile(cachePath, 'utf8');
|
|
33
|
-
|
|
33
|
+
const version = JSON.parse(data).version;
|
|
34
|
+
// A cache entry that is not a valid version would make `semver.lt` throw
|
|
35
|
+
// before the refresh below runs, so every start would fail on the same
|
|
36
|
+
// file. Ignore such an entry and let the refresh replace it.
|
|
37
|
+
if (typeof version === 'string' && semver.valid(version)) {
|
|
38
|
+
cachedVersion = version;
|
|
39
|
+
}
|
|
34
40
|
}
|
|
35
41
|
catch {
|
|
36
42
|
// Ignore errors reading cache.
|
|
@@ -8,6 +8,9 @@ import { logger } from './logger.js';
|
|
|
8
8
|
export function getErrorMessage(err) {
|
|
9
9
|
return err instanceof Error ? err.message : String(err);
|
|
10
10
|
}
|
|
11
|
+
export function toError(err) {
|
|
12
|
+
return err instanceof Error ? err : new Error(String(err));
|
|
13
|
+
}
|
|
11
14
|
export function setupUnhandledRejectionHandler(onCrash) {
|
|
12
15
|
process.on('unhandledRejection', (reason, promise) => {
|
|
13
16
|
logger?.('Unhandled promise rejection:', promise, reason);
|
|
@@ -267,13 +267,10 @@ const validKeys = new Set([
|
|
|
267
267
|
export function isValidKey(key) {
|
|
268
268
|
return validKeys.has(key);
|
|
269
269
|
}
|
|
270
|
-
|
|
271
|
-
* Error message for a string that is not a valid key name.
|
|
272
|
-
*/
|
|
273
|
-
export function invalidKeyMessage(key) {
|
|
270
|
+
function invalidKeyMessage(key) {
|
|
274
271
|
return `${key} is invalid. Valid keys are: ${Array.from(validKeys.values()).join(',')}.`;
|
|
275
272
|
}
|
|
276
|
-
function throwIfInvalidKey(key) {
|
|
273
|
+
export function throwIfInvalidKey(key) {
|
|
277
274
|
if (isValidKey(key)) {
|
|
278
275
|
return key;
|
|
279
276
|
}
|
|
@@ -298,12 +295,13 @@ export function parseKey(keyInput) {
|
|
|
298
295
|
if (key) {
|
|
299
296
|
result.push(throwIfInvalidKey(key));
|
|
300
297
|
}
|
|
301
|
-
|
|
298
|
+
const primaryKey = result.at(-1);
|
|
299
|
+
if (primaryKey === undefined) {
|
|
302
300
|
throw new Error(`Key ${keyInput} could not be parsed.`);
|
|
303
301
|
}
|
|
304
302
|
if (new Set(result).size !== result.length) {
|
|
305
303
|
throw new Error(`Key ${keyInput} contains duplicate keys.`);
|
|
306
304
|
}
|
|
307
|
-
return [
|
|
305
|
+
return [primaryKey, ...result.slice(0, -1)];
|
|
308
306
|
}
|
|
309
307
|
//# sourceMappingURL=keyboard.js.map
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { URLPattern } from '../third_party/cli.js';
|
|
7
|
+
import { redactUrlForLogging } from './logger.js';
|
|
8
|
+
const CROSS_ORIGIN_REDIRECT_HEADERS = new Set([
|
|
9
|
+
'accept',
|
|
10
|
+
'accept-language',
|
|
11
|
+
'cache-control',
|
|
12
|
+
'origin',
|
|
13
|
+
'pragma',
|
|
14
|
+
'range',
|
|
15
|
+
'user-agent',
|
|
16
|
+
]);
|
|
17
|
+
export function getRedirectHeaders(sourceUrl, targetUrl, originalHeaders) {
|
|
18
|
+
const sameOrigin = sourceUrl.origin === targetUrl.origin;
|
|
19
|
+
const headers = {};
|
|
20
|
+
for (const [name, value] of Object.entries(originalHeaders)) {
|
|
21
|
+
const lowerName = name.toLowerCase();
|
|
22
|
+
if (lowerName === 'accept-encoding') {
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
if (sameOrigin || CROSS_ORIGIN_REDIRECT_HEADERS.has(lowerName)) {
|
|
26
|
+
headers[name] = value;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return headers;
|
|
30
|
+
}
|
|
31
|
+
export function validateUrlNotBlocked(url, blocklist) {
|
|
32
|
+
for (const block of blocklist ?? []) {
|
|
33
|
+
if (new URLPattern(block).test(url)) {
|
|
34
|
+
throw new Error('Blocked by blocklist: ' + redactUrlForLogging(url.href));
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
export function validateNetworkUrl(url, policy) {
|
|
39
|
+
if (url.protocol !== 'https:' && url.protocol !== 'http:') {
|
|
40
|
+
throw new Error('Unsupported URL protocol: ' + url.protocol);
|
|
41
|
+
}
|
|
42
|
+
validateUrlNotBlocked(url, policy.blockedUrlPattern);
|
|
43
|
+
if (policy.allowedUrlPattern &&
|
|
44
|
+
!policy.allowedUrlPattern.some(allow => new URLPattern(allow).test(url))) {
|
|
45
|
+
throw new Error('Not allowed by allowlist: ' + redactUrlForLogging(url.href));
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
export async function fetchWithValidatedRedirects(url, options) {
|
|
49
|
+
const redirectStatuses = new Set([301, 302, 303, 307, 308]);
|
|
50
|
+
const maxRedirects = 20;
|
|
51
|
+
let currentUrl = url;
|
|
52
|
+
let headers = options.headers
|
|
53
|
+
? Object.fromEntries(new Headers(options.headers))
|
|
54
|
+
: undefined;
|
|
55
|
+
for (let redirectCount = 0;; redirectCount++) {
|
|
56
|
+
validateNetworkUrl(currentUrl, options.policy);
|
|
57
|
+
const response = await fetch(currentUrl, {
|
|
58
|
+
redirect: 'manual',
|
|
59
|
+
...(options.method ? { method: options.method } : {}),
|
|
60
|
+
...(headers ? { headers } : {}),
|
|
61
|
+
});
|
|
62
|
+
if (!redirectStatuses.has(response.status)) {
|
|
63
|
+
return response;
|
|
64
|
+
}
|
|
65
|
+
const location = response.headers.get('location');
|
|
66
|
+
await response.body?.cancel();
|
|
67
|
+
if (!location) {
|
|
68
|
+
throw new Error('Redirect has no Location header: ' +
|
|
69
|
+
redactUrlForLogging(currentUrl.href));
|
|
70
|
+
}
|
|
71
|
+
if (redirectCount >= maxRedirects) {
|
|
72
|
+
throw new Error('Too many redirects loading resource: ' + redactUrlForLogging(url.href));
|
|
73
|
+
}
|
|
74
|
+
const nextUrl = new URL(location, currentUrl);
|
|
75
|
+
if (headers) {
|
|
76
|
+
headers = getRedirectHeaders(currentUrl, nextUrl, headers);
|
|
77
|
+
}
|
|
78
|
+
currentUrl = nextUrl;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=network.js.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
export function raceWithSignal(promise, signal) {
|
|
7
|
+
return new Promise((resolve, reject) => {
|
|
8
|
+
const onAbort = () => {
|
|
9
|
+
reject(signal.reason);
|
|
10
|
+
};
|
|
11
|
+
if (signal.aborted) {
|
|
12
|
+
onAbort();
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
signal.addEventListener('abort', onAbort, { once: true });
|
|
16
|
+
}
|
|
17
|
+
Promise.resolve(promise).then(value => {
|
|
18
|
+
signal.removeEventListener('abort', onAbort);
|
|
19
|
+
resolve(value);
|
|
20
|
+
}, error => {
|
|
21
|
+
signal.removeEventListener('abort', onAbort);
|
|
22
|
+
reject(error);
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=raceWithSignal.js.map
|