Bug 1416822 - remove INSTALL_COMPACT_THEMES define now that we always ship compact themes, r?bgrins draft
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Mon, 13 Nov 2017 17:10:49 +0000
changeset 697251 4df228d509c33991b0fcd40b9917d1a36d2ed858
parent 697096 fc194660762d1b92e1679d860a8bf41116d0f54f
child 740060 daffd92e2d9a4a5b7eee15a5cc0825887bdb5d7f
push id88936
push usergijskruitbosch@gmail.com
push dateMon, 13 Nov 2017 17:21:07 +0000
reviewersbgrins
bugs1416822
milestone59.0a1
Bug 1416822 - remove INSTALL_COMPACT_THEMES define now that we always ship compact themes, r?bgrins MozReview-Commit-ID: 118eGLpRqjg
browser/base/content/browser-compacttheme.js
browser/base/content/test/general/browser_compacttheme.js
browser/components/nsBrowserGlue.js
toolkit/modules/AppConstants.jsm
toolkit/modules/moz.build
--- a/browser/base/content/browser-compacttheme.js
+++ b/browser/base/content/browser-compacttheme.js
@@ -71,12 +71,11 @@ var CompactTheme = {
     Services.obs.removeObserver(this, "lightweight-theme-styling-update");
     this.styleSheet = null;
   }
 };
 
 // If the compact theme is going to be applied in gBrowserInit.onLoad,
 // then preload it now.  This prevents a flash of unstyled content where the
 // normal theme is applied while the compact theme stylesheet is loading.
