Bug 1264483 - Hide Widevine on unsupported systems. r=spohl
authorKirk Steuber <ksteuber@mozilla.com>
Wed, 13 Apr 2016 16:41:48 -0700
changeset 331535 60bd274b9c7c8bcb491111f38d1e7210c09b4c10
parent 331534 01267d99f891c525dc6af7eac888e08aa0aa923a
child 331536 92fa6bc494feaa8b96785f2da527073ce915b78d
push id6048
push userkmoir@mozilla.com
push dateMon, 06 Jun 2016 19:02:08 +0000
treeherdermozilla-beta@46d72a56c57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersspohl
bugs1264483
milestone48.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1264483 - Hide Widevine on unsupported systems. r=spohl 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;
     }
 
     return true;
   },
 
   /**
    * Checks whether or not a given plugin is forced visible. This can be used
--- a/toolkit/mozapps/extensions/test/browser/browser_gmpProvider.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_gmpProvider.js
@@ -380,16 +380,25 @@ add_task(function* testEmeSupport() {
     let item = get_addon_element(gManagerWindow, addon.id);
     if (addon.id == GMPScope.EME_ADOBE_ID) {
       if (Services.appinfo.OS == "WINNT") {
         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);