mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-22 06:08:02 +01:00
Remove some dead code and fix :rehash.
This commit is contained in:
15
common/bootstrap.js
vendored
15
common/bootstrap.js
vendored
@@ -17,6 +17,7 @@ const resourceProto = Services.io.getProtocolHandler("resource")
|
|||||||
const categoryManager = Cc["@mozilla.org/categorymanager;1"].getService(Ci.nsICategoryManager);
|
const categoryManager = Cc["@mozilla.org/categorymanager;1"].getService(Ci.nsICategoryManager);
|
||||||
const manager = Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
|
const manager = Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
|
||||||
const storage = Cc["@mozilla.org/fuel/application;1"].getService(Ci.fuelIApplication).storage;
|
const storage = Cc["@mozilla.org/fuel/application;1"].getService(Ci.fuelIApplication).storage;
|
||||||
|
let JSMLoader = storage.get("dactyl.JSMLoader", undefined);
|
||||||
|
|
||||||
function reportError(e) {
|
function reportError(e) {
|
||||||
dump("dactyl: bootstrap: " + e + "\n" + (e.stack || Error().stack));
|
dump("dactyl: bootstrap: " + e + "\n" + (e.stack || Error().stack));
|
||||||
@@ -119,12 +120,10 @@ function init() {
|
|||||||
|
|
||||||
function url(path) getURI(path).spec;
|
function url(path) getURI(path).spec;
|
||||||
|
|
||||||
let result = [];
|
|
||||||
|
|
||||||
let suffix = "-";
|
let suffix = "-";
|
||||||
let chars = "0123456789abcdefghijklmnopqrstuv";
|
let chars = "0123456789abcdefghijklmnopqrstuv";
|
||||||
for (let n = Date.now(); n; n = Math.round(n / chars.length))
|
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")) {
|
for each (let line in manifest.split("\n")) {
|
||||||
let fields = line.split(/\s+/);
|
let fields = line.split(/\s+/);
|
||||||
@@ -148,24 +147,16 @@ function init() {
|
|||||||
|
|
||||||
if (typeof JSMLoader === "undefined")
|
if (typeof JSMLoader === "undefined")
|
||||||
Cu.import("resource://dactyl/bootstrap.jsm", global);
|
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)
|
if (suffix)
|
||||||
JSMLoader.suffix = suffix;
|
JSMLoader.suffix = suffix;
|
||||||
|
JSMLoader.load("resource://dactyl/bootstrap.jsm", global);
|
||||||
|
|
||||||
for each (let component in components)
|
for each (let component in components)
|
||||||
component.register();
|
component.register();
|
||||||
|
|
||||||
Services.obs.notifyObservers(null, "dactyl-rehash", null);
|
Services.obs.notifyObservers(null, "dactyl-rehash", null);
|
||||||
JSMLoader.load("resource://dactyl/bootstrap.jsm", global);
|
|
||||||
|
|
||||||
require(global, "services");
|
require(global, "services");
|
||||||
|
|
||||||
let manifestText = result.map(function (line) line.join(" ")).join("\n");
|
|
||||||
|
|
||||||
require(global, "overlay");
|
require(global, "overlay");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,11 +4,12 @@
|
|||||||
// given in the LICENSE.txt file included with this file.
|
// given in the LICENSE.txt file included with this file.
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
let is_bootstrap = 1;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
if (!JSMLoader || JSMLoader.bump != 1)
|
if (!JSMLoader || JSMLoader.bump != 1)
|
||||||
var JSMLoader = {
|
var JSMLoader = {
|
||||||
global: this,
|
|
||||||
bump: 1,
|
bump: 1,
|
||||||
builtin: Components.utils.Sandbox(this),
|
builtin: Components.utils.Sandbox(this),
|
||||||
canonical: {},
|
canonical: {},
|
||||||
@@ -20,6 +21,9 @@ if (!JSMLoader || JSMLoader.bump != 1)
|
|||||||
stale: {},
|
stale: {},
|
||||||
suffix: "",
|
suffix: "",
|
||||||
getTarget: function getTarget(url) {
|
getTarget: function getTarget(url) {
|
||||||
|
if (url.indexOf(":") === -1)
|
||||||
|
url = "resource://dactyl" + this.suffix + "/" + url;
|
||||||
|
|
||||||
let chan = this.io.newChannel(url, null, null);
|
let chan = this.io.newChannel(url, null, null);
|
||||||
chan.cancel(Components.results.NS_BINDING_ABORTED);
|
chan.cancel(Components.results.NS_BINDING_ABORTED);
|
||||||
return chan.name;
|
return chan.name;
|
||||||
@@ -29,11 +33,11 @@ if (!JSMLoader || JSMLoader.bump != 1)
|
|||||||
if (url.indexOf(":") === -1)
|
if (url.indexOf(":") === -1)
|
||||||
url = "resource://dactyl" + this.suffix + "/" + url;
|
url = "resource://dactyl" + this.suffix + "/" + url;
|
||||||
|
|
||||||
if (url in this.stale) {
|
if (name in this.stale) {
|
||||||
let stale = this.stale[url];
|
let stale = this.stale[name];
|
||||||
delete this.stale[url];
|
delete this.stale[name];
|
||||||
|
|
||||||
let global = this.globals[url];
|
let global = this.globals[name];
|
||||||
if (stale === this.getTarget(url))
|
if (stale === this.getTarget(url))
|
||||||
this.loadSubScript(url, global.global || global);
|
this.loadSubScript(url, global.global || global);
|
||||||
}
|
}
|
||||||
@@ -41,13 +45,13 @@ if (!JSMLoader || JSMLoader.bump != 1)
|
|||||||
try {
|
try {
|
||||||
let global = Components.utils.import(url, target);
|
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;
|
global.JSMLoader = this;
|
||||||
Components.utils.import(url, this.global);
|
target.JSMLoader = this;
|
||||||
this.global.EXPORTED_SYMBOLS = global.EXPORTED_SYMBOLS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.globals[url] = global;
|
return this.globals[name] = global;
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
dump("Importing " + url + ": " + e + "\n" + (e.stack || Error().stack));
|
dump("Importing " + url + ": " + e + "\n" + (e.stack || Error().stack));
|
||||||
|
|||||||
@@ -1263,8 +1263,9 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
|
|||||||
services.fuel.storage.set("dactyl.commandlineArgs", args);
|
services.fuel.storage.set("dactyl.commandlineArgs", args);
|
||||||
this.timeout(function () {
|
this.timeout(function () {
|
||||||
this.rehashing = true;
|
this.rehashing = true;
|
||||||
config.addon.userDisabled = true;
|
let addon = config.addon;
|
||||||
config.addon.userDisabled = false;
|
addon.userDisabled = true;
|
||||||
|
addon.userDisabled = false;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user