Bug 1245256 - Add support for Widevine to CDM updater. r=spohl
authorKirk Steuber <ksteuber@mozilla.com>
Thu, 25 Feb 2016 14:24:13 -0800
changeset 330623 1ee6ac3ef6a80d0267a393c7ae857e16a344b334
parent 330622 0586926e98f2571103292a3f904539568a5ebeda
child 330624 f4d7ddb7aea8a45a0b59c524213a61c541cb6324
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
bugs1245256
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 1245256 - Add support for Widevine to CDM updater. r=spohl MozReview-Commit-ID: JwB4Q6ZEqoV
dom/locales/en-US/chrome/plugins.properties
toolkit/modules/GMPInstallManager.jsm
toolkit/modules/GMPUtils.jsm
toolkit/mozapps/extensions/internal/GMPProvider.jsm
--- a/dom/locales/en-US/chrome/plugins.properties
+++ b/dom/locales/en-US/chrome/plugins.properties
@@ -24,8 +24,11 @@ learn_more_label=Learn More
 # GMP Plugins
 gmp_license_info=License information
 
 openH264_name=OpenH264 Video Codec provided by Cisco Systems, Inc.
 openH264_description2=This plugin is automatically installed by Mozilla to comply with the WebRTC specification and to enable WebRTC calls with devices that require the H.264 video codec. Visit http://www.openh264.org/ to view the codec source code and learn more about the implementation.
 
 eme-adobe_name=Primetime Content Decryption Module provided by Adobe Systems, Incorporated
 eme-adobe_description=Play back protected web video.
+
+widevine_name=WidevineCdm
+widevine_description=Widevine Content Decryption Module provided by Google Inc.
--- a/toolkit/modules/GMPInstallManager.jsm
+++ b/toolkit/modules/GMPInstallManager.jsm
@@ -346,17 +346,17 @@ GMPAddon.prototype = {
     return this.id && this.URL && this.version &&
       this.hashFunction && !!this.hashValue;
   },
   get isInstalled() {
     return this.version &&
       GMPPrefs.get(GMPPrefs.KEY_PLUGIN_VERSION, "", this.id) === this.version;
   },
   get isEME() {
-    return this.id.indexOf("gmp-eme-") == 0;
+    return this.id == "gmp-widevinecdm" || this.id.indexOf("gmp-eme-") == 0;
   },
 };
 /**
  * Constructs a GMPExtractor object which is used to extract a GMP zip
  * into the specified location. (Which typically leties per platform)
  * @param zipPath The path on disk of the zip file to extract
  */
 function GMPExtractor(zipPath, installToDirPath) {
--- a/toolkit/modules/GMPUtils.jsm
+++ b/toolkit/modules/GMPUtils.jsm
@@ -6,26 +6,28 @@
 
 const {classes: Cc, interfaces: Ci, results: Cr, utils: Cu, manager: Cm} =
   Components;
 
 this.EXPORTED_SYMBOLS = [ "EME_ADOBE_ID",
                           "GMP_PLUGIN_IDS",
                           "GMPPrefs",
                           "GMPUtils",
-                          "OPEN_H264_ID" ];
+                          "OPEN_H264_ID",
+                          "WIDEVINE_ID" ];
 
 Cu.import("resource://gre/modules/Preferences.jsm");
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://gre/modules/AppConstants.jsm");
 
 // GMP IDs
 const OPEN_H264_ID  = "gmp-gmpopenh264";
 const EME_ADOBE_ID  = "gmp-eme-adobe";
