chrome-devtools-mcp 1.6.0 → 1.8.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 -22
- package/build/src/McpContext.js +121 -44
- package/build/src/McpPage.js +230 -14
- package/build/src/McpResponse.js +209 -283
- package/build/src/SlimMcpResponse.js +1 -1
- package/build/src/TextSnapshot.js +80 -19
- package/build/src/ToolHandler.js +80 -15
- package/build/src/bin/chrome-devtools-mcp-main.js +3 -3
- package/build/src/bin/chrome-devtools.js +47 -32
- package/build/src/browser.js +3 -1
- package/build/src/{PageCollector.js → collectors/PageCollector.js} +15 -10
- package/build/src/{ServiceWorkerCollector.js → collectors/ServiceWorkerCollector.js} +1 -1
- package/build/src/{bin/chrome-devtools-cli-options.js → config/cli-options.js} +414 -23
- package/build/src/{bin/chrome-devtools-mcp-cli-options.js → config/mcp-options.js} +74 -9
- package/build/src/daemon/client.js +33 -2
- package/build/src/daemon/daemon.js +17 -13
- package/build/src/daemon/utils.js +18 -3
- package/build/src/devtools/DevtoolsUtils.js +9 -16
- package/build/src/formatters/ConsoleFormatter.js +43 -10
- package/build/src/formatters/HeapSnapshotFormatter.js +58 -13
- package/build/src/formatters/IssueFormatter.js +1 -1
- package/build/src/formatters/NetworkFormatter.js +7 -7
- package/build/src/index.js +34 -5
- package/build/src/{HeapSnapshotManager.js → processors/HeapSnapshotManager.js} +82 -27
- package/build/src/{trace-processing/parse.js → processors/PerformanceTrace.js} +1 -1
- package/build/src/telemetry/ClearcutLogger.js +16 -1
- package/build/src/telemetry/flagUtils.js +4 -3
- package/build/src/telemetry/transformation.js +30 -0
- package/build/src/telemetry/types.js +4 -0
- package/build/src/third_party/THIRD_PARTY_NOTICES +235 -113
- package/build/src/third_party/bundled-packages.json +6 -7
- package/build/src/third_party/devtools-formatter-worker.js +60 -19
- package/build/src/third_party/devtools-heap-snapshot-worker.js +657 -224
- package/build/src/third_party/index.js +62484 -43814
- package/build/src/third_party/issue-descriptions/CoepCorpNotSameOrigin.md +2 -2
- package/build/src/third_party/issue-descriptions/CoepCorpNotSameOriginAfterDefaultedToSameOriginByCoep.md +3 -3
- package/build/src/third_party/issue-descriptions/CoepCorpNotSameSite.md +2 -2
- package/build/src/third_party/issue-descriptions/CoepFrameResourceNeedsCoepHeader.md +1 -1
- package/build/src/third_party/issue-descriptions/CompatibilityModeQuirks.md +1 -1
- package/build/src/third_party/issue-descriptions/CookieAttributeValueExceedsMaxSize.md +2 -2
- package/build/src/third_party/issue-descriptions/LowTextContrast.md +1 -1
- package/build/src/third_party/issue-descriptions/SameSiteNoneInsecureErrorRead.md +1 -1
- package/build/src/third_party/issue-descriptions/SameSiteNoneInsecureErrorSet.md +1 -1
- package/build/src/third_party/issue-descriptions/SameSiteNoneInsecureWarnRead.md +1 -1
- package/build/src/third_party/issue-descriptions/SameSiteNoneInsecureWarnSet.md +1 -1
- package/build/src/third_party/issue-descriptions/SameSiteUnspecifiedLaxAllowUnsafeRead.md +3 -3
- package/build/src/third_party/issue-descriptions/SameSiteUnspecifiedLaxAllowUnsafeSet.md +3 -3
- package/build/src/third_party/issue-descriptions/bounceTrackingMitigations.md +1 -1
- package/build/src/third_party/issue-descriptions/connectionAllowlistEmbeddingRequirementNotSatisfied.md +26 -0
- package/build/src/third_party/issue-descriptions/connectionAllowlistIFrameAttributeLoosensEmbeddingRequirement.md +19 -0
- package/build/src/third_party/issue-descriptions/connectionAllowlistInvalidAllowConnectionAllowlistFrom.md +21 -0
- package/build/src/third_party/issue-descriptions/connectionAllowlistInvalidAllowlistItemType.md +2 -2
- package/build/src/third_party/issue-descriptions/connectionAllowlistInvalidHeader.md +2 -2
- package/build/src/third_party/issue-descriptions/connectionAllowlistInvalidUrlPattern.md +3 -3
- package/build/src/third_party/issue-descriptions/connectionAllowlistItemNotInnerList.md +2 -2
- package/build/src/third_party/issue-descriptions/connectionAllowlistMoreThanOneList.md +2 -2
- package/build/src/third_party/issue-descriptions/connectionAllowlistReportingEndpointNotToken.md +1 -1
- package/build/src/third_party/issue-descriptions/cookieCrossSiteRedirectDowngrade.md +3 -3
- package/build/src/third_party/issue-descriptions/cookieExcludeBlockedWithinRelatedWebsiteSet.md +1 -1
- package/build/src/third_party/issue-descriptions/cookieExcludePortMismatch.md +1 -1
- package/build/src/third_party/issue-descriptions/cookieExcludeSchemeMismatch.md +1 -1
- package/build/src/third_party/issue-descriptions/cookieExcludeThirdPartyPhaseoutSet.md +1 -1
- package/build/src/third_party/issue-descriptions/cookieWarnThirdPartyPhaseoutRead.md +1 -1
- package/build/src/third_party/issue-descriptions/corsAllowCredentialsRequired.md +1 -1
- package/build/src/third_party/issue-descriptions/corsDisabledScheme.md +2 -2
- package/build/src/third_party/issue-descriptions/corsDisallowedByMode.md +2 -2
- package/build/src/third_party/issue-descriptions/corsHeaderDisallowedByPreflightResponse.md +1 -1
- package/build/src/third_party/issue-descriptions/corsInvalidHeaderValues.md +3 -3
- package/build/src/third_party/issue-descriptions/corsLocalNetworkAccessPermissionDenied.md +1 -1
- package/build/src/third_party/issue-descriptions/corsMethodDisallowedByPreflightResponse.md +1 -1
- package/build/src/third_party/issue-descriptions/corsNoCorsRedirectModeNotFollow.md +1 -1
- package/build/src/third_party/issue-descriptions/corsOriginMismatch.md +3 -3
- package/build/src/third_party/issue-descriptions/corsPreflightResponseInvalid.md +2 -2
- package/build/src/third_party/issue-descriptions/corsRedirectContainsCredentials.md +3 -3
- package/build/src/third_party/issue-descriptions/corsWildcardOriginNotAllowed.md +4 -3
- package/build/src/third_party/issue-descriptions/cspEvalViolation.md +4 -4
- package/build/src/third_party/issue-descriptions/cspInlineViolation.md +2 -2
- package/build/src/third_party/issue-descriptions/cspTrustedTypesPolicyViolation.md +2 -2
- package/build/src/third_party/issue-descriptions/cspTrustedTypesSinkViolation.md +4 -4
- package/build/src/third_party/issue-descriptions/cspURLViolation.md +4 -4
- package/build/src/third_party/issue-descriptions/emailVerificationRequestAccountsEmptyList.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestAccountsHttpNotFound.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestAccountsInvalidContentType.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestAccountsInvalidResponse.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestAccountsNoResponse.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestDnsFetchFailed.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestDnsInvalidRecord.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestEmailVerificationWellKnownHttpNotFound.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestEmailVerificationWellKnownInvalidContentType.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestEmailVerificationWellKnownInvalidResponse.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestEmailVerificationWellKnownNoResponse.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestInvalidEmail.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestJwksHttpNotFound.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestJwksInvalidResponse.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestKeyBindingSigningFailed.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestRpOriginIsOpaque.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenHttpNotFound.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenInvalidContentType.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenInvalidResponse.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenInvalidSdJwt.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenMalformedSdJwt.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenNoResponse.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidAudience.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidIssuedAt.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidNonce.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidSdHash.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbInvalidTyp.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingAud.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingCnf.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingIat.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingNonce.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbMissingSdHash.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationKbSignatureFailed.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidEmail.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidEmailVerified.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidHolderKey.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidIssuedAt.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtInvalidIssuer.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtJwksMissingKeys.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtMissingCnf.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtMissingEmail.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtMissingIat.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtMissingIss.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtSignatureFailed.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestTokenVerificationSdJwtUnsupportedHeaderAlg.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestUserLoggedOut.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownAccountsEndpointCrossOrigin.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownHttpNotFound.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownInvalidContentType.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownInvalidResponse.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownIssuanceEndpointCrossOrigin.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownListEmpty.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownMissingAccountsEndpoint.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownMissingIssuanceEndpoint.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownNoResponse.md +1 -1
- package/build/src/third_party/issue-descriptions/emailVerificationRequestWellKnownUnsupportedSigningAlgorithm.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestAccountsBlockedByConnectionAllowlist.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthRequestAccountsHttpNotFound.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestAccountsInvalidResponse.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestAccountsNoResponse.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestApprovalDeclined.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestCanceled.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestConfigBlockedByConnectionAllowlist.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthRequestErrorFetchingSignin.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestErrorIdToken.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestIdTokenBlockedByConnectionAllowlist.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthRequestIdTokenHttpNotFound.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestIdTokenInvalidRequest.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestIdTokenInvalidResponse.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestIdTokenNoResponse.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestInvalidSigninResponse.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestManifestHttpNotFound.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestManifestInvalidResponse.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestManifestNoResponse.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestTooManyRequests.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthRequestWellKnownBlockedByConnectionAllowlist.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestInvalidAccountsResponse.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestInvalidConfigOrWellKnown.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNoAccountSharingPermission.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNoApiPermission.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNoReturningUserFromFetchedAccounts.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotIframe.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotPotentiallyTrustworthy.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotSameOrigin.md +1 -1
- package/build/src/third_party/issue-descriptions/federatedAuthUserInfoRequestNotSignedInWithIdp.md +1 -1
- package/build/src/third_party/issue-descriptions/fetchingPartitionedBlobURL.md +2 -2
- package/build/src/third_party/issue-descriptions/genericFormAriaLabelledByToNonExistingIdError.md +2 -2
- package/build/src/third_party/issue-descriptions/genericFormAutocompleteAttributeEmptyError.md +1 -1
- package/build/src/third_party/issue-descriptions/genericFormDuplicateIdForInputError.md +1 -1
- package/build/src/third_party/issue-descriptions/genericFormEmptyIdAndNameAttributesForInputError.md +2 -2
- package/build/src/third_party/issue-descriptions/genericFormInputAssignedAutocompleteValueToIdOrNameAttributeError.md +2 -2
- package/build/src/third_party/issue-descriptions/genericFormInputHasWrongButWellIntendedAutocompleteValueError.md +1 -1
- package/build/src/third_party/issue-descriptions/genericFormInputWithNoLabelError.md +1 -1
- package/build/src/third_party/issue-descriptions/genericFormLabelForMatchesNonExistingIdError.md +2 -2
- package/build/src/third_party/issue-descriptions/genericFormLabelForNameError.md +1 -1
- package/build/src/third_party/issue-descriptions/genericFormLabelHasNeitherForNorNestedInputError.md +1 -1
- package/build/src/third_party/issue-descriptions/genericFormModelContextMissingToolName.md +1 -1
- package/build/src/third_party/issue-descriptions/genericFormModelContextParameterMissingName.md +1 -1
- package/build/src/third_party/issue-descriptions/genericFormModelContextRequiredParameterMissingName.md +1 -1
- package/build/src/third_party/issue-descriptions/genericNavigationEntryMarkedSkippable.md +2 -2
- package/build/src/third_party/issue-descriptions/heavyAd.md +1 -1
- package/build/src/third_party/issue-descriptions/lazyLoadImageZeroSize.md +7 -0
- package/build/src/third_party/issue-descriptions/navigatingPartitionedBlobURL.md +3 -3
- package/build/src/third_party/issue-descriptions/permissionElementActivationDisabled.md +1 -1
- package/build/src/third_party/issue-descriptions/permissionElementActivationDisabledWithOccluder.md +1 -1
- package/build/src/third_party/issue-descriptions/permissionElementActivationDisabledWithOccluderParent.md +1 -1
- package/build/src/third_party/issue-descriptions/permissionElementFencedFrameDisallowed.md +2 -2
- package/build/src/third_party/issue-descriptions/permissionElementFontSizeTooLarge.md +2 -2
- package/build/src/third_party/issue-descriptions/permissionElementFontSizeTooSmall.md +2 -2
- package/build/src/third_party/issue-descriptions/permissionElementInsetBoxShadowUnsupported.md +1 -1
- package/build/src/third_party/issue-descriptions/permissionElementInvalidDisplayStyle.md +2 -2
- package/build/src/third_party/issue-descriptions/permissionElementInvalidSizeValue.md +2 -2
- package/build/src/third_party/issue-descriptions/permissionElementInvalidType.md +2 -2
- package/build/src/third_party/issue-descriptions/permissionElementInvalidTypeActivation.md +2 -2
- package/build/src/third_party/issue-descriptions/permissionElementNonOpaqueColor.md +1 -1
- package/build/src/third_party/issue-descriptions/permissionElementPaddingBottomUnsupported.md +2 -2
- package/build/src/third_party/issue-descriptions/permissionElementPaddingRightUnsupported.md +2 -2
- package/build/src/third_party/issue-descriptions/permissionElementRequestInProgress.md +2 -2
- package/build/src/third_party/issue-descriptions/permissionElementSecurityChecksFailed.md +1 -1
- package/build/src/third_party/issue-descriptions/permissionElementTypeNotSupported.md +2 -2
- package/build/src/third_party/issue-descriptions/permissionElementUntrustedEvent.md +1 -1
- package/build/src/third_party/issue-descriptions/placeholderDescriptionForInvisibleIssues.md +1 -1
- package/build/src/third_party/issue-descriptions/selectElementAccessibilityDisallowedOptGroupChild.md +1 -1
- package/build/src/third_party/issue-descriptions/selectElementAccessibilityDisallowedSelectChild.md +1 -1
- package/build/src/third_party/issue-descriptions/selectElementAccessibilityInteractiveContentAttributesSelectDescendant.md +1 -1
- package/build/src/third_party/issue-descriptions/selectElementAccessibilityInteractiveContentLegendChild.md +1 -1
- package/build/src/third_party/issue-descriptions/selectElementAccessibilityInteractiveContentOptionChild.md +1 -1
- package/build/src/third_party/issue-descriptions/selectElementAccessibilityNonPhrasingContentOptionChild.md +1 -1
- package/build/src/third_party/issue-descriptions/selectivePermissionsIntervention.md +3 -3
- package/build/src/third_party/issue-descriptions/sharedArrayBuffer.md +1 -1
- package/build/src/third_party/issue-descriptions/sharedDictionaryUseErrorCrossOriginNoCorsRequest.md +1 -1
- package/build/src/third_party/issue-descriptions/sharedDictionaryUseErrorMatchingDictionaryNotUsed.md +1 -1
- package/build/src/third_party/issue-descriptions/sharedDictionaryUseErrorUnexpectedContentDictionaryHeader.md +1 -1
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorCossOriginNoCorsRequest.md +1 -1
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorDisallowedBySettings.md +1 -1
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorExpiredResponse.md +1 -1
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorFeatureDisabled.md +2 -2
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorInvalidStructuredHeader.md +1 -1
- package/build/src/third_party/issue-descriptions/sharedDictionaryWriteErrorNavigationRequest.md +2 -2
- package/build/src/third_party/issue-descriptions/sriInvalidSignatureHeader.md +4 -4
- package/build/src/third_party/issue-descriptions/sriInvalidSignatureInputHeader.md +4 -4
- package/build/src/third_party/issue-descriptions/sriMissingSignatureHeader.md +1 -1
- package/build/src/third_party/issue-descriptions/sriMissingSignatureInputHeader.md +2 -2
- package/build/src/third_party/issue-descriptions/sriSignatureHeaderValueIsIncorrectLength.md +2 -2
- package/build/src/third_party/issue-descriptions/sriSignatureHeaderValueIsNotByteSequence.md +4 -4
- package/build/src/third_party/issue-descriptions/sriSignatureHeaderValueIsParameterized.md +4 -4
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidComponentName.md +1 -1
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidComponentType.md +2 -2
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidDerivedComponentParameter.md +1 -1
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidHeaderComponentParameter.md +1 -1
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderInvalidParameter.md +2 -2
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderKeyIdLength.md +5 -5
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderMissingLabel.md +3 -3
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderMissingRequiredParameters.md +2 -2
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderValueMissingComponents.md +2 -2
- package/build/src/third_party/issue-descriptions/sriSignatureInputHeaderValueNotInnerList.md +2 -2
- package/build/src/third_party/issue-descriptions/sriValidationFailedIntegrityMismatch.md +4 -4
- package/build/src/third_party/issue-descriptions/sriValidationFailedInvalidLength.md +3 -3
- package/build/src/third_party/issue-descriptions/sriValidationFailedSignatureExpired.md +2 -2
- package/build/src/third_party/issue-descriptions/sriValidationFailedSignatureMismatch.md +2 -2
- package/build/src/third_party/issue-descriptions/stylesheetLateImport.md +1 -1
- package/build/src/third_party/issue-descriptions/summaryElementAccessibilityInteractiveContentSummaryDescendant.md +1 -1
- package/build/src/third_party/issue-descriptions/unencodedDigestIncorrectDigestLength.md +2 -2
- package/build/src/third_party/issue-descriptions/unencodedDigestIncorrectDigestType.md +3 -3
- package/build/src/third_party/issue-descriptions/unencodedDigestMalformedDictionary.md +2 -2
- package/build/src/third_party/issue-descriptions/unencodedDigestUnknownAlgorithm.md +1 -1
- package/build/src/third_party/lighthouse-devtools-mcp-bundle.js +1125 -1027
- package/build/src/tools/categories.js +3 -0
- package/build/src/tools/console.js +9 -3
- package/build/src/tools/emulation.js +2 -2
- package/build/src/tools/extensions.js +7 -5
- package/build/src/tools/input.js +222 -120
- package/build/src/tools/lighthouse.js +3 -1
- package/build/src/tools/memory.js +144 -17
- package/build/src/tools/network.js +6 -3
- package/build/src/tools/pages.js +13 -16
- package/build/src/tools/performance.js +57 -46
- package/build/src/tools/pwa.js +128 -0
- package/build/src/tools/screencast.js +6 -4
- package/build/src/tools/screenshot.js +192 -84
- package/build/src/tools/script.js +118 -34
- package/build/src/tools/slim/tools.js +3 -3
- package/build/src/tools/snapshot.js +5 -3
- package/build/src/tools/thirdPartyDeveloper.js +2 -2
- package/build/src/tools/tools.js +2 -0
- package/build/src/tools/webmcp.js +2 -2
- package/build/src/utils/WaitForHelper.js +299 -0
- package/build/src/utils/bytes.js +105 -0
- package/build/src/utils/logger.js +25 -11
- package/build/src/utils/polyfill.js +6 -3
- package/build/src/utils/url.js +43 -0
- package/build/src/version.js +1 -1
- package/package.json +37 -25
- package/skills/a11y-debugging/SKILL.md +2 -0
- package/skills/chrome-devtools/SKILL.md +5 -4
- package/skills/chrome-devtools-cli/SKILL.md +109 -64
- package/skills/debug-optimize-lcp/SKILL.md +9 -9
- package/skills/memory-leak-debugging/SKILL.md +14 -18
- package/skills/memory-leak-debugging/references/common-leaks.md +1 -1
- package/skills/troubleshooting/SKILL.md +1 -0
- package/build/src/WaitForHelper.js +0 -200
- package/build/src/devtools/DevToolsConnectionAdapter.js +0 -70
- package/build/src/third_party/issue-descriptions/SameSiteExcludeContextDowngradeRead.md +0 -8
- package/build/src/third_party/issue-descriptions/SameSiteExcludeContextDowngradeSet.md +0 -8
- package/build/src/third_party/issue-descriptions/SameSiteExcludeNavigationContextDowngrade.md +0 -8
- package/build/src/third_party/issue-descriptions/SameSiteWarnCrossDowngradeRead.md +0 -8
- package/build/src/third_party/issue-descriptions/SameSiteWarnCrossDowngradeSet.md +0 -8
- package/build/src/third_party/issue-descriptions/SameSiteWarnStrictLaxDowngradeStrict.md +0 -8
- package/build/src/third_party/issue-descriptions/arInsecureContext.md +0 -7
- package/build/src/third_party/issue-descriptions/arInvalidInfoHeader.md +0 -5
- package/build/src/third_party/issue-descriptions/arInvalidRegisterOsSourceHeader.md +0 -5
- package/build/src/third_party/issue-descriptions/arInvalidRegisterOsTriggerHeader.md +0 -5
- package/build/src/third_party/issue-descriptions/arInvalidRegisterSourceHeader.md +0 -5
- package/build/src/third_party/issue-descriptions/arInvalidRegisterTriggerHeader.md +0 -5
- package/build/src/third_party/issue-descriptions/arNavigationRegistrationUniqueScopeAlreadySet.md +0 -5
- package/build/src/third_party/issue-descriptions/arNavigationRegistrationWithoutTransientUserActivation.md +0 -6
- package/build/src/third_party/issue-descriptions/arNoRegisterOsSourceHeader.md +0 -5
- package/build/src/third_party/issue-descriptions/arNoRegisterOsTriggerHeader.md +0 -5
- package/build/src/third_party/issue-descriptions/arNoRegisterSourceHeader.md +0 -5
- package/build/src/third_party/issue-descriptions/arNoRegisterTriggerHeader.md +0 -5
- package/build/src/third_party/issue-descriptions/arNoWebOrOsSupport.md +0 -4
- package/build/src/third_party/issue-descriptions/arOsSourceIgnored.md +0 -18
- package/build/src/third_party/issue-descriptions/arOsTriggerIgnored.md +0 -19
- package/build/src/third_party/issue-descriptions/arPermissionPolicyDisabled.md +0 -8
- package/build/src/third_party/issue-descriptions/arSourceAndTriggerHeaders.md +0 -9
- package/build/src/third_party/issue-descriptions/arSourceIgnored.md +0 -13
- package/build/src/third_party/issue-descriptions/arTriggerIgnored.md +0 -12
- package/build/src/third_party/issue-descriptions/arUntrustworthyReportingOrigin.md +0 -10
- package/build/src/third_party/issue-descriptions/arWebAndOsHeaders.md +0 -11
- package/build/src/utils/Mutex.js +0 -38
- package/build/src/utils/string.js +0 -37
- package/skills/memory-leak-debugging/references/compare_snapshots.js +0 -109
- package/skills/memory-leak-debugging/references/memlab.md +0 -29
|
@@ -2810,34 +2810,6 @@ const LAYOUT_LINES_HIGHLIGHT_COLOR = [127, 32, 210];
|
|
|
2810
2810
|
Mask: Legacy.fromRGBA([248, 249, 249, 1]),
|
|
2811
2811
|
});
|
|
2812
2812
|
|
|
2813
|
-
// Copyright 2025 The Chromium Authors
|
|
2814
|
-
class WritableDevToolsContext {
|
|
2815
|
-
#instances = new Map();
|
|
2816
|
-
get(ctor) {
|
|
2817
|
-
const instance = this.#instances.get(ctor);
|
|
2818
|
-
if (!instance) {
|
|
2819
|
-
throw new Error(`No instance for ${ctor.name}. Ensure the bootstrapper creates it.`);
|
|
2820
|
-
}
|
|
2821
|
-
return instance;
|
|
2822
|
-
}
|
|
2823
|
-
has(ctor) {
|
|
2824
|
-
return this.#instances.has(ctor);
|
|
2825
|
-
}
|
|
2826
|
-
set(ctor, instance) {
|
|
2827
|
-
this.#instances.set(ctor, instance);
|
|
2828
|
-
}
|
|
2829
|
-
delete(ctor) {
|
|
2830
|
-
this.#instances.delete(ctor);
|
|
2831
|
-
}
|
|
2832
|
-
}
|
|
2833
|
-
let gInstance = null;
|
|
2834
|
-
function globalInstance() {
|
|
2835
|
-
if (!gInstance) {
|
|
2836
|
-
gInstance = new WritableDevToolsContext();
|
|
2837
|
-
}
|
|
2838
|
-
return gInstance;
|
|
2839
|
-
}
|
|
2840
|
-
|
|
2841
2813
|
// Copyright 2026 The Chromium Authors
|
|
2842
2814
|
var ExperimentName;
|
|
2843
2815
|
(function (ExperimentName) {
|
|
@@ -4801,7 +4773,7 @@ function lockedLazyString(str) {
|
|
|
4801
4773
|
// Copyright 2014 The Chromium Authors
|
|
4802
4774
|
const UIStrings$2 = {
|
|
4803
4775
|
elementsPanel: 'Elements panel',
|
|
4804
|
-
stylesSidebar: '
|
|
4776
|
+
stylesSidebar: 'Styles sidebar',
|
|
4805
4777
|
changesDrawer: 'Changes drawer',
|
|
4806
4778
|
issuesView: 'Issues view',
|
|
4807
4779
|
networkPanel: 'Network panel',
|
|
@@ -4810,51 +4782,12 @@ const UIStrings$2 = {
|
|
|
4810
4782
|
sourcesPanel: 'Sources panel',
|
|
4811
4783
|
timelinePanel: 'Performance panel',
|
|
4812
4784
|
memoryInspectorPanel: 'Memory inspector panel',
|
|
4813
|
-
developerResourcesPanel: 'Developer
|
|
4785
|
+
developerResourcesPanel: 'Developer resources panel',
|
|
4814
4786
|
animationsPanel: 'Animations panel',
|
|
4815
4787
|
lighthousePanel: 'Lighthouse panel',
|
|
4816
4788
|
};
|
|
4817
4789
|
const str_$2 = registerUIStrings('core/common/Revealer.ts', UIStrings$2);
|
|
4818
4790
|
const i18nLazyString$1 = getLazilyComputedLocalizedString.bind(undefined, str_$2);
|
|
4819
|
-
let revealerRegistry;
|
|
4820
|
-
class RevealerRegistry {
|
|
4821
|
-
registeredRevealers = [];
|
|
4822
|
-
static instance() {
|
|
4823
|
-
if (revealerRegistry === undefined) {
|
|
4824
|
-
revealerRegistry = new RevealerRegistry();
|
|
4825
|
-
}
|
|
4826
|
-
return revealerRegistry;
|
|
4827
|
-
}
|
|
4828
|
-
static removeInstance() {
|
|
4829
|
-
revealerRegistry = undefined;
|
|
4830
|
-
}
|
|
4831
|
-
register(registration) {
|
|
4832
|
-
this.registeredRevealers.push(registration);
|
|
4833
|
-
}
|
|
4834
|
-
async reveal(revealable, omitFocus) {
|
|
4835
|
-
const revealers = await Promise.all(this.getApplicableRegisteredRevealers(revealable).map(registration => registration.loadRevealer()));
|
|
4836
|
-
if (revealers.length < 1) {
|
|
4837
|
-
throw new Error(`No revealers found for ${revealable}`);
|
|
4838
|
-
}
|
|
4839
|
-
if (revealers.length > 1) {
|
|
4840
|
-
throw new Error(`Conflicting reveals found for ${revealable}`);
|
|
4841
|
-
}
|
|
4842
|
-
return await revealers[0].reveal(revealable, omitFocus);
|
|
4843
|
-
}
|
|
4844
|
-
getApplicableRegisteredRevealers(revealable) {
|
|
4845
|
-
return this.registeredRevealers.filter(registration => {
|
|
4846
|
-
for (const contextType of registration.contextTypes()) {
|
|
4847
|
-
if (revealable instanceof contextType) {
|
|
4848
|
-
return true;
|
|
4849
|
-
}
|
|
4850
|
-
}
|
|
4851
|
-
return false;
|
|
4852
|
-
});
|
|
4853
|
-
}
|
|
4854
|
-
}
|
|
4855
|
-
async function reveal(revealable, omitFocus = false) {
|
|
4856
|
-
await RevealerRegistry.instance().reveal(revealable, omitFocus);
|
|
4857
|
-
}
|
|
4858
4791
|
({
|
|
4859
4792
|
DEVELOPER_RESOURCES_PANEL: i18nLazyString$1(UIStrings$2.developerResourcesPanel),
|
|
4860
4793
|
ELEMENTS_PANEL: i18nLazyString$1(UIStrings$2.elementsPanel),
|
|
@@ -4872,41 +4805,6 @@ async function reveal(revealable, omitFocus = false) {
|
|
|
4872
4805
|
});
|
|
4873
4806
|
|
|
4874
4807
|
// Copyright 2014 The Chromium Authors
|
|
4875
|
-
class Console extends ObjectWrapper {
|
|
4876
|
-
#messages = [];
|
|
4877
|
-
static instance(opts) {
|
|
4878
|
-
if (!globalInstance().has(Console) || opts?.forceNew) {
|
|
4879
|
-
globalInstance().set(Console, new Console());
|
|
4880
|
-
}
|
|
4881
|
-
return globalInstance().get(Console);
|
|
4882
|
-
}
|
|
4883
|
-
static removeInstance() {
|
|
4884
|
-
globalInstance().delete(Console);
|
|
4885
|
-
}
|
|
4886
|
-
addMessage(text, level = "info" , show = false, source) {
|
|
4887
|
-
const message = new Message(text, level, Date.now(), show, source);
|
|
4888
|
-
this.#messages.push(message);
|
|
4889
|
-
this.dispatchEventToListeners("messageAdded" , message);
|
|
4890
|
-
}
|
|
4891
|
-
log(text) {
|
|
4892
|
-
this.addMessage(text, "info" );
|
|
4893
|
-
}
|
|
4894
|
-
warn(text, source) {
|
|
4895
|
-
this.addMessage(text, "warning" , undefined, source);
|
|
4896
|
-
}
|
|
4897
|
-
error(text, show = true) {
|
|
4898
|
-
this.addMessage(text, "error" , show);
|
|
4899
|
-
}
|
|
4900
|
-
messages() {
|
|
4901
|
-
return this.#messages;
|
|
4902
|
-
}
|
|
4903
|
-
show() {
|
|
4904
|
-
void this.showPromise();
|
|
4905
|
-
}
|
|
4906
|
-
showPromise() {
|
|
4907
|
-
return reveal(this);
|
|
4908
|
-
}
|
|
4909
|
-
}
|
|
4910
4808
|
var FrontendMessageSource;
|
|
4911
4809
|
(function (FrontendMessageSource) {
|
|
4912
4810
|
FrontendMessageSource["CSS"] = "css";
|
|
@@ -4914,22 +4812,6 @@ var FrontendMessageSource;
|
|
|
4914
4812
|
FrontendMessageSource["ISSUE_PANEL"] = "issue-panel";
|
|
4915
4813
|
FrontendMessageSource["SELF_XSS"] = "self-xss";
|
|
4916
4814
|
})(FrontendMessageSource || (FrontendMessageSource = {}));
|
|
4917
|
-
class Message {
|
|
4918
|
-
text;
|
|
4919
|
-
level;
|
|
4920
|
-
timestamp;
|
|
4921
|
-
show;
|
|
4922
|
-
source;
|
|
4923
|
-
constructor(text, level, timestamp, show, source) {
|
|
4924
|
-
this.text = text;
|
|
4925
|
-
this.level = level;
|
|
4926
|
-
this.timestamp = (typeof timestamp === 'number') ? timestamp : Date.now();
|
|
4927
|
-
this.show = show;
|
|
4928
|
-
if (source) {
|
|
4929
|
-
this.source = source;
|
|
4930
|
-
}
|
|
4931
|
-
}
|
|
4932
|
-
}
|
|
4933
4815
|
|
|
4934
4816
|
// Copyright 2012 The Chromium Authors
|
|
4935
4817
|
function normalizePath(path) {
|
|
@@ -5333,7 +5215,11 @@ class ParsedURL {
|
|
|
5333
5215
|
return 'data:';
|
|
5334
5216
|
}
|
|
5335
5217
|
const scheme = this.isBlobURL() ? this.blobInnerScheme : this.scheme;
|
|
5336
|
-
|
|
5218
|
+
const domain = this.domain();
|
|
5219
|
+
if (!scheme && !domain) {
|
|
5220
|
+
return '';
|
|
5221
|
+
}
|
|
5222
|
+
return scheme + '://' + domain;
|
|
5337
5223
|
}
|
|
5338
5224
|
urlWithoutScheme() {
|
|
5339
5225
|
if (this.scheme && this.url.startsWith(this.scheme + '://')) {
|
|
@@ -5730,7 +5616,6 @@ const UIStrings = {
|
|
|
5730
5616
|
extension: 'Extension',
|
|
5731
5617
|
adorner: 'Adorner',
|
|
5732
5618
|
account: 'Account',
|
|
5733
|
-
privacy: 'Privacy',
|
|
5734
5619
|
};
|
|
5735
5620
|
const str_ = registerUIStrings('core/common/SettingRegistration.ts', UIStrings);
|
|
5736
5621
|
getLocalizedString.bind(undefined, str_);
|
|
@@ -5738,6 +5623,7 @@ getLocalizedString.bind(undefined, str_);
|
|
|
5738
5623
|
// Copyright 2011 The Chromium Authors
|
|
5739
5624
|
class HeapSnapshotWorkerProxy extends ObjectWrapper {
|
|
5740
5625
|
eventHandler;
|
|
5626
|
+
#console;
|
|
5741
5627
|
nextObjectId = 1;
|
|
5742
5628
|
nextCallId = 1;
|
|
5743
5629
|
callbacks = new Map();
|
|
@@ -5745,13 +5631,17 @@ class HeapSnapshotWorkerProxy extends ObjectWrapper {
|
|
|
5745
5631
|
worker;
|
|
5746
5632
|
interval;
|
|
5747
5633
|
workerUrl;
|
|
5748
|
-
constructor(eventHandler, workerUrl) {
|
|
5634
|
+
constructor(eventHandler, console, workerUrl) {
|
|
5749
5635
|
super();
|
|
5750
5636
|
this.eventHandler = eventHandler;
|
|
5637
|
+
this.#console = console;
|
|
5751
5638
|
this.workerUrl = workerUrl;
|
|
5752
5639
|
this.worker = HOST_RUNTIME.createWorker(workerUrl ?? import.meta.resolve('../../entrypoints/heap_snapshot_worker/heap_snapshot_worker-entrypoint.js'));
|
|
5753
5640
|
this.worker.onmessage = this.messageReceived.bind(this);
|
|
5754
5641
|
}
|
|
5642
|
+
get console() {
|
|
5643
|
+
return this.#console;
|
|
5644
|
+
}
|
|
5755
5645
|
createLoader(profileUid, snapshotReceivedCallback) {
|
|
5756
5646
|
const objectId = this.nextObjectId++;
|
|
5757
5647
|
const proxy = new HeapSnapshotLoaderProxy(this, objectId, profileUid, snapshotReceivedCallback);
|
|
@@ -5771,15 +5661,21 @@ class HeapSnapshotWorkerProxy extends ObjectWrapper {
|
|
|
5771
5661
|
}
|
|
5772
5662
|
evaluateForTest(script, callback) {
|
|
5773
5663
|
const callId = this.nextCallId++;
|
|
5774
|
-
this.callbacks.set(callId,
|
|
5664
|
+
this.callbacks.set(callId, (error, result) => {
|
|
5665
|
+
callback(error, result);
|
|
5666
|
+
});
|
|
5775
5667
|
this.postMessage({ callId, disposition: 'evaluateForTest', source: script });
|
|
5776
5668
|
}
|
|
5777
5669
|
callFactoryMethod(callback, objectId, methodName, proxyConstructor, transfer, ...methodArguments) {
|
|
5778
5670
|
const callId = this.nextCallId++;
|
|
5779
5671
|
const newObjectId = this.nextObjectId++;
|
|
5780
5672
|
if (callback) {
|
|
5781
|
-
this.callbacks.set(callId, remoteResult => {
|
|
5782
|
-
|
|
5673
|
+
this.callbacks.set(callId, (error, remoteResult) => {
|
|
5674
|
+
if (error) {
|
|
5675
|
+
callback(error);
|
|
5676
|
+
return;
|
|
5677
|
+
}
|
|
5678
|
+
callback(undefined, remoteResult ? new proxyConstructor(this, newObjectId) : undefined);
|
|
5783
5679
|
});
|
|
5784
5680
|
this.postMessage({
|
|
5785
5681
|
callId,
|
|
@@ -5804,7 +5700,9 @@ class HeapSnapshotWorkerProxy extends ObjectWrapper {
|
|
|
5804
5700
|
callMethod(callback, objectId, methodName, ...methodArguments) {
|
|
5805
5701
|
const callId = this.nextCallId++;
|
|
5806
5702
|
if (callback) {
|
|
5807
|
-
this.callbacks.set(callId,
|
|
5703
|
+
this.callbacks.set(callId, (error, result) => {
|
|
5704
|
+
callback(error, result);
|
|
5705
|
+
});
|
|
5808
5706
|
}
|
|
5809
5707
|
this.postMessage({
|
|
5810
5708
|
callId,
|
|
@@ -5819,7 +5717,7 @@ class HeapSnapshotWorkerProxy extends ObjectWrapper {
|
|
|
5819
5717
|
return;
|
|
5820
5718
|
}
|
|
5821
5719
|
this.checkLongRunningCalls();
|
|
5822
|
-
this.interval =
|
|
5720
|
+
this.interval = globalThis.setInterval(this.checkLongRunningCalls.bind(this), 300);
|
|
5823
5721
|
}
|
|
5824
5722
|
checkLongRunningCalls() {
|
|
5825
5723
|
for (const callId of this.previousCallbacks) {
|
|
@@ -5835,8 +5733,15 @@ class HeapSnapshotWorkerProxy extends ObjectWrapper {
|
|
|
5835
5733
|
}
|
|
5836
5734
|
setupForSecondaryInit(port) {
|
|
5837
5735
|
const callId = this.nextCallId++;
|
|
5838
|
-
const done = new Promise(resolve => {
|
|
5839
|
-
this.callbacks.set(callId,
|
|
5736
|
+
const done = new Promise((resolve, reject) => {
|
|
5737
|
+
this.callbacks.set(callId, error => {
|
|
5738
|
+
if (error) {
|
|
5739
|
+
reject(new Error(error));
|
|
5740
|
+
}
|
|
5741
|
+
else {
|
|
5742
|
+
resolve();
|
|
5743
|
+
}
|
|
5744
|
+
});
|
|
5840
5745
|
});
|
|
5841
5746
|
this.postMessage({
|
|
5842
5747
|
callId,
|
|
@@ -5854,17 +5759,19 @@ class HeapSnapshotWorkerProxy extends ObjectWrapper {
|
|
|
5854
5759
|
return;
|
|
5855
5760
|
}
|
|
5856
5761
|
if (data.error) {
|
|
5857
|
-
|
|
5858
|
-
|
|
5859
|
-
this.callbacks.delete(data.callId);
|
|
5860
|
-
return;
|
|
5762
|
+
this.#console.error(`An error occurred when a call to method '${data.errorMethodName}' was requested`);
|
|
5763
|
+
this.#console.error(data['errorCallStack']);
|
|
5861
5764
|
}
|
|
5862
5765
|
const callback = this.callbacks.get(data.callId);
|
|
5863
5766
|
if (!callback) {
|
|
5864
5767
|
return;
|
|
5865
5768
|
}
|
|
5866
5769
|
this.callbacks.delete(data.callId);
|
|
5867
|
-
|
|
5770
|
+
if (data.error) {
|
|
5771
|
+
callback(data.error);
|
|
5772
|
+
return;
|
|
5773
|
+
}
|
|
5774
|
+
callback(undefined, data.result);
|
|
5868
5775
|
}
|
|
5869
5776
|
postMessage(message, transfer) {
|
|
5870
5777
|
this.worker.postMessage(message, transfer);
|
|
@@ -5884,10 +5791,27 @@ class HeapSnapshotProxyObject {
|
|
|
5884
5791
|
return this.worker.callFactoryMethod(null, String(this.objectId), methodName, proxyConstructor, [], ...args);
|
|
5885
5792
|
}
|
|
5886
5793
|
callFactoryMethodPromise(methodName, proxyConstructor, transfer, ...args) {
|
|
5887
|
-
return new Promise(resolve => this.worker.callFactoryMethod(
|
|
5794
|
+
return new Promise((resolve, reject) => this.worker.callFactoryMethod((error, result) => {
|
|
5795
|
+
if (error) {
|
|
5796
|
+
reject(new Error(error));
|
|
5797
|
+
}
|
|
5798
|
+
else if (result) {
|
|
5799
|
+
resolve(result);
|
|
5800
|
+
}
|
|
5801
|
+
else {
|
|
5802
|
+
reject(new Error(`Failed to create ${proxyConstructor.name}`));
|
|
5803
|
+
}
|
|
5804
|
+
}, String(this.objectId), methodName, proxyConstructor, transfer, ...args));
|
|
5888
5805
|
}
|
|
5889
5806
|
callMethodPromise(methodName, ...args) {
|
|
5890
|
-
return new Promise(resolve => this.worker.callMethod(
|
|
5807
|
+
return new Promise((resolve, reject) => this.worker.callMethod((error, result) => {
|
|
5808
|
+
if (error) {
|
|
5809
|
+
reject(new Error(error));
|
|
5810
|
+
}
|
|
5811
|
+
else {
|
|
5812
|
+
resolve(result);
|
|
5813
|
+
}
|
|
5814
|
+
}, String(this.objectId), methodName, ...args));
|
|
5891
5815
|
}
|
|
5892
5816
|
}
|
|
5893
5817
|
class HeapSnapshotLoaderProxy extends HeapSnapshotProxyObject {
|
|
@@ -5903,15 +5827,19 @@ class HeapSnapshotLoaderProxy extends HeapSnapshotProxyObject {
|
|
|
5903
5827
|
}
|
|
5904
5828
|
async close() {
|
|
5905
5829
|
await this.callMethodPromise('close');
|
|
5906
|
-
const secondWorker = new HeapSnapshotWorkerProxy(() => { }, this.worker.workerUrl);
|
|
5830
|
+
const secondWorker = new HeapSnapshotWorkerProxy(() => { }, this.worker.console, this.worker.workerUrl);
|
|
5907
5831
|
const channel = new MessageChannel();
|
|
5908
5832
|
await secondWorker.setupForSecondaryInit(channel.port2);
|
|
5909
|
-
|
|
5910
|
-
|
|
5911
|
-
|
|
5912
|
-
|
|
5913
|
-
|
|
5914
|
-
|
|
5833
|
+
try {
|
|
5834
|
+
const snapshotProxy = await this.callFactoryMethodPromise('buildSnapshot', HeapSnapshotProxy, [channel.port1]);
|
|
5835
|
+
snapshotProxy.setProfileUid(this.profileUid);
|
|
5836
|
+
await snapshotProxy.updateStaticData();
|
|
5837
|
+
this.snapshotReceivedCallback(snapshotProxy);
|
|
5838
|
+
}
|
|
5839
|
+
finally {
|
|
5840
|
+
secondWorker.dispose();
|
|
5841
|
+
this.dispose();
|
|
5842
|
+
}
|
|
5915
5843
|
}
|
|
5916
5844
|
}
|
|
5917
5845
|
class HeapSnapshotProxy extends HeapSnapshotProxyObject {
|
|
@@ -5927,6 +5855,12 @@ class HeapSnapshotProxy extends HeapSnapshotProxyObject {
|
|
|
5927
5855
|
interfaceDefinitions() {
|
|
5928
5856
|
return this.callMethodPromise('interfaceDefinitions');
|
|
5929
5857
|
}
|
|
5858
|
+
getNativeContextSizes() {
|
|
5859
|
+
return this.callMethodPromise('getNativeContextSizes');
|
|
5860
|
+
}
|
|
5861
|
+
getRetainedByContextSummary() {
|
|
5862
|
+
return this.callMethodPromise('getRetainedByContextSummary');
|
|
5863
|
+
}
|
|
5930
5864
|
aggregatesWithFilter(filter) {
|
|
5931
5865
|
return this.callMethodPromise('aggregatesWithFilter', filter);
|
|
5932
5866
|
}
|
|
@@ -5945,8 +5879,11 @@ class HeapSnapshotProxy extends HeapSnapshotProxyObject {
|
|
|
5945
5879
|
nodeIndexForId(nodeId) {
|
|
5946
5880
|
return this.callMethodPromise('nodeIndexForId', nodeId);
|
|
5947
5881
|
}
|
|
5948
|
-
|
|
5949
|
-
return this.
|
|
5882
|
+
getObjectInfo(nodeIndex) {
|
|
5883
|
+
return this.callMethodPromise('getObjectInfo', nodeIndex);
|
|
5884
|
+
}
|
|
5885
|
+
createEdgesProvider(nodeIndex, options) {
|
|
5886
|
+
return this.callFactoryMethod('createEdgesProvider', HeapSnapshotProviderProxy, nodeIndex, options);
|
|
5950
5887
|
}
|
|
5951
5888
|
createRetainingEdgesProvider(nodeIndex) {
|
|
5952
5889
|
return this.callFactoryMethod('createRetainingEdgesProvider', HeapSnapshotProviderProxy, nodeIndex);
|
|
@@ -5963,6 +5900,9 @@ class HeapSnapshotProxy extends HeapSnapshotProxyObject {
|
|
|
5963
5900
|
createNodesProviderForClass(classKey, nodeFilter) {
|
|
5964
5901
|
return this.callFactoryMethod('createNodesProviderForClass', HeapSnapshotProviderProxy, classKey, nodeFilter);
|
|
5965
5902
|
}
|
|
5903
|
+
queryObjects(queryOptions) {
|
|
5904
|
+
return this.callFactoryMethod('queryObjects', HeapSnapshotProviderProxy, queryOptions);
|
|
5905
|
+
}
|
|
5966
5906
|
allocationTracesTops() {
|
|
5967
5907
|
return this.callMethodPromise('allocationTracesTops');
|
|
5968
5908
|
}
|
|
@@ -6690,21 +6630,10 @@ class HeapSnapshotNode {
|
|
|
6690
6630
|
return false;
|
|
6691
6631
|
}
|
|
6692
6632
|
#detachednessAndClassIndex() {
|
|
6693
|
-
|
|
6694
|
-
const nodeDetachednessAndClassIndexOffset = snapshot.nodeDetachednessAndClassIndexOffset;
|
|
6695
|
-
return nodeDetachednessAndClassIndexOffset !== -1 ?
|
|
6696
|
-
snapshot.nodes.getValue(nodeIndex + nodeDetachednessAndClassIndexOffset) :
|
|
6697
|
-
snapshot.detachednessAndClassIndexArray[nodeIndex / snapshot.nodeFieldCount];
|
|
6633
|
+
return this.snapshot.detachednessAndClassIndexArray[this.nodeIndex / this.snapshot.nodeFieldCount];
|
|
6698
6634
|
}
|
|
6699
6635
|
#setDetachednessAndClassIndex(value) {
|
|
6700
|
-
|
|
6701
|
-
const nodeDetachednessAndClassIndexOffset = snapshot.nodeDetachednessAndClassIndexOffset;
|
|
6702
|
-
if (nodeDetachednessAndClassIndexOffset !== -1) {
|
|
6703
|
-
snapshot.nodes.setValue(nodeIndex + nodeDetachednessAndClassIndexOffset, value);
|
|
6704
|
-
}
|
|
6705
|
-
else {
|
|
6706
|
-
snapshot.detachednessAndClassIndexArray[nodeIndex / snapshot.nodeFieldCount] = value;
|
|
6707
|
-
}
|
|
6636
|
+
this.snapshot.detachednessAndClassIndexArray[this.nodeIndex / this.snapshot.nodeFieldCount] = value;
|
|
6708
6637
|
}
|
|
6709
6638
|
detachedness() {
|
|
6710
6639
|
return this.#detachednessAndClassIndex() & BITMASK_FOR_DOM_LINK_STATE;
|
|
@@ -6747,6 +6676,28 @@ class HeapSnapshotNode {
|
|
|
6747
6676
|
}
|
|
6748
6677
|
return undefined;
|
|
6749
6678
|
}
|
|
6679
|
+
nodeValueAsInt() {
|
|
6680
|
+
if (this.rawType() !== this.snapshot.nodeNumberType) {
|
|
6681
|
+
return undefined;
|
|
6682
|
+
}
|
|
6683
|
+
if (this.rawName() !== 'int') {
|
|
6684
|
+
return undefined;
|
|
6685
|
+
}
|
|
6686
|
+
const valNode = this.findInternalEdgeTarget('value');
|
|
6687
|
+
if (!valNode) {
|
|
6688
|
+
return undefined;
|
|
6689
|
+
}
|
|
6690
|
+
const value = parseInt(valNode.rawName(), 10);
|
|
6691
|
+
return isNaN(value) ? undefined : value;
|
|
6692
|
+
}
|
|
6693
|
+
nodeStringLength() {
|
|
6694
|
+
const lengthNode = this.findInternalEdgeTarget('length');
|
|
6695
|
+
return lengthNode ? lengthNode.nodeValueAsInt() : undefined;
|
|
6696
|
+
}
|
|
6697
|
+
nodeStringHash() {
|
|
6698
|
+
const hashNode = this.findInternalEdgeTarget('hash');
|
|
6699
|
+
return hashNode ? hashNode.nodeValueAsInt() : undefined;
|
|
6700
|
+
}
|
|
6750
6701
|
nodeIsTruncatedString() {
|
|
6751
6702
|
const truncNode = this.findInternalEdgeTarget('truncated');
|
|
6752
6703
|
if (!truncNode) {
|
|
@@ -6904,7 +6855,7 @@ class SecondaryInitManager {
|
|
|
6904
6855
|
...retainers,
|
|
6905
6856
|
essentialEdges: createBitVector(argsStep2.essentialEdgesBuffer),
|
|
6906
6857
|
port,
|
|
6907
|
-
nodeSelfSizesPromise: this.getNodeSelfSizes()
|
|
6858
|
+
nodeSelfSizesPromise: this.getNodeSelfSizes(),
|
|
6908
6859
|
};
|
|
6909
6860
|
const dominatorsAndRetainedSizes = await HeapSnapshot.calculateDominatorsAndRetainedSizes(args);
|
|
6910
6861
|
const dominatedNodesOutputs = HeapSnapshot.buildDominatedNodes({ ...args, ...dominatorsAndRetainedSizes });
|
|
@@ -6934,6 +6885,8 @@ const MIN_INTERFACE_PROPERTY_COUNT = 1;
|
|
|
6934
6885
|
const MAX_INTERFACE_NAME_LENGTH = 120;
|
|
6935
6886
|
const MIN_OBJECT_COUNT_PER_INTERFACE = 2;
|
|
6936
6887
|
const MIN_OBJECT_PROPORTION_PER_INTERFACE = 1000;
|
|
6888
|
+
const NO_NATIVE_CONTEXT = -1;
|
|
6889
|
+
const SHARED_NATIVE_CONTEXT = -2;
|
|
6937
6890
|
class HeapSnapshot {
|
|
6938
6891
|
nodes;
|
|
6939
6892
|
containmentEdges;
|
|
@@ -7006,6 +6959,9 @@ class HeapSnapshot {
|
|
|
7006
6959
|
#nodeDistancesForRetainersView;
|
|
7007
6960
|
#edgeNamesThatAreNotWeakMaps;
|
|
7008
6961
|
detachednessAndClassIndexArray;
|
|
6962
|
+
nodeNativeContextAttribution;
|
|
6963
|
+
#nativeContextSizes;
|
|
6964
|
+
#nativeContextOrdinals;
|
|
7009
6965
|
#interfaceNames = new Map();
|
|
7010
6966
|
#interfaceDefinitions;
|
|
7011
6967
|
constructor(profile, progress) {
|
|
@@ -7072,6 +7028,7 @@ class HeapSnapshot {
|
|
|
7072
7028
|
this.#progress.updateStatus('Building retainers…');
|
|
7073
7029
|
const resultsFromSecondWorker = this.startInitStep1InSecondThread(secondWorker);
|
|
7074
7030
|
this.#progress.updateStatus('Propagating DOM state…');
|
|
7031
|
+
this.initDetachednessAndClassIndex();
|
|
7075
7032
|
this.propagateDOMState();
|
|
7076
7033
|
this.#progress.updateStatus('Calculating node flags…');
|
|
7077
7034
|
this.calculateFlags();
|
|
@@ -7091,8 +7048,11 @@ class HeapSnapshot {
|
|
|
7091
7048
|
this.buildSamples();
|
|
7092
7049
|
this.#progress.updateStatus('Building locations…');
|
|
7093
7050
|
this.buildLocationMap();
|
|
7051
|
+
this.#progress.updateStatus('Calculating native context attribution…');
|
|
7052
|
+
this.calculateNativeContextAttribution();
|
|
7094
7053
|
this.#progress.updateStatus('Calculating retained sizes…');
|
|
7095
7054
|
await this.installResultsFromSecondThread(resultsFromSecondWorker);
|
|
7055
|
+
this.calculateNativeContextSizes();
|
|
7096
7056
|
this.#progress.updateStatus('Calculating statistics…');
|
|
7097
7057
|
this.calculateStatistics();
|
|
7098
7058
|
if (this.profile.snapshot.trace_function_count) {
|
|
@@ -7127,6 +7087,26 @@ class HeapSnapshot {
|
|
|
7127
7087
|
}
|
|
7128
7088
|
return undefined;
|
|
7129
7089
|
}
|
|
7090
|
+
getObjectInfo(nodeIndex) {
|
|
7091
|
+
const nodesLength = this.nodes.length;
|
|
7092
|
+
const nodeFieldCount = this.nodeFieldCount;
|
|
7093
|
+
if (!Number.isInteger(nodeIndex) || nodeIndex < 0 || nodeIndex >= nodesLength || nodeIndex % nodeFieldCount !== 0) {
|
|
7094
|
+
throw new Error('Invalid nodeIndex ' + nodeIndex);
|
|
7095
|
+
}
|
|
7096
|
+
const node = this.createNode(nodeIndex);
|
|
7097
|
+
return {
|
|
7098
|
+
id: node.id(),
|
|
7099
|
+
name: node.name(),
|
|
7100
|
+
type: node.type(),
|
|
7101
|
+
nodeIndex,
|
|
7102
|
+
detachedness: node.detachedness(),
|
|
7103
|
+
selfSize: node.selfSize(),
|
|
7104
|
+
retainedSize: node.retainedSize(),
|
|
7105
|
+
distance: node.distance(),
|
|
7106
|
+
edgeCount: node.edgesCount(),
|
|
7107
|
+
retainerCount: node.retainersCount(),
|
|
7108
|
+
};
|
|
7109
|
+
}
|
|
7130
7110
|
startInitStep1InSecondThread(secondWorker) {
|
|
7131
7111
|
const resultsFromSecondWorker = new Promise((resolve, reject) => {
|
|
7132
7112
|
const listener = (e) => {
|
|
@@ -7326,40 +7306,76 @@ class HeapSnapshot {
|
|
|
7326
7306
|
}
|
|
7327
7307
|
getDuplicateStrings() {
|
|
7328
7308
|
const filter = this.createNamedFilter('duplicatedStrings');
|
|
7329
|
-
const
|
|
7309
|
+
const untruncatedGroups = new Map();
|
|
7310
|
+
const truncatedGroups = new Map();
|
|
7330
7311
|
const node = this.createNode(0);
|
|
7331
7312
|
for (let i = 0; i < this.nodeCount; ++i) {
|
|
7332
7313
|
node.nodeIndex = i * this.nodeFieldCount;
|
|
7333
7314
|
if (filter(node)) {
|
|
7334
7315
|
const name = node.name();
|
|
7335
7316
|
const truncated = node.nodeIsTruncatedString();
|
|
7336
|
-
|
|
7337
|
-
|
|
7338
|
-
|
|
7339
|
-
|
|
7340
|
-
|
|
7341
|
-
|
|
7342
|
-
|
|
7343
|
-
|
|
7344
|
-
|
|
7345
|
-
|
|
7346
|
-
|
|
7347
|
-
|
|
7348
|
-
|
|
7349
|
-
|
|
7350
|
-
|
|
7351
|
-
|
|
7352
|
-
|
|
7353
|
-
|
|
7354
|
-
|
|
7355
|
-
|
|
7356
|
-
|
|
7357
|
-
|
|
7358
|
-
|
|
7359
|
-
|
|
7317
|
+
if (truncated) {
|
|
7318
|
+
const length = node.nodeStringLength();
|
|
7319
|
+
const hash = node.nodeStringHash();
|
|
7320
|
+
let groups = truncatedGroups.get(name);
|
|
7321
|
+
if (!groups) {
|
|
7322
|
+
groups = [];
|
|
7323
|
+
truncatedGroups.set(name, groups);
|
|
7324
|
+
}
|
|
7325
|
+
let group = groups.find(g => g.length === length && g.hash === hash);
|
|
7326
|
+
if (!group) {
|
|
7327
|
+
group = {
|
|
7328
|
+
value: name,
|
|
7329
|
+
count: 0,
|
|
7330
|
+
totalSelfSize: 0,
|
|
7331
|
+
totalRetainedSize: 0,
|
|
7332
|
+
nodes: [],
|
|
7333
|
+
truncated: true,
|
|
7334
|
+
length,
|
|
7335
|
+
hash,
|
|
7336
|
+
};
|
|
7337
|
+
groups.push(group);
|
|
7338
|
+
}
|
|
7339
|
+
group.count++;
|
|
7340
|
+
group.totalSelfSize += node.selfSize();
|
|
7341
|
+
group.totalRetainedSize += node.retainedSize();
|
|
7342
|
+
group.nodes.push({
|
|
7343
|
+
id: node.id(),
|
|
7344
|
+
selfSize: node.selfSize(),
|
|
7345
|
+
retainedSize: node.retainedSize(),
|
|
7346
|
+
distance: node.distance(),
|
|
7347
|
+
});
|
|
7348
|
+
}
|
|
7349
|
+
else {
|
|
7350
|
+
let group = untruncatedGroups.get(name);
|
|
7351
|
+
if (!group) {
|
|
7352
|
+
group = {
|
|
7353
|
+
value: name,
|
|
7354
|
+
count: 0,
|
|
7355
|
+
totalSelfSize: 0,
|
|
7356
|
+
totalRetainedSize: 0,
|
|
7357
|
+
nodes: [],
|
|
7358
|
+
truncated: false,
|
|
7359
|
+
};
|
|
7360
|
+
untruncatedGroups.set(name, group);
|
|
7361
|
+
}
|
|
7362
|
+
group.count++;
|
|
7363
|
+
group.totalSelfSize += node.selfSize();
|
|
7364
|
+
group.totalRetainedSize += node.retainedSize();
|
|
7365
|
+
group.nodes.push({
|
|
7366
|
+
id: node.id(),
|
|
7367
|
+
selfSize: node.selfSize(),
|
|
7368
|
+
retainedSize: node.retainedSize(),
|
|
7369
|
+
distance: node.distance(),
|
|
7370
|
+
});
|
|
7371
|
+
}
|
|
7360
7372
|
}
|
|
7361
7373
|
}
|
|
7362
|
-
|
|
7374
|
+
const allGroups = [
|
|
7375
|
+
...untruncatedGroups.values(),
|
|
7376
|
+
...Array.from(truncatedGroups.values()).flat(),
|
|
7377
|
+
];
|
|
7378
|
+
return allGroups.sort((a, b) => b.totalRetainedSize - a.totalRetainedSize);
|
|
7363
7379
|
}
|
|
7364
7380
|
createNodeIdFilter(minNodeId, maxNodeId) {
|
|
7365
7381
|
function nodeIdFilter(node) {
|
|
@@ -7433,29 +7449,8 @@ class HeapSnapshot {
|
|
|
7433
7449
|
});
|
|
7434
7450
|
markUnreachableNodes();
|
|
7435
7451
|
return (node) => !getBit(node);
|
|
7436
|
-
case 'duplicatedStrings':
|
|
7437
|
-
|
|
7438
|
-
const node = this.createNode(0);
|
|
7439
|
-
for (let i = 0; i < this.nodeCount; ++i) {
|
|
7440
|
-
node.nodeIndex = i * this.nodeFieldCount;
|
|
7441
|
-
const rawType = node.rawType();
|
|
7442
|
-
if (rawType === this.nodeStringType || rawType === this.nodeConsStringType) {
|
|
7443
|
-
if (node.isFlatConsString()) {
|
|
7444
|
-
continue;
|
|
7445
|
-
}
|
|
7446
|
-
const name = node.name();
|
|
7447
|
-
const alreadyVisitedNodeIndex = stringToNodeIndexMap.get(name);
|
|
7448
|
-
if (alreadyVisitedNodeIndex === undefined) {
|
|
7449
|
-
stringToNodeIndexMap.set(name, node.nodeIndex);
|
|
7450
|
-
}
|
|
7451
|
-
else {
|
|
7452
|
-
bitmap.setBit(alreadyVisitedNodeIndex / this.nodeFieldCount);
|
|
7453
|
-
bitmap.setBit(node.nodeIndex / this.nodeFieldCount);
|
|
7454
|
-
}
|
|
7455
|
-
}
|
|
7456
|
-
}
|
|
7457
|
-
return getBit;
|
|
7458
|
-
}
|
|
7452
|
+
case 'duplicatedStrings':
|
|
7453
|
+
return this.createDuplicatedStringsFilter(bitmap);
|
|
7459
7454
|
case 'objectsRetainedByEventHandlers': {
|
|
7460
7455
|
const node = this.createNode(0);
|
|
7461
7456
|
const nodeFieldCount = this.nodeFieldCount;
|
|
@@ -7494,9 +7489,79 @@ class HeapSnapshot {
|
|
|
7494
7489
|
markUnreachableNodes();
|
|
7495
7490
|
return (node) => !getBit(node);
|
|
7496
7491
|
}
|
|
7492
|
+
case 'sharedNativeContext':
|
|
7493
|
+
return (node) => {
|
|
7494
|
+
const ordinal = node.nodeIndex / this.nodeFieldCount;
|
|
7495
|
+
return this.nodeNativeContextAttribution[ordinal] === SHARED_NATIVE_CONTEXT;
|
|
7496
|
+
};
|
|
7497
|
+
case 'noNativeContext':
|
|
7498
|
+
return (node) => {
|
|
7499
|
+
const ordinal = node.nodeIndex / this.nodeFieldCount;
|
|
7500
|
+
return this.nodeNativeContextAttribution[ordinal] === NO_NATIVE_CONTEXT;
|
|
7501
|
+
};
|
|
7502
|
+
default:
|
|
7503
|
+
if (filterName.startsWith('nativeContext_')) {
|
|
7504
|
+
const targetNodeIndex = Number(filterName.substring('nativeContext_'.length));
|
|
7505
|
+
const targetOrdinal = targetNodeIndex / this.nodeFieldCount;
|
|
7506
|
+
return (node) => {
|
|
7507
|
+
const ordinal = node.nodeIndex / this.nodeFieldCount;
|
|
7508
|
+
return this.nodeNativeContextAttribution[ordinal] === targetOrdinal;
|
|
7509
|
+
};
|
|
7510
|
+
}
|
|
7497
7511
|
}
|
|
7498
7512
|
throw new Error('Invalid filter name');
|
|
7499
7513
|
}
|
|
7514
|
+
createDuplicatedStringsFilter(bitmap) {
|
|
7515
|
+
const untruncatedStringToNodeIndexMap = new Map();
|
|
7516
|
+
const truncatedStringToNodeIndexesMap = new Map();
|
|
7517
|
+
const node = this.createNode(0);
|
|
7518
|
+
for (let i = 0; i < this.nodeCount; ++i) {
|
|
7519
|
+
node.nodeIndex = i * this.nodeFieldCount;
|
|
7520
|
+
const rawType = node.rawType();
|
|
7521
|
+
if (rawType !== this.nodeStringType && rawType !== this.nodeConsStringType) {
|
|
7522
|
+
continue;
|
|
7523
|
+
}
|
|
7524
|
+
if (node.isFlatConsString()) {
|
|
7525
|
+
continue;
|
|
7526
|
+
}
|
|
7527
|
+
if (node.selfSize() === 0) {
|
|
7528
|
+
continue;
|
|
7529
|
+
}
|
|
7530
|
+
const name = node.name();
|
|
7531
|
+
const truncated = node.nodeIsTruncatedString();
|
|
7532
|
+
if (truncated) {
|
|
7533
|
+
const length = node.nodeStringLength();
|
|
7534
|
+
const hash = node.nodeStringHash();
|
|
7535
|
+
let entries = truncatedStringToNodeIndexesMap.get(name);
|
|
7536
|
+
if (!entries) {
|
|
7537
|
+
entries = [];
|
|
7538
|
+
truncatedStringToNodeIndexesMap.set(name, entries);
|
|
7539
|
+
}
|
|
7540
|
+
const match = entries.find(e => e.length === length && e.hash === hash);
|
|
7541
|
+
if (match) {
|
|
7542
|
+
bitmap.setBit(match.nodeIndex / this.nodeFieldCount);
|
|
7543
|
+
bitmap.setBit(node.nodeIndex / this.nodeFieldCount);
|
|
7544
|
+
}
|
|
7545
|
+
else {
|
|
7546
|
+
entries.push({ nodeIndex: node.nodeIndex, length, hash });
|
|
7547
|
+
}
|
|
7548
|
+
}
|
|
7549
|
+
else {
|
|
7550
|
+
const alreadyVisitedNodeIndex = untruncatedStringToNodeIndexMap.get(name);
|
|
7551
|
+
if (alreadyVisitedNodeIndex === undefined) {
|
|
7552
|
+
untruncatedStringToNodeIndexMap.set(name, node.nodeIndex);
|
|
7553
|
+
}
|
|
7554
|
+
else {
|
|
7555
|
+
bitmap.setBit(alreadyVisitedNodeIndex / this.nodeFieldCount);
|
|
7556
|
+
bitmap.setBit(node.nodeIndex / this.nodeFieldCount);
|
|
7557
|
+
}
|
|
7558
|
+
}
|
|
7559
|
+
}
|
|
7560
|
+
return (node) => {
|
|
7561
|
+
const ordinal = node.nodeIndex / this.nodeFieldCount;
|
|
7562
|
+
return bitmap.getBit(ordinal);
|
|
7563
|
+
};
|
|
7564
|
+
}
|
|
7500
7565
|
getAggregatesByClassKey(sortedIndexes, key, filter) {
|
|
7501
7566
|
let aggregates;
|
|
7502
7567
|
if (key && this.#aggregates[key]) {
|
|
@@ -7815,7 +7880,7 @@ class HeapSnapshot {
|
|
|
7815
7880
|
return true;
|
|
7816
7881
|
}
|
|
7817
7882
|
static async calculateDominatorsAndRetainedSizes(inputs) {
|
|
7818
|
-
const { nodeCount, firstEdgeIndexes, edgeFieldsCount, nodeFieldCount, firstRetainerIndex, retainingEdges, retainingNodes, edgeToNodeOrdinals, rootNodeOrdinal, essentialEdges, nodeSelfSizesPromise, port } = inputs;
|
|
7883
|
+
const { nodeCount, firstEdgeIndexes, edgeFieldsCount, nodeFieldCount, firstRetainerIndex, retainingEdges, retainingNodes, edgeToNodeOrdinals, rootNodeOrdinal, essentialEdges, nodeSelfSizesPromise, port, } = inputs;
|
|
7819
7884
|
function isEssentialEdge(edgeIndex) {
|
|
7820
7885
|
return essentialEdges.getBit(edgeIndex / edgeFieldsCount);
|
|
7821
7886
|
}
|
|
@@ -7999,9 +8064,6 @@ class HeapSnapshot {
|
|
|
7999
8064
|
}
|
|
8000
8065
|
calculateObjectNames() {
|
|
8001
8066
|
const { nodes, nodeCount, nodeNameOffset, nodeNativeType, nodeHiddenType, nodeObjectType, nodeCodeType, nodeClosureType, nodeRegExpType, } = this;
|
|
8002
|
-
if (this.nodeDetachednessAndClassIndexOffset === -1) {
|
|
8003
|
-
this.detachednessAndClassIndexArray = new Uint32Array(nodeCount);
|
|
8004
|
-
}
|
|
8005
8067
|
const stringTable = new Map();
|
|
8006
8068
|
const getIndexForString = (s) => {
|
|
8007
8069
|
let index = stringTable.get(s);
|
|
@@ -8054,6 +8116,215 @@ class HeapSnapshot {
|
|
|
8054
8116
|
node.nodeIndex = node.nextNodeIndex();
|
|
8055
8117
|
}
|
|
8056
8118
|
}
|
|
8119
|
+
calculateNativeContextAttribution() {
|
|
8120
|
+
const attribution = new Int32Array(this.nodeCount).fill(NO_NATIVE_CONTEXT);
|
|
8121
|
+
const isFixed = createBitVector(this.nodeCount);
|
|
8122
|
+
const edgeTargets = this.buildInitEdgeTargets();
|
|
8123
|
+
this.#nativeContextOrdinals = [];
|
|
8124
|
+
for (let ordinal = 0; ordinal < this.nodeCount; ordinal++) {
|
|
8125
|
+
if (this.isNativeContext(ordinal)) {
|
|
8126
|
+
this.#nativeContextOrdinals.push(ordinal);
|
|
8127
|
+
attribution[ordinal] = ordinal;
|
|
8128
|
+
isFixed.setBit(ordinal);
|
|
8129
|
+
}
|
|
8130
|
+
else {
|
|
8131
|
+
const owner = this.inferFixedNativeContextForOrdinal(ordinal, edgeTargets);
|
|
8132
|
+
if (owner >= 0) {
|
|
8133
|
+
attribution[ordinal] = owner;
|
|
8134
|
+
isFixed.setBit(ordinal);
|
|
8135
|
+
}
|
|
8136
|
+
}
|
|
8137
|
+
}
|
|
8138
|
+
this.propagateNativeContextAttribution(attribution, isFixed);
|
|
8139
|
+
this.nodeNativeContextAttribution = attribution;
|
|
8140
|
+
}
|
|
8141
|
+
calculateNativeContextSizes() {
|
|
8142
|
+
const nodeFieldCount = this.nodeFieldCount;
|
|
8143
|
+
const node = this.createNode(0);
|
|
8144
|
+
const nativeContexts = [];
|
|
8145
|
+
const ordinalToInfo = new Map();
|
|
8146
|
+
for (const ordinal of this.#nativeContextOrdinals) {
|
|
8147
|
+
node.nodeIndex = ordinal * nodeFieldCount;
|
|
8148
|
+
const info = {
|
|
8149
|
+
nodeId: node.id(),
|
|
8150
|
+
nodeIndex: node.nodeIndex,
|
|
8151
|
+
nodeName: node.name(),
|
|
8152
|
+
attributedSize: 0,
|
|
8153
|
+
retainedSize: node.retainedSize(),
|
|
8154
|
+
selfSize: node.selfSize(),
|
|
8155
|
+
};
|
|
8156
|
+
nativeContexts.push(info);
|
|
8157
|
+
ordinalToInfo.set(ordinal, info);
|
|
8158
|
+
}
|
|
8159
|
+
let sharedSize = 0;
|
|
8160
|
+
let noAttributionSize = 0;
|
|
8161
|
+
const selfSizeOffset = this.nodeSelfSizeOffset;
|
|
8162
|
+
const nodes = this.nodes;
|
|
8163
|
+
for (let i = 0; i < this.nodeCount; ++i) {
|
|
8164
|
+
const ownerOrdinal = this.nodeNativeContextAttribution[i];
|
|
8165
|
+
const selfSize = nodes.getValue(i * nodeFieldCount + selfSizeOffset);
|
|
8166
|
+
if (ownerOrdinal === SHARED_NATIVE_CONTEXT) {
|
|
8167
|
+
sharedSize += selfSize;
|
|
8168
|
+
}
|
|
8169
|
+
else if (ownerOrdinal === NO_NATIVE_CONTEXT) {
|
|
8170
|
+
noAttributionSize += selfSize;
|
|
8171
|
+
}
|
|
8172
|
+
else {
|
|
8173
|
+
console.assert(ownerOrdinal >= 0, 'ownerOrdinal should be >= 0');
|
|
8174
|
+
const info = ordinalToInfo.get(ownerOrdinal);
|
|
8175
|
+
console.assert(info !== undefined, 'info should exist');
|
|
8176
|
+
if (info) {
|
|
8177
|
+
info.attributedSize += selfSize;
|
|
8178
|
+
}
|
|
8179
|
+
}
|
|
8180
|
+
}
|
|
8181
|
+
this.#nativeContextSizes = {
|
|
8182
|
+
nativeContexts,
|
|
8183
|
+
sharedSize,
|
|
8184
|
+
noAttributionSize,
|
|
8185
|
+
};
|
|
8186
|
+
}
|
|
8187
|
+
buildInitEdgeTargets() {
|
|
8188
|
+
const { nodeCount, nodeFieldCount, containmentEdges, edgeFieldsCount, edgeTypeOffset, edgeNameOffset, edgeToNodeOffset, edgeInternalType, firstEdgeIndexes, strings, } = this;
|
|
8189
|
+
const nativeContext = new Int32Array(nodeCount).fill(-1);
|
|
8190
|
+
const map = new Int32Array(nodeCount).fill(-1);
|
|
8191
|
+
const nativeContextIdx = strings.indexOf('native_context');
|
|
8192
|
+
const mapIdx = strings.indexOf('map');
|
|
8193
|
+
for (let ordinal = 0; ordinal < nodeCount; ordinal++) {
|
|
8194
|
+
const first = firstEdgeIndexes[ordinal];
|
|
8195
|
+
const last = firstEdgeIndexes[ordinal + 1];
|
|
8196
|
+
for (let edgeIndex = first; edgeIndex < last; edgeIndex += edgeFieldsCount) {
|
|
8197
|
+
const edgeType = containmentEdges.getValue(edgeIndex + edgeTypeOffset);
|
|
8198
|
+
if (edgeType !== edgeInternalType) {
|
|
8199
|
+
continue;
|
|
8200
|
+
}
|
|
8201
|
+
const nameIdx = containmentEdges.getValue(edgeIndex + edgeNameOffset);
|
|
8202
|
+
const childNodeIndex = containmentEdges.getValue(edgeIndex + edgeToNodeOffset);
|
|
8203
|
+
const childOrdinal = childNodeIndex / nodeFieldCount;
|
|
8204
|
+
if (nameIdx === nativeContextIdx && nativeContext[ordinal] === -1 && this.isNativeContext(childOrdinal)) {
|
|
8205
|
+
nativeContext[ordinal] = childOrdinal;
|
|
8206
|
+
}
|
|
8207
|
+
else if (nameIdx === mapIdx && map[ordinal] === -1) {
|
|
8208
|
+
map[ordinal] = childOrdinal;
|
|
8209
|
+
}
|
|
8210
|
+
}
|
|
8211
|
+
}
|
|
8212
|
+
return { nativeContext, map };
|
|
8213
|
+
}
|
|
8214
|
+
inferFixedNativeContextForOrdinal(ordinal, edgeTargets) {
|
|
8215
|
+
const mapOrdinal = edgeTargets.map[ordinal];
|
|
8216
|
+
if (mapOrdinal >= 0) {
|
|
8217
|
+
const metaMapOrdinal = edgeTargets.map[mapOrdinal];
|
|
8218
|
+
if (metaMapOrdinal >= 0) {
|
|
8219
|
+
const mapNativeContextOrdinal = edgeTargets.nativeContext[metaMapOrdinal];
|
|
8220
|
+
if (mapNativeContextOrdinal >= 0) {
|
|
8221
|
+
return mapNativeContextOrdinal;
|
|
8222
|
+
}
|
|
8223
|
+
}
|
|
8224
|
+
}
|
|
8225
|
+
return NO_NATIVE_CONTEXT;
|
|
8226
|
+
}
|
|
8227
|
+
mergeNativeContextOwner(current, incoming) {
|
|
8228
|
+
console.assert(incoming !== NO_NATIVE_CONTEXT, 'Incoming owner should not be NO_NATIVE_CONTEXT');
|
|
8229
|
+
if (current === SHARED_NATIVE_CONTEXT || incoming === SHARED_NATIVE_CONTEXT) {
|
|
8230
|
+
return SHARED_NATIVE_CONTEXT;
|
|
8231
|
+
}
|
|
8232
|
+
if (current === NO_NATIVE_CONTEXT) {
|
|
8233
|
+
return incoming;
|
|
8234
|
+
}
|
|
8235
|
+
if (current === incoming) {
|
|
8236
|
+
return current;
|
|
8237
|
+
}
|
|
8238
|
+
return SHARED_NATIVE_CONTEXT;
|
|
8239
|
+
}
|
|
8240
|
+
propagateNativeContextAttribution(attribution, isFixed) {
|
|
8241
|
+
const { nodeCount, containmentEdges, edgeFieldsCount, edgeTypeOffset, edgeToNodeOffset, edgeShortcutType, edgeWeakType, nodeFieldCount, firstEdgeIndexes, } = this;
|
|
8242
|
+
const queue = [];
|
|
8243
|
+
for (let ordinal = 0; ordinal < nodeCount; ordinal++) {
|
|
8244
|
+
if (isFixed.getBit(ordinal)) {
|
|
8245
|
+
queue.push(ordinal);
|
|
8246
|
+
}
|
|
8247
|
+
}
|
|
8248
|
+
let queueIndex = 0;
|
|
8249
|
+
while (queueIndex < queue.length) {
|
|
8250
|
+
const ordinal = queue[queueIndex];
|
|
8251
|
+
queueIndex++;
|
|
8252
|
+
const current = attribution[ordinal];
|
|
8253
|
+
console.assert(current !== NO_NATIVE_CONTEXT, 'Queue should not contain unattributed nodes');
|
|
8254
|
+
const first = firstEdgeIndexes[ordinal];
|
|
8255
|
+
const last = firstEdgeIndexes[ordinal + 1];
|
|
8256
|
+
for (let edgeIndex = first; edgeIndex < last; edgeIndex += edgeFieldsCount) {
|
|
8257
|
+
const edgeType = containmentEdges.getValue(edgeIndex + edgeTypeOffset);
|
|
8258
|
+
if (edgeType === edgeShortcutType || edgeType === edgeWeakType) {
|
|
8259
|
+
continue;
|
|
8260
|
+
}
|
|
8261
|
+
const childNodeIndex = containmentEdges.getValue(edgeIndex + edgeToNodeOffset);
|
|
8262
|
+
const childOrdinal = childNodeIndex / nodeFieldCount;
|
|
8263
|
+
if (childOrdinal === ordinal || isFixed.getBit(childOrdinal)) {
|
|
8264
|
+
continue;
|
|
8265
|
+
}
|
|
8266
|
+
const merged = this.mergeNativeContextOwner(attribution[childOrdinal], current);
|
|
8267
|
+
if (merged !== attribution[childOrdinal]) {
|
|
8268
|
+
attribution[childOrdinal] = merged;
|
|
8269
|
+
queue.push(childOrdinal);
|
|
8270
|
+
}
|
|
8271
|
+
}
|
|
8272
|
+
}
|
|
8273
|
+
}
|
|
8274
|
+
getNativeContextSizes() {
|
|
8275
|
+
return this.#nativeContextSizes;
|
|
8276
|
+
}
|
|
8277
|
+
getRetainedByContextSummary() {
|
|
8278
|
+
const isRetainedByContext = this.createNamedFilter('objectsRetainedByContexts');
|
|
8279
|
+
let contextCount = 0;
|
|
8280
|
+
let retainedByContextSize = 0;
|
|
8281
|
+
let retainedByContextCount = 0;
|
|
8282
|
+
let notRetainedByContextSize = 0;
|
|
8283
|
+
let notRetainedByContextCount = 0;
|
|
8284
|
+
const node = this.rootNode();
|
|
8285
|
+
const { nodes, nodeFieldCount, nodeSelfSizeOffset: selfSizeOffset } = this;
|
|
8286
|
+
const nodesLength = nodes.length;
|
|
8287
|
+
for (let nodeIndex = 0; nodeIndex < nodesLength; nodeIndex += nodeFieldCount) {
|
|
8288
|
+
const selfSize = nodes.getValue(nodeIndex + selfSizeOffset);
|
|
8289
|
+
if (!selfSize) {
|
|
8290
|
+
continue;
|
|
8291
|
+
}
|
|
8292
|
+
node.nodeIndex = nodeIndex;
|
|
8293
|
+
if (isRetainedByContext(node)) {
|
|
8294
|
+
retainedByContextCount++;
|
|
8295
|
+
retainedByContextSize += selfSize;
|
|
8296
|
+
}
|
|
8297
|
+
else {
|
|
8298
|
+
notRetainedByContextCount++;
|
|
8299
|
+
notRetainedByContextSize += selfSize;
|
|
8300
|
+
}
|
|
8301
|
+
if (this.isContextObject(node)) {
|
|
8302
|
+
contextCount++;
|
|
8303
|
+
}
|
|
8304
|
+
}
|
|
8305
|
+
return {
|
|
8306
|
+
contextCount,
|
|
8307
|
+
retainedByContextSize,
|
|
8308
|
+
retainedByContextCount,
|
|
8309
|
+
notRetainedByContextSize,
|
|
8310
|
+
notRetainedByContextCount,
|
|
8311
|
+
totalSize: retainedByContextSize + notRetainedByContextSize,
|
|
8312
|
+
};
|
|
8313
|
+
}
|
|
8314
|
+
nodeNativeContext(nodeIndex) {
|
|
8315
|
+
const ordinal = nodeIndex / this.nodeFieldCount;
|
|
8316
|
+
const nativeContextOrdinal = this.nodeNativeContextAttribution[ordinal];
|
|
8317
|
+
if (nativeContextOrdinal < 0) {
|
|
8318
|
+
return nativeContextOrdinal;
|
|
8319
|
+
}
|
|
8320
|
+
return nativeContextOrdinal * this.nodeFieldCount;
|
|
8321
|
+
}
|
|
8322
|
+
isNativeContext(nodeOrdinal) {
|
|
8323
|
+
const nameIdx = this.nodes.getValue(nodeOrdinal * this.nodeFieldCount + this.nodeNameOffset);
|
|
8324
|
+
const name = this.strings[nameIdx];
|
|
8325
|
+
return name === 'system / NativeContext' || name.startsWith('system / NativeContext / ') ||
|
|
8326
|
+
name === 'Detached system / NativeContext' || name.startsWith('Detached system / NativeContext / ');
|
|
8327
|
+
}
|
|
8057
8328
|
interfaceDefinitions() {
|
|
8058
8329
|
return JSON.stringify(this.#interfaceDefinitions ?? []);
|
|
8059
8330
|
}
|
|
@@ -8228,11 +8499,32 @@ class HeapSnapshot {
|
|
|
8228
8499
|
}
|
|
8229
8500
|
return null;
|
|
8230
8501
|
}
|
|
8502
|
+
initDetachednessAndClassIndex() {
|
|
8503
|
+
this.detachednessAndClassIndexArray = new Uint32Array(this.nodeCount);
|
|
8504
|
+
if (this.nodeDetachednessAndClassIndexOffset !== -1) {
|
|
8505
|
+
const { nodeFieldCount, nodeDetachednessAndClassIndexOffset: offset } = this;
|
|
8506
|
+
for (let i = 0; i < this.nodeCount; ++i) {
|
|
8507
|
+
this.detachednessAndClassIndexArray[i] = Number(this.nodes.getValue(i * nodeFieldCount + offset));
|
|
8508
|
+
}
|
|
8509
|
+
}
|
|
8510
|
+
else {
|
|
8511
|
+
const node = this.rootNode();
|
|
8512
|
+
const nodesLength = this.nodes.length;
|
|
8513
|
+
const { nodeFieldCount, nodeNativeType, nodeTypeOffset } = this;
|
|
8514
|
+
for (let nodeIndex = 0; nodeIndex < nodesLength; nodeIndex += nodeFieldCount) {
|
|
8515
|
+
if (this.nodes.getValue(nodeIndex + nodeTypeOffset) === nodeNativeType) {
|
|
8516
|
+
node.nodeIndex = nodeIndex;
|
|
8517
|
+
if (node.name().startsWith('Detached ')) {
|
|
8518
|
+
node.setDetachedness(2 );
|
|
8519
|
+
}
|
|
8520
|
+
}
|
|
8521
|
+
}
|
|
8522
|
+
}
|
|
8523
|
+
}
|
|
8231
8524
|
propagateDOMState() {
|
|
8232
8525
|
if (this.nodeDetachednessAndClassIndexOffset === -1) {
|
|
8233
8526
|
return;
|
|
8234
8527
|
}
|
|
8235
|
-
console.time('propagateDOMState');
|
|
8236
8528
|
const visited = new Uint8Array(this.nodeCount);
|
|
8237
8529
|
const attached = [];
|
|
8238
8530
|
const detached = [];
|
|
@@ -8291,7 +8583,6 @@ class HeapSnapshot {
|
|
|
8291
8583
|
}
|
|
8292
8584
|
propagateState(this, nodeOrdinal, 2 );
|
|
8293
8585
|
}
|
|
8294
|
-
console.timeEnd('propagateDOMState');
|
|
8295
8586
|
}
|
|
8296
8587
|
buildSamples() {
|
|
8297
8588
|
const samples = this.#rawSamples;
|
|
@@ -8457,11 +8748,54 @@ class HeapSnapshot {
|
|
|
8457
8748
|
}
|
|
8458
8749
|
return null;
|
|
8459
8750
|
}
|
|
8460
|
-
createEdgesProvider(nodeIndex) {
|
|
8751
|
+
createEdgesProvider(nodeIndex, options) {
|
|
8461
8752
|
const node = this.createNode(nodeIndex);
|
|
8462
|
-
const
|
|
8753
|
+
const defaultFilter = this.containmentEdgesFilter();
|
|
8754
|
+
const minRetainedSize = options?.minRetainedSize;
|
|
8755
|
+
const excludePrimitives = options?.excludePrimitives ?? false;
|
|
8756
|
+
let filter = defaultFilter;
|
|
8757
|
+
if (minRetainedSize !== undefined || excludePrimitives) {
|
|
8758
|
+
filter = (edge) => {
|
|
8759
|
+
if (defaultFilter && !defaultFilter(edge)) {
|
|
8760
|
+
return false;
|
|
8761
|
+
}
|
|
8762
|
+
const targetNode = edge.node();
|
|
8763
|
+
if (minRetainedSize !== undefined && targetNode.retainedSize() < minRetainedSize) {
|
|
8764
|
+
return false;
|
|
8765
|
+
}
|
|
8766
|
+
if (excludePrimitives) {
|
|
8767
|
+
const rawType = targetNode.rawType();
|
|
8768
|
+
if (rawType === this.nodeNumberType) {
|
|
8769
|
+
return false;
|
|
8770
|
+
}
|
|
8771
|
+
if (rawType === this.nodeNativeType) {
|
|
8772
|
+
const targetName = targetNode.rawName();
|
|
8773
|
+
if (targetName === 'undefined' || targetName === 'null' || targetName === 'true' ||
|
|
8774
|
+
targetName === 'false') {
|
|
8775
|
+
return false;
|
|
8776
|
+
}
|
|
8777
|
+
}
|
|
8778
|
+
}
|
|
8779
|
+
return true;
|
|
8780
|
+
};
|
|
8781
|
+
}
|
|
8463
8782
|
const indexProvider = new HeapSnapshotEdgeIndexProvider(this);
|
|
8464
|
-
|
|
8783
|
+
const provider = new HeapSnapshotEdgesProvider(this, filter, node.edges(), indexProvider);
|
|
8784
|
+
if (options?.sortBy) {
|
|
8785
|
+
const sortBy = options.sortBy;
|
|
8786
|
+
let comparator;
|
|
8787
|
+
if (sortBy === 'selfSize') {
|
|
8788
|
+
comparator = new ComparatorConfig('selfSize', false, '!edgeName', true);
|
|
8789
|
+
}
|
|
8790
|
+
else if (sortBy === 'name') {
|
|
8791
|
+
comparator = new ComparatorConfig('!edgeName', true, 'retainedSize', false);
|
|
8792
|
+
}
|
|
8793
|
+
else {
|
|
8794
|
+
comparator = new ComparatorConfig('retainedSize', false, '!edgeName', true);
|
|
8795
|
+
}
|
|
8796
|
+
provider.sortAndRewind(comparator);
|
|
8797
|
+
}
|
|
8798
|
+
return provider;
|
|
8465
8799
|
}
|
|
8466
8800
|
createEdgesProviderForTest(nodeIndex, filter) {
|
|
8467
8801
|
const node = this.createNode(nodeIndex);
|
|
@@ -8481,7 +8815,7 @@ class HeapSnapshot {
|
|
|
8481
8815
|
return new HeapSnapshotEdgesProvider(this, filter, node.retainers(), indexProvider);
|
|
8482
8816
|
}
|
|
8483
8817
|
getRetainingPaths(nodeIndex, maxDepth = 30, maxNodes = 5000, maxSiblings = 100) {
|
|
8484
|
-
const { nodeFieldCount, firstRetainerIndex, retainingNodes, retainingEdges, edgeTypeOffset, edgeWeakType, containmentEdges } = this;
|
|
8818
|
+
const { nodeFieldCount, firstRetainerIndex, retainingNodes, retainingEdges, edgeTypeOffset, edgeWeakType, containmentEdges, } = this;
|
|
8485
8819
|
const distances = this.#nodeDistancesForRetainersView ?? this.nodeDistances;
|
|
8486
8820
|
let traversedNodesCount = 0;
|
|
8487
8821
|
const visiting = new Set();
|
|
@@ -8618,6 +8952,85 @@ class HeapSnapshot {
|
|
|
8618
8952
|
createNodesProviderForClass(classKey, nodeFilter) {
|
|
8619
8953
|
return new HeapSnapshotNodesProvider(this, this.aggregatesWithFilter(nodeFilter)[classKey].idxs);
|
|
8620
8954
|
}
|
|
8955
|
+
queryObjects(queryOptions) {
|
|
8956
|
+
const { nodes, nodeFieldCount, retainedSizes } = this;
|
|
8957
|
+
const nodesLength = nodes.length;
|
|
8958
|
+
const matchingIndexes = [];
|
|
8959
|
+
const classNamePattern = queryOptions.className ? new RegExp(queryOptions.className, 'i') : null;
|
|
8960
|
+
const propertyNamePattern = queryOptions.propertyName ? new RegExp(queryOptions.propertyName, 'i') : null;
|
|
8961
|
+
const targetNodeType = queryOptions.nodeType ? queryOptions.nodeType.toLowerCase() : null;
|
|
8962
|
+
const node = this.rootNode();
|
|
8963
|
+
for (let nodeIndex = 0, ordinal = 0; nodeIndex < nodesLength; nodeIndex += nodeFieldCount, ordinal++) {
|
|
8964
|
+
node.nodeIndex = nodeIndex;
|
|
8965
|
+
if (queryOptions.minSelfSize !== undefined && node.selfSize() < queryOptions.minSelfSize) {
|
|
8966
|
+
continue;
|
|
8967
|
+
}
|
|
8968
|
+
if (queryOptions.maxSelfSize !== undefined && node.selfSize() > queryOptions.maxSelfSize) {
|
|
8969
|
+
continue;
|
|
8970
|
+
}
|
|
8971
|
+
const retainedSize = retainedSizes[ordinal];
|
|
8972
|
+
if (queryOptions.minRetainedSize !== undefined && retainedSize < queryOptions.minRetainedSize) {
|
|
8973
|
+
continue;
|
|
8974
|
+
}
|
|
8975
|
+
if (queryOptions.maxRetainedSize !== undefined && retainedSize > queryOptions.maxRetainedSize) {
|
|
8976
|
+
continue;
|
|
8977
|
+
}
|
|
8978
|
+
if (queryOptions.isDetached !== undefined) {
|
|
8979
|
+
const isDetached = node.detachedness() === 2 ;
|
|
8980
|
+
if (isDetached !== queryOptions.isDetached) {
|
|
8981
|
+
continue;
|
|
8982
|
+
}
|
|
8983
|
+
}
|
|
8984
|
+
if (classNamePattern) {
|
|
8985
|
+
const name = node.name();
|
|
8986
|
+
if (!classNamePattern.test(name)) {
|
|
8987
|
+
continue;
|
|
8988
|
+
}
|
|
8989
|
+
}
|
|
8990
|
+
if (targetNodeType) {
|
|
8991
|
+
const typeStr = node.type();
|
|
8992
|
+
if (typeStr.toLowerCase() !== targetNodeType) {
|
|
8993
|
+
continue;
|
|
8994
|
+
}
|
|
8995
|
+
}
|
|
8996
|
+
if (propertyNamePattern) {
|
|
8997
|
+
let propMatch = false;
|
|
8998
|
+
for (const iter = node.edges(); iter.hasNext(); iter.next()) {
|
|
8999
|
+
if (propertyNamePattern.test(iter.edge.name())) {
|
|
9000
|
+
propMatch = true;
|
|
9001
|
+
break;
|
|
9002
|
+
}
|
|
9003
|
+
}
|
|
9004
|
+
if (!propMatch) {
|
|
9005
|
+
continue;
|
|
9006
|
+
}
|
|
9007
|
+
}
|
|
9008
|
+
matchingIndexes.push(nodeIndex);
|
|
9009
|
+
}
|
|
9010
|
+
const sortBy = queryOptions.sortBy ?? 'retainedSize';
|
|
9011
|
+
if (sortBy === 'retainedSize') {
|
|
9012
|
+
matchingIndexes.sort((a, b) => retainedSizes[b / nodeFieldCount] - retainedSizes[a / nodeFieldCount]);
|
|
9013
|
+
}
|
|
9014
|
+
else if (sortBy === 'selfSize') {
|
|
9015
|
+
matchingIndexes.sort((a, b) => {
|
|
9016
|
+
node.nodeIndex = b;
|
|
9017
|
+
const sizeB = node.selfSize();
|
|
9018
|
+
node.nodeIndex = a;
|
|
9019
|
+
const sizeA = node.selfSize();
|
|
9020
|
+
return sizeB - sizeA;
|
|
9021
|
+
});
|
|
9022
|
+
}
|
|
9023
|
+
else if (sortBy === 'id') {
|
|
9024
|
+
matchingIndexes.sort((a, b) => {
|
|
9025
|
+
node.nodeIndex = b;
|
|
9026
|
+
const idB = node.id();
|
|
9027
|
+
node.nodeIndex = a;
|
|
9028
|
+
const idA = node.id();
|
|
9029
|
+
return idA - idB;
|
|
9030
|
+
});
|
|
9031
|
+
}
|
|
9032
|
+
return new HeapSnapshotNodesProvider(this, matchingIndexes);
|
|
9033
|
+
}
|
|
8621
9034
|
maxJsNodeId() {
|
|
8622
9035
|
const nodeFieldCount = this.nodeFieldCount;
|
|
8623
9036
|
const nodes = this.nodes;
|
|
@@ -9125,7 +9538,7 @@ class JSHeapSnapshot extends HeapSnapshot {
|
|
|
9125
9538
|
continue;
|
|
9126
9539
|
}
|
|
9127
9540
|
node.nodeIndex = nodeIndex;
|
|
9128
|
-
if (node.
|
|
9541
|
+
if (node.detachedness() === 2 ) {
|
|
9129
9542
|
this.flags[ordinal] |= flag;
|
|
9130
9543
|
}
|
|
9131
9544
|
}
|
|
@@ -9279,7 +9692,7 @@ class JSHeapSnapshot extends HeapSnapshot {
|
|
|
9279
9692
|
jsArrays: sizeJSArrays,
|
|
9280
9693
|
strings: sizeStrings,
|
|
9281
9694
|
system: sizeSystem,
|
|
9282
|
-
}
|
|
9695
|
+
},
|
|
9283
9696
|
};
|
|
9284
9697
|
}
|
|
9285
9698
|
calculateArraySize(node) {
|
|
@@ -9694,6 +10107,7 @@ class HeapSnapshotLoader {
|
|
|
9694
10107
|
this.#dataCallback = null;
|
|
9695
10108
|
this.#done = false;
|
|
9696
10109
|
this.parsingComplete = this.#parseInput();
|
|
10110
|
+
this.parsingComplete.catch(() => { });
|
|
9697
10111
|
}
|
|
9698
10112
|
dispose() {
|
|
9699
10113
|
this.#reset();
|
|
@@ -9706,6 +10120,7 @@ class HeapSnapshotLoader {
|
|
|
9706
10120
|
this.#done = true;
|
|
9707
10121
|
if (this.#dataCallback) {
|
|
9708
10122
|
this.#dataCallback('');
|
|
10123
|
+
this.#dataCallback = null;
|
|
9709
10124
|
}
|
|
9710
10125
|
}
|
|
9711
10126
|
async buildSnapshot(secondWorker) {
|
|
@@ -9773,6 +10188,9 @@ class HeapSnapshotLoader {
|
|
|
9773
10188
|
this.#snapshot.strings = JSON.parse(this.#json);
|
|
9774
10189
|
}
|
|
9775
10190
|
write(chunk) {
|
|
10191
|
+
if (!chunk) {
|
|
10192
|
+
return;
|
|
10193
|
+
}
|
|
9776
10194
|
this.#buffer.push(chunk);
|
|
9777
10195
|
if (!this.#dataCallback) {
|
|
9778
10196
|
return;
|
|
@@ -9784,6 +10202,9 @@ class HeapSnapshotLoader {
|
|
|
9784
10202
|
if (this.#buffer.length > 0) {
|
|
9785
10203
|
return Promise.resolve(this.#buffer.shift());
|
|
9786
10204
|
}
|
|
10205
|
+
if (this.#done) {
|
|
10206
|
+
return Promise.resolve('');
|
|
10207
|
+
}
|
|
9787
10208
|
const { promise, resolve } = Promise.withResolvers();
|
|
9788
10209
|
this.#dataCallback = resolve;
|
|
9789
10210
|
return promise;
|
|
@@ -9795,7 +10216,11 @@ class HeapSnapshotLoader {
|
|
|
9795
10216
|
return pos;
|
|
9796
10217
|
}
|
|
9797
10218
|
startIndex = this.#json.length - token.length + 1;
|
|
9798
|
-
|
|
10219
|
+
const chunk = await this.#fetchChunk();
|
|
10220
|
+
if (!chunk) {
|
|
10221
|
+
throw new Error(`Token ${token} not found (unexpected end of input)`);
|
|
10222
|
+
}
|
|
10223
|
+
this.#json += chunk;
|
|
9799
10224
|
}
|
|
9800
10225
|
}
|
|
9801
10226
|
async #parseArray(name, title, length) {
|
|
@@ -9812,7 +10237,11 @@ class HeapSnapshotLoader {
|
|
|
9812
10237
|
else {
|
|
9813
10238
|
this.#progress.updateStatus(title);
|
|
9814
10239
|
}
|
|
9815
|
-
|
|
10240
|
+
const chunk = await this.#fetchChunk();
|
|
10241
|
+
if (!chunk) {
|
|
10242
|
+
throw new Error(`Unexpected end of input while ${title}`);
|
|
10243
|
+
}
|
|
10244
|
+
this.#json += chunk;
|
|
9816
10245
|
}
|
|
9817
10246
|
const result = this.#array;
|
|
9818
10247
|
this.#array = null;
|
|
@@ -9835,7 +10264,11 @@ class HeapSnapshotLoader {
|
|
|
9835
10264
|
});
|
|
9836
10265
|
jsonTokenizer.write(json);
|
|
9837
10266
|
while (!jsonTokenizerDone) {
|
|
9838
|
-
|
|
10267
|
+
const chunk = await this.#fetchChunk();
|
|
10268
|
+
if (!chunk) {
|
|
10269
|
+
throw new Error('Unexpected end of input while loading snapshot info');
|
|
10270
|
+
}
|
|
10271
|
+
jsonTokenizer.write(chunk);
|
|
9839
10272
|
}
|
|
9840
10273
|
this.#snapshot = this.#snapshot || {};
|
|
9841
10274
|
const nodes = await this.#parseArray('"nodes"', 'Loading nodes… {PH1}%', this.#snapshot.snapshot.meta.node_fields.length * this.#snapshot.snapshot.node_count);
|