From bbe245a7bdbc59e215a02975598160b048178923 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Wed, 2 Feb 2011 11:58:03 -0500 Subject: [PATCH] Fix some startup issues. --- common/modules/config.jsm | 41 +++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/common/modules/config.jsm b/common/modules/config.jsm index 5175c92b..0f9a006a 100644 --- a/common/modules/config.jsm +++ b/common/modules/config.jsm @@ -12,8 +12,8 @@ let global = this; Components.utils.import("resource://dactyl/bootstrap.jsm"); defineModule("config", { exports: ["ConfigBase", "Config", "config"], - require: ["highlight", "services", "storage", "util", "template"], - use: ["highlight", "io"] + require: ["services", "storage", "util", "template"], + use: ["io"] }, this); var ConfigBase = Class("ConfigBase", { @@ -22,23 +22,6 @@ var ConfigBase = Class("ConfigBase", { * initialization code. Must call superclass's init function. */ init: function init() { - - this.timeout(function () { - highlight.styleableChrome = this.styleableChrome; - highlight.loadCSS(this.CSS); - highlight.loadCSS(this.helpCSS); - if (!util.haveGecko("2b")) - highlight.loadCSS(); - }); - this.features.push = deprecated("set.add", function push(feature) set.add(this, feature)); if (util.haveGecko("2b")) set.add(this.features, "Gecko2"); @@ -53,6 +36,23 @@ var ConfigBase = Class("ConfigBase", { }); }, + loadStyles: function loadStyles() { + const { highlight } = require("highlight"); + highlight.styleableChrome = this.styleableChrome; + highlight.loadCSS(this.CSS); + highlight.loadCSS(this.helpCSS); + if (!util.haveGecko("2b")) + highlight.loadCSS(); + }, + get addonID() this.name + "@dactyl.googlecode.com", addon: Class.memoize(function () { let addon; @@ -169,6 +169,7 @@ var ConfigBase = Class("ConfigBase", { ], styleHelp: function styleHelp() { + const { highlight } = require("highlight"); if (!this.helpStyled) for (let k in keys(highlight.loaded)) if (/^(Help|StatusLine)|^(Boolean|Indicator|MoreMsg|Number|Logo|Key(word)?|String)$/.test(k)) @@ -726,6 +727,8 @@ config.INIT = update(Object.create(config.INIT), config.INIT, { endModule(); +config.loadStyles(); + } catch(e){ if (isString(e)) e = Error(e); dump(e.fileName+":"+e.lineNumber+": "+e+"\n" + e.stack); } // vim: set fdm=marker sw=4 sts=4 et ft=javascript: