Bug 1695362 - part2 : remove the platform check when displaying an infobar. r=bryce

Let the front end part relies on the report Id only, because on Gecko side (`DecoderDoctorDocumentWatcher`) we've already done the check to determine if that notification should be reported on current platform.

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

View File

@ -23,14 +23,16 @@ XPCOMUtils.defineLazyGetter(this, "gNavigatorBundle", function() {
});
class DecoderDoctorParent extends JSWindowActorParent {
getLabelForNotificationBox(type) {
getLabelForNotificationBox({ type, decoderDoctorReportId }) {
if (type == "platform-decoder-not-found") {
if (AppConstants.platform == "win") {
if (decoderDoctorReportId == "MediaWMFNeeded") {
return gNavigatorBundle.GetStringFromName(
"decoder.noHWAcceleration.message"
);
}
if (AppConstants.platform == "linux") {
// Although this name seems generic, this is actually for not being able
// to find libavcodec on Linux.
if (decoderDoctorReportId == "MediaPlatformDecoderNotFound") {
return gNavigatorBundle.GetStringFromName(
"decoder.noCodecsLinux.message"
);
@ -55,10 +57,10 @@ class DecoderDoctorParent extends JSWindowActorParent {
return "";
}
getSumoForLearnHowButton(type) {
getSumoForLearnHowButton({ type, decoderDoctorReportId }) {
if (
type == "platform-decoder-not-found" &&
AppConstants.platform == "win"
decoderDoctorReportId == "MediaWMFNeeded"
) {
return "fix-video-audio-problems-firefox-windows";
}
@ -134,7 +136,10 @@ class DecoderDoctorParent extends JSWindowActorParent {
if (!/^\w+$/im.test(decoderDoctorReportId)) {
return;
}
let title = this.getLabelForNotificationBox(type);
let title = this.getLabelForNotificationBox({
type,
decoderDoctorReportId,
});
if (!title) {
return;
}
@ -176,7 +181,7 @@ class DecoderDoctorParent extends JSWindowActorParent {
}
let buttons = [];
let sumo = this.getSumoForLearnHowButton(type);
let sumo = this.getSumoForLearnHowButton({ type, decoderDoctorReportId });
if (sumo) {
buttons.push({
label: gNavigatorBundle.GetStringFromName("decoder.noCodecs.button"),