Bug 1677822 - Capture last line in the YSOD telemetry. r=peterv DONTBUILD

Differential Revision: https://phabricator.services.mozilla.com/D97348
This commit is contained in:
Zibi Braniecki 2020-11-18 20:29:41 +00:00
parent 921110e00f
commit 4db97d1029
3 changed files with 12 additions and 1 deletions

View File

@ -828,6 +828,10 @@ nsresult nsExpatDriver::HandleError() {
nsPrintfCString("%u", code)},
mozilla::Telemetry::EventExtraEntry{
"location"_ns, nsPrintfCString("%u:%u", lineNumber, colNumber)},
mozilla::Telemetry::EventExtraEntry{
"last_line"_ns, NS_ConvertUTF16toUTF8(mLastLine)},
mozilla::Telemetry::EventExtraEntry{
"last_line_len"_ns, nsPrintfCString("%u", mLastLine.Length())},
});
mozilla::Telemetry::SetEventRecordingEnabled("ysod"_ns, true);

View File

@ -30,7 +30,12 @@ add_task(async function test_popup_opened() {
method: "shown",
object: "ysod",
value: PAGE_URL.substr(0, 80),
extra: { error_code: "11", location: "3:12" },
extra: {
error_code: "11",
location: "3:12",
last_line: " <title>&nonExistingEntity;</title>",
last_line_len: "38",
},
},
],
{

View File

@ -2567,3 +2567,5 @@ ysod:
extra_keys:
error_code: Code of the XML Error (See `XML_Error` enum in expat.h for the list of errors where XML_ERROR_NONE is 0).
location: Location as Row:Column of where the error happened.
last_line: The content of the last line that led to the error.
last_line_len: The length of the last line that led to the error.