mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-02-05 00:55:48 +01:00
Rip out FUEL references. Use a persistent component instead.
This commit is contained in:
27
common/bootstrap.js
vendored
27
common/bootstrap.js
vendored
@@ -28,8 +28,15 @@ const resourceProto = Services.io.getProtocolHandler("resource")
|
||||
.QueryInterface(Ci.nsIResProtocolHandler);
|
||||
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);
|
||||
|
||||
try { // Temporary migration code.
|
||||
const storage = Cc["@mozilla.org/fuel/application;1"].getService(Ci.fuelIApplication).storage;
|
||||
var JSMLoader = storage.get("dactyl.JSMLoader", undefined);
|
||||
}
|
||||
catch (e) {}
|
||||
|
||||
const BOOTSTRAP_CONTRACT = "@dactyl.googlecode.com/base/bootstrap";
|
||||
JSMLoader = JSMLoader || BOOTSTRAP_CONTRACT in Cc && Cc[BOOTSTRAP_CONTRACT].getService().wrappedJSObject;
|
||||
|
||||
function reportError(e) {
|
||||
dump("\ndactyl: bootstrap: " + e + "\n" + (e.stack || Error().stack) + "\n");
|
||||
@@ -52,7 +59,6 @@ let categories = [];
|
||||
let components = {};
|
||||
let resources = [];
|
||||
let getURI = null;
|
||||
storage.set("dactyl.bootstrap", this);
|
||||
|
||||
function updateVersion() {
|
||||
try {
|
||||
@@ -182,11 +188,26 @@ function init() {
|
||||
if (!JSMLoader || JSMLoader.bump !== 4)
|
||||
Cu.import("resource://dactyl/bootstrap.jsm", global);
|
||||
|
||||
JSMLoader.bootstrap = this;
|
||||
|
||||
JSMLoader.load("resource://dactyl/bootstrap.jsm", global);
|
||||
|
||||
JSMLoader.init(suffix);
|
||||
JSMLoader.load("base.jsm", global);
|
||||
|
||||
if (!(BOOTSTRAP_CONTRACT in Cc))
|
||||
manager.registerFactory(Components.ID("{f541c8b0-fe26-4621-a30b-e77d21721fb5}"),
|
||||
String("{f541c8b0-fe26-4621-a30b-e77d21721fb5}"),
|
||||
BOOTSTRAP_CONTRACT, {
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIFactory]),
|
||||
instance: {
|
||||
QueryInterface: XPCOMUtils.generateQI([]),
|
||||
contractID: BOOTSTRAP_CONTRACT,
|
||||
wrappedJSObject: JSMLoader
|
||||
},
|
||||
createInstance: function () this.instance
|
||||
})
|
||||
|
||||
for each (let component in components)
|
||||
component.register();
|
||||
|
||||
|
||||
@@ -2055,8 +2055,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
||||
|
||||
dactyl.timeout(function () {
|
||||
try {
|
||||
var args = services.fuel && services.fuel.storage.get("dactyl.commandlineArgs", null)
|
||||
|| services.commandLineHandler.optionValue;
|
||||
var args = JSMLoader.commandlineArgs || services.commandLineHandler.optionValue;
|
||||
if (isString(args))
|
||||
args = dactyl.parseCommandLine(args);
|
||||
|
||||
|
||||
@@ -8,11 +8,10 @@ try {
|
||||
|
||||
var EXPORTED_SYMBOLS = ["JSMLoader"];
|
||||
var global = this;
|
||||
var storage = Components.classes["@mozilla.org/fuel/application;1"]
|
||||
.getService(Components.interfaces.fuelIApplication)
|
||||
.storage;
|
||||
|
||||
var JSMLoader = storage.get("dactyl.JSMLoader", undefined);
|
||||
var BOOTSTRAP_CONTRACT = "@dactyl.googlecode.com/base/bootstrap";
|
||||
var JSMLoader = BOOTSTRAP_CONTRACT in Components.classes &&
|
||||
Components.classes[BOOTSTRAP_CONTRACT].getService().wrappedJSObject;
|
||||
|
||||
if (!JSMLoader || JSMLoader.bump != 4)
|
||||
JSMLoader = {
|
||||
@@ -25,14 +24,11 @@ if (!JSMLoader || JSMLoader.bump != 4)
|
||||
loader: Components.classes["@mozilla.org/moz/jssubscript-loader;1"].getService(Components.interfaces.mozIJSSubScriptLoader),
|
||||
manager: Components.manager.QueryInterface(Components.interfaces.nsIComponentRegistrar),
|
||||
stale: JSMLoader ? JSMLoader.stale : {},
|
||||
storage: storage,
|
||||
suffix: "",
|
||||
init: function init(suffix) {
|
||||
this.initialized = true;
|
||||
this.suffix = suffix || "";
|
||||
|
||||
this.storage.set("dactyl.JSMLoader", this);
|
||||
|
||||
let base = this.load("base.jsm", global);
|
||||
global.EXPORTED_SYMBOLS = base.EXPORTED_SYMBOLS;
|
||||
global.JSMLoader = this;
|
||||
|
||||
@@ -57,7 +57,7 @@ var ConfigBase = Class("ConfigBase", {
|
||||
addon: Class.memoize(function () {
|
||||
let addon;
|
||||
do {
|
||||
addon = services.fuel.storage.get("dactyl.bootstrap", {}).addon;
|
||||
addon = (JSMLoader.bootstrap || {}).addon;
|
||||
if (addon && !addon.getResourceURI) {
|
||||
util.reportError(Error("Don't have add-on yet"));
|
||||
yield 10;
|
||||
|
||||
@@ -41,7 +41,6 @@ var Services = Module("Services", {
|
||||
this.add("externalProtocol", "@mozilla.org/uriloader/external-protocol-service;1", Ci.nsIExternalProtocolService);
|
||||
this.add("favicon", "@mozilla.org/browser/favicon-service;1", Ci.nsIFaviconService);
|
||||
this.add("focus", "@mozilla.org/focus-manager;1", Ci.nsIFocusManager);
|
||||
this.add("fuel", "@mozilla.org/fuel/application;1", Ci.extIApplication);
|
||||
this.add("history", "@mozilla.org/browser/global-history;2",
|
||||
[Ci.nsIBrowserHistory, Ci.nsIGlobalHistory3, Ci.nsINavHistoryService, Ci.nsPIPlacesDatabase]);
|
||||
this.add("io", "@mozilla.org/network/io-service;1", Ci.nsIIOService);
|
||||
|
||||
@@ -1414,8 +1414,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
|
||||
}),
|
||||
|
||||
rehash: function (args) {
|
||||
if (services.fuel)
|
||||
services.fuel.storage.set("dactyl.commandlineArgs", args);
|
||||
JSMLoader.commandlineArgs = args;
|
||||
this.timeout(function () {
|
||||
this.rehashing = true;
|
||||
let addon = config.addon;
|
||||
|
||||
Reference in New Issue
Block a user