Bug 1561844 Remove OpenH264 plugin from about:addons r=VladBaicu
authorAndrei Lazar <andrei.a.lazar@softvision.ro>
Mon, 08 Jul 2019 12:15:44 +0000
changeset 481627 bbe14fc961956ebccf579c867b4f4828176dc2f9
parent 481626 0ac6ffc632bc94d0a356774ddc1c651cb28b6060
child 481628 6def08fee1b51221a52f02eb05d440d3a93c8c43
push id36261
push usernbeleuzu@mozilla.com
push dateTue, 09 Jul 2019 03:44:14 +0000
treeherdermozilla-central@b782ed36b2e8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersVladBaicu
bugs1561844
milestone69.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 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
mobile/android/chrome/content/browser.js
--- a/mobile/android/chrome/content/browser.js
+++ b/mobile/android/chrome/content/browser.js
@@ -225,16 +225,18 @@ ChromeUtils.defineModuleGetter(
 );
 
 ChromeUtils.defineModuleGetter(
   this,
   "ContentBlockingAllowList",
   "resource://gre/modules/ContentBlockingAllowList.jsm"
 );
 
+ChromeUtils.defineModuleGetter(this, "GMPInstallManager", "resource://gre/modules/GMPInstallManager.jsm");
+
 var GlobalEventDispatcher = EventDispatcher.instance;
 var WindowEventDispatcher = EventDispatcher.for(window);
 
 var lazilyLoadedBrowserScripts = [
   ["MasterPassword", "chrome://browser/content/MasterPassword.js"],
   ["OfflineApps", "chrome://browser/content/OfflineApps.js"],
   ["Linkifier", "chrome://browser/content/Linkify.js"],
   ["CastingApps", "chrome://browser/content/CastingApps.js"],
@@ -674,16 +676,18 @@ var BrowserApp = {
       Services.prefs.setIntPref("extensions.autoDisableScopes", 1);
       Services.prefs.setBoolPref("xpinstall.enabled", false);
     } else if (ParentalControls.parentalControlsEnabled) {
       Services.prefs.clearUserPref("extensions.enabledScopes");
       Services.prefs.clearUserPref("extensions.autoDisableScopes");
       Services.prefs.setBoolPref("xpinstall.enabled", true);
     }
 
+    this.hideH264AddonIfNeeded();
+
     if (ParentalControls.parentalControlsEnabled) {
       let isBlockListEnabled = ParentalControls.isAllowed(
         ParentalControls.BLOCK_LIST
       );
       Services.prefs.setBoolPref(
         "browser.safebrowsing.allowOverride",
         !isBlockListEnabled
       );
@@ -843,16 +847,30 @@ var BrowserApp = {
 
   /**
    * Pass this a locale string, such as "fr" or "es_ES".
    */
   setLocale: function(locale) {
     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
     // having to be rebuilt.
     let stringGetter = name => () => Strings.browser.GetStringFromName(name);
 
     function videoClassifier(aTarget) {
       if (aTarget.readyState == aTarget.HAVE_NOTHING) {