From 064146c0ce2a3e969289d3dc3849b8357a090cd4 Mon Sep 17 00:00:00 2001 From: Alexandre Poirot Date: Tue, 3 Nov 2015 13:35:12 -0800 Subject: [PATCH] Bug 1217153 - Do not reset devtools theme when hot reloading the tools. r=bgrins --- devtools/client/framework/gDevTools.jsm | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/devtools/client/framework/gDevTools.jsm b/devtools/client/framework/gDevTools.jsm index a17823d5397e..2f3f3d113d3b 100644 --- a/devtools/client/framework/gDevTools.jsm +++ b/devtools/client/framework/gDevTools.jsm @@ -23,7 +23,8 @@ XPCOMUtils.defineLazyModuleGetter(this, "CustomizableUI", loader.lazyRequireGetter(this, "DebuggerServer", "devtools/server/main", true); loader.lazyRequireGetter(this, "DebuggerClient", "devtools/shared/client/main", true); -const DefaultTools = require("devtools/client/definitions").defaultTools; +const {defaultTools: DefaultTools, defaultThemes: DefaultThemes} = + require("devtools/client/definitions"); const EventEmitter = require("devtools/shared/event-emitter"); const Telemetry = require("devtools/client/shared/telemetry"); const {JsonView} = require("devtools/client/jsonview/main"); @@ -286,10 +287,17 @@ DevTools.prototype = { let currTheme = Services.prefs.getCharPref("devtools.theme"); - // Change the current theme if it's being dynamically removed together - // with the owner (bootstrapped) extension. - // But, do not change it if the application is just shutting down. - if (!Services.startup.shuttingDown && theme.id == currTheme) { + // Note that we can't check if `theme` is an item + // of `DefaultThemes` as we end up reloading definitions + // module and end up with different theme objects + let isCoreTheme = DefaultThemes.some(t => t.id === themeId); + + // Reset the theme if an extension theme that's currently applied + // is being removed. + // Ignore shutdown since addons get disabled during that time. + if (!Services.startup.shuttingDown && + !isCoreTheme && + theme.id == currTheme) { Services.prefs.setCharPref("devtools.theme", "light"); let data = {