mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-22 17:57:58 +01:00
[bootstrap] Add a :rehash (temporarily undocumented) command.
--HG-- branch : bootstrapped
This commit is contained in:
2
common/bootstrap.js
vendored
2
common/bootstrap.js
vendored
@@ -41,6 +41,7 @@ let addon = null;
|
|||||||
let basePath = null;
|
let basePath = null;
|
||||||
let components = {};
|
let components = {};
|
||||||
let getURI = null;
|
let getURI = null;
|
||||||
|
storage.set("dactyl.bootstrap", this);
|
||||||
var JSMLoader = storage.get("dactyl.JSMLoader", { get load() Cu.import });
|
var JSMLoader = storage.get("dactyl.JSMLoader", { get load() Cu.import });
|
||||||
|
|
||||||
function startup(data, reason) {
|
function startup(data, reason) {
|
||||||
@@ -53,6 +54,7 @@ function startup(data, reason) {
|
|||||||
dump("dactyl: bootstrap: init" + " " + data.id + "\n");
|
dump("dactyl: bootstrap: init" + " " + data.id + "\n");
|
||||||
|
|
||||||
addon = data;
|
addon = data;
|
||||||
|
AddonManager.getAddonByID(addon.id, function (a) { addon = a });
|
||||||
|
|
||||||
if (basePath.isDirectory())
|
if (basePath.isDirectory())
|
||||||
getURI = function getURI(path) {
|
getURI = function getURI(path) {
|
||||||
|
|||||||
@@ -255,6 +255,8 @@ const CommandWidgets = Class("CommandWidgets", {
|
|||||||
let elem = this.multilineOutput;
|
let elem = this.multilineOutput;
|
||||||
elem.contentWindow.addEventListener("unload", function (event) { event.preventDefault(); }, true);
|
elem.contentWindow.addEventListener("unload", function (event) { event.preventDefault(); }, true);
|
||||||
elem.contentDocument.body.id = "dactyl-multiline-output-content";
|
elem.contentDocument.body.id = "dactyl-multiline-output-content";
|
||||||
|
elem.__defineGetter__("atEnd", function ()
|
||||||
|
!Buffer.isScrollable(elem.contentDocument.documentElement, 1));
|
||||||
|
|
||||||
["copy", "copylink", "selectall"].forEach(function (tail) {
|
["copy", "copylink", "selectall"].forEach(function (tail) {
|
||||||
// some host apps use "hostPrefixContext-copy" ids
|
// some host apps use "hostPrefixContext-copy" ids
|
||||||
@@ -617,6 +619,8 @@ const CommandLine = Module("commandline", {
|
|||||||
this.widgets.message = null;
|
this.widgets.message = null;
|
||||||
if (modes.main != modes.COMMAND_LINE)
|
if (modes.main != modes.COMMAND_LINE)
|
||||||
this.widgets.command = null;
|
this.widgets.command = null;
|
||||||
|
if ((modes.extended & modes.OUTPUT_MULTILINE) && this.widgets.multilineOutput.atEnd)
|
||||||
|
modes.pop();
|
||||||
if (modes.extended != modes.OUTPUT_MULTILINE)
|
if (modes.extended != modes.OUTPUT_MULTILINE)
|
||||||
this.multilineOutputVisible = false;
|
this.multilineOutputVisible = false;
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1865,10 +1865,13 @@ const Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase),
|
|||||||
bang: true
|
bang: true
|
||||||
});
|
});
|
||||||
|
|
||||||
|
commands.add(["reh[ash]"],
|
||||||
|
"Reload the " + config.appName + " add-on",
|
||||||
|
function () { util.rehash(); });
|
||||||
|
|
||||||
commands.add(["res[tart]"],
|
commands.add(["res[tart]"],
|
||||||
"Force " + config.appName + " to restart",
|
"Force " + config.appName + " to restart",
|
||||||
function () { dactyl.restart(); },
|
function () { dactyl.restart(); });
|
||||||
{ argCount: "0" });
|
|
||||||
|
|
||||||
var toolbox = document.getElementById("navigator-toolbox");
|
var toolbox = document.getElementById("navigator-toolbox");
|
||||||
if (toolbox) {
|
if (toolbox) {
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ var Services = Module("Services", {
|
|||||||
this.add("extensionManager", "@mozilla.org/extensions/manager;1", Ci.nsIExtensionManager);
|
this.add("extensionManager", "@mozilla.org/extensions/manager;1", Ci.nsIExtensionManager);
|
||||||
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.fuelIApplication);
|
||||||
this.add("history", "@mozilla.org/browser/global-history;2", [Ci.nsIBrowserHistory, Ci.nsIGlobalHistory3,
|
this.add("history", "@mozilla.org/browser/global-history;2", [Ci.nsIBrowserHistory, Ci.nsIGlobalHistory3,
|
||||||
Ci.nsINavHistoryService, Ci.nsPIPlacesDatabase]);
|
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);
|
||||||
|
|||||||
@@ -59,6 +59,8 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
get addon() services.fuel.storage.get("dactyl.bootstrap", null).addon,
|
||||||
|
|
||||||
// FIXME: Only works for Pentadactyl
|
// FIXME: Only works for Pentadactyl
|
||||||
get activeWindow() services.windowMediator.getMostRecentWindow("navigator:browser"),
|
get activeWindow() services.windowMediator.getMostRecentWindow("navigator:browser"),
|
||||||
dactyl: update(function dactyl(obj) {
|
dactyl: update(function dactyl(obj) {
|
||||||
@@ -920,7 +922,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
|
|||||||
services.observer.removeObserver(this, "dactyl-rehash");
|
services.observer.removeObserver(this, "dactyl-rehash");
|
||||||
|
|
||||||
util.dump("dactyl: util: observe: dactyl-rehash");
|
util.dump("dactyl: util: observe: dactyl-rehash");
|
||||||
if (true)
|
if (this.rehashing)
|
||||||
JSMLoader.purge();
|
JSMLoader.purge();
|
||||||
else
|
else
|
||||||
for (let module in values(defineModule.modules)) {
|
for (let module in values(defineModule.modules)) {
|
||||||
@@ -1144,6 +1146,14 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
|
|||||||
getSource: function regexp_getSource(re) re.source.replace(/\\(.)/g, function (m0, m1) m1 === "/" ? "/" : m0)
|
getSource: function regexp_getSource(re) re.source.replace(/\\(.)/g, function (m0, m1) m1 === "/" ? "/" : m0)
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
rehash: function () {
|
||||||
|
this.rehashing = true;
|
||||||
|
this.addon.userDisabled = true;
|
||||||
|
this.timeout(function () {
|
||||||
|
this.addon.userDisabled = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
maxErrors: 15,
|
maxErrors: 15,
|
||||||
errors: Class.memoize(function () []),
|
errors: Class.memoize(function () []),
|
||||||
reportError: function (error) {
|
reportError: function (error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user