mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-01-07 21:24:11 +01:00
Add dom.jsm. And stuff.
This commit is contained in:
@@ -59,7 +59,6 @@ var updateAddons = Class("UpgradeListener", AddonListener, {
|
||||
|
||||
},
|
||||
onUpdateAvailable: function (addon, install) {
|
||||
util.dump("onUpdateAvailable");
|
||||
this.upgrade.push(addon);
|
||||
install.addListener(this);
|
||||
install.install();
|
||||
@@ -278,7 +277,7 @@ var AddonList = Class("AddonList", {
|
||||
this.update();
|
||||
},
|
||||
|
||||
message: Class.memoize(function () {
|
||||
message: Class.Memoize(function () {
|
||||
|
||||
XML.ignoreWhitespace = true;
|
||||
util.xmlToDom(<table highlight="Addons" key="list" xmlns={XHTML}>
|
||||
@@ -348,7 +347,7 @@ var AddonList = Class("AddonList", {
|
||||
});
|
||||
|
||||
var Addons = Module("addons", {
|
||||
errors: Class.memoize(function ()
|
||||
errors: Class.Memoize(function ()
|
||||
array(["ERROR_NETWORK_FAILURE", "ERROR_INCORRECT_HASH",
|
||||
"ERROR_CORRUPT_FILE", "ERROR_FILE_ACCESS"])
|
||||
.map(function (e) [AddonManager[e], _("AddonManager." + e)])
|
||||
@@ -539,7 +538,7 @@ else
|
||||
return "";
|
||||
},
|
||||
|
||||
installLocation: Class.memoize(function () services.extensionManager.getInstallLocation(this.id)),
|
||||
installLocation: Class.Memoize(function () services.extensionManager.getInstallLocation(this.id)),
|
||||
getResourceURI: function getResourceURI(path) {
|
||||
let file = this.installLocation.getItemFile(this.id, path);
|
||||
return services.io.newFileURI(file);
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
var { classes: Cc, interfaces: Ci, results: Cr, utils: Cu } = Components;
|
||||
|
||||
Cu.import("resource://dactyl/bootstrap.jsm");
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
try {
|
||||
var ctypes;
|
||||
@@ -14,7 +15,8 @@ try {
|
||||
catch (e) {}
|
||||
|
||||
let objproto = Object.prototype;
|
||||
let { __lookupGetter__, __lookupSetter__, hasOwnProperty, propertyIsEnumerable } = objproto;
|
||||
let { __lookupGetter__, __lookupSetter__, __defineGetter__, __defineSetter__,
|
||||
hasOwnProperty, propertyIsEnumerable } = objproto;
|
||||
|
||||
if (typeof XPCSafeJSObjectWrapper === "undefined")
|
||||
this.XPCSafeJSObjectWrapper = XPCNativeWrapper;
|
||||
@@ -44,15 +46,15 @@ if (!Object.defineProperty)
|
||||
}
|
||||
catch (e if e instanceof TypeError) {}
|
||||
else {
|
||||
objproto.__defineGetter__.call(obj, prop, function () value);
|
||||
__defineGetter__.call(obj, prop, function () value);
|
||||
if (desc.writable)
|
||||
objproto.__defineSetter__.call(obj, prop, function (val) { value = val; });
|
||||
__defineSetter__.call(obj, prop, function (val) { value = val; });
|
||||
}
|
||||
|
||||
if ("get" in desc)
|
||||
objproto.__defineGetter__.call(obj, prop, desc.get);
|
||||
__defineGetter__.call(obj, prop, desc.get);
|
||||
if ("set" in desc)
|
||||
objproto.__defineSetter__.call(obj, prop, desc.set);
|
||||
__defineSetter__.call(obj, prop, desc.set);
|
||||
}
|
||||
catch (e) {
|
||||
throw e.stack ? e : Error(e);
|
||||
@@ -163,9 +165,8 @@ defineModule.dump = function dump_() {
|
||||
msg = util.objectToString(msg);
|
||||
return msg;
|
||||
}).join(", ");
|
||||
let name = loaded.config ? config.name : "dactyl";
|
||||
dump(String.replace(msg, /\n?$/, "\n")
|
||||
.replace(/^./gm, name + ": $&"));
|
||||
.replace(/^./gm, JSMLoader.name + ": $&"));
|
||||
}
|
||||
defineModule.modules = [];
|
||||
defineModule.time = function time(major, minor, func, self) {
|
||||
@@ -851,7 +852,7 @@ Class.extend = function extend(subclass, superclass, overrides) {
|
||||
* property's value.
|
||||
* @returns {Class.Property}
|
||||
*/
|
||||
Class.Memoize = Class.memoize = function Memoize(getter, wait)
|
||||
Class.Memoize = Class.Memoize = function Memoize(getter, wait)
|
||||
Class.Property({
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
@@ -1265,7 +1266,7 @@ var Timer = Class("Timer", {
|
||||
}
|
||||
catch (e) {
|
||||
if (typeof util === "undefined")
|
||||
dump("dactyl: " + e + "\n" + (e.stack || Error().stack));
|
||||
dump(JSMLoader.name + ": " + e + "\n" + (e.stack || Error().stack));
|
||||
else
|
||||
util.reportError(e);
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ var BookmarkCache = Module("BookmarkCache", XPCOM(Ci.nsINavBookmarkObserver), {
|
||||
|
||||
get bookmarks() Class.replaceProperty(this, "bookmarks", this.load()),
|
||||
|
||||
keywords: Class.memoize(function () array.toObject([[b.keyword, b] for (b in this) if (b.keyword)])),
|
||||
keywords: Class.Memoize(function () array.toObject([[b.keyword, b] for (b in this) if (b.keyword)])),
|
||||
|
||||
rootFolders: ["toolbarFolder", "bookmarksMenuFolder", "unfiledBookmarksFolder"]
|
||||
.map(function (s) services.bookmarks[s]),
|
||||
|
||||
@@ -26,6 +26,8 @@ else
|
||||
|
||||
factories: [],
|
||||
|
||||
name: "dactyl",
|
||||
|
||||
global: this,
|
||||
|
||||
globals: JSMLoader ? JSMLoader.globals : {},
|
||||
|
||||
@@ -215,7 +215,7 @@ var Command = Class("Command", {
|
||||
extra: extra
|
||||
}),
|
||||
|
||||
complained: Class.memoize(function () ({})),
|
||||
complained: Class.Memoize(function () ({})),
|
||||
|
||||
/**
|
||||
* @property {[string]} All of this command's name specs. e.g., "com[mand]"
|
||||
@@ -286,7 +286,7 @@ var Command = Class("Command", {
|
||||
*/
|
||||
options: [],
|
||||
|
||||
optionMap: Class.memoize(function () array(this.options)
|
||||
optionMap: Class.Memoize(function () array(this.options)
|
||||
.map(function (opt) opt.names.map(function (name) [name, opt]))
|
||||
.flatten().toObject()),
|
||||
|
||||
@@ -297,19 +297,19 @@ var Command = Class("Command", {
|
||||
return res;
|
||||
},
|
||||
|
||||
argsPrototype: Class.memoize(function argsPrototype() {
|
||||
argsPrototype: Class.Memoize(function argsPrototype() {
|
||||
let res = update([], {
|
||||
__iterator__: function AP__iterator__() array.iterItems(this),
|
||||
|
||||
command: this,
|
||||
|
||||
explicitOpts: Class.memoize(function () ({})),
|
||||
explicitOpts: Class.Memoize(function () ({})),
|
||||
|
||||
has: function AP_has(opt) Set.has(this.explicitOpts, opt) || typeof opt === "number" && Set.has(this, opt),
|
||||
|
||||
get literalArg() this.command.literal != null && this[this.command.literal] || "",
|
||||
|
||||
// TODO: string: Class.memoize(function () { ... }),
|
||||
// TODO: string: Class.Memoize(function () { ... }),
|
||||
|
||||
verify: function verify() {
|
||||
if (this.command.argCount) {
|
||||
@@ -1175,9 +1175,9 @@ var Commands = Module("commands", {
|
||||
]]>, /U/g, "\\u"), "x")
|
||||
}),
|
||||
|
||||
validName: Class.memoize(function validName() util.regexp("^" + this.nameRegexp.source + "$")),
|
||||
validName: Class.Memoize(function validName() util.regexp("^" + this.nameRegexp.source + "$")),
|
||||
|
||||
commandRegexp: Class.memoize(function commandRegexp() util.regexp(<![CDATA[
|
||||
commandRegexp: Class.Memoize(function commandRegexp() util.regexp(<![CDATA[
|
||||
^
|
||||
(?P<spec>
|
||||
(?P<prespace> [:\s]*)
|
||||
@@ -1514,7 +1514,7 @@ var Commands = Module("commands", {
|
||||
["+", "One or more arguments are allowed"]],
|
||||
default: "0",
|
||||
type: CommandOption.STRING,
|
||||
validator: function (arg) /^[01*?+]$/.test(arg)
|
||||
validator: bind("test", /^[01*?+]$/)
|
||||
},
|
||||
{
|
||||
names: ["-nopersist", "-n"],
|
||||
|
||||
@@ -405,7 +405,7 @@ var CompletionContext = Class("CompletionContext", {
|
||||
this.noUpdate = false;
|
||||
},
|
||||
|
||||
ignoreCase: Class.memoize(function () {
|
||||
ignoreCase: Class.Memoize(function () {
|
||||
let mode = this.wildcase;
|
||||
if (mode == "match")
|
||||
return false;
|
||||
|
||||
@@ -10,7 +10,7 @@ let global = this;
|
||||
Components.utils.import("resource://dactyl/bootstrap.jsm");
|
||||
defineModule("config", {
|
||||
exports: ["ConfigBase", "Config", "config"],
|
||||
require: ["protocol", "services", "storage", "util", "template"],
|
||||
require: ["dom", "protocol", "services", "storage", "util", "template"],
|
||||
use: ["io", "messages", "prefs", "styles"]
|
||||
}, this);
|
||||
|
||||
@@ -67,6 +67,7 @@ var ConfigBase = Class("ConfigBase", {
|
||||
"completion",
|
||||
"config",
|
||||
"contexts",
|
||||
"dom",
|
||||
"downloads",
|
||||
"finder",
|
||||
"help",
|
||||
@@ -130,7 +131,7 @@ var ConfigBase = Class("ConfigBase", {
|
||||
elem.style.cssText = this.cssText;
|
||||
|
||||
let keys = iter(Styles.propertyIter(this.cssText)).map(function (p) p.name).toArray();
|
||||
let bg = keys.some(function (k) /^background/.test(k));
|
||||
let bg = keys.some(bind("test", /^background/));
|
||||
let fg = keys.indexOf("color") >= 0;
|
||||
|
||||
let style = DOM(elem).style;
|
||||
@@ -141,7 +142,7 @@ var ConfigBase = Class("ConfigBase", {
|
||||
|
||||
get addonID() this.name + "@dactyl.googlecode.com",
|
||||
|
||||
addon: Class.memoize(function () {
|
||||
addon: Class.Memoize(function () {
|
||||
return (JSMLoader.bootstrap || {}).addon ||
|
||||
require("addons").AddonManager.getAddonByID(this.addonID);
|
||||
}),
|
||||
@@ -149,17 +150,17 @@ var ConfigBase = Class("ConfigBase", {
|
||||
/**
|
||||
* The current application locale.
|
||||
*/
|
||||
appLocale: Class.memoize(function () services.chromeRegistry.getSelectedLocale("global")),
|
||||
appLocale: Class.Memoize(function () services.chromeRegistry.getSelectedLocale("global")),
|
||||
|
||||
/**
|
||||
* The current dactyl locale.
|
||||
*/
|
||||
locale: Class.memoize(function () this.bestLocale(this.locales)),
|
||||
locale: Class.Memoize(function () this.bestLocale(this.locales)),
|
||||
|
||||
/**
|
||||
* The current application locale.
|
||||
*/
|
||||
locales: Class.memoize(function () {
|
||||
locales: Class.Memoize(function () {
|
||||
// TODO: Merge with completion.file code.
|
||||
function getDir(str) str.match(/^(?:.*[\/\\])?/)[0];
|
||||
|
||||
@@ -283,7 +284,7 @@ var ConfigBase = Class("ConfigBase", {
|
||||
* directory if the application is running from one via an extension
|
||||
* proxy file.
|
||||
*/
|
||||
VCSPath: Class.memoize(function () {
|
||||
VCSPath: Class.Memoize(function () {
|
||||
if (/pre$/.test(this.addon.version)) {
|
||||
let uri = util.newURI(this.addon.getResourceURI("").spec + "../.hg");
|
||||
if (uri instanceof Ci.nsIFileURL &&
|
||||
@@ -299,14 +300,14 @@ var ConfigBase = Class("ConfigBase", {
|
||||
* running from if using an extension proxy file or was built from if
|
||||
* installed as an XPI.
|
||||
*/
|
||||
branch: Class.memoize(function () {
|
||||
branch: Class.Memoize(function () {
|
||||
if (this.VCSPath)
|
||||
return io.system(["hg", "-R", this.VCSPath, "branch"]).output;
|
||||
return (/pre-hg\d+-(\S*)/.exec(this.version) || [])[1];
|
||||
}),
|
||||
|
||||
/** @property {string} The Dactyl version string. */
|
||||
version: Class.memoize(function () {
|
||||
version: Class.Memoize(function () {
|
||||
if (this.VCSPath)
|
||||
return io.system(["hg", "-R", this.VCSPath, "log", "-r.",
|
||||
"--template=hg{rev}-{branch}"]).output;
|
||||
@@ -314,7 +315,7 @@ var ConfigBase = Class("ConfigBase", {
|
||||
return this.addon.version;
|
||||
}),
|
||||
|
||||
buildDate: Class.memoize(function () {
|
||||
buildDate: Class.Memoize(function () {
|
||||
if (this.VCSPath)
|
||||
return io.system(["hg", "-R", this.VCSPath, "log", "-r.",
|
||||
"--template={date|isodate}"]).output;
|
||||
@@ -324,7 +325,7 @@ var ConfigBase = Class("ConfigBase", {
|
||||
|
||||
get fileExt() this.name.slice(0, -6),
|
||||
|
||||
dtd: Class.memoize(function ()
|
||||
dtd: Class.Memoize(function ()
|
||||
iter(this.dtdExtra,
|
||||
(["dactyl." + k, v] for ([k, v] in iter(config.dtdDactyl))),
|
||||
(["dactyl." + s, config[s]] for each (s in config.dtdStrings)))
|
||||
@@ -339,10 +340,10 @@ var ConfigBase = Class("ConfigBase", {
|
||||
get plugins() "http://dactyl.sf.net/" + this.name + "/plugins",
|
||||
get faq() this.home + this.name + "/faq",
|
||||
|
||||
"list.mailto": Class.memoize(function () config.name + "@googlegroups.com"),
|
||||
"list.href": Class.memoize(function () "http://groups.google.com/group/" + config.name),
|
||||
"list.mailto": Class.Memoize(function () config.name + "@googlegroups.com"),
|
||||
"list.href": Class.Memoize(function () "http://groups.google.com/group/" + config.name),
|
||||
|
||||
"hg.latest": Class.memoize(function () this.code + "source/browse/"), // XXX
|
||||
"hg.latest": Class.Memoize(function () this.code + "source/browse/"), // XXX
|
||||
"irc": "irc://irc.oftc.net/#pentadactyl",
|
||||
}),
|
||||
|
||||
@@ -397,8 +398,8 @@ var ConfigBase = Class("ConfigBase", {
|
||||
util.overlayWindow(window, { append: append.elements() });
|
||||
},
|
||||
|
||||
browser: Class.memoize(function () window.gBrowser),
|
||||
tabbrowser: Class.memoize(function () window.gBrowser),
|
||||
browser: Class.Memoize(function () window.gBrowser),
|
||||
tabbrowser: Class.Memoize(function () window.gBrowser),
|
||||
|
||||
get browserModes() [modules.modes.NORMAL],
|
||||
|
||||
@@ -413,7 +414,7 @@ var ConfigBase = Class("ConfigBase", {
|
||||
*/
|
||||
get outputHeight() this.browser.mPanelContainer.boxObject.height,
|
||||
|
||||
tabStrip: Class.memoize(function () window.document.getElementById("TabsToolbar") || this.tabbrowser.mTabContainer),
|
||||
tabStrip: Class.Memoize(function () window.document.getElementById("TabsToolbar") || this.tabbrowser.mTabContainer),
|
||||
}),
|
||||
|
||||
/**
|
||||
|
||||
@@ -75,7 +75,7 @@ var Group = Class("Group", {
|
||||
});
|
||||
},
|
||||
|
||||
defaultFilter: Class.memoize(function () this.compileFilter(["*"]))
|
||||
defaultFilter: Class.Memoize(function () this.compileFilter(["*"]))
|
||||
});
|
||||
|
||||
var Contexts = Module("contexts", {
|
||||
@@ -283,9 +283,9 @@ var Contexts = Module("contexts", {
|
||||
return frame;
|
||||
},
|
||||
|
||||
groups: Class.memoize(function () this.matchingGroups()),
|
||||
groups: Class.Memoize(function () this.matchingGroups()),
|
||||
|
||||
allGroups: Class.memoize(function () Object.create(this.groupsProto, {
|
||||
allGroups: Class.Memoize(function () Object.create(this.groupsProto, {
|
||||
groups: { value: this.initializedGroups() }
|
||||
})),
|
||||
|
||||
@@ -486,7 +486,7 @@ var Contexts = Module("contexts", {
|
||||
get persist() this.group.persist,
|
||||
set persist(val) this.group.persist = val,
|
||||
|
||||
prefix: Class.memoize(function () this.name === "builtin" ? "" : this.name + ":"),
|
||||
prefix: Class.Memoize(function () this.name === "builtin" ? "" : this.name + ":"),
|
||||
|
||||
get toStringParams() [this.name]
|
||||
})
|
||||
|
||||
1079
common/modules/dom.jsm
Normal file
1079
common/modules/dom.jsm
Normal file
File diff suppressed because it is too large
Load Diff
@@ -74,7 +74,7 @@ var Download = Class("Download", {
|
||||
|
||||
get alive() this.inState(["downloading", "notstarted", "paused", "queued", "scanning"]),
|
||||
|
||||
allowedCommands: Class.memoize(function () let (self = this) ({
|
||||
allowedCommands: Class.Memoize(function () let (self = this) ({
|
||||
get cancel() self.cancelable && self.inState(["downloading", "paused", "starting"]),
|
||||
get delete() !this.cancel && self.targetFile.exists(),
|
||||
get launch() self.targetFile.exists() && self.inState(["finished"]),
|
||||
@@ -213,7 +213,7 @@ var DownloadList = Class("DownloadList",
|
||||
services.downloadManager.removeListener(this);
|
||||
},
|
||||
|
||||
message: Class.memoize(function () {
|
||||
message: Class.Memoize(function () {
|
||||
|
||||
util.xmlToDom(<table highlight="Downloads" key="list" xmlns={XHTML}>
|
||||
<tr highlight="DownloadHead">
|
||||
@@ -280,7 +280,7 @@ var DownloadList = Class("DownloadList",
|
||||
this.cleanup();
|
||||
},
|
||||
|
||||
allowedCommands: Class.memoize(function () let (self = this) ({
|
||||
allowedCommands: Class.Memoize(function () let (self = this) ({
|
||||
get clear() values(self.downloads).some(function (dl) dl.allowedCommands.remove)
|
||||
})),
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ Components.utils.import("resource://dactyl/bootstrap.jsm");
|
||||
defineModule("finder", {
|
||||
exports: ["RangeFind", "RangeFinder", "rangefinder"],
|
||||
require: ["prefs"],
|
||||
use: ["messages", "services", "util"]
|
||||
use: ["dom", "messages", "services", "util"]
|
||||
}, this);
|
||||
|
||||
function equals(a, b) XPCNativeWrapper(a) == XPCNativeWrapper(b);
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
Components.utils.import("resource://dactyl/bootstrap.jsm");
|
||||
defineModule("help", {
|
||||
exports: ["help"],
|
||||
require: ["protocol", "services", "util"],
|
||||
require: ["dom", "protocol", "services", "util"],
|
||||
use: ["config", "highlight", "messages", "template"]
|
||||
}, this);
|
||||
|
||||
@@ -21,7 +21,8 @@ var Help = Module("Help", {
|
||||
function Loop(fn)
|
||||
function (uri, path) {
|
||||
if (!help.initialized)
|
||||
return RedirectChannel(uri.spec, uri, 1);
|
||||
return RedirectChannel(uri.spec, uri, 2,
|
||||
"Initializing. Please wait...");
|
||||
return fn.apply(this, arguments);
|
||||
}
|
||||
|
||||
|
||||
@@ -269,7 +269,7 @@ var IO = Module("io", {
|
||||
* @property {function} File class.
|
||||
* @final
|
||||
*/
|
||||
File: Class.memoize(function () let (io = this)
|
||||
File: Class.Memoize(function () let (io = this)
|
||||
Class("File", File, {
|
||||
init: function init(path, checkCWD)
|
||||
init.supercall(this, path, (arguments.length < 2 || checkCWD) && io.cwd)
|
||||
@@ -826,12 +826,12 @@ unlet s:cpo_save
|
||||
if (args.bang)
|
||||
arg = "!" + arg;
|
||||
|
||||
// NOTE: Vim doesn't replace ! preceded by 2 or more backslashes and documents it - desirable?
|
||||
// pass through a raw bang when escaped or substitute the last command
|
||||
|
||||
// This is an asinine and irritating feature when we have searchable
|
||||
// This is an asinine and irritating "feature" when we have searchable
|
||||
// command-line history. --Kris
|
||||
if (modules.options["banghist"]) {
|
||||
// NOTE: Vim doesn't replace ! preceded by 2 or more backslashes and documents it - desirable?
|
||||
// pass through a raw bang when escaped or substitute the last command
|
||||
|
||||
// replaceable bang and no previous command?
|
||||
dactyl.assert(!/((^|[^\\])(\\\\)*)!/.test(arg) || io._lastRunCommand,
|
||||
_("command.run.noPrevious"));
|
||||
@@ -1041,7 +1041,7 @@ unlet s:cpo_save
|
||||
|
||||
options.add(["banghist", "bh"],
|
||||
"Replace occurrences of ! with the previous command when executing external commands",
|
||||
"boolean", true);
|
||||
"boolean", false);
|
||||
|
||||
options.add(["fileencoding", "fenc"],
|
||||
"The character encoding used when reading and writing files",
|
||||
|
||||
@@ -44,13 +44,13 @@ var JavaScript = Module("javascript", {
|
||||
}
|
||||
}),
|
||||
|
||||
globals: Class.memoize(function () [
|
||||
globals: Class.Memoize(function () [
|
||||
[this.modules.userContext, /*L*/"Global Variables"],
|
||||
[this.modules, "modules"],
|
||||
[this.window, "window"]
|
||||
]),
|
||||
|
||||
toplevel: Class.memoize(function () this.modules.jsmodules),
|
||||
toplevel: Class.Memoize(function () this.modules.jsmodules),
|
||||
|
||||
lazyInit: true,
|
||||
|
||||
@@ -612,13 +612,13 @@ var JavaScript = Module("javascript", {
|
||||
return null;
|
||||
},
|
||||
|
||||
magicalNames: Class.memoize(function () Object.getOwnPropertyNames(Cu.Sandbox(this.window), true).sort()),
|
||||
magicalNames: Class.Memoize(function () Object.getOwnPropertyNames(Cu.Sandbox(this.window), true).sort()),
|
||||
|
||||
/**
|
||||
* A list of properties of the global object which are not
|
||||
* enumerable by any standard method.
|
||||
*/
|
||||
globalNames: Class.memoize(function () let (self = this) array.uniq([
|
||||
globalNames: Class.Memoize(function () let (self = this) array.uniq([
|
||||
"Array", "ArrayBuffer", "AttributeName", "Boolean", "Components",
|
||||
"CSSFontFaceStyleDecl", "CSSGroupRuleRuleList", "CSSNameSpaceRule",
|
||||
"CSSRGBColor", "CSSRect", "ComputedCSSStyleDeclaration", "Date",
|
||||
@@ -700,7 +700,7 @@ var JavaScript = Module("javascript", {
|
||||
modes.addMode("REPL", {
|
||||
description: "JavaScript Read Eval Print Loop",
|
||||
bases: [modes.COMMAND_LINE],
|
||||
displayName: Class.memoize(function () this.name)
|
||||
displayName: Class.Memoize(function () this.name)
|
||||
});
|
||||
},
|
||||
commandline: function initCommandLine(dactyl, modules, window) {
|
||||
@@ -746,7 +746,7 @@ var JavaScript = Module("javascript", {
|
||||
|
||||
count: 0,
|
||||
|
||||
message: Class.memoize(function () {
|
||||
message: Class.Memoize(function () {
|
||||
default xml namespace = XHTML;
|
||||
util.xmlToDom(<div highlight="REPL" key="rootNode"/>,
|
||||
this.document, this);
|
||||
|
||||
@@ -30,7 +30,7 @@ var Messages = Module("messages", {
|
||||
init: function _(message) {
|
||||
this.args = arguments;
|
||||
},
|
||||
message: Class.memoize(function () {
|
||||
message: Class.Memoize(function () {
|
||||
let message = this.args[0];
|
||||
|
||||
if (this.args.length > 1) {
|
||||
|
||||
@@ -928,7 +928,7 @@ var Options = Module("options", {
|
||||
setPref: deprecated("prefs.set", function setPref() prefs.set.apply(prefs, arguments)),
|
||||
withContext: deprecated("prefs.withContext", function withContext() prefs.withContext.apply(prefs, arguments)),
|
||||
|
||||
cleanupPrefs: Class.memoize(function () localPrefs.Branch("cleanup.option.")),
|
||||
cleanupPrefs: Class.Memoize(function () localPrefs.Branch("cleanup.option.")),
|
||||
|
||||
cleanup: function cleanup(reason) {
|
||||
if (~["disable", "uninstall"].indexOf(reason))
|
||||
|
||||
@@ -539,7 +539,7 @@ var Overlay = Module("Overlay", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReferen
|
||||
/**
|
||||
* A list of extant dactyl windows.
|
||||
*/
|
||||
windows: Class.memoize(function () [])
|
||||
windows: Class.Memoize(function () [])
|
||||
});
|
||||
|
||||
endModule();
|
||||
|
||||
@@ -50,8 +50,9 @@ function NetError(orig, error) {
|
||||
open: function () { throw error || Cr.NS_ERROR_FILE_NOT_FOUND }
|
||||
}).data.QueryInterface(Ci.nsIChannel);
|
||||
}
|
||||
function RedirectChannel(to, orig, time) {
|
||||
let html = <html><head><meta http-equiv="Refresh" content={(time || 0) + ";" + to}/></head></html>.toXMLString();
|
||||
function RedirectChannel(to, orig, time, message) {
|
||||
let html = <html><head><meta http-equiv="Refresh" content={(time || 0) + ";" + to}/></head>
|
||||
<body><h2 style="text-align: center">{message || ""}</h2></body></html>.toXMLString();
|
||||
return StringChannel(html, "text/html", services.io.newURI(to, null, null));
|
||||
}
|
||||
|
||||
|
||||
@@ -348,7 +348,7 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef
|
||||
session: 8
|
||||
},
|
||||
|
||||
UNPERMS: Class.memoize(function () iter(this.PERMS).map(Array.reverse).toObject()),
|
||||
UNPERMS: Class.Memoize(function () iter(this.PERMS).map(Array.reverse).toObject()),
|
||||
|
||||
COMMANDS: {
|
||||
unset: /*L*/"Unset",
|
||||
@@ -650,7 +650,7 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef
|
||||
"1d": "Past day",
|
||||
"1w": "Past week"
|
||||
},
|
||||
validator: function (value) /^(a(ll)?|s(ession)|\d+[mhdw])$/.test(value)
|
||||
validator: bind("test", /^(a(ll)?|s(ession)|\d+[mhdw])$/)
|
||||
});
|
||||
|
||||
options.add(["cookies", "ck"],
|
||||
|
||||
@@ -510,13 +510,13 @@ var File = Class("File", {
|
||||
/**
|
||||
* @property {string} The current platform's path separator.
|
||||
*/
|
||||
PATH_SEP: Class.memoize(function () {
|
||||
PATH_SEP: Class.Memoize(function () {
|
||||
let f = services.directory.get("CurProcD", Ci.nsIFile);
|
||||
f.append("foo");
|
||||
return f.path.substr(f.parent.path.length, 1);
|
||||
}),
|
||||
|
||||
pathSplit: Class.memoize(function () util.regexp("(?:/|" + util.regexp.escape(this.PATH_SEP) + ")", "g")),
|
||||
pathSplit: Class.Memoize(function () util.regexp("(?:/|" + util.regexp.escape(this.PATH_SEP) + ")", "g")),
|
||||
|
||||
DoesNotExist: function (path, error) ({
|
||||
path: path,
|
||||
|
||||
@@ -8,7 +8,7 @@ Components.utils.import("resource://dactyl/bootstrap.jsm");
|
||||
defineModule("styles", {
|
||||
exports: ["Style", "Styles", "styles"],
|
||||
require: ["services", "util"],
|
||||
use: ["contexts", "messages", "template"]
|
||||
use: ["contexts", "dom", "messages", "template"]
|
||||
}, this);
|
||||
|
||||
function cssUri(css) "chrome-data:text/css," + encodeURI(css);
|
||||
|
||||
@@ -57,7 +57,7 @@ var Binding = Class("Binding", {
|
||||
}
|
||||
},
|
||||
|
||||
events: Class.memoize(function () {
|
||||
events: Class.Memoize(function () {
|
||||
let res = [];
|
||||
for (let obj in this.bindings)
|
||||
if (Object.getOwnPropertyDescriptor(obj, "events"))
|
||||
@@ -66,7 +66,7 @@ var Binding = Class("Binding", {
|
||||
return res;
|
||||
}),
|
||||
|
||||
properties: Class.memoize(function () {
|
||||
properties: Class.Memoize(function () {
|
||||
let res = {};
|
||||
for (let obj in this.bindings)
|
||||
for (let prop in properties(obj)) {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user