Bug 1325149: Don't download dummy config when GMP updates are disabled. r?rhelmer draft
authorKris Maglione <maglione.k@gmail.com>
Thu, 22 Dec 2016 18:37:17 -0800
changeset 453230 e19785f79d9b4fb0b61cd4aeee5eb0a4b742e0c0
parent 452723 7f813afa9a8c9deda34b19cb31bedf433f8d8e3c
child 540404 0800746b9c9cc7cb1647af6490a08b58d68860a7
push id39606
push usermaglione.k@gmail.com
push dateFri, 23 Dec 2016 02:37:55 +0000
reviewersrhelmer
bugs1325149
milestone53.0a1
Bug 1325149: Don't download dummy config when GMP updates are disabled. r?rhelmer MozReview-Commit-ID: DfKOxpTIiXE
toolkit/mozapps/extensions/internal/ProductAddonChecker.jsm
--- a/toolkit/mozapps/extensions/internal/ProductAddonChecker.jsm
+++ b/toolkit/mozapps/extensions/internal/ProductAddonChecker.jsm
@@ -415,16 +415,21 @@ const ProductAddonChecker = {
    * @param  allowedCerts
    *         The list of certificate attributes to match the SSL certificate
    *         against or null to skip checks.
    * @return a promise that resolves to an object containing the list of add-ons
    *         and whether the local fallback was used, or rejects with a JS
    *         exception in case of error.
    */
   getProductAddonList: function(url, allowNonBuiltIn = false, allowedCerts = null) {
+    if (!GMPPrefs.get(GMPPrefs.KEY_UPDATE_ENABLED, true)) {
+      logger.info("Updates are disabled via media.gmp-manager.updateEnabled");
+      return Promise.resolve({usedFallback: true, gmpAddons: []});
+    }
+
     return downloadXML(url, allowNonBuiltIn, allowedCerts)
       .then(parseXML)
       .catch(downloadLocalConfig);
   },
 
   /**
    * Downloads an add-on to a local file and checks that it matches the expected
    * file. The caller is responsible for deleting the temporary file returned.