From 49fcbb81cb02b418927aca4871901c842f97100e Mon Sep 17 00:00:00 2001 From: Stephen A Pohl Date: Wed, 27 Jun 2018 13:59:40 -0400 Subject: [PATCH] Bug 1466335: Automatically apply the dark theme on startup if the OS is in dark mode. r=dao --- browser/base/content/browser-compacttheme.js | 2 +- .../mozapps/extensions/LightweightThemeManager.jsm | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/browser/base/content/browser-compacttheme.js b/browser/base/content/browser-compacttheme.js index 99abc39f7448..8e3d8c94b8e0 100644 --- a/browser/base/content/browser-compacttheme.js +++ b/browser/base/content/browser-compacttheme.js @@ -22,7 +22,7 @@ var CompactTheme = { }, get isThemeCurrentlyApplied() { - let theme = LightweightThemeManager.currentTheme; + let theme = LightweightThemeManager.currentThemeForDisplay; return theme && ( theme.id == "firefox-compact-dark@mozilla.org" || theme.id == "firefox-compact-light@mozilla.org"); diff --git a/toolkit/mozapps/extensions/LightweightThemeManager.jsm b/toolkit/mozapps/extensions/LightweightThemeManager.jsm index 000a82a45b50..16fb080b9826 100644 --- a/toolkit/mozapps/extensions/LightweightThemeManager.jsm +++ b/toolkit/mozapps/extensions/LightweightThemeManager.jsm @@ -140,8 +140,15 @@ var LightweightThemeManager = { get currentThemeForDisplay() { var data = this.currentTheme; - if ((!data || data.id == DEFAULT_THEME_ID) && _fallbackThemeData) - data = _fallbackThemeData; + + if (!data || data.id == DEFAULT_THEME_ID) { + if (_fallbackThemeData) { + return _fallbackThemeData; + } + if (_defaultThemeIsInDarkMode) { + return this.getUsedTheme(DARK_THEME_ID); + } + } if (data && PERSIST_ENABLED) { for (let key in PERSIST_FILES) {