Bug 1508777 Skip updates for LWTs with no updateURL r=kmag
authorAndrew Swan <aswan@mozilla.com>
Wed, 19 Dec 2018 03:58:49 +0000
changeset 451292 f69fb4fba54b564f2a20ea733663d96ccd2e0ef0
parent 451291 7359f1ce3a65537fe5c7a2075c58e0cb11b358e3
child 451293 973d54f232af0074ebb4fd1a6eab4822d43e80c1
push id110646
push userebalazs@mozilla.com
push dateWed, 19 Dec 2018 16:05:18 +0000
treeherdermozilla-inbound@1acd86ad823c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskmag
bugs1508777
milestone66.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 1508777 Skip updates for LWTs with no updateURL r=kmag 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
@@ -274,16 +274,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.
@@ -359,17 +363,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