-const GMP_PLUGIN_IDS = [ OPEN_H264_ID, EME_ADOBE_ID ];
+const WIDEVINE_ID   = "gmp-widevinecdm";
+const GMP_PLUGIN_IDS = [ OPEN_H264_ID, EME_ADOBE_ID, WIDEVINE_ID ];
 
 var GMPPluginUnsupportedReason = {
   NOT_WINDOWS: 1,
   WINDOWS_VERSION: 2,
 };
 
 var GMPPluginHiddenReason = {
   UNSUPPORTED: 1,
--- a/toolkit/mozapps/extensions/internal/GMPProvider.jsm
+++ b/toolkit/mozapps/extensions/internal/GMPProvider.jsm
@@ -67,16 +67,25 @@ const GMP_PLUGINS = [
       return Services.urlFormatter.formatURLPref("app.support.baseURL") + "drm-content";
     },
     licenseURL:      "http://help.adobe.com/en_US/primetime/drm/HTML5_CDM_EULA/index.html",
     homepageURL:     "http://help.adobe.com/en_US/primetime/drm/HTML5_CDM",
     optionsURL:      "chrome://mozapps/content/extensions/gmpPrefs.xul",
     isEME:           true,
     missingKey:      "VIDEO_ADOBE_GMP_DISAPPEARED",
     missingFilesKey: "VIDEO_ADOBE_GMP_MISSING_FILES",
+  },
+  {
+    id:              WIDEVINE_ID,
+    name:            "widevine_name",
+    description:     "widevine_description",
+    licenseURL:      "http://www.google.com/policies/terms/",
+    homepageURL:     "http://www.widevine.com/",
+    optionsURL:      "chrome://mozapps/content/extensions/gmpPrefs.xul",
+    isEME:           true
   }];
 XPCOMUtils.defineConstant(this, "GMP_PLUGINS", GMP_PLUGINS);
 
 XPCOMUtils.defineLazyGetter(this, "pluginsBundle",
   () => Services.strings.createBundle("chrome://global/locale/plugins.properties"));
 XPCOMUtils.defineLazyGetter(this, "gmpService",
   () => Cc["@mozilla.org/gecko-media-plugin-service;1"].getService(Ci.mozIGeckoMediaPluginChromeService));
 
@@ -472,20 +481,26 @@ GMPWrapper.prototype = {
       let f = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile);
       let path = OS.Path.join(aGmpPath, aFileName);
       f.initWithPath(path);
       return f.exists();
     };
 
     let id = this._plugin.id.substring(4);
     let libName = AppConstants.DLL_PREFIX + id + AppConstants.DLL_SUFFIX;
+    let infoName;
+    if (this._plugin.id == WIDEVINE_ID) {
+      infoName = "manifest.json";
+    } else {
+      infoName = id + ".info";
+    }
 
     return {
       libraryMissing: !fileExists(this.gmpPath, libName),
-      infoMissing: !fileExists(this.gmpPath, id + ".info"),
+      infoMissing: !fileExists(this.gmpPath, infoName),
       voucherMissing: this._plugin.id == EME_ADOBE_ID
                       && !fileExists(this.gmpPath, id + ".voucher"),
     };
   },
 
   validate: function() {
     if (!this.isInstalled) {
       // Not installed -> Valid.
@@ -555,23 +570,25 @@ var GMPProvider = {
       if (gmpPath && isEnabled) {
         let validation = wrapper.validate();
         if (validation.mismatchedABI) {
           this._log.info("startup - gmp " + plugin.id +
                          " mismatched ABI, uninstalling");
           wrapper.uninstallPlugin();
           continue;
         }
-        if (validation.installed) {
+        if (validation.installed && wrapper.missingFilesKey) {
           telemetryService.getHistogramById(wrapper.missingFilesKey).add(validation.telemetry);
         }
         if (!validation.valid) {
           this._log.info("startup - gmp " + plugin.id +
                          " missing [" + validation.missing + "], uninstalling");
-          telemetryService.getHistogramById(wrapper.missingKey).add(true);
+          if (wrapper.missingKey) {
+            telemetryService.getHistogramById(wrapper.missingKey).add(true);
+          }
           wrapper.uninstallPlugin();
           continue;
         }
         this._log.info("startup - adding gmp directory " + gmpPath);
         try {
           gmpService.addPluginDirectory(gmpPath);
         } catch (e) {
           if (e.name != 'NS_ERROR_NOT_AVAILABLE')