Audits

class Audits(cdp: CDP) : Domain

Audits domain allows investigation of page violations and possible improvements.

Constructors

Link copied to clipboard
constructor(cdp: CDP)

Types

Link copied to clipboard
@Serializable
data class AffectedCookie(val name: String, val path: String, val domain: String)

Information about a cookie that is affected by an inspector issue.

Link copied to clipboard
@Serializable
data class AffectedFrame(val frameId: String)

Information about the frame affected by an inspector issue.

Link copied to clipboard
@Serializable
data class AffectedRequest(val requestId: String? = null, val url: String)

Information about a request that is affected by an inspector issue.

Link copied to clipboard
@Serializable
data class AttributionReportingIssueDetails(val violationType: Audits.AttributionReportingIssueType, val request: Audits.AffectedRequest? = null, val violatingNodeId: Int? = null, val invalidParameter: String? = null)

Details for issues around "Attribution Reporting API" usage. Explainer: https://github.com/WICG/attribution-reporting-api

Link copied to clipboard
@Serializable
data class BlockedByResponseIssueDetails(val request: Audits.AffectedRequest, val parentFrame: Audits.AffectedFrame? = null, val blockedFrame: Audits.AffectedFrame? = null, val reason: Audits.BlockedByResponseReason)

Details for a request that has been blocked with the BLOCKED_BY_RESPONSE code. Currently only used for COEP/COOP, but may be extended to include some CSP errors in the future.

Link copied to clipboard

Enum indicating the reason a response has been blocked. These reasons are refinements of the net error BLOCKED_BY_RESPONSE.

Link copied to clipboard
@Serializable
data class BounceTrackingIssueDetails(val trackingSites: List<String>)

This issue warns about sites in the redirect chain of a finished navigation that may be flagged as trackers and have their state cleared if they don't receive a user interaction. Note that in this context 'site' means eTLD+1. For example, if the URL https://example.test:80/bounce was in the redirect chain, the site reported would be example.test.

Link copied to clipboard
@Serializable
data class CheckContrastParameter(val reportAAA: Boolean? = null)
Link copied to clipboard
@Serializable
data class CheckFormsIssuesReturn(val formIssues: List<Audits.GenericIssueDetails>)
Link copied to clipboard
@Serializable
data class ClientHintIssueDetails(val sourceCodeLocation: Audits.SourceCodeLocation, val clientHintIssueReason: Audits.ClientHintIssueReason)

This issue tracks client hints related issues. It's used to deprecate old features, encourage the use of new ones, and provide general guidance.

Link copied to clipboard
Link copied to clipboard
@Serializable
data class ContentSecurityPolicyIssueDetails(val blockedURL: String? = null, val violatedDirective: String, val isReportOnly: Boolean, val contentSecurityPolicyViolationType: Audits.ContentSecurityPolicyViolationType, val frameAncestor: Audits.AffectedFrame? = null, val sourceCodeLocation: Audits.SourceCodeLocation? = null, val violatingNodeId: Int? = null)
Link copied to clipboard
@Serializable
data class CookieDeprecationMetadataIssueDetails(val allowedSites: List<String>, val optOutPercentage: Double, val isOptOutTopLevel: Boolean, val operation: Audits.CookieOperation)

This issue warns about third-party sites that are accessing cookies on the current page, and have been permitted due to having a global metadata grant. Note that in this context 'site' means eTLD+1. For example, if the URL https://example.test:80/web_page was accessing cookies, the site reported would be example.test.

Link copied to clipboard
Link copied to clipboard
@Serializable
data class CookieIssueDetails(val cookie: Audits.AffectedCookie? = null, val rawCookieLine: String? = null, val cookieWarningReasons: List<Audits.CookieWarningReason>, val cookieExclusionReasons: List<Audits.CookieExclusionReason>, val operation: Audits.CookieOperation, val siteForCookies: String? = null, val cookieUrl: String? = null, val request: Audits.AffectedRequest? = null, val insight: Audits.CookieIssueInsight? = null)

This information is currently necessary, as the front-end has a difficult time finding a specific cookie. With this, we can convey specific error information without the cookie.

Link copied to clipboard
@Serializable
data class CookieIssueInsight(val type: Audits.InsightType, val tableEntryUrl: String? = null)

Information about the suggested solution to a cookie issue.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
@Serializable
data class CorsIssueDetails(val corsErrorStatus: Network.CorsErrorStatus, val isWarning: Boolean, val request: Audits.AffectedRequest, val location: Audits.SourceCodeLocation? = null, val initiatorOrigin: String? = null, val resourceIPAddressSpace: Network.IPAddressSpace? = null, val clientSecurityState: Network.ClientSecurityState? = null)

Details for a CORS related issue, e.g. a warning or error related to CORS RFC1918 enforcement.

