Bug 1096469 - Make devedition theme work with custom devtools themes. r=Gijs, a=lsblakk
authorBrian Grinstead <bgrinstead@mozilla.com>
Tue, 11 Nov 2014 17:33:18 -0800
changeset 235185 3d78aaf8a9c7ac0b82b35617362fee16d7b85a88
parent 235184 92a9effa0ed40659237ad8fbf2e2e61535ed2463
child 235186 9c775c8888ef57d344cc18cb0a857148ebc54d0a
push id611
push userraliiev@mozilla.com
push dateMon, 05 Jan 2015 23:23:16 +0000
treeherdermozilla-release@345cd3b9c445 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersGijs, lsblakk
bugs1096469
milestone35.0a2
Bug 1096469 - Make devedition theme work with custom devtools themes. r=Gijs, a=lsblakk
browser/base/content/browser-devedition.js
browser/base/content/test/general/browser_devedition.js
--- a/browser/base/content/browser-devedition.js
+++ b/browser/base/content/browser-devedition.js
@@ -48,18 +48,21 @@ let DevEdition = {
         this._updateStyleSheetFromPrefs();
       }
     }
   },
 
   _updateDevtoolsThemeAttribute: function() {
     // Set an attribute on root element to make it possible
     // to change colors based on the selected devtools theme.
-    document.documentElement.setAttribute("devtoolstheme",
-      Services.prefs.getCharPref(this._devtoolsThemePrefName));
+    let devtoolsTheme = Services.prefs.getCharPref(this._devtoolsThemePrefName);
+    if (devtoolsTheme != "dark") {
+      devtoolsTheme = "light";
+    }
+    document.documentElement.setAttribute("devtoolstheme", devtoolsTheme);
     ToolbarIconColor.inferFromText();
     this._updateStyleSheetFromPrefs();
   },
 
   _updateStyleSheetFromPrefs: function() {
     let lightweightThemeSelected = false;
     try {
       lightweightThemeSelected = Services.prefs.getBoolPref(this._lwThemePrefName);
--- a/browser/base/content/test/general/browser_devedition.js
+++ b/browser/base/content/test/general/browser_devedition.js
@@ -60,16 +60,21 @@ function testDevtoolsTheme() {
   is (document.documentElement.getAttribute("devtoolstheme"), "light",
     "The documentElement has an attribute based on devtools theme.");
   ok (DevEdition.styleSheet, "The devedition stylesheet is still there with the light devtools theme.");
 
   Services.prefs.setCharPref(PREF_DEVTOOLS_THEME, "dark");
   is (document.documentElement.getAttribute("devtoolstheme"), "dark",
     "The documentElement has an attribute based on devtools theme.");
   ok (DevEdition.styleSheet, "The devedition stylesheet is still there with the dark devtools theme.");
+
+  Services.prefs.setCharPref(PREF_DEVTOOLS_THEME, "foobar");
+  is (document.documentElement.getAttribute("devtoolstheme"), "light",
+    "The documentElement has 'light' as a default for the devtoolstheme attribute");
+  ok (DevEdition.styleSheet, "The devedition stylesheet is still there with the foobar devtools theme.");
 }
 
 function dummyLightweightTheme(id) {
   return {
     id: id,
     name: id,
     headerURL: "http://lwttest.invalid/a.png",
     footerURL: "http://lwttest.invalid/b.png",