diff --git a/parser/htmlparser/nsExpatDriver.cpp b/parser/htmlparser/nsExpatDriver.cpp index f5804c70463e..8a23449e63ec 100644 --- a/parser/htmlparser/nsExpatDriver.cpp +++ b/parser/htmlparser/nsExpatDriver.cpp @@ -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); diff --git a/parser/htmlparser/tests/mochitest/browser_ysod_telemetry.js b/parser/htmlparser/tests/mochitest/browser_ysod_telemetry.js index 331e453afc8b..5a709351e70a 100644 --- a/parser/htmlparser/tests/mochitest/browser_ysod_telemetry.js +++ b/parser/htmlparser/tests/mochitest/browser_ysod_telemetry.js @@ -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: " &nonExistingEntity;", + last_line_len: "38", + }, }, ], { diff --git a/toolkit/components/telemetry/Events.yaml b/toolkit/components/telemetry/Events.yaml index 7e6043dfea83..f1c3a7f705c6 100644 --- a/toolkit/components/telemetry/Events.yaml +++ b/toolkit/components/telemetry/Events.yaml @@ -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.