Bug 1695362 - part3 : add debug log for DecoderDoctorParent. r=bryce

Differential Revision: https://phabricator.services.mozilla.com/D106683
This commit is contained in:
alwu 2021-03-02 20:37:20 +00:00
parent 70200c7668
commit 436096c561

View File

@ -22,6 +22,19 @@ XPCOMUtils.defineLazyGetter(this, "gNavigatorBundle", function() {
);
});
XPCOMUtils.defineLazyPreferenceGetter(
this,
"DEBUG_LOG",
"media.decoder-doctor.testing",
false
);
function LOG_DD(message) {
if (DEBUG_LOG) {
dump("[DecoderDoctorParent] " + message + "\n");
}
}
class DecoderDoctorParent extends JSWindowActorParent {
getLabelForNotificationBox({ type, decoderDoctorReportId }) {
if (type == "platform-decoder-not-found") {
@ -136,6 +149,12 @@ class DecoderDoctorParent extends JSWindowActorParent {
if (!/^\w+$/im.test(decoderDoctorReportId)) {
return;
}
LOG_DD(
`type=${type}, isSolved=${isSolved}, ` +
`decoderDoctorReportId=${decoderDoctorReportId}, formats=${formats}, ` +
`decodeIssue=${decodeIssue}, docURL=${docURL}, ` +
`resourceURL=${resourceURL}`
);
let title = this.getLabelForNotificationBox({
type,
decoderDoctorReportId,
@ -183,6 +202,7 @@ class DecoderDoctorParent extends JSWindowActorParent {
let buttons = [];
let sumo = this.getSumoForLearnHowButton({ type, decoderDoctorReportId });
if (sumo) {
LOG_DD(`sumo=${sumo}`);
buttons.push({
label: gNavigatorBundle.GetStringFromName("decoder.noCodecs.button"),
supportPage: sumo,
@ -199,6 +219,7 @@ class DecoderDoctorParent extends JSWindowActorParent {
}
let endpoint = this.getEndpointForReportIssueButton(type);
if (endpoint) {
LOG_DD(`endpoint=${endpoint}`);
buttons.push({
label: gNavigatorBundle.GetStringFromName(
"decoder.decodeError.button"