summaryrefslogtreecommitdiff
path: root/common/modules
diff options
context:
space:
mode:
authorKris Maglione <maglione.k@gmail.com>2011-02-05 03:02:36 -0500
committerKris Maglione <maglione.k@gmail.com>2011-02-05 03:02:36 -0500
commit9b3ad1c7c6b2a8afd11ea6a392e38666c5aafd01 (patch)
treee10448b0249ca8e3fbad84c84af019a8c16b365e /common/modules
parente9fd99dafa8e9ed0f479143ad098c96889e31e1b (diff)
downloadpentadactyl-9b3ad1c7c6b2a8afd11ea6a392e38666c5aafd01.tar.gz
imported patch groups
--HG-- branch : groups
Diffstat (limited to 'common/modules')
-rw-r--r--common/modules/addons.jsm4
-rw-r--r--common/modules/base.jsm14
-rw-r--r--common/modules/io.jsm11
-rw-r--r--common/modules/overlay.jsm6
-rw-r--r--common/modules/storage.jsm2
-rw-r--r--common/modules/util.jsm11
6 files changed, 25 insertions, 23 deletions
diff --git a/common/modules/addons.jsm b/common/modules/addons.jsm
index 9e0d04fb..3824f149 100644
--- a/common/modules/addons.jsm
+++ b/common/modules/addons.jsm
@@ -35,12 +35,12 @@ var AddonListener = Class("AddonListener", {
onExternalInstall: function (addon, existingAddon, needsRestart) {},
onDownloadStarted: listener("download", "started"),
onDownloadEnded: listener("download", "complete"),
- onDownloadCancelled: listener("download", "cancelled"),
+ onDownloadCancelled: listener("download", "canceled"),
onDownloadFailed: listener("download", "failed"),
onDownloadProgress: function (install) {},
onInstallStarted: function (install) {},
onInstallEnded: listener("installation", "complete"),
- onInstallCancelled: listener("installation", "cancelled"),
+ onInstallCancelled: listener("installation", "canceled"),
onInstallFailed: listener("installation", "failed")
});
diff --git a/common/modules/base.jsm b/common/modules/base.jsm
index c3da6d2c..f147ebf1 100644
--- a/common/modules/base.jsm
+++ b/common/modules/base.jsm
@@ -616,12 +616,12 @@ function update(target) {
if (desc.value instanceof Class.Property)
desc = desc.value.init(k) || desc.value;
if (typeof desc.value == "function" && Object.getPrototypeOf(target)) {
- let func = desc.value;
- desc.value.__defineGetter__("super", function () Object.getPrototypeOf(target)[k]);
- desc.value.superapply = function superapply(self, args)
+ let func = desc.value.wrapped || desc.value;
+ func.__defineGetter__("super", function () Object.getPrototypeOf(target)[k]);
+ func.superapply = function superapply(self, args)
let (meth = Object.getPrototypeOf(target)[k])
meth && meth.apply(self, args);
- desc.value.supercall = function supercall(self)
+ func.supercall = function supercall(self)
func.superapply(self, Array.slice(arguments, 1));
}
Object.defineProperty(target, k, desc);
@@ -663,7 +663,7 @@ function Class() {
superclass = args.shift();
var Constructor = eval(String.replace(<![CDATA[
- (function constructor() {
+ (function constructor(PARAMS) {
var self = Object.create(Constructor.prototype, {
constructor: { value: Constructor },
});
@@ -671,7 +671,9 @@ function Class() {
var res = self.init.apply(self, arguments);
return res !== undefined ? res : self;
})]]>,
- "constructor", (name || superclass.className).replace(/\W/g, "_")));
+ "constructor", (name || superclass.className).replace(/\W/g, "_"))
+ .replace("PARAMS", /^function .*?\((.*?)\)/.exec(args[0] && args[0].init || Class.prototype.init)[1]));
+
Constructor.className = name || superclass.className || superclass.name;
if ("init" in superclass.prototype)
diff --git a/common/modules/io.jsm b/common/modules/io.jsm
index 3e85b02d..e0fdc00f 100644
--- a/common/modules/io.jsm
+++ b/common/modules/io.jsm
@@ -546,7 +546,7 @@ var IO = Module("io", {
PATH_SEP: deprecated("File.PATH_SEP", { get: function PATH_SEP() File.PATH_SEP })
}, {
init: function init(dactyl, modules, window) {
- modules.plugins.contexts = {};
+ Class.replaceProperty(modules.plugins, "contexts", {});
modules.Script = function Script(file) {
const { io, plugins } = modules;
@@ -615,15 +615,6 @@ var IO = Module("io", {
literal: 0
});
- // NOTE: this command is only used in :source
- commands.add(["fini[sh]"],
- "Stop sourcing a script file",
- function () {
- dactyl.assert(io.sourcing, "E168: :finish used outside of a sourced file");
- io.sourcing.finished = true;
- },
- { argCount: "0" });
-
commands.add(["pw[d]"],
"Print the current directory name",
function () { dactyl.echomsg(io.cwd.path); },
diff --git a/common/modules/overlay.jsm b/common/modules/overlay.jsm
index 7b73be7c..45aaf449 100644
--- a/common/modules/overlay.jsm
+++ b/common/modules/overlay.jsm
@@ -144,6 +144,7 @@ var Overlay = Module("Overlay", {
return sandbox;
}
});
+ modules.plugins = create(modules);
modules.modules = modules;
window.dactyl = { modules: modules };
@@ -163,12 +164,13 @@ var Overlay = Module("Overlay", {
"util"
].forEach(function (name) defineModule.time("load", name, require, null, jsmodules, name));
- ["dactyl",
+ ["contexts",
+ "dactyl",
"modes",
+ "commandline",
"abbreviations",
"autocommands",
"buffer",
- "commandline",
"commands",
"editor",
"events",
diff --git a/common/modules/storage.jsm b/common/modules/storage.jsm
index b41e86cf..64a7d7f2 100644
--- a/common/modules/storage.jsm
+++ b/common/modules/storage.jsm
@@ -152,6 +152,8 @@ var Storage = Module("Storage", {
},
cleanup: function () {
+ this.saveAll();
+
for (let key in keys(this.keys)) {
if (this[key].timer)
this[key].timer.flush();
diff --git a/common/modules/util.jsm b/common/modules/util.jsm
index 6b423c66..9bf6e2ee 100644
--- a/common/modules/util.jsm
+++ b/common/modules/util.jsm
@@ -32,8 +32,8 @@ memoize(this, "Commands", function () {
var FailedAssertion = Class("FailedAssertion", ErrorBase);
var Point = Struct("x", "y");
-var wrapCallback = function wrapCallback(fn)
- fn.wrapper = (function wrappedCallback () {
+var wrapCallback = function wrapCallback(fn) {
+ fn.wrapper = function wrappedCallback () {
try {
return fn.apply(this, arguments);
}
@@ -41,7 +41,10 @@ var wrapCallback = function wrapCallback(fn)
util.reportError(e);
return undefined;
}
- })
+ };
+ fn.wrapper.wrapped = fn;
+ return fn.wrapper;
+}
var getAttr = function getAttr(elem, ns, name)
elem.hasAttributeNS(ns, name) ? elem.getAttributeNS(ns, name) : null;
@@ -1585,6 +1588,8 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
})();
},
+ wrapCallback: wrapCallback,
+
/**
* Traps errors in the called function, possibly reporting them.
*