1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-20 04:38:01 +01:00

Fix some bootstrap issues on upgrade.

This commit is contained in:
Kris Maglione
2011-01-15 12:02:02 -05:00
parent 67e2a23c5a
commit c78c7b36cb
4 changed files with 23 additions and 19 deletions

8
common/bootstrap.js vendored
View File

@@ -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();

View File

@@ -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");

View File

@@ -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

View File

@@ -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) }