1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-01-07 00:44:14 +01:00

Use temp files rather than URL arguments for :viewsource!. Also update the statusline on :redraw and add an XPCOM shim class for pseudo-XPCOM objects.

This commit is contained in:
Kris Maglione
2010-10-03 13:44:37 -04:00
parent cbed89d8ba
commit 72b6af3e6b
8 changed files with 123 additions and 25 deletions

View File

@@ -139,12 +139,11 @@ defineModule("base", {
// sed -n 's/^(const|function) ([a-zA-Z0-9_]+).*/ "\2",/p' base.jsm | sort | fmt
exports: [
"Cc", "Ci", "Class", "Cr", "Cu", "Module", "Object", "Runnable",
"Struct", "StructBase", "Timer", "UTF8", "XPCOMUtils", "array",
"Struct", "StructBase", "Timer", "UTF8", "XPCOM", "XPCOMUtils", "array",
"call", "callable", "curry", "debuggerProperties", "defineModule",
"endModule", "forEach", "isArray", "isGenerator", "isinstance",
"isObject", "isString", "isSubclass", "iter", "iterAll", "keys",
"memoize", "properties", "requiresMainThread", "set", "update",
"values"
"memoize", "properties", "requiresMainThread", "set", "update", "values"
],
use: ["services"]
});
@@ -700,6 +699,25 @@ Class.extend = function extend(subclass, superclass, overrides) {
superclass.prototype.constructor = superclass;
}
/**
* A base class generator for classes which impliment XPCOM interfaces.
*
* @param {nsIIID|[nsIJSIID]} interfaces The interfaces which the class
* implements.
* @param {Class} superClass A super class. @optional
* @returns {Class}
*/
function XPCOM(interfaces, superClass) {
interfaces = Array.concat(interfaces);
let shim = interfaces.reduce(function (shim, iface) shim.QueryInterface(iface),
Cc["@dactyl.googlecode.com/base/xpc-interface-shim"].createInstance());
let res = Class("XPCOM(" + interfaces + ")", superClass || Class, update(
array([k, v === undefined || callable(v) ? function stub() null : v] for ([k, v] in Iterator(shim))).toObject(),
{ QueryInterface: XPCOMUtils.generateQI(interfaces) }));
shim = interfaces = null;
return res;
}
/**
* Memoizes the value of a class property to the falue returned by
* the passed function the first time the property is accessed.