Bug 1508777 - Skip updates for LWTs with no updateURL. r=kmag, a=jcristau
authorAndrew Swan <aswan@mozilla.com>
Wed, 19 Dec 2018 03:58:49 +0000
changeset 501489 e4c03449c5ec
parent 501488 a2b5b227742b
child 501490 97f7aec00819
push id1891
push userjcristau@mozilla.com
push dateTue, 08 Jan 2019 16:05:30 +0000
treeherdermozilla-release@c58ea2229c33 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskmag, jcristau
bugs1508777
milestone64.0.2
Bug 1508777 - Skip updates for LWTs with no updateURL. r=kmag, a=jcristau Differential Revision: https://phabricator.services.mozilla.com/D14931
toolkit/mozapps/extensions/LightweightThemeManager.jsm
--- a/toolkit/mozapps/extensions/LightweightThemeManager.jsm
+++ b/toolkit/mozapps/extensions/LightweightThemeManager.jsm
@@ -254,16 +254,20 @@ var LightweightThemeManager = {
    * this is the current theme.
    *
    * Returns the LWT object (which could be the old one or a new one)
    * if this theme is still an LWT, or null if this theme should be
    * removed from the usedThemes list (ie, because it was updated to an
    * xpi packaged theme).
    */
   async _updateOneTheme(theme, isCurrent) {
+    if (!theme.updateURL) {
+      return theme;
+    }
+
     let req = new ServiceRequest();
 
     req.mozBackgroundRequest = true;
     req.overrideMimeType("text/plain");
     req.open("GET", theme.updateURL, true);
     // Prevent the request from reading from the cache.
     req.channel.loadFlags |= Ci.nsIRequest.LOAD_BYPASS_CACHE;
     // Prevent the request from writing to the cache.
@@ -339,17 +343,17 @@ var LightweightThemeManager = {
     try {
       allThemes = JSON.parse(_prefs.getStringPref("usedThemes"));
     } catch (e) {
       return;
     }
 
     let selectedID = _prefs.getStringPref("selectedThemeID", DEFAULT_THEME_ID);
     let newThemes = await Promise.all(allThemes.map(
-      t => this._updateOneTheme(t, t.id == selectedID)));
+      t => this._updateOneTheme(t, t.id == selectedID).catch(err => {})));
     newThemes = newThemes.filter(t => t);
     _prefs.setStringPref("usedThemes", JSON.stringify(newThemes));
   },
 
   /**
    * Switches to a new lightweight theme.
    *
    * @param  aData