Bug 1294649 - Don't show EME plugins in the plugin list that are disabled. r=spohl,a=ritu
authorChris Pearce <cpearce@mozilla.com>
Tue, 16 Aug 2016 16:15:45 +1200
changeset 349802 c43cb7e9ce93af133fe4eaee82699b1889d206d2
parent 349801 cf696b986483b2b58c760e0063c8260904c7fe8d
child 349803 947cb99af8fef61905b281d29e86c9a216a9ddca
push id1230
push userjlund@mozilla.com
push dateMon, 31 Oct 2016 18:13:35 +0000
treeherdermozilla-release@5e06e3766db2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersspohl, ritu
bugs1294649
milestone50.0a2
Bug 1294649 - Don't show EME plugins in the plugin list that are disabled. r=spohl,a=ritu I noticed that on Linux is you have 'Play DRM content' unchecked, and then open about:addons > plugins, and then check 'Play DRM content', that the Adobe CDM then appears in the about:addons > plugins list. This is because in GMPWrapper.onPrefEMEGlobalEnabledChanged() we're taking the branch that calls AddonManagerPrivate addon listeners. We're doing that because we're only checking the GMPWrapper.appDisabled on that branch, and so if EME is enabled, we'll go down that path for the Adobe CDM on Linux, even though the CDM itself isn't visible/supported on Linux. So we should instead only go down that path if EME is enabled, *and* if the GMP is not hidden. We can uninstall the GMP if it's hidden or EME is disabled, as there's not much point in keeping the plugin around if its disabled. This means toggling the 'Play DRM Content' checkbox doesn't make the Adobe CDM appear in the plugins list, and also if the Widevine CDM is explicitly disabled, it still appears in the plugins list if 'Play DRM Content' is checked, but it appears in a disabled state. As you'd expect. MozReview-Commit-ID: Fq10vnhiaKO
toolkit/mozapps/extensions/internal/GMPProvider.jsm
--- a/toolkit/mozapps/extensions/internal/GMPProvider.jsm
+++ b/toolkit/mozapps/extensions/internal/GMPProvider.jsm
@@ -168,24 +168,24 @@ GMPWrapper.prototype = {
   get fullDescription() { return this._plugin.fullDescription; },
 
   get version() { return GMPPrefs.get(GMPPrefs.KEY_PLUGIN_VERSION, null,
                                       this._plugin.id); },
 
   get isActive() {
     return !this.appDisabled &&
            !this.userDisabled &&
-           !GMPUtils.isPluginHidden(this._plugin.id);
+           !GMPUtils.isPluginHidden(this._plugin);
   },
   get appDisabled() {
     if (this._plugin.isEME && !GMPPrefs.get(GMPPrefs.KEY_EME_ENABLED, true)) {
       // If "media.eme.enabled" is false, all EME plugins are disabled.
       return true;
     }
-   return false;
+    return false;
   },
 
   get userDisabled() {
     return !GMPPrefs.get(GMPPrefs.KEY_PLUGIN_ENABLED, true, this._plugin.id);
   },
   set userDisabled(aVal) { GMPPrefs.set(GMPPrefs.KEY_PLUGIN_ENABLED,
                                         aVal === false,
                                         this._plugin.id); },
@@ -333,16 +333,19 @@ GMPWrapper.prototype = {
     return [];
   },
 
   get isInstalled() {
     return this.version && this.version.length > 0;
   },
 
   _handleEnabledChanged: function() {
+    this._log.info("_handleEnabledChanged() id=" +
+      this._plugin.id + " isActive=" + this.isActive);
+
     AddonManagerPrivate.callAddonListeners(this.isActive ?
                                            "onEnabling" : "onDisabling",
                                            this, false);
     if (this._gmpPath) {
       if (this.isActive) {
         this._log.info("onPrefEnabledChanged() - adding gmp directory " +
                        this._gmpPath);
         gmpService.addPluginDirectory(this._gmpPath);
@@ -353,21 +356,27 @@ GMPWrapper.prototype = {
       }
     }
     AddonManagerPrivate.callAddonListeners(this.isActive ?
                                            "onEnabled" : "onDisabled",
                                            this);
   },
 
   onPrefEMEGlobalEnabledChanged: function() {
+    this._log.info("onPrefEMEGlobalEnabledChanged() id=" + this._plugin.id +
+      " appDisabled=" + this.appDisabled + " isActive=" + this.isActive +
+      " hidden=" + GMPUtils.isPluginHidden(this._plugin));
+
     AddonManagerPrivate.callAddonListeners("onPropertyChanged", this,
                                            ["appDisabled"]);
+    // If EME or the GMP itself are disabled, uninstall the GMP.
+    // Otherwise, check for updates, so we download and install the GMP.
     if (this.appDisabled) {
       this.uninstallPlugin();
-    } else {
+    } else if (!GMPUtils.isPluginHidden(this._plugin)) {
       AddonManagerPrivate.callInstallListeners("onExternalInstall", null, this,
                                                null, false);
       AddonManagerPrivate.callAddonListeners("onInstalling", this, false);
       AddonManagerPrivate.callAddonListeners("onInstalled", this);
       this.checkForUpdates(GMP_CHECK_DELAY);
     }
     if (!this.userDisabled) {
       this._handleEnabledChanged();