Audits🧪
Audits 领域允许调查页面违规和可能的改进。
EN
✅️️ Methods
🔨Audits.checkFormsIssues
对目标页面执行表单问题检查。发现的问题将通过 Audits.issueAdded 事件进行报告。
EN
| 返回对象 | 类型 | 描述 | 原文 |
|---|---|---|---|
| formIssues | array[GenericIssueDetails] |
🔨Audits.disable
禁用问题域,防止进一步的问题报告给客户端。
EN
🔨Audits.enable
启用问题域,通过issueAdded事件将迄今为止收集的问题发送给客户端。
EN
issueAdded event.🔨Audits.getEncodedResponse
如果使用指定设置重新编码,则返回响应体及其大小。仅适用于图像。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| requestId | ✔️ | Network.RequestId | 获取内容的网络请求标识符。 | ENIdentifier of the network request to get content for. | |
| encoding | ✔️ | string | 使用的编码。 允许的值: webp、jpeg、png | ENThe encoding to use.Allowed Values: webp, jpeg, png | |
| quality | number | 编码质量(0-1)。(默认为1) | ENThe quality of the encoding (0-1). (defaults to 1) | ||
| sizeOnly | boolean | 是否仅返回尺寸信息(默认为 false)。 | ENWhether to only return the size information (defaults to false). |
| 返回对象 | 类型 | 描述 | 原文 |
|---|---|---|---|
| body | string | 编码后的主体以base64字符串形式表示。如果sizeOnly为true则省略。(通过JSON传递时编码为base64字符串) | ENThe encoded body as a base64 string. Omitted if sizeOnly is true. (Encoded as a base64 string when passed over JSON) |
| originalSize | integer | 重新编码前的大小。 | ENSize before re-encoding. |
| encodedSize | integer | 重新编码后的大小。 | ENSize after re-encoding. |
✅️️ Events
👋Audits.issueAdded
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| issue | ✔️ | InspectorIssue |
✅️️ Types
📌Audits.AdAncestry
关于广告脚本如何被判定为广告脚本的说明。它之所以被视为广告,是因为其URL匹配了过滤列表规则,或者是因为在加载此脚本时,调用堆栈中已存在其他广告脚本。
EN
返回类型:object
| 属性 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| adAncestryChain | ✔️ | array[AdScriptIdentifier] | 当违规脚本加载时堆栈中的广告脚本。由于过滤列表规则,此过程递归向下直至被标记的根脚本。 | ENThe ad-script in the stack when the offending script was loaded. This is recursive down to the root script that was tagged due to the filterlist rule. | |
| rootScriptFilterlistRule | string | 导致 adAncestry 中根(最后)脚本被标记为广告的过滤列表规则。 | ENThe filterlist rule that caused the root (last) script inadAncestry to be ad-tagged. |
📌Audits.AdScriptIdentifier
关于导致AdAncestry中当前脚本被视为广告相关的原因,即位于堆栈上的广告脚本的元数据。
EN
AdAncestry to be considered ad related.返回类型:object
| 属性 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| scriptId | ✔️ | Runtime.ScriptId | 脚本的v8标识符。 | ENThe script's v8 identifier. | |
| debuggerId | ✔️ | Runtime.UniqueDebuggerId | v8 调试器为 v8::Context 分配的调试标识符。 | ENv8's debugging id for the v8::Context. | |
| name | ✔️ | string | 脚本的URL(如果是内联脚本,则基于ID生成名称)。 | ENThe script's url (or generated name based on id if inline script). |
📌Audits.AffectedCookie
关于受检查器问题影响的cookie信息。
EN
返回类型:object
| 属性 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| name | ✔️ | string | 以下三个属性唯一标识一个cookie | ENThe following three properties uniquely identify a cookie | |
| path | ✔️ | string | |||
| domain | ✔️ | string |
📌Audits.AffectedFrame
关于受检查器问题影响的帧的信息。
EN
返回类型:object
| 属性 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| frameId | ✔️ | Page.FrameId |
📌Audits.AffectedRequest
有关受检查器问题影响的请求信息。
EN
返回类型:object
| 属性 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| requestId | Network.RequestId | 唯一的请求标识符。 | ENThe unique request id. | ||
| url | ✔️ | string |
📌Audits.AttributionReportingIssueDetails
关于"Attribution Reporting API"使用相关问题的详细信息。解释文档:https://github.com/WICG/attribution-reporting-api
EN
返回类型:object
| 属性 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| violationType | ✔️ | AttributionReportingIssueType | |||
| request | AffectedRequest | ||||
| violatingNodeId | DOM.BackendNodeId | ||||
| invalidParameter | string |
📌Audits.AttributionReportingIssueType
允许的值:PermissionPolicyDisabled、UntrustworthyReportingOrigin、InsecureContext、InvalidHeader、InvalidRegisterTriggerHeader、SourceAndTriggerHeaders、SourceIgnored、TriggerIgnored、OsSourceIgnored、OsTriggerIgnored、InvalidRegisterOsSourceHeader、InvalidRegisterOsTriggerHeader、WebAndOsHeaders、NoWebOrOsSupport、NavigationRegistrationWithoutTransientUserActivation、InvalidInfoHeader、NoRegisterSourceHeader、NoRegisterTriggerHeader、NoRegisterOsSourceHeader、NoRegisterOsTriggerHeader、NavigationRegistrationUniqueScopeAlreadySet
EN
PermissionPolicyDisabled, UntrustworthyReportingOrigin, InsecureContext, InvalidHeader, InvalidRegisterTriggerHeader, SourceAndTriggerHeaders, SourceIgnored, TriggerIgnored, OsSourceIgnored, OsTriggerIgnored, InvalidRegisterOsSourceHeader, InvalidRegisterOsTriggerHeader, WebAndOsHeaders, NoWebOrOsSupport, NavigationRegistrationWithoutTransientUserActivation, InvalidInfoHeader, NoRegisterSourceHeader, NoRegisterTriggerHeader, NoRegisterOsSourceHeader, NoRegisterOsTriggerHeader, NavigationRegistrationUniqueScopeAlreadySet返回类型:string
📌Audits.BlockedByResponseIssueDetails
关于因 BLOCKED_BY_RESPONSE 代码而被阻止的请求的详细信息。目前仅用于 COEP/COOP,但未来可能会扩展以包含某些 CSP 错误。
EN
返回类型:object
| 属性 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| request | ✔️ | AffectedRequest | |||
| parentFrame | AffectedFrame | ||||
| blockedFrame | AffectedFrame | ||||
| reason | ✔️ | BlockedByResponseReason |
📌Audits.BlockedByResponseReason
枚举类型,指示响应被阻止的原因。这些原因是对网络错误 BLOCKED_BY_RESPONSE 的细化。
允许的值:CoepFrameResourceNeedsCoepHeader, CoopSandboxedIFrameCannotNavigateToCoopPage, CorpNotSameOrigin, CorpNotSameOriginAfterDefaultedToSameOriginByCoep, CorpNotSameOriginAfterDefaultedToSameOriginByDip, CorpNotSameOriginAfterDefaultedToSameOriginByCoepAndDip, CorpNotSameSite, SRIMessageSignatureMismatch
EN
Allowed Values:
CoepFrameResourceNeedsCoepHeader, CoopSandboxedIFrameCannotNavigateToCoopPage, CorpNotSameOrigin, CorpNotSameOriginAfterDefaultedToSameOriginByCoep, CorpNotSameOriginAfterDefaultedToSameOriginByDip, CorpNotSameOriginAfterDefaultedToSameOriginByCoepAndDip, CorpNotSameSite, SRIMessageSignatureMismatch返回类型:string
📌Audits.BounceTrackingIssueDetails
此问题警告的是,在已完成导航的重定向链中,某些网站可能被标记为跟踪器,并且如果未收到用户交互,其状态将被清除。请注意,此处的“网站”指的是eTLD+1。例如,如果重定向链中包含URL https://example.test:80/bounce,则报告的网站将是 example.test。
EN
https://example.test:80/bounce was in the redirect chain, the site reported would be example.test.返回类型:object
| 属性 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| trackingSites | ✔️ | array[string] |
📌Audits.ClientHintIssueDetails
此问题用于追踪与客户端提示相关的议题。其目的在于弃用旧功能、鼓励采用新功能,并提供通用指导。
EN
返回类型:object
| 属性 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| sourceCodeLocation | ✔️ | SourceCodeLocation | |||
| clientHintIssueReason | ✔️ | ClientHintIssueReason |
📌Audits.ClientHintIssueReason
允许的值:MetaTagAllowListInvalidOrigin,MetaTagModifiedHTML
EN
MetaTagAllowListInvalidOrigin, MetaTagModifiedHTML返回类型:string
📌Audits.ConnectionAllowlistError
允许的值:InvalidHeader、MoreThanOneList、ItemNotInnerList、InvalidAllowlistItemType、ReportingEndpointNotToken、InvalidUrlPattern
EN
InvalidHeader, MoreThanOneList, ItemNotInnerList, InvalidAllowlistItemType, ReportingEndpointNotToken, InvalidUrlPattern返回类型:string
📌Audits.ConnectionAllowlistIssueDetails
返回类型:object
| 属性 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| error | ✔️ | ConnectionAllowlistError | |||
| request | ✔️ | AffectedRequest |
📌Audits.ContentSecurityPolicyIssueDetails
返回类型:object
| 属性 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| blockedURL | string | 该网址未包含在允许的来源中。 | ENThe url not included in allowed sources. | ||
| violatedDirective | ✔️ | string | 违反的具体指令,导致CSP问题。 | ENSpecific directive that is violated, causing the CSP issue. | |
| isReportOnly | ✔️ | boolean | |||
| contentSecurityPolicyViolationType | ✔️ | ContentSecurityPolicyViolationType | |||
| frameAncestor | AffectedFrame | ||||
| sourceCodeLocation | SourceCodeLocation | ||||
| violatingNodeId | DOM.BackendNodeId |
📌Audits.ContentSecurityPolicyViolationType
允许的值:kInlineViolation、kEvalViolation、kURLViolation、kSRIViolation、kTrustedTypesSinkViolation、kTrustedTypesPolicyViolation、kWasmEvalViolation
EN
kInlineViolation, kEvalViolation, kURLViolation, kSRIViolation, kTrustedTypesSinkViolation, kTrustedTypesPolicyViolation, kWasmEvalViolation返回类型:string
📌Audits.CookieDeprecationMetadataIssueDetails
此问题警告第三方网站正在访问当前页面的Cookie,并且由于拥有全局元数据授权而被允许。请注意,在此上下文中,“网站”指的是eTLD+1。例如,如果URL https://example.test:80/web_page 正在访问Cookie,那么报告的网站将是 example.test。
EN
https://example.test:80/web_page was accessing cookies, the site reported would be example.test.返回类型:object
| 属性 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| allowedSites | ✔️ | array[string] | |||
| optOutPercentage | ✔️ | number | |||
| isOptOutTopLevel | ✔️ | boolean | |||
| operation | ✔️ | CookieOperation |
📌Audits.CookieExclusionReason
允许的值:ExcludeSameSiteUnspecifiedTreatedAsLax、ExcludeSameSiteNoneInsecure、ExcludeSameSiteLax、ExcludeSameSiteStrict、ExcludeDomainNonASCII、ExcludeThirdPartyCookieBlockedInFirstPartySet、ExcludeThirdPartyPhaseout、ExcludePortMismatch、ExcludeSchemeMismatch
EN
ExcludeSameSiteUnspecifiedTreatedAsLax, ExcludeSameSiteNoneInsecure, ExcludeSameSiteLax, ExcludeSameSiteStrict, ExcludeDomainNonASCII, ExcludeThirdPartyCookieBlockedInFirstPartySet, ExcludeThirdPartyPhaseout, ExcludePortMismatch, ExcludeSchemeMismatch返回类型:string