mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-03-06 04:25:45 +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);
|
.QueryInterface(Ci.nsIResProtocolHandler);
|
||||||
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;
|
|
||||||
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) {
|
function reportError(e) {
|
||||||
dump("\ndactyl: bootstrap: " + e + "\n" + (e.stack || Error().stack) + "\n");
|
dump("\ndactyl: bootstrap: " + e + "\n" + (e.stack || Error().stack) + "\n");
|
||||||
@@ -52,7 +59,6 @@ let categories = [];
|
|||||||
let components = {};
|
let components = {};
|
||||||
let resources = [];
|
let resources = [];
|
||||||
let getURI = null;
|
let getURI = null;
|
||||||
storage.set("dactyl.bootstrap", this);
|
|
||||||
|
|
||||||
function updateVersion() {
|
function updateVersion() {
|
||||||
try {
|
try {
|
||||||
@@ -182,11 +188,26 @@ function init() {
|
|||||||
if (!JSMLoader || JSMLoader.bump !== 4)
|
if (!JSMLoader || JSMLoader.bump !== 4)
|
||||||
Cu.import("resource://dactyl/bootstrap.jsm", global);
|
Cu.import("resource://dactyl/bootstrap.jsm", global);
|
||||||
|
|
||||||
|
JSMLoader.bootstrap = this;
|
||||||
|
|
||||||
JSMLoader.load("resource://dactyl/bootstrap.jsm", global);
|
JSMLoader.load("resource://dactyl/bootstrap.jsm", global);
|
||||||
|
|
||||||
JSMLoader.init(suffix);
|
JSMLoader.init(suffix);
|
||||||
JSMLoader.load("base.jsm", global);
|
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)
|
for each (let component in components)
|
||||||
component.register();
|
component.register();
|
||||||
|
|
||||||
|
|||||||
@@ -2055,8 +2055,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
|||||||
|
|
||||||
dactyl.timeout(function () {
|
dactyl.timeout(function () {
|
||||||
try {
|
try {
|
||||||
var args = services.fuel && services.fuel.storage.get("dactyl.commandlineArgs", null)
|
var args = JSMLoader.commandlineArgs || services.commandLineHandler.optionValue;
|
||||||
|| services.commandLineHandler.optionValue;
|
|
||||||
if (isString(args))
|
if (isString(args))
|
||||||
args = dactyl.parseCommandLine(args);
|
args = dactyl.parseCommandLine(args);
|
||||||
|
|
||||||
|
|||||||
@@ -8,11 +8,10 @@ try {
|
|||||||
|
|
||||||
var EXPORTED_SYMBOLS = ["JSMLoader"];
|
var EXPORTED_SYMBOLS = ["JSMLoader"];
|
||||||
var global = this;
|
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)
|
if (!JSMLoader || JSMLoader.bump != 4)
|
||||||
JSMLoader = {
|
JSMLoader = {
|
||||||
@@ -25,14 +24,11 @@ if (!JSMLoader || JSMLoader.bump != 4)
|
|||||||
loader: Components.classes["@mozilla.org/moz/jssubscript-loader;1"].getService(Components.interfaces.mozIJSSubScriptLoader),
|
loader: Components.classes["@mozilla.org/moz/jssubscript-loader;1"].getService(Components.interfaces.mozIJSSubScriptLoader),
|
||||||
manager: Components.manager.QueryInterface(Components.interfaces.nsIComponentRegistrar),
|
manager: Components.manager.QueryInterface(Components.interfaces.nsIComponentRegistrar),
|
||||||
stale: JSMLoader ? JSMLoader.stale : {},
|
stale: JSMLoader ? JSMLoader.stale : {},
|
||||||
storage: storage,
|
|
||||||
suffix: "",
|
suffix: "",
|
||||||
init: function init(suffix) {
|
init: function init(suffix) {
|
||||||
this.initialized = true;
|
this.initialized = true;
|
||||||
this.suffix = suffix || "";
|
this.suffix = suffix || "";
|
||||||
|
|
||||||
this.storage.set("dactyl.JSMLoader", this);
|
|
||||||
|
|
||||||
let base = this.load("base.jsm", global);
|
let base = this.load("base.jsm", global);
|
||||||
global.EXPORTED_SYMBOLS = base.EXPORTED_SYMBOLS;
|
global.EXPORTED_SYMBOLS = base.EXPORTED_SYMBOLS;
|
||||||
global.JSMLoader = this;
|
global.JSMLoader = this;
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ var ConfigBase = Class("ConfigBase", {
|
|||||||
addon: Class.memoize(function () {
|
addon: Class.memoize(function () {
|
||||||
let addon;
|
let addon;
|
||||||
do {
|
do {
|
||||||
addon = services.fuel.storage.get("dactyl.bootstrap", {}).addon;
|
addon = (JSMLoader.bootstrap || {}).addon;
|
||||||
if (addon && !addon.getResourceURI) {
|
if (addon && !addon.getResourceURI) {
|
||||||
util.reportError(Error("Don't have add-on yet"));
|
util.reportError(Error("Don't have add-on yet"));
|
||||||
yield 10;
|
yield 10;
|
||||||
|
|||||||
@@ -41,7 +41,6 @@ var Services = Module("Services", {
|
|||||||
this.add("externalProtocol", "@mozilla.org/uriloader/external-protocol-service;1", Ci.nsIExternalProtocolService);
|
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("favicon", "@mozilla.org/browser/favicon-service;1", Ci.nsIFaviconService);
|
||||||
this.add("focus", "@mozilla.org/focus-manager;1", Ci.nsIFocusManager);
|
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",
|
this.add("history", "@mozilla.org/browser/global-history;2",
|
||||||
[Ci.nsIBrowserHistory, Ci.nsIGlobalHistory3, Ci.nsINavHistoryService, Ci.nsPIPlacesDatabase]);
|
[Ci.nsIBrowserHistory, Ci.nsIGlobalHistory3, Ci.nsINavHistoryService, Ci.nsPIPlacesDatabase]);
|
||||||
this.add("io", "@mozilla.org/network/io-service;1", Ci.nsIIOService);
|
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) {
|
rehash: function (args) {
|
||||||
if (services.fuel)
|
JSMLoader.commandlineArgs = args;
|
||||||
services.fuel.storage.set("dactyl.commandlineArgs", args);
|
|
||||||
this.timeout(function () {
|
this.timeout(function () {
|
||||||
this.rehashing = true;
|
this.rehashing = true;
|
||||||
let addon = config.addon;
|
let addon = config.addon;
|
||||||
|
|||||||
Reference in New Issue
Block a user