Skip to content

Technical review: Document crash reporting api#43791

Open
chrisdavidmills wants to merge 2 commits intomdn:mainfrom
chrisdavidmills:crash-reporting-api
Open

Technical review: Document crash reporting api#43791
chrisdavidmills wants to merge 2 commits intomdn:mainfrom
chrisdavidmills:crash-reporting-api

Conversation

@chrisdavidmills
Copy link
Copy Markdown
Contributor

Description

Chrome 145 adds support for the Crash Reporting API; see https://chromestatus.com/feature/6228675846209536.

I have documented this as part of the Reporting API documentation, rather than in its own API docs tree, as I feel that this makes much sense, even though it is specified in a separate spec.

Motivation

Additional details

Related issues and pull requests

@chrisdavidmills chrisdavidmills requested review from a team as code owners April 14, 2026 15:54
@chrisdavidmills chrisdavidmills requested review from hamishwillee and pepelsbey and removed request for a team April 14, 2026 15:54
@github-actions github-actions bot added the Content:WebAPI Web API docs label Apr 14, 2026
@chrisdavidmills chrisdavidmills changed the title Document crash reporting api Technical review: Document crash reporting api Apr 14, 2026
@github-actions github-actions bot added the size/m [PR only] 51-500 LoC changed label Apr 14, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 14, 2026

Preview URLs (9 pages)

Flaws (3)

Note! 7 documents with no flaws that don't need to be listed. 🎉

Found an unexpected or unresolvable flaw? Please report it here.

URL: /en-US/docs/Web/API/CrashReportContext
Title: CrashReportContext
Flaw count: 1

  • macros:
    • Macro domxref produces link /en-US/docs/Web/API/fetch which is a redirect

URL: /en-US/docs/Web/API/Window
Title: Window
Flaw count: 2

  • macros:
    • Macro domxref produces link /en-US/docs/Web/API/HTMLElement/invalid_event which is a redirect
    • Macro domxref produces link /en-US/docs/Web/API/Element/select_event which is a redirect
External URLs (2)

URL: /en-US/docs/Web/API/CrashReport
Title: CrashReport


URL: /en-US/docs/Web/API/CrashReportContext
Title: CrashReportContext

(comment last updated: 2026-04-15 08:00:13)


## Instance properties

- `age`
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI I don't/haven't documented the age and user agent properties - normally I document all the others and then here say "same for server version but also has ...".

Copy link
Copy Markdown
Contributor Author

@chrisdavidmills chrisdavidmills Apr 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I know. I did it this way because, in this case, the report type isn't retrieved via reporting observers, so the comparison can't be made.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works for me. Shouldn't they be alphabetic ordering? I'm "OK "with this being an exception since this is the order it is serialized, but my preference is to do it the same as all other APIs

