1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-02-16 04:45:46 +01:00

Death to E4X and stuff.

This commit is contained in:
Kris Maglione
2012-11-28 20:24:44 -08:00
parent 23b6c07666
commit 276956284e
19 changed files with 129 additions and 88 deletions

View File

@@ -144,17 +144,40 @@ defineModule("base", {
"Set", "Struct", "StructBase", "Timer", "UTF8", "XPCOM", "XPCOMShim", "XPCOMUtils",
"XPCSafeJSObjectWrapper", "array", "bind", "call", "callable", "ctypes", "curry",
"debuggerProperties", "defineModule", "deprecated", "endModule", "forEach", "isArray",
"isGenerator", "isinstance", "isObject", "isString", "isSubclass", "isXML", "iter", "iterAll",
"iterOwnProperties", "keys", "memoize", "octal", "properties", "require", "set", "update",
"values"
"isGenerator", "isinstance", "isObject", "isString", "isSubclass", "isXML", "iter",
"iterAll", "iterOwnProperties", "keys", "literal", "memoize", "octal", "properties",
"require", "set", "update", "values"
]
});
this.lazyRequire("cache", ["cache"]);
this.lazyRequire("config", ["config"]);
this.lazyRequire("messages", ["_", "Messages"]);
this.lazyRequire("services", ["services"]);
this.lazyRequire("util", ["FailedAssertion", "util"]);
function literal(/* comment */) {
let { caller } = Components.stack;
let file = caller.filename.replace(/.* -> /, "");
let key = "literal:" + file + ":" + caller.line;
let source = util.httpGet(file).responseText;
let match = RegExp("(?:.*\\n){" + (caller.lineNumber - 1) + "}" +
".*literal\\(/\\*([^]*?)\\*/\\)").exec(source);
return match[1];
// Later...
return cache.get(key, function () {
let source = cache.get("literal:" + file,
function () util.httpGet(file).responseText);
let match = RegExp("(?:.*\\n){" + (caller.lineNumber - 1) + "}" +
".*literal\\(/\\*([^]*?)\\*/\\)").exec(source);
return match[1];
});
}
/**
* Returns a list of all of the top-level properties of an object, by
* way of the debugger.