Bug 1093368 - Customize mode theme picker shouldn't pass the default theme object to LightweightThemeManager.previewTheme. r=jaws

This commit is contained in:
Dão Gottwald 2014-11-08 20:30:00 +01:00
parent 9e29836c25
commit b605783cb3
4 changed files with 4 additions and 7 deletions

View File

@ -14,7 +14,6 @@ let DevEdition = {
styleSheetLocation: "chrome://browser/skin/devedition.css",
styleSheet: null,
defaultThemeID: "{972ce4c6-7e08-4474-a285-3208198ce6fd}",
init: function () {
this._updateDevtoolsThemeAttribute();
@ -32,7 +31,7 @@ let DevEdition = {
observe: function (subject, topic, data) {
if (topic == "lightweight-theme-styling-update") {
let newTheme = JSON.parse(data);
if (!newTheme || newTheme.id === this.defaultThemeID) {
if (!newTheme) {
// A lightweight theme has been unapplied, so just re-read prefs.
this._updateStyleSheetFromPrefs();
} else {

View File

@ -105,7 +105,7 @@ function testLightweightThemePreview() {
info ("Turning the pref on, then previewing the default theme, turning it off and resetting the preview");
Services.prefs.setBoolPref(PREF_DEVEDITION_THEME, true);
ok (DevEdition.styleSheet, "The devedition stylesheet is enabled.");
LightweightThemeManager.previewTheme(dummyLightweightTheme("{972ce4c6-7e08-4474-a285-3208198ce6fd}"));
LightweightThemeManager.previewTheme(null);
ok (DevEdition.styleSheet, "The devedition stylesheet is still enabled after the default theme is applied.");
LightweightThemeManager.resetPreview();
ok (DevEdition.styleSheet, "The devedition stylesheet is still enabled after resetting the preview.");

View File

@ -1293,7 +1293,8 @@ CustomizeMode.prototype = {
const RECENT_LWT_COUNT = 5;
function previewTheme(aEvent) {
LightweightThemeManager.previewTheme(aEvent.target.theme);
LightweightThemeManager.previewTheme(aEvent.target.theme.id != DEFAULT_THEME_ID ?
aEvent.target.theme : null);
}
function resetPreview() {

View File

@ -142,9 +142,6 @@ this.LightweightThemeManager = {
},
previewTheme: function LightweightThemeManager_previewTheme(aData) {
if (!aData)
return;
let cancel = Cc["@mozilla.org/supports-PRBool;1"].createInstance(Ci.nsISupportsPRBool);
cancel.data = false;
Services.obs.notifyObservers(cancel, "lightweight-theme-preview-requested",