//
// This work is licensed for reuse under an MIT license. Details are
// given in the LICENSE.txt file included with this file.
-"use strict";
+/* use strict */
let { getOwnPropertyNames } = Object;
Components.utils.import("resource://dactyl/bootstrap.jsm");
defineModule("javascript", {
- exports: ["JavaScript", "javascript"],
- use: ["messages", "services", "template", "util"]
+ exports: ["JavaScript", "javascript"]
}, this);
let isPrototypeOf = Object.prototype.isPrototypeOf;
}
}),
- 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,
let completions = [k for (k in this.iter(obj, toplevel))];
if (obj === this.modules) // Hack.
- completions = completions.concat([k for (k in this.iter(this.modules.jsmodules, toplevel))]);
+ completions = array.uniq(completions.concat([k for (k in this.iter(this.modules.jsmodules, toplevel))]));
return completions;
},
// Wait for a keypress before completing when there's no key
if (!this.context.tabPressed && key == "" && obj.length > 1) {
+ let message = this.context.message || "";
this.context.waitingForTab = true;
- this.context.message = _("completion.waitingForKeyPress");
+ this.context.message = <>{message}
+ {_("completion.waitingForKeyPress")}</>;
return null;
}
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([
- "Array", "ArrayBuffer", "AttributeName", "Boolean", "Components",
+ globalNames: Class.Memoize(function () let (self = this) array.uniq([
+ "Array", "ArrayBuffer", "AttributeName", "Audio", "Boolean", "Components",
"CSSFontFaceStyleDecl", "CSSGroupRuleRuleList", "CSSNameSpaceRule",
- "CSSRGBColor", "CSSRect", "ComputedCSSStyleDeclaration", "Date",
- "Error", "EvalError", "Float32Array", "Float64Array", "Function",
+ "CSSRGBColor", "CSSRect", "ComputedCSSStyleDeclaration", "Date", "Error",
+ "EvalError", "File", "Float32Array", "Float64Array", "Function",
"HTMLDelElement", "HTMLInsElement", "HTMLSpanElement", "Infinity",
"InnerModalContentWindow", "InnerWindow", "Int16Array", "Int32Array",
"Int8Array", "InternalError", "Iterator", "JSON", "KeyboardEvent",
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) {
try {
var result = dactyl.userEval(js, this.context);
- var xml = util.objectToString(result, true);
+ var xml = result === undefined ? "" : util.objectToString(result, true);
}
catch (e) {
util.reportError(e);
count: 0,
- message: Class.memoize(function () {
+ message: Class.Memoize(function () {
default xml namespace = XHTML;
util.xmlToDom(<div highlight="REPL" key="rootNode"/>,
this.document, this);
init.supercall(this);
let self = this;
- let sandbox = isinstance(context, ["Sandbox"]);
+ let sandbox = true || isinstance(context, ["Sandbox"]);
this.context = modules.newContext(context, !sandbox);
this.js = modules.JavaScript();