diff --git a/common/bootstrap.js b/common/bootstrap.js index 027552f8..dc5609bd 100755 --- a/common/bootstrap.js +++ b/common/bootstrap.js @@ -134,12 +134,12 @@ function init() { } } - if (typeof JSMLoader === "undefined") + dump("JSMLoader " + (typeof JSMLoader !== "undefined" && JSMLoader.bump) + "\n"); + if (typeof JSMLoader === "undefined" || JSMLoader.bump != 2) Cu.import("resource://dactyl/bootstrap.jsm", global); - if (suffix) - JSMLoader.suffix = suffix; - JSMLoader.load("resource://dactyl/bootstrap.jsm", global); + JSMLoader.init(suffix); + JSMLoader.load("base.jsm", global); for each (let component in components) component.register(); diff --git a/common/components/protocols.js b/common/components/protocols.js index 539a539a..f22d11e4 100644 --- a/common/components/protocols.js +++ b/common/components/protocols.js @@ -116,6 +116,8 @@ function Dactyl() { this.pages = {}; Cu.import("resource://dactyl/bootstrap.jsm"); + JSMLoader.init(); + JSMLoader.load("base.jsm", global); require(global, "config"); require(global, "services"); require(global, "util"); diff --git a/common/modules/base.jsm b/common/modules/base.jsm index 7ef74464..68e875f0 100644 --- a/common/modules/base.jsm +++ b/common/modules/base.jsm @@ -173,7 +173,7 @@ function require(obj, name, from) { JSMLoader.load(name + ".jsm", obj); } catch (e) { - defineModule.dump("loading " + String.quote("resource://dactyl/" + name + ".jsm") + "\n"); + defineModule.dump("loading " + String.quote(name + ".jsm") + "\n"); if (loaded.util) util.reportError(e); else diff --git a/common/modules/bootstrap.jsm b/common/modules/bootstrap.jsm index e74d4635..4149828a 100644 --- a/common/modules/bootstrap.jsm +++ b/common/modules/bootstrap.jsm @@ -4,7 +4,10 @@ // given in the LICENSE.txt file included with this file. "use strict"; -let is_bootstrap = 1; +dump(" ======================= bootstrap.jsm " + (typeof JSMLoader) + " ======================= \n"); + +var EXPORTED_SYMBOLS = ["JSMLoader"]; +let global = this; try { @@ -20,6 +23,18 @@ if (!JSMLoader || JSMLoader.bump != 2) manager: Components.manager.QueryInterface(Components.interfaces.nsIComponentRegistrar), stale: {}, suffix: "", + init: function init(suffix) { + this.suffix = suffix || ""; + + Components.classes["@mozilla.org/fuel/application;1"] + .getService(Components.interfaces.fuelIApplication) + .storage.set("dactyl.JSMLoader", this); + + let base = JSMLoader.load("base.jsm", global); + global.EXPORTED_SYMBOLS = base.EXPORTED_SYMBOLS; + global.JSMLoader = this; + base.JSMLoader = this; + }, getTarget: function getTarget(url) { if (url.indexOf(":") === -1) url = "resource://dactyl" + this.suffix + "/" + url; @@ -46,13 +61,6 @@ if (!JSMLoader || JSMLoader.bump != 2) try { let global = Components.utils.import(url, target); - - if (name == "base.jsm" && target.is_bootstrap) { - target.EXPORTED_SYMBOLS = global.EXPORTED_SYMBOLS; - global.JSMLoader = this; - target.JSMLoader = this; - } - return this.globals[name] = global; } catch (e) { @@ -94,11 +102,5 @@ if (!JSMLoader || JSMLoader.bump != 2) } }; -Components.classes["@mozilla.org/fuel/application;1"] - .getService(Components.interfaces.fuelIApplication) - .storage.set("dactyl.JSMLoader", JSMLoader); - -JSMLoader.load("base.jsm", this); - }catch(e){ dump(e + "\n" + (e.stack || Error().stack)); Components.utils.reportError(e) }