When the browser crashes, the information stored in the key-value store is added to a {{domxref("CrashReport")}} and sent to the default [reporting server endpoint](/en-US/docs/Web/API/Reporting_API#reporting_server_endpoints), if it is defined. The reporting server endpoint and its mapping to a particular URL are set using the {{httpheader("Reporting-Endpoints")}} header.

> [!NOTE]
> It is not possible to retrieve {{domxref("CrashReport")}}s using a {{domxref("ReportingObserver")}}.
Copy link
Copy Markdown
Collaborator

@hamishwillee hamishwillee Apr 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is worth saying why, and I would put this as a note up in the description - i.e. this only supports server reports.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call; I've updated the note to:

Note

It is not possible to retrieve {{domxref("CrashReport")}}s using a {{domxref("ReportingObserver")}} — the reports are only generated when the browser crashes, at which point the observer code isn't available to run.

I didn't understand the second part of this sentence — the note is in the description already.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The note update is good. I'm suggesting this is important enough to move it below the introductory sentence at the top of the page, rather than here. Mostly because this behaviour is a real outlier for the interface.

Comment thread files/en-us/web/api/crashreport/index.md Outdated
Copy link
Copy Markdown

@jcscottiii jcscottiii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small nits but LGTM overall

### Basic usage

```js
window.crashReport.set(1024).then(() => {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit

Suggested change
window.crashReport.set(1024).then(() => {
window.crashReport.initialize(1024).then(() => {

### Basic usage

```js
window.crashReport.set(1024).then(() => {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
window.crashReport.set(1024).then(() => {
window.crashReport.initialize(1024).then(() => {

### Parameters

- `length`
- : A number indicating the maximum number of bytes that can be stored in the key-value store by each individual `set()` call. The maximum allowable value is `5 * 1024 * 1024` (5MB), which is also the maximum amount of crash report memory allowed for one origin.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- The calling document is not fully active.
- A crash report key-value store was already initialized by a previous `initialize()` call.
- `NotAllowedError` {{domxref("DOMException")}}
- : `length` is more than `5 * 1024 * 1024`.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See note about updated limit

- `age`
- : The age of the report in milliseconds.
- `type`
- : The string `"crash"` indicating that this is a deprecation report.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- : The string `"crash"` indicating that this is a deprecation report.
- : The string `"crash"` indicating that this is a crash report.


## Description

The [Crash Reporting API](https://wicg.github.io/crash-reporting) extension to the [Reporting API](/en-US/docs/Web/API/Reporting_API) specifies a mechanism allowing arbitrary information to be recorded and made available in crash reports. This is useful because we can store detailed diagnostic information throughout the lifetime of an application and use the crash reports to debug crashes more effectively.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"The Crash Reporting API extension to the" is unusual. MDN doesn't recognise extensions like this or link direct to spec - that would be added to browser compat or a spec url. For this I would do

Suggested change
The [Crash Reporting API](https://wicg.github.io/crash-reporting) extension to the [Reporting API](/en-US/docs/Web/API/Reporting_API) specifies a mechanism allowing arbitrary information to be recorded and made available in crash reports. This is useful because we can store detailed diagnostic information throughout the lifetime of an application and use the crash reports to debug crashes more effectively.
Crash reports containing arbitrary information can be sent to a server endpoint using the [Reporting API](/en-US/docs/Web/API/Reporting_API) .
This is useful because we can store detailed diagnostic information throughout the lifetime of an application and use the reports to debug crashes more effectively.


The [Crash Reporting API](https://wicg.github.io/crash-reporting) extension to the [Reporting API](/en-US/docs/Web/API/Reporting_API) specifies a mechanism allowing arbitrary information to be recorded and made available in crash reports. This is useful because we can store detailed diagnostic information throughout the lifetime of an application and use the crash reports to debug crashes more effectively.

The information is stored in a special key-value store, manipulated using the document's {{domxref("CrashReportContext")}} object, which is accessed via the {{domxref("Window.crashReport")}} property.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The information is stored in a special key-value store, manipulated using the document's {{domxref("CrashReportContext")}} object, which is accessed via the {{domxref("Window.crashReport")}} property.
The diagnostic information is stored in a special key-value store that can be manipulated using the document's {{domxref("CrashReportContext")}} object.
This is accessed via the {{domxref("Window.crashReport")}} property.


{{securecontext_header}}{{APIRef("Reporting API")}}

The **`crashReport`** read-only property of the {{domxref("Window")}} interface returns a {{domxref("CrashReportContext")}} object that enables arbitrary data to be recorded for the current top-level browsing context, which is then added to a {{domxref("CrashReport")}} and sent to a reporting endpoint when a browser crash occurs.
Copy link
Copy Markdown
Collaborator

@hamishwillee hamishwillee Apr 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider making this into shorter sentences.

Suggested change
The **`crashReport`** read-only property of the {{domxref("Window")}} interface returns a {{domxref("CrashReportContext")}} object that enables arbitrary data to be recorded for the current top-level browsing context, which is then added to a {{domxref("CrashReport")}} and sent to a reporting endpoint when a browser crash occurs.
The **`crashReport`** read-only property of the {{domxref("Window")}} interface returns a {{domxref("CrashReportContext")}} object that enables arbitrary data to be recorded for the current top-level browsing context.
The data is then included in {{domxref("CrashReport")}} objects that are sent to a reporting endpoint when a browser crash occurs.


## Description

The [Crash Reporting API](https://wicg.github.io/crash-reporting) extension to the [Reporting API](/en-US/docs/Web/API/Reporting_API) specifies a mechanism allowing arbitrary information to be recorded and made available in crash reports. This is useful because we can store detailed diagnostic information throughout the lifetime of an application and use the crash reports to debug crashes more effectively.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as before - we don't reference specs in page like this.


The information is stored in a special key-value store, which is similar to [Web Storage](/en-US/docs/Web/API/Web_Storage_API) except that its scope is restricted to the current top-level origin, and it doesn't have a getter method available. It allows document-specific state information to be recorded and deleted. The top-level document will record diagnostic information relating to it and any embedded documents, and send any related crash reports.

To use this API, a document first needs to call {{domxref("CrashReportContext.initialize", "window.crashReport.initialize()")}}, which takes as an argument a number specifying the maximum number of bytes that can be recorded in the key-value store by each individual {{domxref("CrashReportContext.set", "window.crashReport.set()")}} call. Values are then recorded using `set()`, and deleted using {{domxref("CrashReportContext.delete", "window.crashReport.delete()")}}.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW I was going to say "what happens if you run out of memory when calling set", but this is covered in set()

- {{domxref("IntegrityViolationReport")}}
- : Contains information about a resource that was blocked because it did not meet the Subresource Integrity guarantees required by its {{httpheader("Integrity-Policy")}}, or that would be blocked for report-only policies set using {{httpheader("Integrity-Policy-Report-Only")}}.
This is defined as part of the [Subresource Integrity](/en-US/docs/Web/Security/Defenses/Subresource_Integrity) specification.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add the CrashReport here? I think so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Content:WebAPI Web API docs size/m [PR only] 51-500 LoC changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants