chrome-devtools-mcp 1.11.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 +73 -21
- package/{build → out/Default/gen}/src/BrowserManager.js +49 -18
- package/out/Default/gen/src/LogpointManager.js +307 -0
- package/{build → out/Default/gen}/src/McpContext.js +439 -133
- package/{build → out/Default/gen}/src/McpPage.js +368 -59
- package/{build → out/Default/gen}/src/McpResponse.js +90 -47
- package/out/Default/gen/src/NetworkOverrideManager.js +419 -0
- package/{build → out/Default/gen}/src/TextSnapshot.js +37 -18
- package/out/Default/gen/src/ToolHandler.js +512 -0
- package/{build → out/Default/gen}/src/bin/chrome-devtools-mcp-main.js +6 -4
- package/{build → out/Default/gen}/src/bin/chrome-devtools.js +4 -4
- package/{build → out/Default/gen}/src/collectors/PageCollector.js +28 -12
- package/{build → out/Default/gen}/src/collectors/ServiceWorkerCollector.js +2 -2
- package/out/Default/gen/src/collectors/constants.js +7 -0
- package/out/Default/gen/src/config/ConfigParser.js +162 -0
- package/{build → out/Default/gen}/src/config/ConfigWatcher.js +3 -2
- package/out/Default/gen/src/config/ServerConfig.js +251 -0
- package/{build → out/Default/gen}/src/config/browser-options.js +13 -4
- package/{build → out/Default/gen}/src/config/category-options.js +10 -0
- package/{build → out/Default/gen}/src/config/cli-options.js +223 -22
- package/{build → out/Default/gen}/src/config/mcp-options.js +62 -36
- package/{build → out/Default/gen}/src/config/puppeteer-options.js +4 -2
- package/{build → out/Default/gen}/src/daemon/client.js +3 -3
- package/{build → out/Default/gen}/src/daemon/daemon.js +7 -3
- package/{build → out/Default/gen}/src/daemon/utils.js +2 -1
- package/{build → out/Default/gen}/src/devtools/DevToolsCommentBridge.js +28 -5
- package/{build → out/Default/gen}/src/devtools/DevtoolsUtils.js +94 -20
- package/{build → out/Default/gen}/src/formatters/ConsoleFormatter.js +28 -1
- package/{build → out/Default/gen}/src/formatters/HeapSnapshotFormatter.js +14 -18
- package/out/Default/gen/src/formatters/LogpointFormatter.js +62 -0
- package/{build → out/Default/gen}/src/formatters/NetworkFormatter.js +70 -17
- package/out/Default/gen/src/formatters/NetworkOverridesFormatter.js +49 -0
- package/out/Default/gen/src/formatters/RemoteObjectFormatter.js +231 -0
- package/{build → out/Default/gen}/src/formatters/SnapshotFormatter.js +13 -3
- package/out/Default/gen/src/formatters/WebAuthnFormatter.js +56 -0
- package/out/Default/gen/src/index.js +435 -0
- package/out/Default/gen/src/processors/HeapSnapshotManager.js +569 -0
- package/{build → out/Default/gen}/src/telemetry/transformation.js +1 -1
- package/{build → out/Default/gen}/src/third_party/THIRD_PARTY_NOTICES +796 -712
- 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/out/Default/gen/src/third_party/lighthouse-devtools-mcp-bundle.js +60395 -0
- package/out/Default/gen/src/tools/ToolDefinition.js +180 -0
- package/{build → out/Default/gen}/src/tools/categories.js +4 -0
- package/{build → out/Default/gen}/src/tools/comments.js +46 -4
- package/{build → out/Default/gen}/src/tools/console.js +8 -6
- package/{build → out/Default/gen}/src/tools/css.js +1 -0
- package/{build → out/Default/gen}/src/tools/emulation.js +5 -4
- package/{build → out/Default/gen}/src/tools/extensions.js +6 -1
- package/{build → out/Default/gen}/src/tools/input.js +23 -28
- package/{build → out/Default/gen}/src/tools/lighthouse.js +30 -8
- package/out/Default/gen/src/tools/logpoints.js +51 -0
- package/{build → out/Default/gen}/src/tools/memory.js +59 -53
- package/out/Default/gen/src/tools/network.js +260 -0
- package/{build → out/Default/gen}/src/tools/pages.js +48 -6
- package/{build → out/Default/gen}/src/tools/performance.js +33 -7
- package/{build → out/Default/gen}/src/tools/pwa.js +7 -0
- package/{build → out/Default/gen}/src/tools/screencast.js +3 -1
- package/{build → out/Default/gen}/src/tools/screenshot.js +23 -7
- package/{build → out/Default/gen}/src/tools/script.js +38 -6
- package/{build → out/Default/gen}/src/tools/slim/tools.js +21 -5
- package/{build → out/Default/gen}/src/tools/snapshot.js +29 -5
- package/{build → out/Default/gen}/src/tools/thirdPartyDeveloper.js +6 -20
- 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 +5 -19
- package/out/Default/gen/src/utils/TaskRunner.js +151 -0
- package/{build → out/Default/gen}/src/utils/WaitForHelper.js +16 -2
- package/{build → out/Default/gen}/src/utils/bytes.js +2 -12
- package/{build → out/Default/gen}/src/utils/check-for-updates.js +8 -2
- package/out/Default/gen/src/utils/disclaimers.js +27 -0
- package/{build → out/Default/gen}/src/utils/errorHandling.js +3 -0
- package/{build → out/Default/gen}/src/utils/keyboard.js +15 -5
- package/out/Default/gen/src/utils/logger.js +131 -0
- package/out/Default/gen/src/utils/network.js +81 -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 +44 -0
- package/out/Default/gen/src/utils/timeout.js +14 -0
- package/{build → out/Default/gen}/src/utils/url.js +73 -17
- package/{build → out/Default/gen}/src/version.js +1 -1
- package/package.json +26 -32
- package/skills/a11y-debugging/SKILL.md +3 -8
- package/skills/chrome-devtools/SKILL.md +2 -0
- package/skills/chrome-devtools-cli/SKILL.md +12 -1
- package/build/src/ToolHandler.js +0 -360
- package/build/src/config/ConfigParser.js +0 -264
- package/build/src/index.js +0 -282
- package/build/src/processors/HeapSnapshotManager.js +0 -307
- package/build/src/third_party/bundled-packages.json +0 -11
- package/build/src/third_party/devtools-formatter-worker.js +0 -16625
- package/build/src/third_party/devtools-heap-snapshot-worker.js +0 -12084
- package/build/src/third_party/index.js +0 -189603
- package/build/src/third_party/lighthouse-devtools-mcp-bundle.js +0 -58435
- package/build/src/tools/ToolDefinition.js +0 -92
- package/build/src/tools/network.js +0 -128
- package/build/src/utils/logger.js +0 -62
- package/build/src/utils/text.js +0 -15
- /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/bin/check-latest-version.js +0 -0
- /package/{build → out/Default/gen}/src/bin/chrome-devtools-mcp.js +0 -0
- /package/{build → out/Default/gen}/src/config/ConfigLocator.js +0 -0
- /package/{build → out/Default/gen}/src/config/cli-commands.js +0 -0
- /package/{build → out/Default/gen}/src/config/tool-options.js +0 -0
- /package/{build → out/Default/gen}/src/daemon/types.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/CssFormatter.js +0 -0
- /package/{build → out/Default/gen}/src/formatters/IssueFormatter.js +0 -0
- /package/{build → out/Default/gen}/src/processors/ChunkedTraceParser.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/types.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/pagination.js +0 -0
- /package/{build → out/Default/gen}/src/utils/polyfill.js +0 -0
|
@@ -6,16 +6,16 @@
|
|
|
6
6
|
import { logger } from '../utils/logger.js';
|
|
7
7
|
const DEFAULT_DEBOUNCE_MS = 200;
|
|
8
8
|
/**
|
|
9
|
-
* Manages the
|
|
10
|
-
* and
|
|
9
|
+
* Manages the bridge between DevTools frontend comments and the MCP server.
|
|
10
|
+
* Comment events are debounced and delivered to callers that wait for them
|
|
11
|
+
* through `waitForCommentEvent`.
|
|
11
12
|
*/
|
|
12
13
|
export class DevToolsCommentBridge {
|
|
13
|
-
#onNotification;
|
|
14
14
|
#debounceMs;
|
|
15
15
|
#commentDebounceTimer;
|
|
16
16
|
#attachedPages = new Set();
|
|
17
|
+
#commentWaiters = new Set();
|
|
17
18
|
constructor(options) {
|
|
18
|
-
this.#onNotification = options?.onNotification;
|
|
19
19
|
this.#debounceMs = options?.debounceMs ?? DEFAULT_DEBOUNCE_MS;
|
|
20
20
|
}
|
|
21
21
|
isAttached(devtoolsPage) {
|
|
@@ -90,19 +90,42 @@ export class DevToolsCommentBridge {
|
|
|
90
90
|
return window.universe?.cd4aBridge?.getCommentThreads() ?? [];
|
|
91
91
|
});
|
|
92
92
|
}
|
|
93
|
+
/**
|
|
94
|
+
* Resolves `true` on the next debounced comment event, or `false` when
|
|
95
|
+
* `timeoutMs` elapses or the bridge is disposed first.
|
|
96
|
+
*/
|
|
97
|
+
waitForCommentEvent(timeoutMs) {
|
|
98
|
+
return new Promise(resolve => {
|
|
99
|
+
const settle = (changed) => {
|
|
100
|
+
clearTimeout(timer);
|
|
101
|
+
this.#commentWaiters.delete(settle);
|
|
102
|
+
resolve(changed);
|
|
103
|
+
};
|
|
104
|
+
const timer = setTimeout(() => {
|
|
105
|
+
settle(false);
|
|
106
|
+
}, timeoutMs);
|
|
107
|
+
this.#commentWaiters.add(settle);
|
|
108
|
+
});
|
|
109
|
+
}
|
|
93
110
|
#handleCommentEvent() {
|
|
94
111
|
if (this.#commentDebounceTimer) {
|
|
95
112
|
clearTimeout(this.#commentDebounceTimer);
|
|
96
113
|
}
|
|
97
114
|
this.#commentDebounceTimer = setTimeout(() => {
|
|
98
|
-
this.#
|
|
115
|
+
this.#notifyCommentWaiters(true);
|
|
99
116
|
}, this.#debounceMs);
|
|
100
117
|
}
|
|
118
|
+
#notifyCommentWaiters(changed) {
|
|
119
|
+
for (const waiter of [...this.#commentWaiters]) {
|
|
120
|
+
waiter(changed);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
101
123
|
dispose() {
|
|
102
124
|
if (this.#commentDebounceTimer) {
|
|
103
125
|
clearTimeout(this.#commentDebounceTimer);
|
|
104
126
|
this.#commentDebounceTimer = undefined;
|
|
105
127
|
}
|
|
128
|
+
this.#notifyCommentWaiters(false);
|
|
106
129
|
for (const page of this.#attachedPages) {
|
|
107
130
|
try {
|
|
108
131
|
const result = page.evaluate(() => {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright 2025 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import { DevTools } from '../third_party/index.js';
|
|
6
|
+
import { DevTools, } from '../third_party/index.js';
|
|
7
7
|
import { McpHostBindingAdapter } from './McpHostBindingAdapter.js';
|
|
8
8
|
/**
|
|
9
9
|
* A mock implementation of an issues manager that only implements the methods
|
|
@@ -135,6 +135,12 @@ const DISABLE_NETWORK = {
|
|
|
135
135
|
// Do nothing.
|
|
136
136
|
},
|
|
137
137
|
};
|
|
138
|
+
/**
|
|
139
|
+
* Maximum number of `cause` links resolved for one error. A page can create a
|
|
140
|
+
* cyclic chain (`error.cause = error`), and CDP returns a new object id on
|
|
141
|
+
* every lookup of the same object, so a cycle cannot be detected by id.
|
|
142
|
+
*/
|
|
143
|
+
const MAX_CAUSE_DEPTH = 10;
|
|
138
144
|
/**
|
|
139
145
|
* Constructed from Runtime.ExceptionDetails of an uncaught error.
|
|
140
146
|
*
|
|
@@ -152,15 +158,18 @@ export class SymbolizedError {
|
|
|
152
158
|
this.cause = cause;
|
|
153
159
|
}
|
|
154
160
|
static async fromDetails(opts) {
|
|
161
|
+
return await SymbolizedError.#fromDetails(opts, 0);
|
|
162
|
+
}
|
|
163
|
+
static async #fromDetails(opts, causeDepth) {
|
|
155
164
|
const message = SymbolizedError.#getMessage(opts.details);
|
|
156
|
-
if (!opts.includeStackAndCause || !opts.devTools) {
|
|
165
|
+
if (!opts.includeStackAndCause || (!opts.devTools && !opts.session)) {
|
|
157
166
|
return new SymbolizedError(message, opts.resolvedStackTraceForTesting, opts.resolvedCauseForTesting);
|
|
158
167
|
}
|
|
159
168
|
let stackTrace;
|
|
160
169
|
if (opts.resolvedStackTraceForTesting) {
|
|
161
170
|
stackTrace = opts.resolvedStackTraceForTesting;
|
|
162
171
|
}
|
|
163
|
-
else if (opts.details.stackTrace) {
|
|
172
|
+
else if (opts.devTools && opts.details.stackTrace) {
|
|
164
173
|
try {
|
|
165
174
|
stackTrace = await createStackTrace(opts.devTools, opts.details.stackTrace, opts.targetId);
|
|
166
175
|
}
|
|
@@ -174,15 +183,16 @@ export class SymbolizedError {
|
|
|
174
183
|
if (opts.resolvedCauseForTesting) {
|
|
175
184
|
cause = opts.resolvedCauseForTesting;
|
|
176
185
|
}
|
|
177
|
-
else if (opts.details.exception) {
|
|
186
|
+
else if (opts.details.exception && causeDepth < MAX_CAUSE_DEPTH) {
|
|
178
187
|
try {
|
|
179
|
-
const causeRemoteObj = await SymbolizedError.#lookupCause(opts.devTools, opts.details.exception, opts.targetId);
|
|
188
|
+
const causeRemoteObj = await SymbolizedError.#lookupCause(opts.devTools, opts.details.exception, opts.targetId, opts.session);
|
|
180
189
|
if (causeRemoteObj) {
|
|
181
|
-
cause = await SymbolizedError
|
|
190
|
+
cause = await SymbolizedError.#fromError({
|
|
182
191
|
devTools: opts.devTools,
|
|
183
192
|
error: causeRemoteObj,
|
|
184
193
|
targetId: opts.targetId,
|
|
185
|
-
|
|
194
|
+
session: opts.session,
|
|
195
|
+
}, causeDepth + 1);
|
|
186
196
|
}
|
|
187
197
|
}
|
|
188
198
|
catch {
|
|
@@ -192,14 +202,18 @@ export class SymbolizedError {
|
|
|
192
202
|
return new SymbolizedError(message, stackTrace, cause);
|
|
193
203
|
}
|
|
194
204
|
static async fromError(opts) {
|
|
195
|
-
|
|
205
|
+
return await SymbolizedError.#fromError(opts, 0);
|
|
206
|
+
}
|
|
207
|
+
static async #fromError(opts, causeDepth) {
|
|
208
|
+
const details = await SymbolizedError.#getExceptionDetails(opts.devTools, opts.error, opts.targetId, opts.session);
|
|
196
209
|
if (details) {
|
|
197
|
-
return await SymbolizedError
|
|
210
|
+
return await SymbolizedError.#fromDetails({
|
|
198
211
|
details,
|
|
199
212
|
devTools: opts.devTools,
|
|
200
213
|
targetId: opts.targetId,
|
|
214
|
+
session: opts.session,
|
|
201
215
|
includeStackAndCause: true,
|
|
202
|
-
});
|
|
216
|
+
}, causeDepth);
|
|
203
217
|
}
|
|
204
218
|
return new SymbolizedError(SymbolizedError.#getMessageFromException(opts.error));
|
|
205
219
|
}
|
|
@@ -207,18 +221,41 @@ export class SymbolizedError {
|
|
|
207
221
|
// For Runtime.exceptionThrown with a present exception object, `details.text` will be "Uncaught" and
|
|
208
222
|
// we have to manually parse out the error text from the exception description.
|
|
209
223
|
// In the case of Runtime.getExceptionDetails, `details.text` has the Error.message.
|
|
210
|
-
|
|
211
|
-
|
|
224
|
+
// Unhandled promise rejections work the same way, with
|
|
225
|
+
// "Uncaught (in promise)" as `details.text` and the rejection reason as
|
|
226
|
+
// the exception.
|
|
227
|
+
if ((details.text === 'Uncaught' ||
|
|
228
|
+
details.text === 'Uncaught (in promise)') &&
|
|
229
|
+
details.exception) {
|
|
230
|
+
return (details.text +
|
|
231
|
+
' ' +
|
|
212
232
|
SymbolizedError.#getMessageFromException(details.exception));
|
|
213
233
|
}
|
|
214
234
|
return details.text;
|
|
215
235
|
}
|
|
216
236
|
static #getMessageFromException(error) {
|
|
217
|
-
|
|
237
|
+
if (error.description === undefined) {
|
|
238
|
+
// Primitive values, e.g. `Promise.reject('reason')`, have no description.
|
|
239
|
+
if (error.unserializableValue !== undefined) {
|
|
240
|
+
return error.unserializableValue;
|
|
241
|
+
}
|
|
242
|
+
return error.value === undefined ? '' : String(error.value);
|
|
243
|
+
}
|
|
244
|
+
const messageWithRest = error.description.split('\n at ', 2);
|
|
218
245
|
return messageWithRest[0] ?? '';
|
|
219
246
|
}
|
|
220
|
-
static async #getExceptionDetails(devTools, error, targetId) {
|
|
221
|
-
if (
|
|
247
|
+
static async #getExceptionDetails(devTools, error, targetId, session) {
|
|
248
|
+
if (error.type !== 'object' && error.subtype !== 'error') {
|
|
249
|
+
return null;
|
|
250
|
+
}
|
|
251
|
+
if (session) {
|
|
252
|
+
if (!error.objectId) {
|
|
253
|
+
return null;
|
|
254
|
+
}
|
|
255
|
+
const { exceptionDetails } = await session.send('Runtime.getExceptionDetails', { errorObjectId: error.objectId });
|
|
256
|
+
return exceptionDetails ?? null;
|
|
257
|
+
}
|
|
258
|
+
if (!devTools) {
|
|
222
259
|
return null;
|
|
223
260
|
}
|
|
224
261
|
const targetManager = devTools.universe.context.get(DevTools.TargetManager);
|
|
@@ -228,8 +265,20 @@ export class SymbolizedError {
|
|
|
228
265
|
const model = target.model(DevTools.RuntimeModel);
|
|
229
266
|
return ((await model.getExceptionDetails(error.objectId)) ?? null);
|
|
230
267
|
}
|
|
231
|
-
static async #lookupCause(devTools, error, targetId) {
|
|
232
|
-
if (
|
|
268
|
+
static async #lookupCause(devTools, error, targetId, session) {
|
|
269
|
+
if (error.type !== 'object' && error.subtype !== 'error') {
|
|
270
|
+
return null;
|
|
271
|
+
}
|
|
272
|
+
if (session) {
|
|
273
|
+
if (!error.objectId) {
|
|
274
|
+
return null;
|
|
275
|
+
}
|
|
276
|
+
const { result } = await session.send('Runtime.getProperties', {
|
|
277
|
+
objectId: error.objectId,
|
|
278
|
+
});
|
|
279
|
+
return result.find(prop => prop.name === 'cause')?.value ?? null;
|
|
280
|
+
}
|
|
281
|
+
if (!devTools) {
|
|
233
282
|
return null;
|
|
234
283
|
}
|
|
235
284
|
const targetManager = devTools.universe.context.get(DevTools.TargetManager);
|
|
@@ -277,13 +326,38 @@ export async function createStackTrace(devTools, rawStackTrace, targetId) {
|
|
|
277
326
|
}
|
|
278
327
|
}
|
|
279
328
|
const signal = AbortSignal.timeout(1_000);
|
|
280
|
-
await Promise.all([...scriptIds].map(id => waitForScript(model, id, signal)
|
|
281
|
-
|
|
282
|
-
.catch()));
|
|
329
|
+
const scripts = await Promise.all([...scriptIds].map(id => waitForScript(model, id, signal)));
|
|
330
|
+
await waitForSourceMaps(model, scripts, signal);
|
|
283
331
|
const binding = devTools.universe.context.get(DevTools.DebuggerWorkspaceBinding);
|
|
284
332
|
// DevTools uses branded types for ScriptId and others. Casting the puppeteer protocol type to the DevTools protocol type is safe.
|
|
285
333
|
return await binding.createStackTraceFromProtocolRuntime(rawStackTrace, target);
|
|
286
334
|
}
|
|
335
|
+
/**
|
|
336
|
+
* Waits for the source maps of `scripts` to load, so that their original
|
|
337
|
+
* sources are in the workspace. Scripts without a source map are skipped.
|
|
338
|
+
* Non-trivial pages have hundreds of source maps, so the wait ends when
|
|
339
|
+
* `signal` aborts; loads still pending then continue in the background and
|
|
340
|
+
* resolve later.
|
|
341
|
+
*/
|
|
342
|
+
export async function waitForSourceMaps(model, scripts, signal) {
|
|
343
|
+
const manager = model.sourceMapManager();
|
|
344
|
+
const aborted = new Promise(resolve => {
|
|
345
|
+
if (signal.aborted) {
|
|
346
|
+
resolve();
|
|
347
|
+
return;
|
|
348
|
+
}
|
|
349
|
+
signal.addEventListener('abort', () => resolve(), { once: true });
|
|
350
|
+
});
|
|
351
|
+
await Promise.all([...scripts].map(script => {
|
|
352
|
+
if (!script.sourceMapURL) {
|
|
353
|
+
return undefined;
|
|
354
|
+
}
|
|
355
|
+
return Promise.race([
|
|
356
|
+
manager.sourceMapForClientPromise(script).then(() => undefined),
|
|
357
|
+
aborted,
|
|
358
|
+
]);
|
|
359
|
+
}));
|
|
360
|
+
}
|
|
287
361
|
// Waits indefinitely for the script so pair it with Promise.race.
|
|
288
362
|
async function waitForScript(model, scriptId, signal) {
|
|
289
363
|
while (true) {
|
|
@@ -6,6 +6,19 @@
|
|
|
6
6
|
import { createStackTraceForConsoleMessage, SymbolizedError, } from '../devtools/DevtoolsUtils.js';
|
|
7
7
|
import { UncaughtError } from '../collectors/PageCollector.js';
|
|
8
8
|
import * as DevTools from '../third_party/index.js';
|
|
9
|
+
import { formatRemoteObject } from './RemoteObjectFormatter.js';
|
|
10
|
+
// JSON.stringify prints Map, Set, functions and DOM nodes as `{}`, and throws
|
|
11
|
+
// on symbols and cyclic objects. Those are formatted from their preview.
|
|
12
|
+
function isJsonLike(remoteObject) {
|
|
13
|
+
if (remoteObject.type === 'object') {
|
|
14
|
+
return (remoteObject.subtype === undefined ||
|
|
15
|
+
remoteObject.subtype === 'array' ||
|
|
16
|
+
remoteObject.subtype === 'null');
|
|
17
|
+
}
|
|
18
|
+
return (remoteObject.type !== 'function' &&
|
|
19
|
+
remoteObject.type !== 'symbol' &&
|
|
20
|
+
remoteObject.type !== 'bigint');
|
|
21
|
+
}
|
|
9
22
|
export class ConsoleFormatter {
|
|
10
23
|
#id;
|
|
11
24
|
#type;
|
|
@@ -47,6 +60,7 @@ export class ConsoleFormatter {
|
|
|
47
60
|
devTools: options?.devTools,
|
|
48
61
|
details: msg.details,
|
|
49
62
|
targetId: msg.targetId,
|
|
63
|
+
session: msg.session,
|
|
50
64
|
includeStackAndCause: options?.fetchDetailedData || options?.fetchStackTrace,
|
|
51
65
|
resolvedStackTraceForTesting: options?.resolvedStackTraceForTesting,
|
|
52
66
|
resolvedCauseForTesting: options?.resolvedCauseForTesting,
|
|
@@ -78,7 +92,20 @@ export class ConsoleFormatter {
|
|
|
78
92
|
targetId: msg._targetId(),
|
|
79
93
|
});
|
|
80
94
|
}
|
|
81
|
-
|
|
95
|
+
if (!isJsonLike(remoteObject)) {
|
|
96
|
+
return formatRemoteObject(remoteObject);
|
|
97
|
+
}
|
|
98
|
+
try {
|
|
99
|
+
return await arg.jsonValue();
|
|
100
|
+
}
|
|
101
|
+
catch (error) {
|
|
102
|
+
// JSON can't represent the value (for example, a cyclic object)
|
|
103
|
+
// or the page is gone; the preview still describes it.
|
|
104
|
+
if (remoteObject.preview) {
|
|
105
|
+
return formatRemoteObject(remoteObject);
|
|
106
|
+
}
|
|
107
|
+
throw error;
|
|
108
|
+
}
|
|
82
109
|
}
|
|
83
110
|
catch {
|
|
84
111
|
return `<error: Argument ${i} is no longer available>`;
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
import { DevTools } from '../third_party/index.js';
|
|
7
|
+
import { truncateText } from '../utils/text.js';
|
|
7
8
|
const { formatBytesToKb } = DevTools.I18n.ByteUtilities;
|
|
8
9
|
export const MAX_NAME_LENGTH = 100;
|
|
9
10
|
/**
|
|
@@ -19,10 +20,7 @@ export function formatName(name, options) {
|
|
|
19
20
|
* Truncates `value` to `maxLength`, appending an ellipsis if it was cut off.
|
|
20
21
|
*/
|
|
21
22
|
function truncateValue(value, maxLength = MAX_NAME_LENGTH) {
|
|
22
|
-
|
|
23
|
-
return value;
|
|
24
|
-
}
|
|
25
|
-
return value.slice(0, maxLength) + '...';
|
|
23
|
+
return truncateText(value, maxLength);
|
|
26
24
|
}
|
|
27
25
|
/**
|
|
28
26
|
* Flattens the analysis into the contexts matching `options`, ranked descending
|
|
@@ -153,21 +151,16 @@ export class HeapSnapshotFormatter {
|
|
|
153
151
|
return lines.join('\n');
|
|
154
152
|
}
|
|
155
153
|
static formatDiffTotals(totals) {
|
|
156
|
-
return `Total:
|
|
154
|
+
return `Total: ${formatDiffCounts(totals)}`;
|
|
157
155
|
}
|
|
158
|
-
static
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
const
|
|
163
|
-
const
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
for (let i = 0; i < addedIds.length; i++) {
|
|
167
|
-
lines.push(` + @${addedIds[i]} (self_size: ${formatBytesToKb(addedSelfSizes[i])})`);
|
|
168
|
-
}
|
|
169
|
-
for (let i = 0; i < deletedIds.length; i++) {
|
|
170
|
-
lines.push(` - @${deletedIds[i]} (self_size: ${formatBytesToKb(deletedSelfSizes[i])})`);
|
|
156
|
+
static formatDetailedClassDiffHeader(diff, options) {
|
|
157
|
+
return `${formatName(diff.className, options)}: ${formatDiffCounts(diff)}`;
|
|
158
|
+
}
|
|
159
|
+
static formatDetailedClassDiffObjects(objects) {
|
|
160
|
+
const lines = ['Objects:'];
|
|
161
|
+
for (const object of objects) {
|
|
162
|
+
const sign = object.change === 'added' ? '+' : '-';
|
|
163
|
+
lines.push(` ${sign} @${object.id} (self_size: ${formatBytesToKb(object.selfSize)})`);
|
|
171
164
|
}
|
|
172
165
|
return lines.join('\n');
|
|
173
166
|
}
|
|
@@ -240,4 +233,7 @@ function formatSignedSize(bytes) {
|
|
|
240
233
|
const formatted = formatBytesToKb(bytes);
|
|
241
234
|
return bytes > 0 ? `+${formatted}` : formatted;
|
|
242
235
|
}
|
|
236
|
+
function formatDiffCounts(counts) {
|
|
237
|
+
return `# new: ${counts.addedCount}, # deleted: ${counts.removedCount}, # delta: ${formatSignedCount(counts.countDelta)}, alloc size: ${formatSignedSize(counts.addedSize)}, freed size: ${formatSignedSize(counts.removedSize)}, size delta: ${formatSignedSize(counts.sizeDelta)}`;
|
|
238
|
+
}
|
|
243
239
|
//# sourceMappingURL=HeapSnapshotFormatter.js.map
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
function formatLocation(url, lineNumber, columnNumber) {
|
|
7
|
+
return `${url}:${lineNumber}${columnNumber === undefined ? '' : `:${columnNumber}`}`;
|
|
8
|
+
}
|
|
9
|
+
function formatLogpoint(logpoint) {
|
|
10
|
+
const location = formatLocation(logpoint.url, logpoint.lineNumber, logpoint.columnNumber);
|
|
11
|
+
let status;
|
|
12
|
+
if (logpoint.generatedLocations.length === 0) {
|
|
13
|
+
status = 'not bound (no parsed script contains the location)';
|
|
14
|
+
}
|
|
15
|
+
else if (logpoint.sourceMapped) {
|
|
16
|
+
status = `bound via source map at ${logpoint.generatedLocations
|
|
17
|
+
.map(generated => {
|
|
18
|
+
return formatLocation(generated.url, generated.lineNumber, generated.columnNumber);
|
|
19
|
+
})
|
|
20
|
+
.join(', ')}`;
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
status = 'bound';
|
|
24
|
+
}
|
|
25
|
+
return `- ${location} logging \`${logpoint.expression}\` [${status}]`;
|
|
26
|
+
}
|
|
27
|
+
function formatLogpoints(logpoints) {
|
|
28
|
+
if (logpoints.length === 0) {
|
|
29
|
+
return 'No logpoints are set on the page.';
|
|
30
|
+
}
|
|
31
|
+
const lines = [`${logpoints.length} logpoint(s) set on the page:`];
|
|
32
|
+
for (const logpoint of logpoints) {
|
|
33
|
+
lines.push(formatLogpoint(logpoint));
|
|
34
|
+
}
|
|
35
|
+
return lines.join('\n');
|
|
36
|
+
}
|
|
37
|
+
export class LogpointFormatter {
|
|
38
|
+
#logpoints;
|
|
39
|
+
constructor(logpoints) {
|
|
40
|
+
this.#logpoints = logpoints.map(logpoint => {
|
|
41
|
+
return {
|
|
42
|
+
url: logpoint.url,
|
|
43
|
+
lineNumber: logpoint.lineNumber,
|
|
44
|
+
...(logpoint.columnNumber === undefined
|
|
45
|
+
? {}
|
|
46
|
+
: { columnNumber: logpoint.columnNumber }),
|
|
47
|
+
expression: logpoint.expression,
|
|
48
|
+
sourceMapped: logpoint.sourceMapped,
|
|
49
|
+
generatedLocations: logpoint.generatedLocations.map(generated => {
|
|
50
|
+
return { ...generated };
|
|
51
|
+
}),
|
|
52
|
+
};
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
toJSON() {
|
|
56
|
+
return [...this.#logpoints];
|
|
57
|
+
}
|
|
58
|
+
toString() {
|
|
59
|
+
return formatLogpoints(this.toJSON());
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=LogpointFormatter.js.map
|
|
@@ -5,8 +5,25 @@
|
|
|
5
5
|
* */
|
|
6
6
|
import { isUtf8 } from 'node:buffer';
|
|
7
7
|
import { DevTools, } from '../third_party/index.js';
|
|
8
|
+
import { truncateText, truncateUrl } from '../utils/text.js';
|
|
8
9
|
const BODY_CONTEXT_SIZE_LIMIT = 10000;
|
|
9
|
-
|
|
10
|
+
/**
|
|
11
|
+
* How long to wait for a response body. Puppeteer reads a body only after the
|
|
12
|
+
* response finished loading, with no timeout of its own, and a response that
|
|
13
|
+
* never finishes (e.g. a `Cache-Control: no-store` response the page did not
|
|
14
|
+
* read) would otherwise hold the tool mutex forever.
|
|
15
|
+
*/
|
|
16
|
+
export const RESPONSE_BODY_TIMEOUT_MS = 5000;
|
|
17
|
+
class ResponseBodyTimeoutError extends Error {
|
|
18
|
+
timeout;
|
|
19
|
+
constructor(timeout) {
|
|
20
|
+
super(`Response body timed out after ${timeout} ms`);
|
|
21
|
+
this.timeout = timeout;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
function responseBodyTimeoutMessage(error) {
|
|
25
|
+
return `<Response body not available: the response did not finish loading within ${error.timeout} ms>`;
|
|
26
|
+
}
|
|
10
27
|
export class NetworkFormatter {
|
|
11
28
|
#request;
|
|
12
29
|
#options;
|
|
@@ -41,8 +58,22 @@ export class NetworkFormatter {
|
|
|
41
58
|
if (!this.#options.saveFile) {
|
|
42
59
|
throw new Error('Unable to save the request body to a file: no saveFile callback was configured.');
|
|
43
60
|
}
|
|
44
|
-
|
|
45
|
-
|
|
61
|
+
// postData() is UTF-8 decoded, so binary bodies lose bytes; content()
|
|
62
|
+
// returns the raw bytes.
|
|
63
|
+
let bytes;
|
|
64
|
+
try {
|
|
65
|
+
bytes = await this.#request.content();
|
|
66
|
+
}
|
|
67
|
+
catch {
|
|
68
|
+
// Fall back to the decoded string below.
|
|
69
|
+
}
|
|
70
|
+
const body = bytes?.length
|
|
71
|
+
? bytes
|
|
72
|
+
: data
|
|
73
|
+
? Buffer.from(data)
|
|
74
|
+
: undefined;
|
|
75
|
+
if (body) {
|
|
76
|
+
const result = await this.#options.saveFile(body, this.#options.requestFilePath, '.network-request');
|
|
46
77
|
this.#requestBodyFilePath = result.filename;
|
|
47
78
|
}
|
|
48
79
|
else {
|
|
@@ -63,10 +94,13 @@ export class NetworkFormatter {
|
|
|
63
94
|
if (this.#options.responseFilePath) {
|
|
64
95
|
let buffer;
|
|
65
96
|
try {
|
|
66
|
-
buffer = await response
|
|
97
|
+
buffer = await this.#readResponseBody(response);
|
|
67
98
|
}
|
|
68
|
-
catch {
|
|
69
|
-
|
|
99
|
+
catch (error) {
|
|
100
|
+
this.#responseBody =
|
|
101
|
+
error instanceof ResponseBodyTimeoutError
|
|
102
|
+
? responseBodyTimeoutMessage(error)
|
|
103
|
+
: responseBodyNotAvailableMessage;
|
|
70
104
|
}
|
|
71
105
|
if (buffer) {
|
|
72
106
|
if (!this.#options.saveFile) {
|
|
@@ -75,9 +109,6 @@ export class NetworkFormatter {
|
|
|
75
109
|
const result = await this.#options.saveFile(buffer, this.#options.responseFilePath, '.network-response');
|
|
76
110
|
this.#responseBodyFilePath = result.filename;
|
|
77
111
|
}
|
|
78
|
-
else {
|
|
79
|
-
this.#responseBody = responseBodyNotAvailableMessage;
|
|
80
|
-
}
|
|
81
112
|
}
|
|
82
113
|
else {
|
|
83
114
|
this.#responseBody = await this.#getFormattedResponseBody(response, BODY_CONTEXT_SIZE_LIMIT);
|
|
@@ -110,7 +141,12 @@ export class NetworkFormatter {
|
|
|
110
141
|
}, {});
|
|
111
142
|
}
|
|
112
143
|
toJSONDetailed() {
|
|
113
|
-
|
|
144
|
+
// Puppeteer shares one redirect chain array between all hops of a
|
|
145
|
+
// redirect, so earlier hops also list themselves and the hops after them.
|
|
146
|
+
// Keep only the requests that redirected to this one.
|
|
147
|
+
const fullChain = this.#request.redirectChain();
|
|
148
|
+
const ownIndex = fullChain.indexOf(this.#request);
|
|
149
|
+
const redirectChain = ownIndex === -1 ? fullChain : fullChain.slice(0, ownIndex);
|
|
114
150
|
const formattedRedirectChain = redirectChain.reverse().map(request => {
|
|
115
151
|
const id = this.#options.requestIdResolver
|
|
116
152
|
? this.#options.requestIdResolver(request)
|
|
@@ -158,7 +194,7 @@ export class NetworkFormatter {
|
|
|
158
194
|
}
|
|
159
195
|
async #getFormattedResponseBody(httpResponse, sizeLimit = BODY_CONTEXT_SIZE_LIMIT) {
|
|
160
196
|
try {
|
|
161
|
-
const responseBuffer = await httpResponse
|
|
197
|
+
const responseBuffer = await this.#readResponseBody(httpResponse);
|
|
162
198
|
if (isUtf8(responseBuffer)) {
|
|
163
199
|
const responseAsTest = responseBuffer.toString('utf-8');
|
|
164
200
|
if (responseAsTest.length === 0) {
|
|
@@ -168,21 +204,38 @@ export class NetworkFormatter {
|
|
|
168
204
|
}
|
|
169
205
|
return '<binary data>';
|
|
170
206
|
}
|
|
171
|
-
catch {
|
|
207
|
+
catch (error) {
|
|
208
|
+
if (error instanceof ResponseBodyTimeoutError) {
|
|
209
|
+
return responseBodyTimeoutMessage(error);
|
|
210
|
+
}
|
|
172
211
|
return '<not available anymore>';
|
|
173
212
|
}
|
|
174
213
|
}
|
|
214
|
+
async #readResponseBody(httpResponse) {
|
|
215
|
+
const timeout = this.#options.responseBodyTimeout ?? RESPONSE_BODY_TIMEOUT_MS;
|
|
216
|
+
let timeoutId;
|
|
217
|
+
try {
|
|
218
|
+
return await Promise.race([
|
|
219
|
+
httpResponse.buffer(),
|
|
220
|
+
new Promise((_, reject) => {
|
|
221
|
+
timeoutId = setTimeout(() => {
|
|
222
|
+
reject(new ResponseBodyTimeoutError(timeout));
|
|
223
|
+
}, timeout);
|
|
224
|
+
}),
|
|
225
|
+
]);
|
|
226
|
+
}
|
|
227
|
+
finally {
|
|
228
|
+
clearTimeout(timeoutId);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
175
231
|
}
|
|
176
232
|
function getSizeLimitedString(text, sizeLimit) {
|
|
177
|
-
|
|
178
|
-
return text.substring(0, sizeLimit) + '... <truncated>';
|
|
179
|
-
}
|
|
180
|
-
return text;
|
|
233
|
+
return truncateText(text, sizeLimit, { ellipsis: '... <truncated>' });
|
|
181
234
|
}
|
|
182
235
|
function convertNetworkRequestConciseToString(data) {
|
|
183
236
|
// Long URLs (e.g., data: URLs) bloat the concise list output. The full URL
|
|
184
237
|
// remains available via the detailed view and the structured content.
|
|
185
|
-
const url =
|
|
238
|
+
const url = truncateUrl(data.url);
|
|
186
239
|
return `reqid=${data.requestId} ${data.method} ${url} [${data.status}]${data.selectedInDevToolsUI ? ` [selected in the DevTools Network panel]` : ''}`;
|
|
187
240
|
}
|
|
188
241
|
function formatHeaders(headers) {
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
const MEASUREMENT_WARNING = 'Network mocks disable the page HTTP cache and intercept every request. ' +
|
|
7
|
+
'Replacement resources use altered delivery paths; these timings do not ' +
|
|
8
|
+
'represent normal production loading. Compare baseline and candidate using ' +
|
|
9
|
+
'the same mock mechanism, cache policy, and throttling.';
|
|
10
|
+
export class NetworkOverridesFormatter {
|
|
11
|
+
overrides;
|
|
12
|
+
constructor(overrides) {
|
|
13
|
+
this.overrides = overrides;
|
|
14
|
+
}
|
|
15
|
+
toJSON() {
|
|
16
|
+
return {
|
|
17
|
+
overrides: this.overrides,
|
|
18
|
+
...(this.overrides.length > 0 ? { warning: MEASUREMENT_WARNING } : {}),
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
toString() {
|
|
22
|
+
const { overrides, warning } = this.toJSON();
|
|
23
|
+
if (!warning) {
|
|
24
|
+
return '';
|
|
25
|
+
}
|
|
26
|
+
const lines = [warning];
|
|
27
|
+
for (const override of overrides) {
|
|
28
|
+
const source = override.kind === 'file'
|
|
29
|
+
? override.responseFilePath + ' (' + override.contentType + ')'
|
|
30
|
+
: override.upstreamUrl;
|
|
31
|
+
const resourceType = override.resourceType
|
|
32
|
+
? ' [' + override.resourceType + ']'
|
|
33
|
+
: '';
|
|
34
|
+
lines.push(override.urlPattern + resourceType + ' -> ' + source);
|
|
35
|
+
const { hits, errors, navigations, lastError } = override.diagnostics;
|
|
36
|
+
lines.push(' Since configured: ' + hits + ' hits, ' + errors + ' errors.');
|
|
37
|
+
if (lastError) {
|
|
38
|
+
lines.push(' Last error: ' + lastError);
|
|
39
|
+
}
|
|
40
|
+
if (hits === 0) {
|
|
41
|
+
lines.push(navigations > 0
|
|
42
|
+
? ' Warning: no requests matched after navigation. Check the full-URL pattern, resource type, and service worker.'
|
|
43
|
+
: ' No matches yet. Navigate or reload to verify this rule.');
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return lines.join('\n');
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=NetworkOverridesFormatter.js.map
|