Bug 1264483 - Hide Widevine on unsupported systems. r=spohl,a=ritu
authorKirk Steuber <ksteuber@mozilla.com>
Wed, 13 Apr 2016 16:41:48 -0700
changeset 324059 8259d94f2e54088dd1168b8715e5979d8604bd4c
parent 324058 59b23047aaae6dbc3108e3a849b4b30d05aec271
child 324060 3f1a64989c1221aedd6b6c1beeada36bc5f4e297
push id5913
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 16:57:49 +0000
treeherdermozilla-beta@dcaf0a6fa115 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersspohl, ritu
bugs1264483
milestone47.0a2
Bug 1264483 - Hide Widevine on unsupported systems. r=spohl,a=ritu MozReview-Commit-ID: Ew1jUrxff8R
toolkit/modules/GMPUtils.jsm
toolkit/mozapps/extensions/test/browser/browser_gmpProvider.js
--- a/toolkit/modules/GMPUtils.jsm
+++ b/toolkit/modules/GMPUtils.jsm
@@ -65,26 +65,32 @@ this.GMPUtils = {
   },
 
   /**
    * Checks whether or not a given plugin is supported by the current OS.
    * @param   aPlugin
    *          The plugin to check.
    */
   _isPluginSupported: function(aPlugin) {
-    if (aPlugin.id != EME_ADOBE_ID) {
-      // Only checking Adobe EME at the moment.
-      return true;
-    }
-
-    if (Services.appinfo.OS != "WINNT") {
-      // Non-Windows OSes currently unsupported.
-      this.maybeReportTelemetry(aPlugin.id,
-                                "VIDEO_EME_ADOBE_UNSUPPORTED_REASON",
-                                GMPPluginUnsupportedReason.NOT_WINDOWS);
+    if (aPlugin.id == EME_ADOBE_ID) {
+      if (Services.appinfo.OS != "WINNT") {
+        // Non-Windows OSes currently unsupported by Adobe EME
+        this.maybeReportTelemetry(aPlugin.id,
+                                  "VIDEO_EME_ADOBE_UNSUPPORTED_REASON",
+                                  GMPPluginUnsupportedReason.NOT_WINDOWS);
+        return false;
+      }
+    } else if (aPlugin.id == WIDEVINE_ID) {
+      // The Widevine plugin is available for Windows versions Vista and later
+      // and Mac
+      if ((Services.appinfo.OS == "WINNT" &&
+          Services.sysinfo.getPropertyAsInt32("version") >= 6) ||
+          Services.appinfo.OS == "Darwin") {
+        return true;
+      }
       return false;
     }
 
     if (Services.sysinfo.getPropertyAsInt32("version") < 6) {
       // Windows versions before Vista are unsupported.
       this.maybeReportTelemetry(aPlugin.id,
                                 "VIDEO_EME_ADOBE_UNSUPPORTED_REASON",
                                 GMPPluginUnsupportedReason.WINDOWS_VERSION);
--- a/toolkit/mozapps/extensions/test/browser/browser_gmpProvider.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_gmpProvider.js
@@ -381,16 +381,25 @@ add_task(function* testEmeSupport() {
     if (addon.id == GMPScope.EME_ADOBE_ID) {
       if (Services.appinfo.OS == "WINNT" &&
           Services.sysinfo.getPropertyAsInt32("version") >= 6) {
         Assert.ok(item, "Adobe EME supported, found add-on element.");
       } else {
         Assert.ok(!item,
                   "Adobe EME not supported, couldn't find add-on element.");
       }
+    } else if (addon.id == GMPScope.WIDEVINE_ID) {
+      if ((Services.appinfo.OS == "WINNT" &&
+          Services.sysinfo.getPropertyAsInt32("version") >= 6) ||
+          Services.appinfo.OS == "Darwin") {
+        Assert.ok(item, "Widevine supported, found add-on element.");
+      } else {
+        Assert.ok(!item,
+                  "Widevine not supported, couldn't find add-on element.");
+      }
     } else {
       Assert.ok(item, "Found add-on element.");
     }
   }
 
   for (let addon of gMockAddons) {
     gPrefs.setBoolPref(getKey(GMPScope.GMPPrefs.KEY_PLUGIN_FORCEVISIBLE, addon.id),
                        true);