Bug 1140523: Send correct onEnabling/onDisabling notifications when EME preferences change. r=mossop

This commit is contained in:
Stephen Pohl 2015-03-16 14:59:08 -04:00
parent 36d22b63e9
commit 8334bc893e

View File

@ -176,8 +176,8 @@ function GMPWrapper(aPluginInfo) {
Preferences.observe(GMPPrefs.getPrefKey(KEY_PLUGIN_VERSION, this._plugin.id),
this.onPrefVersionChanged, this);
if (this._plugin.isEME) {
Preferences.observe(GMPPrefs.getPrefKey(KEY_EME_ENABLED, this._plugin.id),
this.onPrefEnabledChanged, this);
Preferences.observe(KEY_EME_ENABLED, this.onPrefEMEGlobalEnabledChanged,
this);
}
}
@ -377,7 +377,7 @@ GMPWrapper.prototype = {
return this.version && this.version.length > 0;
},
onPrefEnabledChanged: function() {
_handleEnabledChanged: function() {
AddonManagerPrivate.callAddonListeners(this.isActive ?
"onEnabling" : "onDisabling",
this, false);
@ -397,6 +397,20 @@ GMPWrapper.prototype = {
this);
},
onPrefEMEGlobalEnabledChanged: function() {
AddonManagerPrivate.callAddonListeners("onPropertyChanged", this,
["appDisabled"]);
if (!this.userDisabled) {
this._handleEnabledChanged();
}
},
onPrefEnabledChanged: function() {
if (!this._plugin.isEME || !this.appDisabled) {
this._handleEnabledChanged();
}
},
onPrefVersionChanged: function() {
AddonManagerPrivate.callAddonListeners("onUninstalling", this, false);
if (this._gmpPath) {
@ -428,9 +442,9 @@ GMPWrapper.prototype = {
this.onPrefEnabledChanged, this);
Preferences.ignore(GMPPrefs.getPrefKey(KEY_PLUGIN_VERSION, this._plugin.id),
this.onPrefVersionChanged, this);
if (this._isEME) {
Preferences.ignore(GMPPrefs.getPrefKey(KEY_EME_ENABLED, this._plugin.id),
this.onPrefEnabledChanged, this);
if (this._plugin.isEME) {
Preferences.ignore(KEY_EME_ENABLED, this.onPrefEMEGlobalEnabledChanged,
this);
}
return this._updateTask;
},