summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rwxr-xr-xcommon/bootstrap.js15
-rw-r--r--common/modules/bootstrap.jsm22
-rw-r--r--common/modules/util.jsm5
3 files changed, 19 insertions, 23 deletions
diff --git a/common/bootstrap.js b/common/bootstrap.js
index 768b2c5f..5fb9330c 100755
--- a/common/bootstrap.js
+++ b/common/bootstrap.js
@@ -17,6 +17,7 @@ const resourceProto = Services.io.getProtocolHandler("resource")
const categoryManager = Cc["@mozilla.org/categorymanager;1"].getService(Ci.nsICategoryManager);
const manager = Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
const storage = Cc["@mozilla.org/fuel/application;1"].getService(Ci.fuelIApplication).storage;
+let JSMLoader = storage.get("dactyl.JSMLoader", undefined);
function reportError(e) {
dump("dactyl: bootstrap: " + e + "\n" + (e.stack || Error().stack));
@@ -119,12 +120,10 @@ function init() {
function url(path) getURI(path).spec;
- let result = [];
-
let suffix = "-";
let chars = "0123456789abcdefghijklmnopqrstuv";
for (let n = Date.now(); n; n = Math.round(n / chars.length))
- suffix += "0123456789abcdef"[n % chars.length];
+ suffix += chars[n % chars.length];
for each (let line in manifest.split("\n")) {
let fields = line.split(/\s+/);
@@ -148,24 +147,16 @@ function init() {
if (typeof JSMLoader === "undefined")
Cu.import("resource://dactyl/bootstrap.jsm", global);
- else {
- Cu.import("resource://dactyl/bootstrap.jsm", {}).JSMLoader = JSMLoader;
- JSMLoader.load("resource://dactyl/bootstrap.jsm", global);
- }
if (suffix)
JSMLoader.suffix = suffix;
+ JSMLoader.load("resource://dactyl/bootstrap.jsm", global);
for each (let component in components)
component.register();
Services.obs.notifyObservers(null, "dactyl-rehash", null);
- JSMLoader.load("resource://dactyl/bootstrap.jsm", global);
-
require(global, "services");
-
- let manifestText = result.map(function (line) line.join(" ")).join("\n");
-
require(global, "overlay");
}
diff --git a/common/modules/bootstrap.jsm b/common/modules/bootstrap.jsm
index 00758bc0..815fc28a 100644
--- a/common/modules/bootstrap.jsm
+++ b/common/modules/bootstrap.jsm
@@ -4,11 +4,12 @@
// given in the LICENSE.txt file included with this file.
"use strict";
+let is_bootstrap = 1;
+
try {
if (!JSMLoader || JSMLoader.bump != 1)
var JSMLoader = {
- global: this,
bump: 1,
builtin: Components.utils.Sandbox(this),
canonical: {},
@@ -20,6 +21,9 @@ if (!JSMLoader || JSMLoader.bump != 1)
stale: {},
suffix: "",
getTarget: function getTarget(url) {
+ if (url.indexOf(":") === -1)
+ url = "resource://dactyl" + this.suffix + "/" + url;
+
let chan = this.io.newChannel(url, null, null);
chan.cancel(Components.results.NS_BINDING_ABORTED);
return chan.name;
@@ -29,11 +33,11 @@ if (!JSMLoader || JSMLoader.bump != 1)
if (url.indexOf(":") === -1)
url = "resource://dactyl" + this.suffix + "/" + url;
- if (url in this.stale) {
- let stale = this.stale[url];
- delete this.stale[url];
+ if (name in this.stale) {
+ let stale = this.stale[name];
+ delete this.stale[name];
- let global = this.globals[url];
+ let global = this.globals[name];
if (stale === this.getTarget(url))
this.loadSubScript(url, global.global || global);
}
@@ -41,13 +45,13 @@ if (!JSMLoader || JSMLoader.bump != 1)
try {
let global = Components.utils.import(url, target);
- if (name == "base.jsm") {
+ if (name == "base.jsm" && target.is_bootstrap) {
+ target.EXPORTED_SYMBOLS = global.EXPORTED_SYMBOLS;
global.JSMLoader = this;
- Components.utils.import(url, this.global);
- this.global.EXPORTED_SYMBOLS = global.EXPORTED_SYMBOLS;
+ target.JSMLoader = this;
}
- return this.globals[url] = global;
+ return this.globals[name] = global;
}
catch (e) {
dump("Importing " + url + ": " + e + "\n" + (e.stack || Error().stack));
diff --git a/common/modules/util.jsm b/common/modules/util.jsm
index fe4a641f..fec12239 100644
--- a/common/modules/util.jsm
+++ b/common/modules/util.jsm
@@ -1263,8 +1263,9 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
services.fuel.storage.set("dactyl.commandlineArgs", args);
this.timeout(function () {
this.rehashing = true;
- config.addon.userDisabled = true;
- config.addon.userDisabled = false;
+ let addon = config.addon;
+ addon.userDisabled = true;
+ addon.userDisabled = false;
});
},