Link copied to clipboard
@Serializable
data class DeprecationIssueDetails(val affectedFrame: Audits.AffectedFrame? = null, val sourceCodeLocation: Audits.SourceCodeLocation, val type: String)

This issue tracks information needed to print a deprecation message. https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/frame/third_party/blink/renderer/core/frame/deprecation/README.md

Link copied to clipboard
@Serializable
data class ElementAccessibilityIssueDetails(val nodeId: Int, val elementAccessibilityIssueReason: Audits.ElementAccessibilityIssueReason, val hasDisallowedAttributes: Boolean)

This issue warns about errors in the select or summary element content model.

Link copied to clipboard
@Serializable
data class FailedRequestInfo(val url: String, val failureMessage: String, val requestId: String? = null)
Link copied to clipboard
@Serializable
data class FederatedAuthRequestIssueDetails(val federatedAuthRequestIssueReason: Audits.FederatedAuthRequestIssueReason)
Link copied to clipboard

Represents the failure reason when a federated authentication reason fails. Should be updated alongside RequestIdTokenStatus in third_party/blink/public/mojom/devtools/inspector_issue.mojom to include all cases except for success.

Link copied to clipboard
@Serializable
data class FederatedAuthUserInfoRequestIssueDetails(val federatedAuthUserInfoRequestIssueReason: Audits.FederatedAuthUserInfoRequestIssueReason)
Link copied to clipboard

Represents the failure reason when a getUserInfo() call fails. Should be updated alongside FederatedAuthUserInfoRequestResult in third_party/blink/public/mojom/devtools/inspector_issue.mojom.

Link copied to clipboard
@Serializable
data class GenericIssueDetails(val errorType: Audits.GenericIssueErrorType, val frameId: String? = null, val violatingNodeId: Int? = null, val violatingNodeAttribute: String? = null, val request: Audits.AffectedRequest? = null)

Depending on the concrete errorType, different properties are set.

Link copied to clipboard
Link copied to clipboard
@Serializable
data class GetEncodedResponseParameter(val requestId: String, val encoding: String, val quality: Double? = null, val sizeOnly: Boolean? = null)
Link copied to clipboard
@Serializable
data class GetEncodedResponseReturn(val body: String?, val originalSize: Int, val encodedSize: Int)
Link copied to clipboard
@Serializable
data class HeavyAdIssueDetails(val resolution: Audits.HeavyAdResolutionStatus, val reason: Audits.HeavyAdReason, val frame: Audits.AffectedFrame)
Link copied to clipboard
Link copied to clipboard
@Serializable
enum InsightType : Enum<Audits.InsightType>

Represents the category of insight that a cookie issue falls under.

Link copied to clipboard
@Serializable
data class InspectorIssue(val code: Audits.InspectorIssueCode, val details: Audits.InspectorIssueDetails, val issueId: String? = null)

An inspector issue reported from the back-end.

Link copied to clipboard

A unique identifier for the type of issue. Each type may use one of the optional fields in InspectorIssueDetails to convey more specific information about the kind of issue.

Link copied to clipboard
@Serializable
data class InspectorIssueDetails(val cookieIssueDetails: Audits.CookieIssueDetails? = null, val mixedContentIssueDetails: Audits.MixedContentIssueDetails? = null, val blockedByResponseIssueDetails: Audits.BlockedByResponseIssueDetails? = null, val heavyAdIssueDetails: Audits.HeavyAdIssueDetails? = null, val contentSecurityPolicyIssueDetails: Audits.ContentSecurityPolicyIssueDetails? = null, val sharedArrayBufferIssueDetails: Audits.SharedArrayBufferIssueDetails? = null, val lowTextContrastIssueDetails: Audits.LowTextContrastIssueDetails? = null, val corsIssueDetails: Audits.CorsIssueDetails? = null, val attributionReportingIssueDetails: Audits.AttributionReportingIssueDetails? = null, val quirksModeIssueDetails: Audits.QuirksModeIssueDetails? = null, val partitioningBlobURLIssueDetails: Audits.PartitioningBlobURLIssueDetails? = null, val navigatorUserAgentIssueDetails: Audits.NavigatorUserAgentIssueDetails? = null, val genericIssueDetails: Audits.GenericIssueDetails? = null, val deprecationIssueDetails: Audits.DeprecationIssueDetails? = null, val clientHintIssueDetails: Audits.ClientHintIssueDetails? = null, val federatedAuthRequestIssueDetails: Audits.FederatedAuthRequestIssueDetails? = null, val bounceTrackingIssueDetails: Audits.BounceTrackingIssueDetails? = null, val cookieDeprecationMetadataIssueDetails: Audits.CookieDeprecationMetadataIssueDetails? = null, val stylesheetLoadingIssueDetails: Audits.StylesheetLoadingIssueDetails? = null, val propertyRuleIssueDetails: Audits.PropertyRuleIssueDetails? = null, val federatedAuthUserInfoRequestIssueDetails: Audits.FederatedAuthUserInfoRequestIssueDetails? = null, val sharedDictionaryIssueDetails: Audits.SharedDictionaryIssueDetails? = null, val elementAccessibilityIssueDetails: Audits.ElementAccessibilityIssueDetails? = null, val sriMessageSignatureIssueDetails: Audits.SRIMessageSignatureIssueDetails? = null, val userReidentificationIssueDetails: Audits.UserReidentificationIssueDetails? = null)

