Bug 1247056 - More flexible SUMO link - r=gijs draft
authorGerald Squelart <gsquelart@mozilla.com>
Tue, 27 Sep 2016 00:03:06 -0700
changeset 417925 beed73472f87d237a9d5b785caafce82b81f58f8
parent 417924 2c8bfb9e7ce6dd69ef5a31b1737e5f314d14cad7
child 417926 3b0409dbb4e9bf02f3ab298b7a133c86115cf479
push id30524
push usergsquelart@mozilla.com
push dateTue, 27 Sep 2016 09:30:55 +0000
reviewersgijs
bugs1247056
milestone52.0a1
Bug 1247056 - More flexible SUMO link - r=gijs Instead of always pointing to the same fix-video-audio-problems-firefox-windows SUMO page, make it possible to point at others depending on the issue. Also we won't show a "Learn How" button for WinXP anymore, as the linked page is not relevant to XP, and CDMs are not available on XP anyway. MozReview-Commit-ID: 7YR43Wa0IRe
browser/base/content/browser-media.js
--- a/browser/base/content/browser-media.js
+++ b/browser/base/content/browser-media.js
@@ -196,20 +196,16 @@ XPCOMUtils.defineLazyGetter(gEMEHandler,
 
 const TELEMETRY_DDSTAT_SHOWN = 0;
 const TELEMETRY_DDSTAT_SHOWN_FIRST = 1;
 const TELEMETRY_DDSTAT_CLICKED = 2;
 const TELEMETRY_DDSTAT_CLICKED_FIRST = 3;
 const TELEMETRY_DDSTAT_SOLVED = 4;
 
 let gDecoderDoctorHandler = {
-  shouldShowLearnMoreButton() {
-    return AppConstants.platform == "win";
-  },
-
   getLabelForNotificationBox(type) {
     if (type == "adobe-cdm-not-found" &&
         AppConstants.platform == "win") {
       if (AppConstants.isPlatformAndVersionAtMost("win", "5.9")) {
         // We supply our own Learn More button so we don't need to populate the message here.
         return gNavigatorBundle.getFormattedString("emeNotifications.drmContentDisabled.message", [""]);
       }
       return gNavigatorBundle.getString("decoder.noCodecs.message");
@@ -233,16 +229,23 @@ let gDecoderDoctorHandler = {
       }
       if (AppConstants.platform == "linux") {
         return gNavigatorBundle.getString("decoder.noCodecsLinux.message");
       }
     }
     return "";
   },
 
+  getSumoForLearnHowButton(type) {
+    if (AppConstants.platform == "win") {
+      return "fix-video-audio-problems-firefox-windows";
+    }
+    return "";
+  },
+
   receiveMessage({target: browser, data: data}) {
     let box = gBrowser.getNotificationBox(browser);
     let notificationId = "decoder-doctor-notification";
     if (box.getNotificationWithValue(notificationId)) {
       return;
     }
 
     let parsedData;
@@ -301,31 +304,32 @@ let gDecoderDoctorHandler = {
         if (newbies.length) {
           Services.prefs.setCharPref(formatsPref,
                                      existing.concat(newbies).join(", "));
         }
       }
       histogram.add(decoderDoctorReportId, TELEMETRY_DDSTAT_SHOWN);
 
       let buttons = [];
-      if (gDecoderDoctorHandler.shouldShowLearnMoreButton()) {
+      let sumo = gDecoderDoctorHandler.getSumoForLearnHowButton(type);
+      if (sumo) {
         buttons.push({
           label: gNavigatorBundle.getString("decoder.noCodecs.button"),
           accessKey: gNavigatorBundle.getString("decoder.noCodecs.accesskey"),
           callback() {
             let clickedInPref = Services.prefs.getPrefType(buttonClickedPref) &&
                                 Services.prefs.getBoolPref(buttonClickedPref);
             if (!clickedInPref) {
               Services.prefs.setBoolPref(buttonClickedPref, true);
               histogram.add(decoderDoctorReportId, TELEMETRY_DDSTAT_CLICKED_FIRST);
             }
             histogram.add(decoderDoctorReportId, TELEMETRY_DDSTAT_CLICKED);
 
             let baseURL = Services.urlFormatter.formatURLPref("app.support.baseURL");
-            openUILinkIn(baseURL + "fix-video-audio-problems-firefox-windows", "tab");
+            openUILinkIn(baseURL + sumo, "tab");
           }
         });
       }
 
       box.appendNotification(
           title,
           notificationId,
           "", // This uses the info icon as specified below.