Bug 1276132 - Rename media.gmp-*.forcevisible to media.gmp-*.visible, and set it when keysystems are enabled. r=spohl

Repurpose the media.gmp-*.forcevisible pref to control whether the
corresponding GMP is visible in the addons manager UI. The pref has to be true
for the GMP to be usable.

The pref is enabled and not hidden when the corresponding EME keysystem is
enabled in the mozconfig.

This means users can turn on EME without needing to recompile their build; they
just need to create a hidden pref. This will be useful for CDM developers, and
users on platforms where we've not enabled EME yet but users want to test it
(Linux).

We also need to change the GMPUtils.isPluginHidden() accessor so that plugins
are considered hidden if the "visible" pref is false OR we're on an unsupported
platform. This ensures that we must be on a supported OS and the visibility
pref is true before GMPs appear in the addon list.

A consequence of the isPluginHidden() change is that we also need to add a
"force-supported" pref to override the checks that refuse to load the GMPs on
various platform versions, so that the unit tests pass.

MozReview-Commit-ID: h6CwLDkvFW

--HG--
extra : rebase_source : d09b952cc12da6f46b404439781b62784e4f54b3
This commit is contained in:
Chris Pearce 2016-05-31 10:59:44 +12:00
Родитель 17821c9ee3
Коммит ac07135594
4 изменённых файлов: 43 добавлений и 14 удалений

Просмотреть файл

@ -1285,11 +1285,21 @@ pref("media.gmp.decoder.h264", 2);
// decode H.264.
pref("media.gmp.trial-create.enabled", true);
// Note: when media.gmp-*.visible is true, provided we're running on a
// supported platform/OS version, the corresponding CDM appears in the
// plugins list, Firefox will download the GMP/CDM if enabled, and our
// UI to re-enable EME prompts the user to re-enable EME if it's disabled
// and script requests EME. If *.visible is false, we won't show the UI
// to enable the CDM if its disabled; it's as if the keysystem is completely
// unsupported.
#ifdef MOZ_ADOBE_EME
pref("media.gmp-eme-adobe.visible", true);
pref("media.gmp-eme-adobe.enabled", true);
#endif
#ifdef MOZ_WIDEVINE_EME
pref("media.gmp-widevinecdm.visible", true);
pref("media.gmp-widevinecdm.enabled", true);
#endif

Просмотреть файл

