- "ErrorBase", "Cc", "Ci", "Class", "Cr", "Cu", "Module", "JSMLoader", "Object", "Runnable",
- "Set", "Struct", "StructBase", "Timer", "UTF8", "XPCOM", "XPCOMUtils", "XPCSafeJSObjectWrapper",
- "array", "bind", "call", "callable", "ctypes", "curry", "debuggerProperties", "defineModule",
- "deprecated", "endModule", "forEach", "isArray", "isGenerator", "isinstance", "isObject",
- "isString", "isSubclass", "iter", "iterAll", "iterOwnProperties", "keys", "memoize", "octal",
- "properties", "require", "set", "update", "values", "withCallerGlobal"
- ],
- use: ["config", "services", "util"]
-}, this);
-
-function Runnable(self, func, args) {
- return {
- __proto__: Runnable.prototype,
- run: function () { func.apply(self, args || []); }
- };
+ "ErrorBase", "Cc", "Ci", "Class", "Cr", "Cu", "Finished", "Module", "JSMLoader",
+ "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", "literal", "memoize", "octal", "properties",
+ "require", "set", "update", "values", "update_"
+ ]
+});
+
+this.lazyRequire("cache", ["cache"]);
+this.lazyRequire("config", ["config"]);
+this.lazyRequire("messages", ["_", "Messages"]);
+this.lazyRequire("services", ["services"]);
+this.lazyRequire("storage", ["File"]);
+this.lazyRequire("util", ["FailedAssertion", "util"]);
+
+function literal(/* comment */) {
+ let { caller } = Components.stack;
+ while (caller && caller.language != 2)
+ caller = caller.caller;
+
+ let file = caller.filename.replace(/.* -> /, "");
+ let key = "literal:" + file + ":" + caller.line;
+
+ let source = File.readURL(file);
+
+ 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];
+ });