Bug 1698073 - Extend ysod event telemetry to record the status of document r=zbraniecki

Differential Revision: https://phabricator.services.mozilla.com/D109484
This commit is contained in:
Kershaw Chang 2021-03-24 08:09:11 +00:00
parent f7505a1445
commit 66f9604c86
3 changed files with 17 additions and 0 deletions

View File

@ -9,6 +9,7 @@
#include "CParserContext.h"
#include "nsIExpatSink.h"
#include "nsIContentSink.h"
#include "nsIDocShell.h"
#include "nsParserMsgUtils.h"
#include "nsIURL.h"
#include "nsIUnicharInputStream.h"
@ -823,6 +824,14 @@ nsresult nsExpatDriver::HandleError() {
if (doc && nsContentUtils::IsChromeDoc(doc)) {
nsCString path = doc->GetDocumentURI()->GetSpecOrDefault();
nsCOMPtr<nsISupports> container = doc->GetContainer();
nsCOMPtr<nsIDocShell> docShell = do_QueryInterface(container);
nsCString docShellDestroyed("unknown"_ns);
if (docShell) {
bool destroyed = false;
docShell->IsBeingDestroyed(&destroyed);
docShellDestroyed.Assign(destroyed ? "true"_ns : "false"_ns);
}
mozilla::Maybe<nsTArray<mozilla::Telemetry::EventExtraEntry>> extra =
mozilla::Some<nsTArray<mozilla::Telemetry::EventExtraEntry>>({
@ -834,6 +843,10 @@ nsresult nsExpatDriver::HandleError() {
"last_line"_ns, NS_ConvertUTF16toUTF8(mLastLine)},
mozilla::Telemetry::EventExtraEntry{
"last_line_len"_ns, nsPrintfCString("%u", mLastLine.Length())},
mozilla::Telemetry::EventExtraEntry{
"hidden"_ns, doc->Hidden() ? "true"_ns : "false"_ns},
mozilla::Telemetry::EventExtraEntry{"destroyed"_ns,
docShellDestroyed},
});
mozilla::Telemetry::SetEventRecordingEnabled("ysod"_ns, true);

View File

@ -35,6 +35,8 @@ add_task(async function test_popup_opened() {
location: "3:12",
last_line: " <title>&nonExistingEntity;</title>",
last_line_len: "38",
hidden: "false",
destroyed: "false",
},
},
],

View File

@ -2632,6 +2632,8 @@ ysod:
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.
hidden: The document is hidden.
destroyed: The container of this document is destroyed.
dom.quota.try:
error: