CDPotion.Domain.Audits (cdpotion v0.1.4)

Summary

Types

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

Information about the frame affected by an inspector issue.

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

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

description not provided :(

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.

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

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.

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

description not provided :(

description not provided :(

description not provided :(

description not provided :(

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.

description not provided :(

description not provided :(

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

description not provided :(

description not provided :(

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.

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

Depending on the concrete errorType, different properties are set.

description not provided :(

description not provided :(

description not provided :(

description not provided :(

An inspector issue reported from the back-end.

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.

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.

A unique id for a DevTools inspector issue. Allows other entities (e.g. exceptions, CDP message, console messages, etc.) to reference an issue.

description not provided :(

description not provided :(

description not provided :(

description not provided :(

description not provided :(

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

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

description not provided :(

description not provided :(

description not provided :(

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

Functions

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

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

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

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

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

Types

Link to this type

affected_cookie()

@type affected_cookie() :: %{domain: String.t(), name: String.t(), path: String.t()}

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

Link to this type

affected_frame()

@type affected_frame() :: %{frameId: CDPotion.Domain.Page.frame_id()}

Information about the frame affected by an inspector issue.

Link to this type

affected_request()

@type affected_request() :: %{
  requestId: CDPotion.Domain.Network.request_id(),
  url: String.t() | nil
}

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

Link to this type

attribution_reporting_issue_details()

@type attribution_reporting_issue_details() :: %{
  invalidParameter: String.t() | nil,
  request: affected_request() | nil,
  violatingNodeId: CDPotion.Domain.DOM.backend_node_id() | nil,
  violationType: attribution_reporting_issue_type()
}

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

Link to this type

attribution_reporting_issue_type()

@type attribution_reporting_issue_type() ::
  :PermissionPolicyDisabled
  | :UntrustworthyReportingOrigin
  | :InsecureContext
  | :InvalidHeader
  | :InvalidRegisterTriggerHeader
  | :SourceAndTriggerHeaders
  | :SourceIgnored
  | :TriggerIgnored
  | :OsSourceIgnored
  | :OsTriggerIgnored
  | :InvalidRegisterOsSourceHeader
  | :InvalidRegisterOsTriggerHeader
  | :WebAndOsHeaders
  | :NoWebOrOsSupport
  | :NavigationRegistrationWithoutTransientUserActivation

description not provided :(

Link to this type

blocked_by_response_issue_details()

@type blocked_by_response_issue_details() :: %{
  blockedFrame: affected_frame() | nil,
  parentFrame: affected_frame() | nil,
  reason: blocked_by_response_reason(),
  request: affected_request()
}

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 to this type

blocked_by_response_reason()

@type blocked_by_response_reason() ::
  :CoepFrameResourceNeedsCoepHeader
  | :CoopSandboxedIFrameCannotNavigateToCoopPage
  | :CorpNotSameOrigin
  | :CorpNotSameOriginAfterDefaultedToSameOriginByCoep
  | :CorpNotSameSite

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

Link to this type

bounce_tracking_issue_details()

@type bounce_tracking_issue_details() :: %{trackingSites: [String.t()]}

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 to this type

client_hint_issue_details()

@type client_hint_issue_details() :: %{
  clientHintIssueReason: client_hint_issue_reason(),
  sourceCodeLocation: source_code_location()
}

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 to this type

client_hint_issue_reason()

@type client_hint_issue_reason() ::
  :MetaTagAllowListInvalidOrigin | :MetaTagModifiedHTML

description not provided :(

Link to this type

content_security_policy_issue_details()

@type content_security_policy_issue_details() :: %{
  blockedURL: String.t() | nil,
  contentSecurityPolicyViolationType: content_security_policy_violation_type(),
  frameAncestor: affected_frame() | nil,
  isReportOnly: boolean(),
  sourceCodeLocation: source_code_location() | nil,
  violatedDirective: String.t(),
  violatingNodeId: CDPotion.Domain.DOM.backend_node_id() | nil
}

description not provided :(

Link to this type

content_security_policy_violation_type()

@type content_security_policy_violation_type() ::
  :kInlineViolation
  | :kEvalViolation
  | :kURLViolation
  | :kTrustedTypesSinkViolation
  | :kTrustedTypesPolicyViolation
  | :kWasmEvalViolation

description not provided :(

Link to this type

cookie_exclusion_reason()

@type cookie_exclusion_reason() ::
  :ExcludeSameSiteUnspecifiedTreatedAsLax
  | :ExcludeSameSiteNoneInsecure
  | :ExcludeSameSiteLax
  | :ExcludeSameSiteStrict
  | :ExcludeInvalidSameParty
  | :ExcludeSamePartyCrossPartyContext
  | :ExcludeDomainNonASCII
  | :ExcludeThirdPartyCookieBlockedInFirstPartySet

description not provided :(

Link to this type

cookie_issue_details()

@type cookie_issue_details() :: %{
  cookie: affected_cookie() | nil,
  cookieExclusionReasons: [cookie_exclusion_reason()],
  cookieUrl: String.t() | nil,
  cookieWarningReasons: [cookie_warning_reason()],
  operation: cookie_operation(),
  rawCookieLine: String.t() | nil,
  request: affected_request() | nil,
  siteForCookies: String.t() | nil
}

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 to this type

cookie_operation()

@type cookie_operation() :: :SetCookie | :ReadCookie

description not provided :(

Link to this type

cookie_warning_reason()

@type cookie_warning_reason() ::
  :WarnSameSiteUnspecifiedCrossSiteContext
  | :WarnSameSiteNoneInsecure
  | :WarnSameSiteUnspecifiedLaxAllowUnsafe
  | :WarnSameSiteStrictLaxDowngradeStrict
  | :WarnSameSiteStrictCrossDowngradeStrict
  | :WarnSameSiteStrictCrossDowngradeLax
  | :WarnSameSiteLaxCrossDowngradeStrict
  | :WarnSameSiteLaxCrossDowngradeLax
  | :WarnAttributeValueExceedsMaxSize
  | :WarnDomainNonASCII
  | :WarnThirdPartyPhaseout

description not provided :(

Link to this type

cors_issue_details()

@type cors_issue_details() :: %{
  clientSecurityState: CDPotion.Domain.Network.client_security_state() | nil,
  corsErrorStatus: CDPotion.Domain.Network.cors_error_status(),
  initiatorOrigin: String.t() | nil,
  isWarning: boolean(),
  location: source_code_location() | nil,
  request: affected_request(),
  resourceIPAddressSpace: CDPotion.Domain.Network.ip_address_space() | nil
}

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

Link to this type

deprecation_issue_details()

@type deprecation_issue_details() :: %{
  affectedFrame: affected_frame() | nil,
  sourceCodeLocation: source_code_location(),
  type: String.t()
}

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 to this type

failed_request_info()

@type failed_request_info() :: %{
  failureMessage: String.t(),
  requestId: CDPotion.Domain.Network.request_id() | nil,
  url: String.t()
}

description not provided :(

Link to this type

federated_auth_request_issue_details()

@type federated_auth_request_issue_details() :: %{
  federatedAuthRequestIssueReason: federated_auth_request_issue_reason()
}

description not provided :(

Link to this type

federated_auth_request_issue_reason()

@type federated_auth_request_issue_reason() ::
  :ShouldEmbargo
  | :TooManyRequests
  | :WellKnownHttpNotFound
  | :WellKnownNoResponse
  | :WellKnownInvalidResponse
  | :WellKnownListEmpty
  | :WellKnownInvalidContentType
  | :ConfigNotInWellKnown
  | :WellKnownTooBig
  | :ConfigHttpNotFound
  | :ConfigNoResponse
  | :ConfigInvalidResponse
  | :ConfigInvalidContentType
  | :ClientMetadataHttpNotFound
  | :ClientMetadataNoResponse
  | :ClientMetadataInvalidResponse
  | :ClientMetadataInvalidContentType
  | :DisabledInSettings
  | :ErrorFetchingSignin
  | :InvalidSigninResponse
  | :AccountsHttpNotFound
  | :AccountsNoResponse
  | :AccountsInvalidResponse
  | :AccountsListEmpty
  | :AccountsInvalidContentType
  | :IdTokenHttpNotFound
  | :IdTokenNoResponse
  | :IdTokenInvalidResponse
  | :IdTokenInvalidRequest
  | :IdTokenInvalidContentType
  | :ErrorIdToken
  | :Canceled
  | :RpPageNotVisible
  | :SilentMediationFailure
  | :ThirdPartyCookiesBlocked

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 to this type

federated_auth_user_info_request_issue_details()

@type federated_auth_user_info_request_issue_details() :: %{
  federatedAuthUserInfoRequestIssueReason:
    federated_auth_user_info_request_issue_reason()
}

description not provided :(

Link to this type

federated_auth_user_info_request_issue_reason()

@type federated_auth_user_info_request_issue_reason() ::
  :NotSameOrigin
  | :NotIframe
  | :NotPotentiallyTrustworthy
  | :NoApiPermission
  | :NotSignedInWithIdp
  | :NoAccountSharingPermission
  | :InvalidConfigOrWellKnown
  | :InvalidAccountsResponse
  | :NoReturningUserFromFetchedAccounts

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 to this type

generic_issue_details()

@type generic_issue_details() :: %{
  errorType: generic_issue_error_type(),
  frameId: CDPotion.Domain.Page.frame_id() | nil,
  request: affected_request() | nil,
  violatingNodeAttribute: String.t() | nil,
  violatingNodeId: CDPotion.Domain.DOM.backend_node_id() | nil
}

Depending on the concrete errorType, different properties are set.

Link to this type

generic_issue_error_type()

@type generic_issue_error_type() ::
  :CrossOriginPortalPostMessageError
  | :FormLabelForNameError
  | :FormDuplicateIdForInputError
  | :FormInputWithNoLabelError
  | :FormAutocompleteAttributeEmptyError
  | :FormEmptyIdAndNameAttributesForInputError
  | :FormAriaLabelledByToNonExistingId
  | :FormInputAssignedAutocompleteValueToIdOrNameAttributeError
  | :FormLabelHasNeitherForNorNestedInput
  | :FormLabelForMatchesNonExistingIdError
  | :FormInputHasWrongButWellIntendedAutocompleteValueError
  | :ResponseWasBlockedByORB

description not provided :(

Link to this type

heavy_ad_issue_details()

@type heavy_ad_issue_details() :: %{
  frame: affected_frame(),
  reason: heavy_ad_reason(),
  resolution: heavy_ad_resolution_status()
}

description not provided :(

Link to this type

heavy_ad_reason()

@type heavy_ad_reason() :: :NetworkTotalLimit | :CpuTotalLimit | :CpuPeakLimit

description not provided :(

Link to this type

heavy_ad_resolution_status()

@type heavy_ad_resolution_status() :: :HeavyAdBlocked | :HeavyAdWarning

description not provided :(

Link to this type

inspector_issue()

@type inspector_issue() :: %{
  code: inspector_issue_code(),
  details: inspector_issue_details(),
  issueId: issue_id() | nil
}

An inspector issue reported from the back-end.

Link to this type

inspector_issue_code()

@type inspector_issue_code() ::
  :CookieIssue
  | :MixedContentIssue
  | :BlockedByResponseIssue
  | :HeavyAdIssue
  | :ContentSecurityPolicyIssue
  | :SharedArrayBufferIssue
  | :LowTextContrastIssue
  | :CorsIssue
  | :AttributionReportingIssue
  | :QuirksModeIssue
  | :NavigatorUserAgentIssue
  | :GenericIssue
  | :DeprecationIssue
  | :ClientHintIssue
  | :FederatedAuthRequestIssue
  | :BounceTrackingIssue
  | :StylesheetLoadingIssue
  | :FederatedAuthUserInfoRequestIssue

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 to this type

inspector_issue_details()

@type inspector_issue_details() :: %{
  attributionReportingIssueDetails: attribution_reporting_issue_details() | nil,
  blockedByResponseIssueDetails: blocked_by_response_issue_details() | nil,
  bounceTrackingIssueDetails: bounce_tracking_issue_details() | nil,
  clientHintIssueDetails: client_hint_issue_details() | nil,
  contentSecurityPolicyIssueDetails:
    content_security_policy_issue_details() | nil,
  cookieIssueDetails: cookie_issue_details() | nil,
  corsIssueDetails: cors_issue_details() | nil,
  deprecationIssueDetails: deprecation_issue_details() | nil,
  federatedAuthRequestIssueDetails:
    federated_auth_request_issue_details() | nil,
  federatedAuthUserInfoRequestIssueDetails:
    federated_auth_user_info_request_issue_details() | nil,
  genericIssueDetails: generic_issue_details() | nil,
  heavyAdIssueDetails: heavy_ad_issue_details() | nil,
  lowTextContrastIssueDetails: low_text_contrast_issue_details() | nil,
  mixedContentIssueDetails: mixed_content_issue_details() | nil,
  navigatorUserAgentIssueDetails: navigator_user_agent_issue_details() | nil,
  quirksModeIssueDetails: quirks_mode_issue_details() | nil,
  sharedArrayBufferIssueDetails: shared_array_buffer_issue_details() | nil,
  stylesheetLoadingIssueDetails: stylesheet_loading_issue_details() | nil
}

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.

@type issue_id() :: String.t()

A unique id for a DevTools inspector issue. Allows other entities (e.g. exceptions, CDP message, console messages, etc.) to reference an issue.

Link to this type

low_text_contrast_issue_details()

@type low_text_contrast_issue_details() :: %{
  contrastRatio: number(),
  fontSize: String.t(),
  fontWeight: String.t(),
  thresholdAA: number(),
  thresholdAAA: number(),
  violatingNodeId: CDPotion.Domain.DOM.backend_node_id(),
  violatingNodeSelector: String.t()
}

description not provided :(

Link to this type

mixed_content_issue_details()

@type mixed_content_issue_details() :: %{
  frame: affected_frame() | nil,
  insecureURL: String.t(),
  mainResourceURL: String.t(),
  request: affected_request() | nil,
  resolutionStatus: mixed_content_resolution_status(),
  resourceType: mixed_content_resource_type() | nil
}

description not provided :(

Link to this type

mixed_content_resolution_status()

@type mixed_content_resolution_status() ::
  :MixedContentBlocked
  | :MixedContentAutomaticallyUpgraded
  | :MixedContentWarning

description not provided :(

Link to this type

mixed_content_resource_type()

@type mixed_content_resource_type() ::
  :AttributionSrc
  | :Audio
  | :Beacon
  | :CSPReport
  | :Download
  | :EventSource
  | :Favicon
  | :Font
  | :Form
  | :Frame
  | :Image
  | :Import
  | :Manifest
  | :Ping
  | :PluginData
  | :PluginResource
  | :Prefetch
  | :Resource
  | :Script
  | :ServiceWorker
  | :SharedWorker
  | :Stylesheet
  | :Track
  | :Video
  | :Worker
  | :XMLHttpRequest
  | :XSLT

description not provided :(

Link to this type

navigator_user_agent_issue_details()

@type navigator_user_agent_issue_details() :: %{
  location: source_code_location() | nil,
  url: String.t()
}

description not provided :(

Link to this type

quirks_mode_issue_details()

@type quirks_mode_issue_details() :: %{
  documentNodeId: CDPotion.Domain.DOM.backend_node_id(),
  frameId: CDPotion.Domain.Page.frame_id(),
  isLimitedQuirksMode: boolean(),
  loaderId: CDPotion.Domain.Network.loader_id(),
  url: String.t()
}

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

Link to this type

shared_array_buffer_issue_details()

@type shared_array_buffer_issue_details() :: %{
  isWarning: boolean(),
  sourceCodeLocation: source_code_location(),
  type: shared_array_buffer_issue_type()
}

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

Link to this type

shared_array_buffer_issue_type()

@type shared_array_buffer_issue_type() :: :TransferIssue | :CreationIssue

description not provided :(

Link to this type

source_code_location()

@type source_code_location() :: %{
  columnNumber: integer(),
  lineNumber: integer(),
  scriptId: CDPotion.Domain.Runtime.script_id() | nil,
  url: String.t()
}

description not provided :(

Link to this type

style_sheet_loading_issue_reason()

@type style_sheet_loading_issue_reason() :: :LateImportRule | :RequestFailed

description not provided :(

Link to this type

stylesheet_loading_issue_details()

@type stylesheet_loading_issue_details() :: %{
  failedRequestInfo: failed_request_info() | nil,
  sourceCodeLocation: source_code_location(),
  styleSheetLoadingIssueReason: style_sheet_loading_issue_reason()
}

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

Functions

Link to this function

check_contrast(report_aaa \\ nil)

@spec check_contrast(boolean()) :: {String.t(), map()}

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

Parameters:

  • (Optional) report_aaa: Whether to report WCAG AAA level issues. Default is false.
Link to this function

check_forms_issues()

@spec check_forms_issues() :: {String.t(), map()}

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

@spec disable() :: {String.t(), map()}

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

@spec enable() :: {String.t(), map()}

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

Link to this function

get_encoded_response(request_id, encoding, quality \\ nil, size_only \\ nil)

@spec get_encoded_response(
  CDPotion.Domain.Network.request_id(),
  String.t(),
  number(),
  boolean()
) :: {String.t(), map()}

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

Parameters:

  • (Required) request_id: Identifier of the network request to get content for.
  • (Required) encoding: The encoding to use.
  • (Optional) quality: The quality of the encoding (0-1). (defaults to 1)
  • (Optional) size_only: Whether to only return the size information (defaults to false).