Bug 1327560 - Always include the current lwtheme in the list of recent lightweight themes (don't truncate it out). r?gijs draft
authorJared Wein <jwein@mozilla.com>
Tue, 03 Jan 2017 17:24:49 -0500
changeset 455472 ab87ddbf00a1d139264777c2b77a7579ed6a283c
parent 455333 cad2ea346d06ec5a3a70eda912513201dff0c21e
child 541005 1de3ef0c4e89dd241fdc2cc56839c747ad386c1c
push id40254
push userbmo:jaws@mozilla.com
push dateTue, 03 Jan 2017 22:31:33 +0000
reviewersgijs
bugs1327560
milestone53.0a1
Bug 1327560 - Always include the current lwtheme in the list of recent lightweight themes (don't truncate it out). r?gijs MozReview-Commit-ID: b3O3MnpmjG
browser/components/customizableui/CustomizeMode.jsm
--- a/browser/components/customizableui/CustomizeMode.jsm
+++ b/browser/components/customizableui/CustomizeMode.jsm
@@ -1389,19 +1389,28 @@ CustomizeMode.prototype = {
         tbb.addEventListener("blur", resetPreview);
         tbb.addEventListener("mouseout", resetPreview);
 
         return tbb;
       }
 
       let themes = [aDefaultTheme];
       let lwts = LightweightThemeManager.usedThemes;
+      let currentLwt = LightweightThemeManager.currentTheme;
+      lwts.sort((a, b) => {
+        if (a == currentLwt) {
+          return -1;
+        }
+        if (b == currentLwt) {
+          return 1;
+        }
+        return 0;
+      });
       if (lwts.length > RECENT_LWT_COUNT)
         lwts.length = RECENT_LWT_COUNT;
-      let currentLwt = LightweightThemeManager.currentTheme;
       for (let lwt of lwts) {
         lwt.isActive = !!currentLwt && (lwt.id == currentLwt.id);
         themes.push(lwt);
       }
 
       let footer = doc.getElementById("customization-lwtheme-menu-footer");
       let panel = footer.parentNode;
       let recommendedLabel = doc.getElementById("customization-lwtheme-menu-recommended");