-if (AppConstants.INSTALL_COMPACT_THEMES &&
-    this != Services.appShell.hiddenDOMWindow && CompactTheme.isThemeCurrentlyApplied) {
+if (this != Services.appShell.hiddenDOMWindow && CompactTheme.isThemeCurrentlyApplied) {
   CompactTheme.createStyleSheet();
 }
--- a/browser/base/content/test/general/browser_compacttheme.js
+++ b/browser/base/content/test/general/browser_compacttheme.js
@@ -3,31 +3,25 @@
  * A special stylesheet should be added to the browser.xul document
  * when the firefox-compact-light and firefox-compact-dark lightweight
  * themes are applied.
  */
 
 const PREF_LWTHEME_USED_THEMES = "lightweightThemes.usedThemes";
 const COMPACT_LIGHT_ID = "firefox-compact-light@mozilla.org";
 const COMPACT_DARK_ID = "firefox-compact-dark@mozilla.org";
-const SKIP_TEST = !AppConstants.INSTALL_COMPACT_THEMES;
 const {LightweightThemeManager} = Components.utils.import("resource://gre/modules/LightweightThemeManager.jsm", {});
 
 registerCleanupFunction(() => {
   // Set preferences back to their original values
   LightweightThemeManager.currentTheme = null;
   Services.prefs.clearUserPref(PREF_LWTHEME_USED_THEMES);
 });
 
 add_task(async function startTests() {
-  if (SKIP_TEST) {
-    ok(true, "No need to run this test since themes aren't installed");
-    return;
-  }
-
   info("Setting the current theme to null");
   LightweightThemeManager.currentTheme = null;
   ok(!CompactTheme.isStyleSheetEnabled, "There is no compact style sheet when no lw theme is applied.");
 
   info("Adding a lightweight theme.");
   LightweightThemeManager.currentTheme = dummyLightweightTheme("preview0");
   ok(!CompactTheme.isStyleSheetEnabled, "The compact stylesheet has been removed when a lightweight theme is applied.");
 
@@ -55,20 +49,16 @@ function dummyLightweightTheme(id) {
     headerURL: "resource:///chrome/browser/content/browser/defaultthemes/compact.header.png",
     iconURL: "resource:///chrome/browser/content/browser/defaultthemes/light.icon.svg",
     textcolor: "red",
     accentcolor: "blue"
   };
 }
 
 add_task(async function testLightweightThemePreview() {
-  if (SKIP_TEST) {
-    ok(true, "No need to run this test since themes aren't installed");
-    return;
-  }
   info("Setting compact to current and previewing others");
   LightweightThemeManager.currentTheme = LightweightThemeManager.getUsedTheme(COMPACT_LIGHT_ID);
   ok(CompactTheme.isStyleSheetEnabled, "The compact stylesheet is enabled.");
   LightweightThemeManager.previewTheme(dummyLightweightTheme("preview0"));
   ok(!CompactTheme.isStyleSheetEnabled, "The compact stylesheet is not enabled after a lightweight theme preview.");
   LightweightThemeManager.resetPreview();
   LightweightThemeManager.previewTheme(dummyLightweightTheme("preview1"));
   ok(!CompactTheme.isStyleSheetEnabled, "The compact stylesheet is not enabled after a second lightweight theme preview.");
--- a/browser/components/nsBrowserGlue.js
+++ b/browser/components/nsBrowserGlue.js
@@ -637,40 +637,38 @@ BrowserGlue.prototype = {
 
     // handle any UI migration
     this._migrateUI();
 
     listeners.init();
 
     SessionStore.init();
 
-    if (AppConstants.INSTALL_COMPACT_THEMES) {
-      let vendorShortName = gBrandBundle.GetStringFromName("vendorShortName");
+    let vendorShortName = gBrandBundle.GetStringFromName("vendorShortName");
 
-      LightweightThemeManager.addBuiltInTheme({
-        id: "firefox-compact-light@mozilla.org",
-        name: gBrowserBundle.GetStringFromName("lightTheme.name"),
-        description: gBrowserBundle.GetStringFromName("lightTheme.description"),
-        headerURL: "resource:///chrome/browser/content/browser/defaultthemes/compact.header.png",
-        iconURL: "resource:///chrome/browser/content/browser/defaultthemes/light.icon.svg",
-        textcolor: "black",
-        accentcolor: "white",
-        author: vendorShortName,
-      });
-      LightweightThemeManager.addBuiltInTheme({
-        id: "firefox-compact-dark@mozilla.org",
-        name: gBrowserBundle.GetStringFromName("darkTheme.name"),
-        description: gBrowserBundle.GetStringFromName("darkTheme.description"),
-        headerURL: "resource:///chrome/browser/content/browser/defaultthemes/compact.header.png",
-        iconURL: "resource:///chrome/browser/content/browser/defaultthemes/dark.icon.svg",
-        textcolor: "white",
-        accentcolor: "black",
-        author: vendorShortName,
-      });
-    }
+    LightweightThemeManager.addBuiltInTheme({
+      id: "firefox-compact-light@mozilla.org",
+      name: gBrowserBundle.GetStringFromName("lightTheme.name"),
+      description: gBrowserBundle.GetStringFromName("lightTheme.description"),
+      headerURL: "resource:///chrome/browser/content/browser/defaultthemes/compact.header.png",
+      iconURL: "resource:///chrome/browser/content/browser/defaultthemes/light.icon.svg",
+      textcolor: "black",
+      accentcolor: "white",
+      author: vendorShortName,
+    });
+    LightweightThemeManager.addBuiltInTheme({
+      id: "firefox-compact-dark@mozilla.org",
+      name: gBrowserBundle.GetStringFromName("darkTheme.name"),
+      description: gBrowserBundle.GetStringFromName("darkTheme.description"),
+      headerURL: "resource:///chrome/browser/content/browser/defaultthemes/compact.header.png",
+      iconURL: "resource:///chrome/browser/content/browser/defaultthemes/dark.icon.svg",
+      textcolor: "white",
+      accentcolor: "black",
+      author: vendorShortName,
+    });
 
 
     // Initialize the default l10n resource sources for L10nRegistry.
     const multilocalePath = "resource://gre/res/multilocale.json";
     L10nRegistry.bootstrap = fetch(multilocalePath).then(d => d.json()).then(({ locales }) => {
       const toolkitSource = new FileSource("toolkit", locales, "resource://gre/localization/{locale}/");
       L10nRegistry.registerSource(toolkitSource);
       const appSource = new FileSource("app", locales, "resource://app/localization/{locale}/");
--- a/toolkit/modules/AppConstants.jsm
+++ b/toolkit/modules/AppConstants.jsm
@@ -231,23 +231,16 @@ this.AppConstants = Object.freeze({
 
   MOZ_ALLOW_LEGACY_EXTENSIONS:
 #ifdef MOZ_ALLOW_LEGACY_EXTENSIONS
   true,
 #else
   false,
 #endif
 
-  INSTALL_COMPACT_THEMES:
-#ifdef INSTALL_COMPACT_THEMES
-  true,
-#else
-  false,
-#endif
-
   MENUBAR_CAN_AUTOHIDE:
 #ifdef MENUBAR_CAN_AUTOHIDE
   true,
 #else
   false,
 #endif
 
   CAN_DRAW_IN_TITLEBAR:
--- a/toolkit/modules/moz.build
+++ b/toolkit/modules/moz.build
@@ -253,17 +253,16 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'coco
 
 EXTRA_JS_MODULES.third_party.jsesc += ['third_party/jsesc/jsesc.js']
 EXTRA_JS_MODULES.sessionstore += [
     'sessionstore/PrivacyLevel.jsm',
     'sessionstore/SessionHistory.jsm',
     'sessionstore/Utils.jsm',
 ]
 
-DEFINES['INSTALL_COMPACT_THEMES'] = 1
 if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('windows', 'cocoa'):
     DEFINES['CAN_DRAW_IN_TITLEBAR'] = 1
 
 if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('windows', 'gtk2', 'gtk3'):
     DEFINES['MENUBAR_CAN_AUTOHIDE'] = 1
 
 if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('windows', 'gtk2', 'gtk3', 'cocoa'):
     DEFINES['HAVE_SHELL_SERVICE'] = 1