This struct holds a list of optional fields with additional information specific to the kind of issue. When adding a new issue code, please also add a new optional field to this type.

Link copied to clipboard
@Serializable
data class IssueAddedParameter(val issue: Audits.InspectorIssue)
Link copied to clipboard
@Serializable
data class LowTextContrastIssueDetails(val violatingNodeId: Int, val violatingNodeSelector: String, val contrastRatio: Double, val thresholdAA: Double, val thresholdAAA: Double, val fontSize: String, val fontWeight: String)
Link copied to clipboard
@Serializable
data class MixedContentIssueDetails(val resourceType: Audits.MixedContentResourceType? = null, val resolutionStatus: Audits.MixedContentResolutionStatus, val insecureURL: String, val mainResourceURL: String, val request: Audits.AffectedRequest? = null, val frame: Audits.AffectedFrame? = null)
Link copied to clipboard
@Serializable
data class NavigatorUserAgentIssueDetails(val url: String, val location: Audits.SourceCodeLocation? = null)
Link copied to clipboard
@Serializable
data class PartitioningBlobURLIssueDetails(val url: String, val partitioningBlobURLInfo: Audits.PartitioningBlobURLInfo)
Link copied to clipboard
@Serializable
data class PropertyRuleIssueDetails(val sourceCodeLocation: Audits.SourceCodeLocation, val propertyRuleIssueReason: Audits.PropertyRuleIssueReason, val propertyValue: String? = null)

This issue warns about errors in property rules that lead to property registrations being ignored.

Link copied to clipboard
@Serializable
data class QuirksModeIssueDetails(val isLimitedQuirksMode: Boolean, val documentNodeId: Int, val url: String, val frameId: String, val loaderId: String)

Details for issues about documents in Quirks Mode or Limited Quirks Mode that affects page layouting.

Link copied to clipboard
@Serializable
data class SharedArrayBufferIssueDetails(val sourceCodeLocation: Audits.SourceCodeLocation, val isWarning: Boolean, val type: Audits.SharedArrayBufferIssueType)

Details for a issue arising from an SAB being instantiated in, or transferred to a context that is not cross-origin isolated.

Link copied to clipboard
Link copied to clipboard
@Serializable
data class SharedDictionaryIssueDetails(val sharedDictionaryError: Audits.SharedDictionaryError, val request: Audits.AffectedRequest)
Link copied to clipboard
@Serializable
data class SourceCodeLocation(val scriptId: String? = null, val url: String, val lineNumber: Int, val columnNumber: Int)
Link copied to clipboard
@Serializable
data class SRIMessageSignatureIssueDetails(val error: Audits.SRIMessageSignatureError, val signatureBase: String, val integrityAssertions: List<String>, val request: Audits.AffectedRequest)
Link copied to clipboard
@Serializable
data class StylesheetLoadingIssueDetails(val sourceCodeLocation: Audits.SourceCodeLocation, val styleSheetLoadingIssueReason: Audits.StyleSheetLoadingIssueReason, val failedRequestInfo: Audits.FailedRequestInfo? = null)

This issue warns when a referenced stylesheet couldn't be loaded.

Link copied to clipboard

This issue warns about uses of APIs that may be considered misuse to re-identify users.

Properties

Link copied to clipboard

Functions

Link copied to clipboard
suspend fun checkContrast(reportAAA: Boolean? = null)
suspend fun checkContrast(args: Audits.CheckContrastParameter, mode: CommandMode = CommandMode.DEFAULT)

Runs the contrast check for the target page. Found issues are reported using Audits.issueAdded event.

Link copied to clipboard
suspend fun checkFormsIssues(mode: CommandMode = CommandMode.DEFAULT): Audits.CheckFormsIssuesReturn

Runs the form issues check for the target page. Found issues are reported using Audits.issueAdded event.

Link copied to clipboard
suspend fun disable(mode: CommandMode = CommandMode.DEFAULT)

Disables issues domain, prevents further issues from being reported to the client.

Link copied to clipboard
suspend fun enable(mode: CommandMode = CommandMode.DEFAULT)

Enables issues domain, sends the issues collected so far to the client by means of the issueAdded event.

Link copied to clipboard
suspend fun getEncodedResponse(requestId: String, encoding: String, quality: Double? = null, sizeOnly: Boolean? = null): Audits.GetEncodedResponseReturn

Returns the response body and size if it were re-encoded with the specified settings. Only applies to images.