0

webui_explainer.md: Added section on error reporting

Add a section on error reporting, including explanations of when error
reports will happen, how to see them, and how to turn them off if
desired.

Fixed: b:186643751
Change-Id: Id2c70096055be3dcf756a1767d3a262bd5ffca5a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2995494
Commit-Queue: Ian Barkley-Yeung <iby@chromium.org>
Reviewed-by: dpapad <dpapad@chromium.org>
Cr-Commit-Position: refs/heads/master@{#897602}
This commit is contained in:
Ian Barkley-Yeung
2021-07-01 01:06:35 +00:00
committed by Chromium LUCI CQ
parent 2e3517397a
commit 20a8ff713d

@ -911,6 +911,45 @@ StoragePartition, a separate frame tree, and restricts postMessage communication
by default. However, `<webview>` does not support Site Isolation and
therefore it is not advisable to use for any sensitive content.
## JavaScript Error Reporting
By default, errors in the JavaScript of a WebUI page will generate error reports
which appear in Google's internal crash/ reports page. These error reports will
only be generated for Google Chrome builds, not Chromium or other Chromium-based
browsers.
Specifically, an error report will be generated when the JavaScript for a
WebUI-based chrome:// page does one of the following:
* Generates an uncaught exception,
* Has a promise which is rejected, and no rejection handler is provided, or
* Calls `console.error()`.
Such errors will appear alongside other crashes in the
`product_name=Chrome_ChromeOS` or `product_name=Chrome_Linux` lists on crash/.
The signature of the error is simply the error message. To avoid
spamming the system, only one error report with a given message will be
generated per hour.
If you are getting error reports for an expected condition, you can turn off the
reports simply by changing `console.error()` into `console.warn()`.
If you wish to get more control of the JavaScript error messages, for example
to change the product name or to add additional data, you may wish to switch to
using `CrashReportPrivate.reportError()`. If you do so, be sure to override
`WebUIController::IsJavascriptErrorReportingEnabled()` to return false for your
page; this will avoid generating redundant error reports.
Known issues:
1. Error reporting is currently enabled only on ChromeOS and Linux.
2. Errors are only reported for chrome:// URLs.
3. Unhandled promise rejections do not have a good stack.
4. The line numbers and column numbers in the stacks are for the minified
JavaScript and do not correspond to the line and column numbers of the
original source files.
5. Error messages with variable strings do not group well. For example, if the
error message includes the name of a network, each network name will be its
own signature.
## See also