Bug 1561844 Remove OpenH264 plugin from about:addons r=VladBaicu

Removed OpenH264 plugin from addons list for users that doesn't have it installed.

Differential Revision: https://phabricator.services.mozilla.com/D37237

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Andrei Lazar 2019-07-08 12:15:44 +00:00
Родитель 875a819a93
Коммит 5f0926e20d
1 изменённых файлов: 18 добавлений и 0 удалений

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

@ -230,6 +230,8 @@ ChromeUtils.defineModuleGetter(
"resource://gre/modules/ContentBlockingAllowList.jsm"
);
ChromeUtils.defineModuleGetter(this, "GMPInstallManager", "resource://gre/modules/GMPInstallManager.jsm");
var GlobalEventDispatcher = EventDispatcher.instance;
var WindowEventDispatcher = EventDispatcher.for(window);
@ -679,6 +681,8 @@ var BrowserApp = {
Services.prefs.setBoolPref("xpinstall.enabled", true);
}
this.hideH264AddonIfNeeded();
if (ParentalControls.parentalControlsEnabled) {
let isBlockListEnabled = ParentalControls.isAllowed(
ParentalControls.BLOCK_LIST
@ -848,6 +852,20 @@ var BrowserApp = {
WindowEventDispatcher.sendRequest({ type: "Locale:Set", locale: locale });
},
hideH264AddonIfNeeded: function() {
let installManager = new GMPInstallManager();
installManager.checkForAddons().then(({usedFallback, gmpAddons}) => {
gmpAddons.forEach((addon) => {
if (addon && addon.id === 'gmp-gmpopenh264' && !addon.isInstalled) {
Services.prefs.setBoolPref('media.gmp-gmpopenh264.visible', false);
Services.prefs.setBoolPref('media.gmp-gmpopenh264.enabled', false);
}
});
}, (err) => {
console.log(`Checking for addons failed with:${err}`);
});
},
initContextMenu: function() {
// We pass a thunk in place of a raw label string. This allows the
// context menu to automatically accommodate locale changes without