@ -46,8 +46,8 @@ this.GMPUtils = {
return false;
}
if (!this._isPluginSupported(aPlugin) &&
!this._isPluginForcedVisible(aPlugin)) {
if (!this._isPluginSupported(aPlugin) ||
!this._isPluginVisible(aPlugin)) {
this.maybeReportTelemetry(aPlugin.id,
"VIDEO_EME_ADOBE_HIDDEN_REASON",
GMPPluginHiddenReason.UNSUPPORTED);
@ -70,6 +70,9 @@ this.GMPUtils = {
* The plugin to check.
*/
_isPluginSupported: function(aPlugin) {
if (this._isPluginForceSupported(aPlugin)) {
return true;
}
if (aPlugin.id == EME_ADOBE_ID) {
if (Services.appinfo.OS != "WINNT") {
// Non-Windows OSes currently unsupported by Adobe EME
@ -92,13 +95,25 @@ this.GMPUtils = {
},
/**
* Checks whether or not a given plugin is forced visible. This can be used
* to test plugins that aren't yet supported by default on a particular OS.
* Checks whether or not a given plugin is visible in the addons manager
* UI and the "enable DRM" notification box. This can be used to test
* plugins that aren't yet turned on in the mozconfig.
* @param aPlugin
* The plugin to check.
*/
_isPluginForcedVisible: function(aPlugin) {
return GMPPrefs.get(GMPPrefs.KEY_PLUGIN_FORCEVISIBLE, false, aPlugin.id);
_isPluginVisible: function(aPlugin) {
return GMPPrefs.get(GMPPrefs.KEY_PLUGIN_VISIBLE, false, aPlugin.id);
},
/**
* Checks whether or not a given plugin is forced-supported. This is used
* in automated tests to override the checks that prevent GMPs running on an
* unsupported platform.
* @param aPlugin
* The plugin to check.
*/
_isPluginForceSupported: function(aPlugin) {
return GMPPrefs.get(GMPPrefs.KEY_PLUGIN_FORCE_SUPPORTED, false, aPlugin.id);
},
/**
@ -136,8 +151,9 @@ this.GMPPrefs = {
KEY_PLUGIN_LAST_UPDATE: "media.{0}.lastUpdate",
KEY_PLUGIN_VERSION: "media.{0}.version",
KEY_PLUGIN_AUTOUPDATE: "media.{0}.autoupdate",
KEY_PLUGIN_FORCEVISIBLE: "media.{0}.forcevisible",
KEY_PLUGIN_VISIBLE: "media.{0}.visible",
KEY_PLUGIN_ABI: "media.{0}.abi",
KEY_PLUGIN_FORCE_SUPPORTED: "media.{0}.forceSupported",
KEY_URL: "media.gmp-manager.url",
KEY_URL_OVERRIDE: "media.gmp-manager.url.override",
KEY_CERT_CHECKATTRS: "media.gmp-manager.cert.checkAttributes",

Просмотреть файл

@ -102,7 +102,8 @@ add_task(function* initializeState() {
gPrefs.clearUserPref(getKey(GMPScope.GMPPrefs.KEY_PLUGIN_LAST_UPDATE, addon.id));
gPrefs.clearUserPref(getKey(GMPScope.GMPPrefs.KEY_PLUGIN_AUTOUPDATE, addon.id));
gPrefs.clearUserPref(getKey(GMPScope.GMPPrefs.KEY_PLUGIN_VERSION, addon.id));
gPrefs.clearUserPref(getKey(GMPScope.GMPPrefs.KEY_PLUGIN_FORCEVISIBLE, addon.id));
gPrefs.clearUserPref(getKey(GMPScope.GMPPrefs.KEY_PLUGIN_VISIBLE, addon.id));
gPrefs.clearUserPref(getKey(GMPScope.GMPPrefs.KEY_PLUGIN_FORCE_SUPPORTED, addon.id));
}
gPrefs.clearUserPref(GMPScope.GMPPrefs.KEY_LOGGING_DUMP);
gPrefs.clearUserPref(GMPScope.GMPPrefs.KEY_LOGGING_LEVEL);
@ -125,8 +126,8 @@ add_task(function* initializeState() {
gPrefs.setIntPref(getKey(GMPScope.GMPPrefs.KEY_PLUGIN_LAST_UPDATE, addon.id), 0);
gPrefs.setBoolPref(getKey(GMPScope.GMPPrefs.KEY_PLUGIN_AUTOUPDATE, addon.id), false);
gPrefs.setCharPref(getKey(GMPScope.GMPPrefs.KEY_PLUGIN_VERSION, addon.id), "");
gPrefs.setBoolPref(getKey(GMPScope.GMPPrefs.KEY_PLUGIN_FORCEVISIBLE, addon.id),
true);
gPrefs.setBoolPref(getKey(GMPScope.GMPPrefs.KEY_PLUGIN_VISIBLE, addon.id), true);
gPrefs.setBoolPref(getKey(GMPScope.GMPPrefs.KEY_PLUGIN_FORCE_SUPPORTED, addon.id), true);
}
yield GMPScope.GMPProvider.shutdown();
GMPScope.GMPProvider.startup();
@ -370,7 +371,7 @@ add_task(function* testUpdateButton() {
add_task(function* testEmeSupport() {
for (let addon of gMockAddons) {
gPrefs.clearUserPref(getKey(GMPScope.GMPPrefs.KEY_PLUGIN_FORCEVISIBLE, addon.id));
gPrefs.clearUserPref(getKey(GMPScope.GMPPrefs.KEY_PLUGIN_FORCE_SUPPORTED, addon.id));
}
yield GMPScope.GMPProvider.shutdown();
GMPScope.GMPProvider.startup();
@ -400,8 +401,8 @@ add_task(function* testEmeSupport() {
}
for (let addon of gMockAddons) {
gPrefs.setBoolPref(getKey(GMPScope.GMPPrefs.KEY_PLUGIN_FORCEVISIBLE, addon.id),
true);
gPrefs.setBoolPref(getKey(GMPScope.GMPPrefs.KEY_PLUGIN_VISIBLE, addon.id), true);
gPrefs.setBoolPref(getKey(GMPScope.GMPPrefs.KEY_PLUGIN_FORCE_SUPPORTED, addon.id), true);
}
yield GMPScope.GMPProvider.shutdown();
GMPScope.GMPProvider.startup();

Просмотреть файл

@ -59,7 +59,9 @@ function run_test() {
gPrefs.setIntPref(GMPScope.GMPPrefs.KEY_LOGGING_LEVEL, 0);
gPrefs.setBoolPref(GMPScope.GMPPrefs.KEY_EME_ENABLED, true);
for (let addon of gMockAddons.values()) {
gPrefs.setBoolPref(gGetKey(GMPScope.GMPPrefs.KEY_PLUGIN_FORCEVISIBLE, addon.id),
gPrefs.setBoolPref(gGetKey(GMPScope.GMPPrefs.KEY_PLUGIN_VISIBLE, addon.id),
true);
gPrefs.setBoolPref(gGetKey(GMPScope.GMPPrefs.KEY_PLUGIN_FORCE_SUPPORTED, addon.id),
true);
}
GMPScope.GMPProvider.shutdown();