这是 实验性技术
检查 浏览器兼容性表格 要小心谨慎在生产中使用这之前。

CrashReportBody 接口在 Reporting API represents the body of a crash report (the return value of its Report.body 特性)。

A crash report is generated when a document becomes unusable due to the browser (or one of its processes) crashing. For security reasons, no details of the crash are communicated in the body except for a general crash reason.

特性

reason
A string representing the reason for the crash. Current possible reasons are:
  • oom : The browser ran out of memory.
  • unresponsive : The page was killed due to being unresponsive.

范例

Crash reports are generally only retrievable via endpoints set up using the Report-To header. It is difficult to retrieve a crash report via a ReportingObserver , as by that point the page would have crashed!

Some sample JSON might look like this:

{
  "type": "crash",
  "age": 42,
  "url": "https://example.com/",
  "user_agent": "Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0",
  "body": {
    "reason": "oom"
  }
}
					

注意 : Crash reports are always delivered to the endpoint group named default ; there is currently no way to override this. If you want to receive other kinds of reports, but not crash reports, make sure to use a different name for the endpoint group that you choose for those reports.

规范

规范 状态 注释
Reporting API
The definition of 'CrashReportBody' in that specification.
编者草案

浏览器兼容性

The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.

No compatibility data found. Please contribute data for "api.CrashReportBody" (depth: 1) to the MDN 兼容性数据存储库 .

另请参阅

元数据

  • 最后修改:
  1. CrashReportBody